From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 01:15:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C58C1065677; Sun, 4 Dec 2011 01:15:52 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B9C08FC08; Sun, 4 Dec 2011 01:15:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB41Fq5M064197; Sun, 4 Dec 2011 01:15:52 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB41Fqud064195; Sun, 4 Dec 2011 01:15:52 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112040115.pB41Fqud064195@svn.freebsd.org> From: Alan Cox Date: Sun, 4 Dec 2011 01:15:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228249 - stable/8/sys/fs/tmpfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 01:15:52 -0000 Author: alc Date: Sun Dec 4 01:15:52 2011 New Revision: 228249 URL: http://svn.freebsd.org/changeset/base/228249 Log: MFC r218863 tmpfs_remove() isn't modifying the file's data, so it shouldn't set TMPFS_NODE_MODIFIED on the node. PR: 152488 Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs_vnops.c Sat Dec 3 23:36:36 2011 (r228248) +++ stable/8/sys/fs/tmpfs/tmpfs_vnops.c Sun Dec 4 01:15:52 2011 (r228249) @@ -823,8 +823,7 @@ tmpfs_remove(struct vop_remove_args *v) tmpfs_free_dirent(tmp, de, TRUE); if (node->tn_links > 0) - node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | \ - TMPFS_NODE_MODIFIED; + node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED; error = 0; out: From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 01:22:22 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB1D6106566C; Sun, 4 Dec 2011 01:22:22 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA5F18FC0A; Sun, 4 Dec 2011 01:22:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB41MMK0064440; Sun, 4 Dec 2011 01:22:22 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB41MMqh064438; Sun, 4 Dec 2011 01:22:22 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112040122.pB41MMqh064438@svn.freebsd.org> From: Alan Cox Date: Sun, 4 Dec 2011 01:22:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228250 - stable/7/sys/fs/tmpfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 01:22:23 -0000 Author: alc Date: Sun Dec 4 01:22:22 2011 New Revision: 228250 URL: http://svn.freebsd.org/changeset/base/228250 Log: MFC r218863 tmpfs_remove() isn't modifying the file's data, so it shouldn't set TMPFS_NODE_MODIFIED on the node. PR: 152488 Modified: stable/7/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/7/sys/fs/tmpfs/tmpfs_vnops.c Sun Dec 4 01:15:52 2011 (r228249) +++ stable/7/sys/fs/tmpfs/tmpfs_vnops.c Sun Dec 4 01:22:22 2011 (r228250) @@ -791,8 +791,7 @@ tmpfs_remove(struct vop_remove_args *v) tmpfs_free_dirent(tmp, de, TRUE); if (node->tn_links > 0) - node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | \ - TMPFS_NODE_MODIFIED; + node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED; error = 0; out: From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 02:06:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81122106566B; Sun, 4 Dec 2011 02:06:12 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 705248FC12; Sun, 4 Dec 2011 02:06:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB426CVx065758; Sun, 4 Dec 2011 02:06:12 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB426C3m065756; Sun, 4 Dec 2011 02:06:12 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112040206.pB426C3m065756@svn.freebsd.org> From: Alan Cox Date: Sun, 4 Dec 2011 02:06:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228251 - stable/8/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 02:06:12 -0000 Author: alc Date: Sun Dec 4 02:06:12 2011 New Revision: 228251 URL: http://svn.freebsd.org/changeset/base/228251 Log: MFC r224689 Fix an error in kmem_alloc_attr(). Unless "tries" is updated, kmem_alloc_attr() could get stuck in a loop. Modified: stable/8/sys/vm/vm_contig.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/vm/vm_contig.c ============================================================================== --- stable/8/sys/vm/vm_contig.c Sun Dec 4 01:22:22 2011 (r228250) +++ stable/8/sys/vm/vm_contig.c Sun Dec 4 02:06:12 2011 (r228251) @@ -253,6 +253,7 @@ retry: vm_contig_grow_cache(tries, low, high); vm_map_lock(map); VM_OBJECT_LOCK(object); + tries++; goto retry; } while (i != 0) { From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 02:13:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C83F11065670; Sun, 4 Dec 2011 02:13:54 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FFF38FC18; Sun, 4 Dec 2011 02:13:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB42DsmV066031; Sun, 4 Dec 2011 02:13:54 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB42DsJd066029; Sun, 4 Dec 2011 02:13:54 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112040213.pB42DsJd066029@svn.freebsd.org> From: Alan Cox Date: Sun, 4 Dec 2011 02:13:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228252 - stable/7/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 02:13:54 -0000 Author: alc Date: Sun Dec 4 02:13:54 2011 New Revision: 228252 URL: http://svn.freebsd.org/changeset/base/228252 Log: MFC r224689 Fix an error in kmem_alloc_attr(). Unless "tries" is updated, kmem_alloc_attr() could get stuck in a loop. Modified: stable/7/sys/vm/vm_contig.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/vm/vm_contig.c ============================================================================== --- stable/7/sys/vm/vm_contig.c Sun Dec 4 02:06:12 2011 (r228251) +++ stable/7/sys/vm/vm_contig.c Sun Dec 4 02:13:54 2011 (r228252) @@ -251,6 +251,7 @@ retry: vm_contig_grow_cache(tries); vm_map_lock(map); VM_OBJECT_LOCK(object); + tries++; goto retry; } while (i != 0) { From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 06:09:02 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFC1C106566C; Sun, 4 Dec 2011 06:09:02 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDDBD8FC08; Sun, 4 Dec 2011 06:09:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4692K0073453; Sun, 4 Dec 2011 06:09:02 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4692J7073449; Sun, 4 Dec 2011 06:09:02 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112040609.pB4692J7073449@svn.freebsd.org> From: Alan Cox Date: Sun, 4 Dec 2011 06:09:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228253 - in stable/8/sys/amd64: amd64 include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 06:09:02 -0000 Author: alc Date: Sun Dec 4 06:09:02 2011 New Revision: 228253 URL: http://svn.freebsd.org/changeset/base/228253 Log: MFC r214425,214954 [1] According to the x86 architectural specifications, no virtual-to- physical page mapping should span two or more MTRRs of different types. Add a pmap function, pmap_demote_DMAP(), by which the MTRR module can ensure that the direct map region doesn't have such a mapping. [2] Fix a couple of nearby style errors in amd64_mrset(). [3] Re-enable the use of 1GB page mappings for implementing the direct map. (See also r197580 and r213897.) Modified: stable/8/sys/amd64/amd64/amd64_mem.c stable/8/sys/amd64/amd64/pmap.c stable/8/sys/amd64/include/pmap.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/amd64/amd64/amd64_mem.c ============================================================================== --- stable/8/sys/amd64/amd64/amd64_mem.c Sun Dec 4 02:13:54 2011 (r228252) +++ stable/8/sys/amd64/amd64/amd64_mem.c Sun Dec 4 06:09:02 2011 (r228253) @@ -35,6 +35,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include + #include #include #include @@ -527,9 +531,9 @@ static int amd64_mrset(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg) { struct mem_range_desc *targ; - int error = 0; + int error, i; - switch(*arg) { + switch (*arg) { case MEMRANGE_SET_UPDATE: /* * Make sure that what's being asked for is even @@ -568,6 +572,21 @@ amd64_mrset(struct mem_range_softc *sc, return (EOPNOTSUPP); } + /* + * Ensure that the direct map region does not contain any mappings + * that span MTRRs of different types. However, the fixed MTRRs can + * be ignored, because a large page mapping the first 1 MB of physical + * memory is a special case that the processor handles. The entire + * TLB will be invalidated by amd64_mrstore(), so pmap_demote_DMAP() + * needn't do it. + */ + i = (sc->mr_cap & MR686_FIXMTRR) ? MTRR_N64K + MTRR_N16K + MTRR_N4K : 0; + mrd = sc->mr_desc + i; + for (; i < sc->mr_ndesc; i++, mrd++) { + if ((mrd->mr_flags & (MDF_ACTIVE | MDF_BOGUS)) == MDF_ACTIVE) + pmap_demote_DMAP(mrd->mr_base, mrd->mr_len, FALSE); + } + /* Update the hardware. */ amd64_mrstore(sc); @@ -657,6 +676,21 @@ amd64_mrinit(struct mem_range_softc *sc) if (mrd->mr_flags & MDF_ACTIVE) mrd->mr_flags |= MDF_FIRMWARE; } + + /* + * Ensure that the direct map region does not contain any mappings + * that span MTRRs of different types. However, the fixed MTRRs can + * be ignored, because a large page mapping the first 1 MB of physical + * memory is a special case that the processor handles. Invalidate + * any old TLB entries that might hold inconsistent memory type + * information. + */ + i = (sc->mr_cap & MR686_FIXMTRR) ? MTRR_N64K + MTRR_N16K + MTRR_N4K : 0; + mrd = sc->mr_desc + i; + for (; i < sc->mr_ndesc; i++, mrd++) { + if ((mrd->mr_flags & (MDF_ACTIVE | MDF_BOGUS)) == MDF_ACTIVE) + pmap_demote_DMAP(mrd->mr_base, mrd->mr_len, TRUE); + } } /* Modified: stable/8/sys/amd64/amd64/pmap.c ============================================================================== --- stable/8/sys/amd64/amd64/pmap.c Sun Dec 4 02:13:54 2011 (r228252) +++ stable/8/sys/amd64/amd64/pmap.c Sun Dec 4 06:09:02 2011 (r228253) @@ -447,7 +447,7 @@ create_pagetables(vm_paddr_t *firstaddr) if (ndmpdp < 4) /* Minimum 4GB of dirmap */ ndmpdp = 4; DMPDPphys = allocpages(firstaddr, NDMPML4E); - if (TRUE || (amd_feature & AMDID_PAGE1GB) == 0) + if ((amd_feature & AMDID_PAGE1GB) == 0) DMPDphys = allocpages(firstaddr, ndmpdp); dmaplimit = (vm_paddr_t)ndmpdp << PDPSHIFT; @@ -479,11 +479,16 @@ create_pagetables(vm_paddr_t *firstaddr) ((pdp_entry_t *)KPDPphys)[i + KPDPI] |= PG_RW | PG_V | PG_U; } - /* Now set up the direct map space using either 2MB or 1GB pages */ - /* Preset PG_M and PG_A because demotion expects it */ - if (TRUE || (amd_feature & AMDID_PAGE1GB) == 0) { + /* + * Now, set up the direct map region using either 2MB or 1GB pages. + * Later, if pmap_mapdev{_attr}() uses the direct map for non-write- + * back memory, pmap_change_attr() will demote any 2MB or 1GB page + * mappings that are partially used. + */ + if ((amd_feature & AMDID_PAGE1GB) == 0) { for (i = 0; i < NPDEPG * ndmpdp; i++) { ((pd_entry_t *)DMPDphys)[i] = (vm_paddr_t)i << PDRSHIFT; + /* Preset PG_M and PG_A because demotion expects it. */ ((pd_entry_t *)DMPDphys)[i] |= PG_RW | PG_V | PG_PS | PG_G | PG_M | PG_A; } @@ -497,6 +502,7 @@ create_pagetables(vm_paddr_t *firstaddr) for (i = 0; i < ndmpdp; i++) { ((pdp_entry_t *)DMPDPphys)[i] = (vm_paddr_t)i << PDPSHIFT; + /* Preset PG_M and PG_A because demotion expects it. */ ((pdp_entry_t *)DMPDPphys)[i] |= PG_RW | PG_V | PG_PS | PG_G | PG_M | PG_A; } @@ -4821,6 +4827,49 @@ pmap_change_attr_locked(vm_offset_t va, } /* + * Demotes any mapping within the direct map region that covers more than the + * specified range of physical addresses. This range's size must be a power + * of two and its starting address must be a multiple of its size. Since the + * demotion does not change any attributes of the mapping, a TLB invalidation + * is not mandatory. The caller may, however, request a TLB invalidation. + */ +void +pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, boolean_t invalidate) +{ + pdp_entry_t *pdpe; + pd_entry_t *pde; + vm_offset_t va; + boolean_t changed; + + if (len < NBPDP) { + va = PHYS_TO_DMAP(base); + changed = FALSE; + PMAP_LOCK(kernel_pmap); + pdpe = pmap_pdpe(kernel_pmap, va); + if ((*pdpe & PG_V) == 0) + panic("pmap_demote_DMAP: invalid PDPE"); + if ((*pdpe & PG_PS) != 0) { + if (!pmap_demote_pdpe(kernel_pmap, pdpe, va)) + panic("pmap_demote_DMAP: PDPE failed"); + changed = TRUE; + } + if (len < NBPDR) { + pde = pmap_pdpe_to_pde(pdpe, va); + if ((*pde & PG_V) == 0) + panic("pmap_demote_DMAP: invalid PDE"); + if ((*pde & PG_PS) != 0) { + if (!pmap_demote_pde(kernel_pmap, pde, va)) + panic("pmap_demote_DMAP: PDE failed"); + changed = TRUE; + } + } + if (changed && invalidate) + pmap_invalidate_page(kernel_pmap, va); + PMAP_UNLOCK(kernel_pmap); + } +} + +/* * perform the pmap work for mincore */ int Modified: stable/8/sys/amd64/include/pmap.h ============================================================================== --- stable/8/sys/amd64/include/pmap.h Sun Dec 4 02:13:54 2011 (r228252) +++ stable/8/sys/amd64/include/pmap.h Sun Dec 4 06:09:02 2011 (r228253) @@ -305,6 +305,7 @@ extern vm_offset_t virtual_end; void pmap_bootstrap(vm_paddr_t *); int pmap_change_attr(vm_offset_t, vm_size_t, int); +void pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, boolean_t invalidate); void pmap_init_pat(void); void pmap_kenter(vm_offset_t va, vm_paddr_t pa); void *pmap_kenter_temporary(vm_paddr_t pa, int i); From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 06:55:28 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0799B106564A; Sun, 4 Dec 2011 06:55:28 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EAFF68FC0A; Sun, 4 Dec 2011 06:55:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB46tR8X074932; Sun, 4 Dec 2011 06:55:27 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB46tRZL074930; Sun, 4 Dec 2011 06:55:27 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112040655.pB46tRZL074930@svn.freebsd.org> From: Alan Cox Date: Sun, 4 Dec 2011 06:55:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228254 - stable/8/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 06:55:28 -0000 Author: alc Date: Sun Dec 4 06:55:27 2011 New Revision: 228254 URL: http://svn.freebsd.org/changeset/base/228254 Log: MFC r214563,214576 Add safety belts to pmap_demote_DMAP(). Modified: stable/8/sys/amd64/amd64/pmap.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/amd64/amd64/pmap.c ============================================================================== --- stable/8/sys/amd64/amd64/pmap.c Sun Dec 4 06:09:02 2011 (r228253) +++ stable/8/sys/amd64/amd64/pmap.c Sun Dec 4 06:55:27 2011 (r228254) @@ -4841,7 +4841,12 @@ pmap_demote_DMAP(vm_paddr_t base, vm_siz vm_offset_t va; boolean_t changed; - if (len < NBPDP) { + if (len == 0) + return; + KASSERT(powerof2(len), ("pmap_demote_DMAP: len is not a power of 2")); + KASSERT((base & (len - 1)) == 0, + ("pmap_demote_DMAP: base is not a multiple of len")); + if (len < NBPDP && base < dmaplimit) { va = PHYS_TO_DMAP(base); changed = FALSE; PMAP_LOCK(kernel_pmap); From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 07:18:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EFDDB106564A; Sun, 4 Dec 2011 07:18:54 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C608A8FC13; Sun, 4 Dec 2011 07:18:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB47IsXP075670; Sun, 4 Dec 2011 07:18:54 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB47Iss3075668; Sun, 4 Dec 2011 07:18:54 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112040718.pB47Iss3075668@svn.freebsd.org> From: Alan Cox Date: Sun, 4 Dec 2011 07:18:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228255 - stable/8/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 07:18:55 -0000 Author: alc Date: Sun Dec 4 07:18:54 2011 New Revision: 228255 URL: http://svn.freebsd.org/changeset/base/228255 Log: MFC r213897 Update pmap_extract() to handle 1GB page mappings. Some device drivers use pmap_extract() rather than pmap_kextract() on direct map addresses. Thus, pmap_extract() needs to be able to deal with 1GB page mappings if we are to use 1GB page mappings for the direct map. (See r197580.) Modified: stable/8/sys/amd64/amd64/pmap.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/amd64/amd64/pmap.c ============================================================================== --- stable/8/sys/amd64/amd64/pmap.c Sun Dec 4 06:55:27 2011 (r228254) +++ stable/8/sys/amd64/amd64/pmap.c Sun Dec 4 07:18:54 2011 (r228255) @@ -1141,26 +1141,33 @@ pmap_is_current(pmap_t pmap) vm_paddr_t pmap_extract(pmap_t pmap, vm_offset_t va) { - vm_paddr_t rtval; + pdp_entry_t *pdpe; + pd_entry_t *pde; pt_entry_t *pte; - pd_entry_t pde, *pdep; + vm_paddr_t pa; - rtval = 0; + pa = 0; PMAP_LOCK(pmap); - pdep = pmap_pde(pmap, va); - if (pdep != NULL) { - pde = *pdep; - if (pde) { - if ((pde & PG_PS) != 0) - rtval = (pde & PG_PS_FRAME) | (va & PDRMASK); - else { - pte = pmap_pde_to_pte(pdep, va); - rtval = (*pte & PG_FRAME) | (va & PAGE_MASK); + pdpe = pmap_pdpe(pmap, va); + if (pdpe != NULL && (*pdpe & PG_V) != 0) { + if ((*pdpe & PG_PS) != 0) + pa = (*pdpe & PG_PS_FRAME) | (va & PDPMASK); + else { + pde = pmap_pdpe_to_pde(pdpe, va); + if ((*pde & PG_V) != 0) { + if ((*pde & PG_PS) != 0) { + pa = (*pde & PG_PS_FRAME) | + (va & PDRMASK); + } else { + pte = pmap_pde_to_pte(pde, va); + pa = (*pte & PG_FRAME) | + (va & PAGE_MASK); + } } } } PMAP_UNLOCK(pmap); - return (rtval); + return (pa); } /* From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 07:28:50 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2055106566B; Sun, 4 Dec 2011 07:28:50 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C04448FC08; Sun, 4 Dec 2011 07:28:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB47Sorc076018; Sun, 4 Dec 2011 07:28:50 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB47SoeR076012; Sun, 4 Dec 2011 07:28:50 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112040728.pB47SoeR076012@svn.freebsd.org> From: Alan Cox Date: Sun, 4 Dec 2011 07:28:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228256 - in stable/8/sys: amd64/amd64 i386/i386 i386/xen ia64/ia64 mips/mips X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 07:28:51 -0000 Author: alc Date: Sun Dec 4 07:28:50 2011 New Revision: 228256 URL: http://svn.freebsd.org/changeset/base/228256 Log: MFC r223732 When iterating over a paging queue, explicitly check for PG_MARKER, instead of relying on zeroed memory being interpreted as an empty PV list. Modified: stable/8/sys/amd64/amd64/pmap.c stable/8/sys/i386/i386/pmap.c stable/8/sys/i386/xen/pmap.c stable/8/sys/ia64/ia64/pmap.c stable/8/sys/mips/mips/pmap.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/amd64/amd64/pmap.c ============================================================================== --- stable/8/sys/amd64/amd64/pmap.c Sun Dec 4 07:18:54 2011 (r228255) +++ stable/8/sys/amd64/amd64/pmap.c Sun Dec 4 07:28:50 2011 (r228256) @@ -2028,7 +2028,7 @@ pmap_collect(pmap_t locked_pmap, struct vm_page_t m, free; TAILQ_FOREACH(m, &vpq->pl, pageq) { - if (m->hold_count || m->busy) + if ((m->flags & PG_MARKER) != 0 || m->hold_count || m->busy) continue; TAILQ_FOREACH_SAFE(pv, &m->md.pv_list, pv_list, next_pv) { va = pv->pv_va; Modified: stable/8/sys/i386/i386/pmap.c ============================================================================== --- stable/8/sys/i386/i386/pmap.c Sun Dec 4 07:18:54 2011 (r228255) +++ stable/8/sys/i386/i386/pmap.c Sun Dec 4 07:28:50 2011 (r228256) @@ -2166,7 +2166,7 @@ pmap_collect(pmap_t locked_pmap, struct sched_pin(); TAILQ_FOREACH(m, &vpq->pl, pageq) { - if (m->hold_count || m->busy) + if ((m->flags & PG_MARKER) != 0 || m->hold_count || m->busy) continue; TAILQ_FOREACH_SAFE(pv, &m->md.pv_list, pv_list, next_pv) { va = pv->pv_va; Modified: stable/8/sys/i386/xen/pmap.c ============================================================================== --- stable/8/sys/i386/xen/pmap.c Sun Dec 4 07:18:54 2011 (r228255) +++ stable/8/sys/i386/xen/pmap.c Sun Dec 4 07:28:50 2011 (r228256) @@ -2068,7 +2068,7 @@ pmap_collect(pmap_t locked_pmap, struct sched_pin(); TAILQ_FOREACH(m, &vpq->pl, pageq) { - if (m->hold_count || m->busy) + if ((m->flags & PG_MARKER) != 0 || m->hold_count || m->busy) continue; TAILQ_FOREACH_SAFE(pv, &m->md.pv_list, pv_list, next_pv) { va = pv->pv_va; Modified: stable/8/sys/ia64/ia64/pmap.c ============================================================================== --- stable/8/sys/ia64/ia64/pmap.c Sun Dec 4 07:18:54 2011 (r228255) +++ stable/8/sys/ia64/ia64/pmap.c Sun Dec 4 07:28:50 2011 (r228256) @@ -798,7 +798,7 @@ get_pv_entry(pmap_t locked_pmap) vpq = &vm_page_queues[PQ_INACTIVE]; retry: TAILQ_FOREACH(m, &vpq->pl, pageq) { - if (m->hold_count || m->busy) + if ((m->flags & PG_MARKER) != 0 || m->hold_count || m->busy) continue; TAILQ_FOREACH_SAFE(pv, &m->md.pv_list, pv_list, next_pv) { va = pv->pv_va; Modified: stable/8/sys/mips/mips/pmap.c ============================================================================== --- stable/8/sys/mips/mips/pmap.c Sun Dec 4 07:18:54 2011 (r228255) +++ stable/8/sys/mips/mips/pmap.c Sun Dec 4 07:28:50 2011 (r228256) @@ -1405,7 +1405,7 @@ get_pv_entry(pmap_t locked_pmap) vpq = &vm_page_queues[PQ_INACTIVE]; retry: TAILQ_FOREACH(m, &vpq->pl, pageq) { - if (m->hold_count || m->busy) + if ((m->flags & PG_MARKER) != 0 || m->hold_count || m->busy) continue; TAILQ_FOREACH_SAFE(pv, &m->md.pv_list, pv_list, next_pv) { va = pv->pv_va; From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 11:55:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAEB4106566C; Sun, 4 Dec 2011 11:55:33 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A0CE78FC19; Sun, 4 Dec 2011 11:55:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4BtXFA085808; Sun, 4 Dec 2011 11:55:33 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4BtXeA085804; Sun, 4 Dec 2011 11:55:33 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201112041155.pB4BtXeA085804@svn.freebsd.org> From: Adrian Chadd Date: Sun, 4 Dec 2011 11:55:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228257 - head/sys/dev/iicbus X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 11:55:33 -0000 Author: adrian Date: Sun Dec 4 11:55:33 2011 New Revision: 228257 URL: http://svn.freebsd.org/changeset/base/228257 Log: Allow the i2c node requirements to be slightly relaxed. These realtek switch PHYs speak a variant of i2c with some slightly modified handling. From the submitter, slightly modified now that some further digging has been done: The I2C framework makes a assumption that the read/not-write bit of the first byte (the address) indicates whether reads or writes are to follow. The RTL8366 family uses the bus: after sending the address+read/not-write byte, two register address bytes are sent, then the 16-bit register value is sent or received. While the register write access can be performed as a 4-byte write, the read access requires the read bit to be set, but the first two bytes for the register address then need to be transmitted. This patch maintains the i2c protocol behaviour but allows it to be relaxed (for these kinds of switch PHYs, and whatever else Realtek may do with this almost-but-not-quite i2c bus) - by setting the "strict" hint to 0. The "strict" hint defaults to 1. Submitted by: Stefan Bethke Modified: head/sys/dev/iicbus/iicbus.c head/sys/dev/iicbus/iicbus.h head/sys/dev/iicbus/iiconf.c Modified: head/sys/dev/iicbus/iicbus.c ============================================================================== --- head/sys/dev/iicbus/iicbus.c Sun Dec 4 07:28:50 2011 (r228256) +++ head/sys/dev/iicbus/iicbus.c Sun Dec 4 11:55:33 2011 (r228257) @@ -92,10 +92,16 @@ iicbus_attach(device_t dev) unsigned char addr; #endif struct iicbus_softc *sc = IICBUS_SOFTC(dev); + int strict; sc->dev = dev; mtx_init(&sc->lock, "iicbus", NULL, MTX_DEF); iicbus_reset(dev, IIC_FASTEST, 0, NULL); + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "strict", &strict) == 0) + sc->strict = strict; + else + sc->strict = 1; /* device probing is meaningless since the bus is supposed to be * hot-plug. Moreover, some I2C chips do not appreciate random Modified: head/sys/dev/iicbus/iicbus.h ============================================================================== --- head/sys/dev/iicbus/iicbus.h Sun Dec 4 07:28:50 2011 (r228256) +++ head/sys/dev/iicbus/iicbus.h Sun Dec 4 11:55:33 2011 (r228257) @@ -41,6 +41,8 @@ struct iicbus_softc device_t owner; /* iicbus owner device structure */ u_char started; /* address of the 'started' slave * 0 if no start condition succeeded */ + u_char strict; /* deny operations that violate the + * I2C protocol */ struct mtx lock; }; Modified: head/sys/dev/iicbus/iiconf.c ============================================================================== --- head/sys/dev/iicbus/iiconf.c Sun Dec 4 07:28:50 2011 (r228256) +++ head/sys/dev/iicbus/iiconf.c Sun Dec 4 11:55:33 2011 (r228257) @@ -243,8 +243,8 @@ iicbus_write(device_t bus, const char *b { struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus); - /* a slave must have been started with the appropriate address */ - if (!sc->started || (sc->started & LSB)) + /* a slave must have been started for writing */ + if (sc->started == 0 || (sc->strict != 0 && (sc->started & LSB) != 0)) return (EINVAL); return (IICBUS_WRITE(device_get_parent(bus), buf, len, sent, timeout)); @@ -261,8 +261,8 @@ iicbus_read(device_t bus, char *buf, int { struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus); - /* a slave must have been started with the appropriate address */ - if (!sc->started || !(sc->started & LSB)) + /* a slave must have been started for reading */ + if (sc->started == 0 || (sc->strict != 0 && (sc->started & LSB) == 0)) return (EINVAL); return (IICBUS_READ(device_get_parent(bus), buf, len, read, last, delay)); From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 12:10:25 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0CCEF1065670; Sun, 4 Dec 2011 12:10:25 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F076D8FC13; Sun, 4 Dec 2011 12:10:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4CAOdb086296; Sun, 4 Dec 2011 12:10:24 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4CAOxL086294; Sun, 4 Dec 2011 12:10:24 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201112041210.pB4CAOxL086294@svn.freebsd.org> From: Adrian Chadd Date: Sun, 4 Dec 2011 12:10:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228258 - head/sys/dev/gpio X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 12:10:25 -0000 Author: adrian Date: Sun Dec 4 12:10:24 2011 New Revision: 228258 URL: http://svn.freebsd.org/changeset/base/228258 Log: Modify the GPIO i2c bus code to allow for arbitrary data/clock pins, rather than defaulting to 0 and 1. This way the pin order can be reversed. It is reversed with the TP-Link TL-WR1043nd. Submitted by: Stefan Bethke Modified: head/sys/dev/gpio/gpioiic.c Modified: head/sys/dev/gpio/gpioiic.c ============================================================================== --- head/sys/dev/gpio/gpioiic.c Sun Dec 4 11:55:33 2011 (r228257) +++ head/sys/dev/gpio/gpioiic.c Sun Dec 4 12:10:24 2011 (r228258) @@ -48,8 +48,8 @@ __FBSDID("$FreeBSD$"); #include "iicbb_if.h" -#define SCL_PIN 0 /* gpiobus mapped pin 6 */ -#define SDA_PIN 1 /* gpiobus mapped pin 7 */ +#define SCL_PIN_DEFAULT 0 /* default index of SCL pin on gpiobus */ +#define SDA_PIN_DEFAULT 1 struct gpioiic_softc { @@ -57,6 +57,8 @@ struct gpioiic_softc device_t sc_busdev; struct mtx sc_mtx; struct cdev *sc_leddev; + int scl_pin; + int sda_pin; }; static int gpioiic_probe(device_t); @@ -88,6 +90,12 @@ gpioiic_attach(device_t dev) sc->sc_dev = dev; sc->sc_busdev = device_get_parent(dev); + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "scl", &sc->scl_pin)) + sc->scl_pin = SCL_PIN_DEFAULT; + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "sda", &sc->sda_pin)) + sc->sda_pin = SDA_PIN_DEFAULT; /* add generic bit-banging code */ bitbang = device_add_child(dev, "iicbb", -1); @@ -105,9 +113,9 @@ gpioiic_reset_bus(device_t dev) { struct gpioiic_softc *sc = device_get_softc(dev); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, SDA_PIN, + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, GPIO_PIN_INPUT); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, SCL_PIN, + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, GPIO_PIN_INPUT); } @@ -142,11 +150,11 @@ gpioiic_setsda(device_t dev, int val) GPIOBUS_LOCK_BUS(sc->sc_busdev); if (val == 0) { - GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, SDA_PIN, 0); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, SDA_PIN, + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->sda_pin, 0); + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, GPIO_PIN_OUTPUT); } else { - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, SDA_PIN, + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, GPIO_PIN_INPUT); } GPIOBUS_UNLOCK_BUS(sc->sc_busdev); @@ -159,11 +167,11 @@ gpioiic_setscl(device_t dev, int val) GPIOBUS_LOCK_BUS(sc->sc_busdev); if (val == 0) { - GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, SCL_PIN, 0); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, SCL_PIN, + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->scl_pin, 0); + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, GPIO_PIN_OUTPUT); } else { - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, SCL_PIN, + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, GPIO_PIN_INPUT); } GPIOBUS_UNLOCK_BUS(sc->sc_busdev); @@ -176,9 +184,9 @@ gpioiic_getscl(device_t dev) unsigned int val; GPIOBUS_LOCK_BUS(sc->sc_busdev); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, SCL_PIN, + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, GPIO_PIN_INPUT); - GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, SCL_PIN, &val); + GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, sc->scl_pin, &val); GPIOBUS_UNLOCK_BUS(sc->sc_busdev); return ((int)val); @@ -191,9 +199,9 @@ gpioiic_getsda(device_t dev) unsigned int val; GPIOBUS_LOCK_BUS(sc->sc_busdev); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, SDA_PIN, + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, GPIO_PIN_INPUT); - GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, SDA_PIN, &val); + GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, sc->sda_pin, &val); GPIOBUS_UNLOCK_BUS(sc->sc_busdev); return ((int)val); From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 12:31:19 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AB36106567C; Sun, 4 Dec 2011 12:31:19 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id 05E9F8FC15; Sun, 4 Dec 2011 12:31:18 +0000 (UTC) Received: from lstewart1.loshell.room52.net (ppp59-167-184-191.static.internode.on.net [59.167.184.191]) by lauren.room52.net (Postfix) with ESMTPSA id 6F1C47E84A; Sun, 4 Dec 2011 23:31:16 +1100 (EST) Message-ID: <4EDB6814.9040403@freebsd.org> Date: Sun, 04 Dec 2011 23:31:16 +1100 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0.1) Gecko/20111016 Thunderbird/7.0.1 MIME-Version: 1.0 To: Jung-uk Kim References: <201111210417.pAL4HOdi023556@svn.freebsd.org> <4ED8575D.2010405@freebsd.org> <201112021927.25234.jkim@FreeBSD.org> <201112022002.49618.jkim@FreeBSD.org> In-Reply-To: <201112022002.49618.jkim@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=unavailable version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on lauren.room52.net Cc: src-committers@FreeBSD.org, John Baldwin , svn-src-all@FreeBSD.org, Julien Ridoux , Ben Kaduk , Benjamin Kaduk , svn-src-head@FreeBSD.org Subject: Re: svn commit: r227778 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 12:31:19 -0000 On 12/03/11 12:02, Jung-uk Kim wrote: > On Friday 02 December 2011 07:27 pm, Jung-uk Kim wrote: >> On Thursday 01 December 2011 11:43 pm, Lawrence Stewart wrote: >>> On 12/02/11 03:43, Jung-uk Kim wrote: >>>> On Thursday 01 December 2011 10:11 am, Lawrence Stewart wrote: >>>>> On 11/30/11 05:09, Jung-uk Kim wrote: >>>>>> On Tuesday 29 November 2011 11:13 am, Lawrence Stewart wrote: [snip] >>>>>>> Here's the first of the patches: >>>>>>> >>>>>>> http://people.freebsd.org/~lstewart/patches/misc/ffclock_bpf >>>>>>> _i nt act abi_10.x.r228130.patch >>>>>> >>>>>> I only glanced at it but it looks very close to what I wanted >>>>>> to suggest. >>>>> >>>>> Final candidate patch is at: >>>>> >>>>> http://people.freebsd.org/~lstewart/patches/misc/ffclock_bpf_i >>>>> nt act abi_10.x.r228180.patch >>>>> >>>>> Assuming it passes the "make tinderbox" build I'm currently >>>>> running and no further input is received from interested >>>>> parties, I plan to commit it in ~10 hours. >>>>> >>>>> Changes since the r228130 patch I sent previously: >>>>> >>>>> - The new flags in bpf.h are added unconditionally so that >>>>> they can always be referenced at compile time and a decision >>>>> made at runtime as to whether a flag will be set or not. Using >>>>> one of the new flags when the kernel doesn't have FFCLOCK >>>>> compiled in results in the flag being ignored. An app should >>>>> check for the existence of the "ffclock" kernel feature or the >>>>> "kern.sysclock" sysctl tree before attempting to use the >>>>> flags. >>>>> >>>>> - This patch will hopefully be MFCed at some point, so I added >>>>> a CTASSERT to bpf.c to ensure that the ABI of structs >>>>> bpf_hdr32, bpf_hdr and bpf_xhdr remains intact when FFCLOCK is >>>>> enabled and the union of a ffcounter and struct >>>>> timeval32/timeval/bpf_ts is switched in. >>>>> >>>>> - bpf_gettime() more comprehensively covers all the possible >>>>> cases of flag combination and does sensible things for each >>>>> case (even though some cases are rather silly). >>>>> >>>>> - The snippet of code at the beginning of catchpacket() that >>>>> was manipulating the struct bintime derived from bpf_gettime() >>>>> was gross and has been removed in favour of selecting the >>>>> right {get}bin{up}time() function call in bpf_gettime(). >>>> >>>> I did that to reduce branching. Since you are introducing more >>>> branches, it warrants a function pointer now. >> >> There's another reason, BTW. If mbufs are tagged with timestamps >> (where only monotonic timestamps are allowed), they must be >> converted within the bpf.c. I forgot all the details. :-( We should document this knowledge in some code comments. >>> I see, thanks for the explanation. Could you elaborate a bit more >>> about how you would implement the function pointer idea? I'm also >>> curious in the !FFCLOCK case just how much overhead having the >>> 2-layer nested if/else adds. I'm not an very optimisation savvy >>> person, but I'm wondering if it's actually worth micro-optimising >>> this code. >>> >>> My initial thoughts about your function pointer idea lead to >>> adding a function pointer in the bpf_d and setting it to the >>> appropriate function to get the timestamp from at bpf_d creation >>> or ioctl time. Whilst I like this idea, I can't see how it would >>> work given that the various functions involved in time/ffcounter >>> stamp generation all have different signatures. >>> >>> We could have multiple variants of bpf_gettime() which each call >>> the appropriate underlying functions to generate the appropriate >>> stamp. Would add quite a lot of code but would reduce the >>> overhead of calling bpf_gettime() to an indirect function call + >>> the underlying stamp generation function call. This also solves >>> the problem of multiple function signatures. >> >> Please see my patch: >> >> http://people.freebsd.org/~jkim/bpf_ffclock.diff > > I booted up the kernel and found it just crashes because of stupid > typos. Now a new patch is uploaded in place. Sorry. > > Anyway, I see no regression nor ABI breakage. :-) struct bpf_d being part of the ABI was the main thing I was concerned about, so given that it isn't I like your approach a lot. As noted by Julien, this approach does introduce problems with respect to the follow up patch that adds a permanent bh_ffcounter member to the bpf header. I thought the fromclock() API would sufficiently meet the needs of consumers like BPF, but if we were to proceed with something like Jung-uk's proposed patch I don't think that's true anymore. We decided to bite the bullet and devise an API that is more compact and can return all appropriate time information from all underlying sysclocks in an efficient manner - something like a more generic version of ffclock_abstime(). Julien and I spent quite some time today nutting out details, and Julien has done a proof of concept patch against my proposed BPF patch which looks good as a starting point for discussion: http://www.cubinlab.ee.unimelb.edu.au/~jrid/patches/r228254/sysclock_snap.patch It needs a bit more work and should be split into two patches (one introducing the API and the other being the BPF changes). With something like this though, the BPF patch becomes radically simplified in the FFCLOCK case. We don't even need a function pointer cached in the bpf_d anymore, but could cache a struct sysclock_snap there instead if we really wanted to minimise overhead in bpf_gettime(). We'll have a go at refining the patch tomorrow hopefully, but wanted to put this out there for early consideration. Cheers, Lawrence From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 14:44:32 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A48B01065670; Sun, 4 Dec 2011 14:44:32 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 91FE28FC0A; Sun, 4 Dec 2011 14:44:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4EiWvw091084; Sun, 4 Dec 2011 14:44:32 GMT (envelope-from dumbbell@svn.freebsd.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4EiWjW091072; Sun, 4 Dec 2011 14:44:32 GMT (envelope-from dumbbell@svn.freebsd.org) Message-Id: <201112041444.pB4EiWjW091072@svn.freebsd.org> From: Jean-Sebastien Pedron Date: Sun, 4 Dec 2011 14:44:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228259 - in head: sbin/dhclient tools/regression/sbin tools/regression/sbin/dhclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 14:44:32 -0000 Author: dumbbell Date: Sun Dec 4 14:44:31 2011 New Revision: 228259 URL: http://svn.freebsd.org/changeset/base/228259 Log: Support domain-search in dhclient(8) The "domain-search" option (option 119) allows a DHCP server to publish a list of implicit domain suffixes used during name lookup. This option is described in RFC 3397. For instance, if the domain-search option says: ".example.org .example.com" and one wants to resolve "foobar", the resolver will try: 1. "foobar.example.org" 2. "foobar.example.com" The file /etc/resolv.conf is updated with a "search" directive if the DHCP server provides "domain-search". A regression test suite is included in this patch under tools/regression/sbin/dhclient. PR: bin/151940 Sponsored by Yakaz (http://www.yakaz.com) Added: head/tools/regression/sbin/dhclient/ head/tools/regression/sbin/dhclient/Makefile (contents, props changed) head/tools/regression/sbin/dhclient/fake.c (contents, props changed) head/tools/regression/sbin/dhclient/option-domain-search.c (contents, props changed) Modified: head/sbin/dhclient/clparse.c head/sbin/dhclient/dhclient-script head/sbin/dhclient/dhclient.c head/sbin/dhclient/dhcp-options.5 head/sbin/dhclient/dhcp.h head/sbin/dhclient/options.c head/sbin/dhclient/tables.c head/tools/regression/sbin/Makefile Modified: head/sbin/dhclient/clparse.c ============================================================================== --- head/sbin/dhclient/clparse.c Sun Dec 4 12:10:24 2011 (r228258) +++ head/sbin/dhclient/clparse.c Sun Dec 4 14:44:31 2011 (r228259) @@ -100,6 +100,8 @@ read_client_conf(void) DHO_DOMAIN_NAME_SERVERS; top_level_config.requested_options [top_level_config.requested_option_count++] = DHO_HOST_NAME; + top_level_config.requested_options + [top_level_config.requested_option_count++] = DHO_DOMAIN_SEARCH; if ((cfile = fopen(path_dhclient_conf, "r")) != NULL) { do { Modified: head/sbin/dhclient/dhclient-script ============================================================================== --- head/sbin/dhclient/dhclient-script Sun Dec 4 12:10:24 2011 (r228258) +++ head/sbin/dhclient/dhclient-script Sun Dec 4 14:44:31 2011 (r228259) @@ -201,7 +201,9 @@ add_new_resolv_conf() { local tmpres=/var/run/resolv.conf.${interface} rm -f $tmpres - if [ -n "$new_domain_name" ]; then + if [ -n "$new_domain_search" ]; then + echo "search $new_domain_search" >>$tmpres + elif [ -n "$new_domain_name" ]; then echo "search $new_domain_name" >>$tmpres fi Modified: head/sbin/dhclient/dhclient.c ============================================================================== --- head/sbin/dhclient/dhclient.c Sun Dec 4 12:10:24 2011 (r228258) +++ head/sbin/dhclient/dhclient.c Sun Dec 4 14:44:31 2011 (r228259) @@ -2401,6 +2401,7 @@ check_option(struct client_lease *l, int } return (1); case DHO_DOMAIN_NAME: + case DHO_DOMAIN_SEARCH: if (!res_hnok(sbuf)) { if (!check_search(sbuf)) { warning("Bogus domain search list %d: %s (%s)", Modified: head/sbin/dhclient/dhcp-options.5 ============================================================================== --- head/sbin/dhclient/dhcp-options.5 Sun Dec 4 12:10:24 2011 (r228258) +++ head/sbin/dhclient/dhcp-options.5 Sun Dec 4 14:44:31 2011 (r228259) @@ -265,6 +265,10 @@ character set. .It Ic option domain-name Ar string ; This option specifies the domain name that the client should use when resolving hostnames via the Domain Name System. +.It Ic option domain-search Ar string ; +This option specifies a list of domain names that the client should use +when resolving hostnames via the Domain Name System. This option is +defined in RFC 3397. .It Ic option swap-server Ar ip-address ; This specifies the IP address of the client's swap server. .It Ic option root-path Ar string ; Modified: head/sbin/dhclient/dhcp.h ============================================================================== --- head/sbin/dhclient/dhcp.h Sun Dec 4 12:10:24 2011 (r228258) +++ head/sbin/dhclient/dhcp.h Sun Dec 4 14:44:31 2011 (r228259) @@ -169,6 +169,7 @@ struct dhcp_packet { #define DHO_STREETTALK_SERVER 75 #define DHO_STREETTALK_DA_SERVER 76 #define DHO_DHCP_USER_CLASS_ID 77 +#define DHO_DOMAIN_SEARCH 119 #define DHO_CLASSLESS_ROUTES 121 #define DHO_END 255 Modified: head/sbin/dhclient/options.c ============================================================================== --- head/sbin/dhclient/options.c Sun Dec 4 12:10:24 2011 (r228258) +++ head/sbin/dhclient/options.c Sun Dec 4 14:44:31 2011 (r228259) @@ -55,6 +55,10 @@ void parse_options(struct packet *); void parse_option_buffer(struct packet *, unsigned char *, int); int store_options(unsigned char *, int, struct tree_cache **, unsigned char *, int, int, int, int); +void expand_domain_search(struct packet *packet); +int find_search_domain_name_len(struct option_data *option, int *offset); +void expand_search_domain_name(struct option_data *option, int *offset, + unsigned char **domain_search); /* @@ -94,6 +98,11 @@ parse_options(struct packet *packet) (unsigned char *)packet->raw->sname, sizeof(packet->raw->sname)); } + + /* Expand DHCP Domain Search option. */ + if (packet->options_valid) { + expand_domain_search(packet); + } } /* @@ -194,6 +203,163 @@ parse_option_buffer(struct packet *packe } /* + * Expand DHCP Domain Search option. The value of this option is + * encoded like DNS' list of labels. See: + * RFC 3397 + * RFC 1035 + */ +void +expand_domain_search(struct packet *packet) +{ + int offset, expanded_len; + struct option_data *option; + unsigned char *domain_search, *cursor; + + if (packet->options[DHO_DOMAIN_SEARCH].data == NULL) + return; + + option = &packet->options[DHO_DOMAIN_SEARCH]; + + /* Compute final expanded length. */ + expanded_len = 0; + offset = 0; + while (offset < option->len) { + /* We add 1 for the space between domain names. */ + expanded_len += + find_search_domain_name_len(option, &offset) + 1; + } + if (expanded_len > 0) + /* Remove 1 for the superfluous trailing space. */ + --expanded_len; + + domain_search = malloc(expanded_len + 1); + if (domain_search == NULL) + error("Can't allocate storage for expanded domain-search\n"); + + offset = 0; + cursor = domain_search; + while (offset < option->len) { + expand_search_domain_name(option, &offset, &cursor); + cursor[0] = ' '; + cursor++; + } + domain_search[expanded_len] = '\0'; + + free(option->data); + option->len = expanded_len; + option->data = domain_search; +} + +int +find_search_domain_name_len(struct option_data *option, int *offset) +{ + int domain_name_len, i, label_len, pointer, pointed_len; + + domain_name_len = 0; + + i = *offset; + while (i < option->len) { + label_len = option->data[i]; + if (label_len == 0) { + /* + * A zero-length label marks the end of this + * domain name. + */ + *offset = i + 1; + return (domain_name_len); + } else if (label_len & 0xC0) { + /* This is a pointer to another list of labels. */ + if (i + 1 >= option->len) { + /* The pointer is truncated. */ + error("Truncated pointer in DHCP Domain " + "Search option."); + } + + pointer = ((label_len & ~(0xC0)) << 8) + + option->data[i + 1]; + if (pointer >= *offset) { + /* + * The pointer must indicates a prior + * occurance. + */ + error("Invalid forward pointer in DHCP Domain " + "Search option compression."); + } + + pointed_len = find_search_domain_name_len(option, + &pointer); + domain_name_len += pointed_len; + + *offset = i + 2; + return (domain_name_len); + } + + if (i + label_len >= option->len) { + error("Truncated label in DHCP Domain Search option."); + } + + /* + * Update the domain name length with the length of the + * current label, plus a trailing dot ('.'). + */ + domain_name_len += label_len + 1; + + /* Move cursor. */ + i += label_len + 1; + } + + error("Truncated DHCP Domain Search option."); + + return (0); +} + +void +expand_search_domain_name(struct option_data *option, int *offset, + unsigned char **domain_search) +{ + int i, label_len, pointer; + unsigned char *cursor; + + /* + * This is the same loop than the function above + * (find_search_domain_name_len). Therefore, we remove checks, + * they're already done. Here, we just make the copy. + */ + i = *offset; + cursor = *domain_search; + while (i < option->len) { + label_len = option->data[i]; + if (label_len == 0) { + /* + * A zero-length label marks the end of this + * domain name. + */ + *offset = i + 1; + *domain_search = cursor; + return; + } else if (label_len & 0xC0) { + /* This is a pointer to another list of labels. */ + pointer = ((label_len & ~(0xC0)) << 8) + + option->data[i + 1]; + + expand_search_domain_name(option, &pointer, &cursor); + + *offset = i + 2; + *domain_search = cursor; + return; + } + + /* Copy the label found. */ + memcpy(cursor, option->data + i + 1, label_len); + cursor[label_len] = '.'; + + /* Move cursor. */ + i += label_len + 1; + cursor += label_len + 1; + } +} + +/* * cons options into a big buffer, and then split them out into the * three separate buffers if needed. This allows us to cons up a set of * vendor options using the same routine. Modified: head/sbin/dhclient/tables.c ============================================================================== --- head/sbin/dhclient/tables.c Sun Dec 4 12:10:24 2011 (r228258) +++ head/sbin/dhclient/tables.c Sun Dec 4 14:44:31 2011 (r228259) @@ -184,7 +184,7 @@ struct option dhcp_options[256] = { { "option-116", "X", &dhcp_universe, 116 }, { "option-117", "X", &dhcp_universe, 117 }, { "option-118", "X", &dhcp_universe, 118 }, - { "option-119", "X", &dhcp_universe, 119 }, + { "domain-search", "t", &dhcp_universe, 119 }, { "option-120", "X", &dhcp_universe, 120 }, { "classless-routes", "BA", &dhcp_universe, 121 }, { "option-122", "X", &dhcp_universe, 122 }, @@ -400,12 +400,13 @@ unsigned char dhcp_option_default_priori DHO_IRC_SERVER, DHO_STREETTALK_SERVER, DHO_STREETTALK_DA_SERVER, + DHO_DOMAIN_SEARCH, /* Presently-undefined options... */ 62, 63, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, + 118, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, Modified: head/tools/regression/sbin/Makefile ============================================================================== --- head/tools/regression/sbin/Makefile Sun Dec 4 12:10:24 2011 (r228258) +++ head/tools/regression/sbin/Makefile Sun Dec 4 14:44:31 2011 (r228259) @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR= growfs +SUBDIR= dhclient growfs .include Added: head/tools/regression/sbin/dhclient/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sbin/dhclient/Makefile Sun Dec 4 14:44:31 2011 (r228259) @@ -0,0 +1,16 @@ +# $FreeBSD$ + +.PATH: ${.CURDIR}/../../../../sbin/dhclient + +SRCS= alloc.c convert.c hash.c options.c tables.c \ + fake.c \ + option-domain-search.c + +CFLAGS+= -I${.CURDIR}/../../../../sbin/dhclient +LDADD= -lutil + +PROG= option-domain-search + +WARNS?= 2 + +.include Added: head/tools/regression/sbin/dhclient/fake.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sbin/dhclient/fake.c Sun Dec 4 14:44:31 2011 (r228259) @@ -0,0 +1,60 @@ +/* $FreeBSD$ */ + +#include +#include +#include + +#include "dhcpd.h" + +extern jmp_buf env; + +void +error(char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "\n"); + + longjmp(env, 1); +} + +int +warning(char *fmt, ...) +{ + int ret; + va_list ap; + + va_start(ap, fmt); + ret = vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "\n"); + + return ret; +} + +int +note(char *fmt, ...) +{ + int ret; + va_list ap; + + va_start(ap, fmt); + ret = vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "\n"); + + return ret; +} + +void +bootp(struct packet *packet) +{ +} + +void +dhcp(struct packet *packet) +{ +} Added: head/tools/regression/sbin/dhclient/option-domain-search.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/sbin/dhclient/option-domain-search.c Sun Dec 4 14:44:31 2011 (r228259) @@ -0,0 +1,328 @@ +/* $FreeBSD$ */ + +#include +#include + +#include "dhcpd.h" + +jmp_buf env; + +void expand_domain_search(struct packet *packet); + +void +no_option_present() +{ + int ret; + struct option_data option; + struct packet p; + + option.data = NULL; + option.len = 0; + p.options[DHO_DOMAIN_SEARCH] = option; + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (p.options[DHO_DOMAIN_SEARCH].len != 0 || + p.options[DHO_DOMAIN_SEARCH].data != NULL) + abort(); +} + +void +one_domain_valid() +{ + int ret; + struct packet p; + struct option_data *option; + + char *data = "\007example\003org\0"; + char *expected = "example.org."; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 13; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (option->len != strlen(expected) || + strcmp(option->data, expected) != 0) + abort(); + + free(option->data); +} + +void +one_domain_truncated1() +{ + int ret; + struct option_data *option; + struct packet p; + + char *data = "\007example\003org"; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 12; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (ret != 1) + abort(); + + free(option->data); +} + +void +one_domain_truncated2() +{ + int ret; + struct option_data *option; + struct packet p; + + char *data = "\007ex"; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 3; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (ret != 1) + abort(); + + free(option->data); +} + +void +two_domains_valid() +{ + int ret; + struct packet p; + struct option_data *option; + + char *data = "\007example\003org\0\007example\003com\0"; + char *expected = "example.org. example.com."; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 26; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (option->len != strlen(expected) || + strcmp(option->data, expected) != 0) + abort(); + + free(option->data); +} + +void +two_domains_truncated1() +{ + int ret; + struct option_data *option; + struct packet p; + + char *data = "\007example\003org\0\007example\003com"; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 25; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (ret != 1) + abort(); + + free(option->data); +} + +void +two_domains_truncated2() +{ + int ret; + struct option_data *option; + struct packet p; + + char *data = "\007example\003org\0\007ex"; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 16; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (ret != 1) + abort(); + + free(option->data); +} + +void +two_domains_compressed() +{ + int ret; + struct packet p; + struct option_data *option; + + char *data = "\007example\003org\0\006foobar\xc0\x08"; + char *expected = "example.org. foobar.org."; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 22; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (option->len != strlen(expected) || + strcmp(option->data, expected) != 0) + abort(); + + free(option->data); +} + +void +two_domains_infloop() +{ + int ret; + struct packet p; + struct option_data *option; + + char *data = "\007example\003org\0\006foobar\xc0\x0d"; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 22; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (ret != 1) + abort(); + + free(option->data); +} + +void +two_domains_forwardptr() +{ + int ret; + struct packet p; + struct option_data *option; + + char *data = "\007example\003org\xc0\x0d\006foobar\0"; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 22; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (ret != 1) + abort(); + + free(option->data); +} + +void +two_domains_truncatedptr() +{ + int ret; + struct packet p; + struct option_data *option; + + char *data = "\007example\003org\0\006foobar\xc0"; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 21; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (ret != 1) + abort(); + + free(option->data); +} + +void +multiple_domains_valid() +{ + int ret; + struct packet p; + struct option_data *option; + + char *data = + "\007example\003org\0\002cl\006foobar\003com\0\002fr\xc0\x10"; + + char *expected = "example.org. cl.foobar.com. fr.foobar.com."; + + option = &p.options[DHO_DOMAIN_SEARCH]; + option->len = 33; + option->data = malloc(option->len); + memcpy(option->data, data, option->len); + + ret = setjmp(env); + if (ret == 0) + expand_domain_search(&p); + + if (option->len != strlen(expected) || + strcmp(option->data, expected) != 0) + abort(); + + free(option->data); +} + +int +main(int argc, char *argv[]) +{ + + no_option_present(); + + one_domain_valid(); + one_domain_truncated1(); + one_domain_truncated2(); + + two_domains_valid(); + two_domains_truncated1(); + two_domains_truncated2(); + + two_domains_compressed(); + two_domains_infloop(); + two_domains_forwardptr(); + two_domains_truncatedptr(); + + multiple_domains_valid(); + + return (0); +} From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 16:33:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48848106566B; Sun, 4 Dec 2011 16:33:05 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 37F718FC08; Sun, 4 Dec 2011 16:33:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4GX5mw094455; Sun, 4 Dec 2011 16:33:05 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4GX57R094453; Sun, 4 Dec 2011 16:33:05 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201112041633.pB4GX57R094453@svn.freebsd.org> From: Rick Macklem Date: Sun, 4 Dec 2011 16:33:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228260 - head/sys/fs/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 16:33:05 -0000 Author: rmacklem Date: Sun Dec 4 16:33:04 2011 New Revision: 228260 URL: http://svn.freebsd.org/changeset/base/228260 Log: This patch adds a sysctl to the NFSv4 server which optionally disables the check for a UTF-8 compliant file name. Enabling this sysctl results in an NFSv4 server that is non-RFC3530 compliant, therefore it is not enabled by default. However, enabling this sysctl results in NFSv3 compatible behaviour and fixes the problem reported by "dan at sunsaturn.com" to freebsd-current@ on Nov. 14, 2011 under the subject "NFSV4 readlink_stat". Tested by: dan at sunsaturn.com Reviewed by: zack MFC after: 2 weeks Modified: head/sys/fs/nfsserver/nfs_nfsdsubs.c Modified: head/sys/fs/nfsserver/nfs_nfsdsubs.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdsubs.c Sun Dec 4 14:44:31 2011 (r228259) +++ head/sys/fs/nfsserver/nfs_nfsdsubs.c Sun Dec 4 16:33:04 2011 (r228260) @@ -56,6 +56,13 @@ static nfstype newnfsv2_type[9] = { NFNO extern nfstype nfsv34_type[9]; #endif /* !APPLEKEXT */ +SYSCTL_DECL(_vfs_nfsd); + +static int disable_checkutf8 = 0; +SYSCTL_INT(_vfs_nfsd, OID_AUTO, disable_checkutf8, CTLFLAG_RW, + &disable_checkutf8, 0, + "Disable the NFSv4 check for a UTF8 compliant name"); + static char nfsrv_hexdigit(char, int *); /* @@ -1963,7 +1970,8 @@ nfsrv_parsename(struct nfsrv_descript *n error = 0; goto nfsmout; } - if (nfsrv_checkutf8((u_int8_t *)bufp, outlen)) { + if (disable_checkutf8 == 0 && + nfsrv_checkutf8((u_int8_t *)bufp, outlen)) { nd->nd_repstat = NFSERR_INVAL; error = 0; goto nfsmout; From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 18:43:09 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9F06106566B; Sun, 4 Dec 2011 18:43:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 99CDF8FC1C; Sun, 4 Dec 2011 18:43:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4Ih9Np098406; Sun, 4 Dec 2011 18:43:09 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4Ih92H098404; Sun, 4 Dec 2011 18:43:09 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112041843.pB4Ih92H098404@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 4 Dec 2011 18:43:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228261 - head/usr.bin/truss X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 18:43:09 -0000 Author: kib Date: Sun Dec 4 18:43:09 2011 New Revision: 228261 URL: http://svn.freebsd.org/changeset/base/228261 Log: Use explicit information from the kernel to detect the traps due to syscall entry and leave. Based on submision by: Dan Nelson MFC after: 1 month Modified: head/usr.bin/truss/setup.c Modified: head/usr.bin/truss/setup.c ============================================================================== --- head/usr.bin/truss/setup.c Sun Dec 4 16:33:04 2011 (r228260) +++ head/usr.bin/truss/setup.c Sun Dec 4 18:43:09 2011 (r228261) @@ -202,9 +202,19 @@ waitevent(struct trussinfo *info) find_thread(info, lwpinfo.pl_lwpid); switch(WSTOPSIG(waitval)) { case SIGTRAP: - info->pr_why = info->curthread->in_syscall?S_SCX:S_SCE; - info->curthread->in_syscall = 1 - info->curthread->in_syscall; - break; + if (lwpinfo.pl_flags & PL_FLAG_SCE) { + info->pr_why = S_SCE; + info->curthread->in_syscall = 1; + break; + } else if (lwpinfo.pl_flags & PL_FLAG_SCX) { + info->pr_why = S_SCX; + info->curthread->in_syscall = 0; + break; + } else { + errx(1, + "pl_flags %x contains neither PL_FLAG_SCE nor PL_FLAG_SCX", + lwpinfo.pl_flags); + } default: info->pr_why = S_SIG; info->pr_data = WSTOPSIG(waitval); From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 18:55:19 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB6EB1065672; Sun, 4 Dec 2011 18:55:19 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B0FC58FC1E; Sun, 4 Dec 2011 18:55:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4ItJ49098811; Sun, 4 Dec 2011 18:55:19 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4ItJY3098809; Sun, 4 Dec 2011 18:55:19 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112041855.pB4ItJY3098809@svn.freebsd.org> From: Alan Cox Date: Sun, 4 Dec 2011 18:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228262 - stable/8/sys/amd64/amd64 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 18:55:20 -0000 Author: alc Date: Sun Dec 4 18:55:19 2011 New Revision: 228262 URL: http://svn.freebsd.org/changeset/base/228262 Log: MFC r219157 Make a change to the implementation of the direct map to improve performance on processors that support 1 GB pages. Specifically, if the end of physical memory is not aligned to a 1 GB page boundary, then map the residual physical memory with multiple 2 MB page mappings rather than a single 1 GB page mapping. When a 1 GB page mapping is used for this residual memory, access to the memory is slower than when multiple 2 MB page mappings are used. (I suspect that the reason for this slowdown is that the TLB is actually being loaded with 4 KB page mappings for the residual memory.) Modified: stable/8/sys/amd64/amd64/pmap.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/amd64/amd64/pmap.c ============================================================================== --- stable/8/sys/amd64/amd64/pmap.c Sun Dec 4 18:43:09 2011 (r228261) +++ stable/8/sys/amd64/amd64/pmap.c Sun Dec 4 18:55:19 2011 (r228262) @@ -435,7 +435,7 @@ allocpages(vm_paddr_t *firstaddr, int n) static void create_pagetables(vm_paddr_t *firstaddr) { - int i; + int i, j, ndm1g; /* Allocate pages */ KPTphys = allocpages(firstaddr, NKPT); @@ -447,8 +447,11 @@ create_pagetables(vm_paddr_t *firstaddr) if (ndmpdp < 4) /* Minimum 4GB of dirmap */ ndmpdp = 4; DMPDPphys = allocpages(firstaddr, NDMPML4E); - if ((amd_feature & AMDID_PAGE1GB) == 0) - DMPDphys = allocpages(firstaddr, ndmpdp); + ndm1g = 0; + if ((amd_feature & AMDID_PAGE1GB) != 0) + ndm1g = ptoa(Maxmem) >> PDPSHIFT; + if (ndm1g < ndmpdp) + DMPDphys = allocpages(firstaddr, ndmpdp - ndm1g); dmaplimit = (vm_paddr_t)ndmpdp << PDPSHIFT; /* Fill in the underlying page table pages */ @@ -480,32 +483,28 @@ create_pagetables(vm_paddr_t *firstaddr) } /* - * Now, set up the direct map region using either 2MB or 1GB pages. - * Later, if pmap_mapdev{_attr}() uses the direct map for non-write- - * back memory, pmap_change_attr() will demote any 2MB or 1GB page - * mappings that are partially used. - */ - if ((amd_feature & AMDID_PAGE1GB) == 0) { - for (i = 0; i < NPDEPG * ndmpdp; i++) { - ((pd_entry_t *)DMPDphys)[i] = (vm_paddr_t)i << PDRSHIFT; - /* Preset PG_M and PG_A because demotion expects it. */ - ((pd_entry_t *)DMPDphys)[i] |= PG_RW | PG_V | PG_PS | - PG_G | PG_M | PG_A; - } - /* And the direct map space's PDP */ - for (i = 0; i < ndmpdp; i++) { - ((pdp_entry_t *)DMPDPphys)[i] = DMPDphys + - (i << PAGE_SHIFT); - ((pdp_entry_t *)DMPDPphys)[i] |= PG_RW | PG_V | PG_U; - } - } else { - for (i = 0; i < ndmpdp; i++) { - ((pdp_entry_t *)DMPDPphys)[i] = - (vm_paddr_t)i << PDPSHIFT; - /* Preset PG_M and PG_A because demotion expects it. */ - ((pdp_entry_t *)DMPDPphys)[i] |= PG_RW | PG_V | PG_PS | - PG_G | PG_M | PG_A; - } + * Now, set up the direct map region using 2MB and/or 1GB pages. If + * the end of physical memory is not aligned to a 1GB page boundary, + * then the residual physical memory is mapped with 2MB pages. Later, + * if pmap_mapdev{_attr}() uses the direct map for non-write-back + * memory, pmap_change_attr() will demote any 2MB or 1GB page mappings + * that are partially used. + */ + for (i = NPDEPG * ndm1g, j = 0; i < NPDEPG * ndmpdp; i++, j++) { + ((pd_entry_t *)DMPDphys)[j] = (vm_paddr_t)i << PDRSHIFT; + /* Preset PG_M and PG_A because demotion expects it. */ + ((pd_entry_t *)DMPDphys)[j] |= PG_RW | PG_V | PG_PS | PG_G | + PG_M | PG_A; + } + for (i = 0; i < ndm1g; i++) { + ((pdp_entry_t *)DMPDPphys)[i] = (vm_paddr_t)i << PDPSHIFT; + /* Preset PG_M and PG_A because demotion expects it. */ + ((pdp_entry_t *)DMPDPphys)[i] |= PG_RW | PG_V | PG_PS | PG_G | + PG_M | PG_A; + } + for (j = 0; i < ndmpdp; i++, j++) { + ((pdp_entry_t *)DMPDPphys)[i] = DMPDphys + (j << PAGE_SHIFT); + ((pdp_entry_t *)DMPDPphys)[i] |= PG_RW | PG_V | PG_U; } /* And recursively map PML4 to itself in order to get PTmap */ From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 19:25:49 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFEA6106566C; Sun, 4 Dec 2011 19:25:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AFAFB8FC0C; Sun, 4 Dec 2011 19:25:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4JPn2b099837; Sun, 4 Dec 2011 19:25:49 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4JPnmU099835; Sun, 4 Dec 2011 19:25:49 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112041925.pB4JPnmU099835@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 4 Dec 2011 19:25:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228263 - head/sys/fs/fifofs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 19:25:49 -0000 Author: kib Date: Sun Dec 4 19:25:49 2011 New Revision: 228263 URL: http://svn.freebsd.org/changeset/base/228263 Log: Initialize fifoinfo fi_wgen field on open. The only important is the difference between fi_wgen and f_seqcount, so the change is purely cosmetic, but it makes the code easier to understand. Submitted by: gianni MFC after: 2 weeks Modified: head/sys/fs/fifofs/fifo_vnops.c Modified: head/sys/fs/fifofs/fifo_vnops.c ============================================================================== --- head/sys/fs/fifofs/fifo_vnops.c Sun Dec 4 18:55:19 2011 (r228262) +++ head/sys/fs/fifofs/fifo_vnops.c Sun Dec 4 19:25:49 2011 (r228263) @@ -218,7 +218,7 @@ fail1: free(fip, M_VNODE); return (error); } - fip->fi_readers = fip->fi_writers = 0; + fip->fi_wgen = fip->fi_readers = fip->fi_writers = 0; wso->so_snd.sb_lowat = PIPE_BUF; SOCKBUF_LOCK(&rso->so_rcv); rso->so_rcv.sb_state |= SBS_CANTRCVMORE; From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 21:24:01 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7055D1065673; Sun, 4 Dec 2011 21:24:01 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 608EF8FC22; Sun, 4 Dec 2011 21:24:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4LO1HZ003573; Sun, 4 Dec 2011 21:24:01 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4LO19M003571; Sun, 4 Dec 2011 21:24:01 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201112042124.pB4LO19M003571@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 4 Dec 2011 21:24:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228264 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 21:24:01 -0000 Author: trociny Date: Sun Dec 4 21:24:01 2011 New Revision: 228264 URL: http://svn.freebsd.org/changeset/base/228264 Log: In sysctl_kern_proc_ps_strings() there is no much sense in checking for P_WEXIT and P_SYSTEM flags. Reviewed by: kib Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Sun Dec 4 19:25:49 2011 (r228263) +++ head/sys/kern/kern_proc.c Sun Dec 4 21:24:01 2011 (r228264) @@ -2456,18 +2456,10 @@ sysctl_kern_proc_ps_strings(SYSCTL_HANDL p = pfind((pid_t)name[0]); if (p == NULL) return (ESRCH); - if (p->p_flag & P_WEXIT) { - PROC_UNLOCK(p); - return (ESRCH); - } if ((error = p_cansee(curthread, p)) != 0) { PROC_UNLOCK(p); return (error); } - if ((p->p_flag & P_SYSTEM) != 0) { - PROC_UNLOCK(p); - return (0); - } #ifdef COMPAT_FREEBSD32 if ((req->flags & SCTL_MASK32) != 0) { /* From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 21:27:41 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 858F51065677; Sun, 4 Dec 2011 21:27:41 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75E5B8FC08; Sun, 4 Dec 2011 21:27:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4LRfZZ003717; Sun, 4 Dec 2011 21:27:41 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4LRfN5003715; Sun, 4 Dec 2011 21:27:41 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112042127.pB4LRfN5003715@svn.freebsd.org> From: Andriy Gapon Date: Sun, 4 Dec 2011 21:27:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228265 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 21:27:41 -0000 Author: avg Date: Sun Dec 4 21:27:41 2011 New Revision: 228265 URL: http://svn.freebsd.org/changeset/base/228265 Log: critical_exit: ignore td_owepreempt if kdb_active is set calling mi_switch in such a context results in a recursion via kdb_switch Suggested by: jhb Reviewed by: jhb MFC after: 5 weeks Modified: head/sys/kern/kern_switch.c Modified: head/sys/kern/kern_switch.c ============================================================================== --- head/sys/kern/kern_switch.c Sun Dec 4 21:24:01 2011 (r228264) +++ head/sys/kern/kern_switch.c Sun Dec 4 21:27:41 2011 (r228265) @@ -200,7 +200,7 @@ critical_exit(void) if (td->td_critnest == 1) { td->td_critnest = 0; - if (td->td_owepreempt) { + if (td->td_owepreempt && !kdb_active) { td->td_critnest = 1; thread_lock(td); td->td_critnest--; From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 21:29:56 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D03CF106566C; Sun, 4 Dec 2011 21:29:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C06838FC0C; Sun, 4 Dec 2011 21:29:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4LTukn003819; Sun, 4 Dec 2011 21:29:56 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4LTumU003817; Sun, 4 Dec 2011 21:29:56 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112042129.pB4LTumU003817@svn.freebsd.org> From: Andriy Gapon Date: Sun, 4 Dec 2011 21:29:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228266 - head/sys/boot/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 21:29:56 -0000 Author: avg Date: Sun Dec 4 21:29:56 2011 New Revision: 228266 URL: http://svn.freebsd.org/changeset/base/228266 Log: zfs boot: allow file vdevs to be used in testing (e.g. with zfsboottest) MFC after: 1 week Modified: head/sys/boot/zfs/zfsimpl.c Modified: head/sys/boot/zfs/zfsimpl.c ============================================================================== --- head/sys/boot/zfs/zfsimpl.c Sun Dec 4 21:27:41 2011 (r228265) +++ head/sys/boot/zfs/zfsimpl.c Sun Dec 4 21:29:56 2011 (r228266) @@ -458,6 +458,9 @@ vdev_init_from_nvlist(const unsigned cha if (strcmp(type, VDEV_TYPE_MIRROR) && strcmp(type, VDEV_TYPE_DISK) +#ifdef ZFS_TEST + && strcmp(type, VDEV_TYPE_FILE) +#endif && strcmp(type, VDEV_TYPE_RAIDZ) && strcmp(type, VDEV_TYPE_REPLACING)) { printf("ZFS: can only boot from disk, mirror, raidz1, raidz2 and raidz3 vdevs\n"); From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 21:32:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 88E421065680; Sun, 4 Dec 2011 21:32:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 790568FC1B; Sun, 4 Dec 2011 21:32:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4LWI4p003932; Sun, 4 Dec 2011 21:32:18 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4LWITl003931; Sun, 4 Dec 2011 21:32:18 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201112042132.pB4LWITl003931@svn.freebsd.org> From: Andriy Gapon Date: Sun, 4 Dec 2011 21:32:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228267 - head/sys/boot/i386/zfsboot X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 21:32:18 -0000 Author: avg Date: Sun Dec 4 21:32:18 2011 New Revision: 228267 URL: http://svn.freebsd.org/changeset/base/228267 Log: zfsboot: print boot.config contents before parsing it as parsing can be a destructive operation MFC after: 2 weeks Modified: head/sys/boot/i386/zfsboot/zfsboot.c Modified: head/sys/boot/i386/zfsboot/zfsboot.c ============================================================================== --- head/sys/boot/i386/zfsboot/zfsboot.c Sun Dec 4 21:29:56 2011 (r228266) +++ head/sys/boot/i386/zfsboot/zfsboot.c Sun Dec 4 21:32:18 2011 (r228267) @@ -541,10 +541,10 @@ main(void) } if (*cmd) { - if (parse()) - autoboot = 0; if (!OPT_CHECK(RBX_QUIET)) printf("%s: %s", PATH_CONFIG, cmd); + if (parse()) + autoboot = 0; /* Do not process this command twice */ *cmd = 0; } From owner-svn-src-all@FreeBSD.ORG Sun Dec 4 21:43:13 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84F18106566B; Sun, 4 Dec 2011 21:43:13 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 748A18FC14; Sun, 4 Dec 2011 21:43:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB4LhDeJ004299; Sun, 4 Dec 2011 21:43:13 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB4LhDYF004297; Sun, 4 Dec 2011 21:43:13 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201112042143.pB4LhDYF004297@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 4 Dec 2011 21:43:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228268 - head/sys/compat/linprocfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2011 21:43:13 -0000 Author: trociny Date: Sun Dec 4 21:43:13 2011 New Revision: 228268 URL: http://svn.freebsd.org/changeset/base/228268 Log: Protect process environment variables with p_candebug(). Discussed with: jilles, kib, rwatson MFC after: 2 weeks Modified: head/sys/compat/linprocfs/linprocfs.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Sun Dec 4 21:32:18 2011 (r228267) +++ head/sys/compat/linprocfs/linprocfs.c Sun Dec 4 21:43:13 2011 (r228268) @@ -967,7 +967,7 @@ linprocfs_doprocenviron(PFS_FILL_ARGS) int ret; PROC_LOCK(p); - if ((ret = p_cansee(td, p)) != 0) { + if ((ret = p_candebug(td, p)) != 0) { PROC_UNLOCK(p); return (ret); } From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 00:00:48 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 665AE106566B; Mon, 5 Dec 2011 00:00:48 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3DA608FC0A; Mon, 5 Dec 2011 00:00:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB500mgk008550; Mon, 5 Dec 2011 00:00:48 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB500mrQ008548; Mon, 5 Dec 2011 00:00:48 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201112050000.pB500mrQ008548@svn.freebsd.org> From: Jilles Tjoelker Date: Mon, 5 Dec 2011 00:00:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228269 - head/lib/libc/locale X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 00:00:48 -0000 Author: jilles Date: Mon Dec 5 00:00:47 2011 New Revision: 228269 URL: http://svn.freebsd.org/changeset/base/228269 Log: libc: Eliminate 13 relative relocations in wctype(). Modified: head/lib/libc/locale/wctype.c Modified: head/lib/libc/locale/wctype.c ============================================================================== --- head/lib/libc/locale/wctype.c Sun Dec 4 21:43:13 2011 (r228268) +++ head/lib/libc/locale/wctype.c Mon Dec 5 00:00:47 2011 (r228269) @@ -57,35 +57,54 @@ iswctype_l(wint_t wc, wctype_t charclass wctype_t wctype_l(const char *property, locale_t locale) { - static const struct { - const char *name; - wctype_t mask; - } props[] = { - { "alnum", _CTYPE_A|_CTYPE_D }, - { "alpha", _CTYPE_A }, - { "blank", _CTYPE_B }, - { "cntrl", _CTYPE_C }, - { "digit", _CTYPE_D }, - { "graph", _CTYPE_G }, - { "lower", _CTYPE_L }, - { "print", _CTYPE_R }, - { "punct", _CTYPE_P }, - { "space", _CTYPE_S }, - { "upper", _CTYPE_U }, - { "xdigit", _CTYPE_X }, - { "ideogram", _CTYPE_I }, /* BSD extension */ - { "special", _CTYPE_T }, /* BSD extension */ - { "phonogram", _CTYPE_Q }, /* BSD extension */ - { "rune", 0xFFFFFF00L }, /* BSD extension */ - { NULL, 0UL }, /* Default */ + const char *propnames = + "alnum\0" + "alpha\0" + "blank\0" + "cntrl\0" + "digit\0" + "graph\0" + "lower\0" + "print\0" + "punct\0" + "space\0" + "upper\0" + "xdigit\0" + "ideogram\0" /* BSD extension */ + "special\0" /* BSD extension */ + "phonogram\0" /* BSD extension */ + "rune\0"; /* BSD extension */ + static const wctype_t propmasks[] = { + _CTYPE_A|_CTYPE_D, + _CTYPE_A, + _CTYPE_B, + _CTYPE_C, + _CTYPE_D, + _CTYPE_G, + _CTYPE_L, + _CTYPE_R, + _CTYPE_P, + _CTYPE_S, + _CTYPE_U, + _CTYPE_X, + _CTYPE_I, + _CTYPE_T, + _CTYPE_Q, + 0xFFFFFF00L }; - int i; + size_t len1, len2; + const char *p; + const wctype_t *q; - i = 0; - while (props[i].name != NULL && strcmp(props[i].name, property) != 0) - i++; + len1 = strlen(property); + q = propmasks; + for (p = propnames; (len2 = strlen(p)) != 0; p += len2 + 1) { + if (len1 == len2 && memcmp(property, p, len1) == 0) + return (*q); + q++; + } - return (props[i].mask); + return (0UL); } wctype_t wctype(const char *property) From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 00:12:10 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83D9E106564A; Mon, 5 Dec 2011 00:12:10 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 59C118FC13; Mon, 5 Dec 2011 00:12:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB50CA7I008921; Mon, 5 Dec 2011 00:12:10 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB50CATY008917; Mon, 5 Dec 2011 00:12:10 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201112050012.pB50CATY008917@svn.freebsd.org> From: Justin Hibbits Date: Mon, 5 Dec 2011 00:12:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228270 - in head: etc/devd sys/powerpc/powermac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 00:12:10 -0000 Author: jhibbits Date: Mon Dec 5 00:12:10 2011 New Revision: 228270 URL: http://svn.freebsd.org/changeset/base/228270 Log: Add a devd notification for closing/opening the lid on PowerBooks and iBooks. Approved by: nwhitehorn (mentor) Modified: head/etc/devd/apple.conf head/sys/powerpc/powermac/pmu.c head/sys/powerpc/powermac/pmuvar.h Modified: head/etc/devd/apple.conf ============================================================================== --- head/etc/devd/apple.conf Mon Dec 5 00:00:47 2011 (r228269) +++ head/etc/devd/apple.conf Mon Dec 5 00:12:10 2011 (r228270) @@ -11,6 +11,16 @@ notify 0 { }; +# Keyboard power key +notify 0 { + match "system" "PMU"; + match "subsystem" "lid"; + match "type" "close"; + match "notify" "0x0"; + action "shutdown -p now"; +}; + + # The next blocks enable volume hotkeys that can be found on Apple laptops notify 0 { match "system" "PMU"; Modified: head/sys/powerpc/powermac/pmu.c ============================================================================== --- head/sys/powerpc/powermac/pmu.c Mon Dec 5 00:00:47 2011 (r228269) +++ head/sys/powerpc/powermac/pmu.c Mon Dec 5 00:12:10 2011 (r228270) @@ -701,6 +701,20 @@ pmu_intr(void *arg) adb_receive_raw_packet(sc->adb_bus,resp[1],resp[2], len - 3,&resp[3]); } + if (resp[1] & PMU_INT_ENVIRONMENT) { + // if the lid was just closed, notify devd. + if ((resp[2] & PMU_ENV_LID_CLOSED) && (!sc->lid_closed)) { + sc->lid_closed = 1; + if (devctl_process_running()) + devctl_notify("PMU", "lid", "close", NULL); + } + else if (!(resp[2] & PMU_ENV_LID_CLOSED) && (sc->lid_closed)) { + // if the lid was just opened, notify devd. + if (devctl_process_running()) + devctl_notify("PMU", "lid", "open", NULL); + sc->lid_closed = 0; + } + } } static u_int Modified: head/sys/powerpc/powermac/pmuvar.h ============================================================================== --- head/sys/powerpc/powermac/pmuvar.h Mon Dec 5 00:00:47 2011 (r228269) +++ head/sys/powerpc/powermac/pmuvar.h Mon Dec 5 00:12:10 2011 (r228270) @@ -160,6 +160,7 @@ struct pmu_softc { volatile int sc_autopoll; int sc_batteries; struct cdev *sc_leddev; + int lid_closed; }; struct pmu_battstate { From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 02:56:09 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F48D106566B; Mon, 5 Dec 2011 02:56:09 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E9758FC15; Mon, 5 Dec 2011 02:56:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB52u8ni013957; Mon, 5 Dec 2011 02:56:08 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB52u8H6013955; Mon, 5 Dec 2011 02:56:08 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201112050256.pB52u8H6013955@svn.freebsd.org> From: "Jayachandran C." Date: Mon, 5 Dec 2011 02:56:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228271 - head/sys/mips/nlm/hal X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 02:56:09 -0000 Author: jchandra Date: Mon Dec 5 02:56:08 2011 New Revision: 228271 URL: http://svn.freebsd.org/changeset/base/228271 Log: Fix XLP compilation. Add definitions of LSU_DEBUG_ADDR and LSU_DEBUG_DATA0, the code that uses it was added in r227799 Reported by: gonzo Modified: head/sys/mips/nlm/hal/cpucontrol.h Modified: head/sys/mips/nlm/hal/cpucontrol.h ============================================================================== --- head/sys/mips/nlm/hal/cpucontrol.h Mon Dec 5 00:12:10 2011 (r228270) +++ head/sys/mips/nlm/hal/cpucontrol.h Mon Dec 5 02:56:08 2011 (r228271) @@ -44,6 +44,8 @@ #define CPU_BLOCKID_MAP 10 #define LSU_DEFEATURE 0x304 +#define LSU_DEBUG_ADDR 0x305 +#define LSU_DEBUG_DATA0 0x306 #define LSU_CERRLOG_REGID 0x09 #define SCHED_DEFEATURE 0x700 From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 03:10:02 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 477C41065676; Mon, 5 Dec 2011 03:10:02 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3199A8FC13; Mon, 5 Dec 2011 03:10:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB53A2aM014544; Mon, 5 Dec 2011 03:10:02 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB53A2bt014543; Mon, 5 Dec 2011 03:10:02 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201112050310.pB53A2bt014543@svn.freebsd.org> From: "Jayachandran C." Date: Mon, 5 Dec 2011 03:10:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228272 - head/sys/mips/nlm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 03:10:02 -0000 Author: jchandra Date: Mon Dec 5 03:10:01 2011 New Revision: 228272 URL: http://svn.freebsd.org/changeset/base/228272 Log: Fix N32 compilation again for XLP. Disable DDB/KDB related options for N32, and add back a cast that was lost during the last set of updates. Reported by: gonzo, bz Modified: head/sys/mips/nlm/xlp_machdep.c Modified: head/sys/mips/nlm/xlp_machdep.c ============================================================================== --- head/sys/mips/nlm/xlp_machdep.c Mon Dec 5 02:56:08 2011 (r228271) +++ head/sys/mips/nlm/xlp_machdep.c Mon Dec 5 03:10:01 2011 (r228272) @@ -278,7 +278,7 @@ xlp_bootargs_init(__register_t arg) phandle_t chosen; ihandle_t mask; - dtbp = (void *)arg; + dtbp = (void *)(intptr_t)arg; #if defined(FDT_DTB_STATIC) /* * In case the device tree blob was not passed as argument try From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 03:18:41 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 225001065670; Mon, 5 Dec 2011 03:18:41 +0000 (UTC) (envelope-from jchandra@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 119D28FC08; Mon, 5 Dec 2011 03:18:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB53IeRH015015; Mon, 5 Dec 2011 03:18:40 GMT (envelope-from jchandra@svn.freebsd.org) Received: (from jchandra@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB53IeOo015013; Mon, 5 Dec 2011 03:18:40 GMT (envelope-from jchandra@svn.freebsd.org) Message-Id: <201112050318.pB53IeOo015013@svn.freebsd.org> From: "Jayachandran C." Date: Mon, 5 Dec 2011 03:18:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228273 - head/sys/mips/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 03:18:41 -0000 Author: jchandra Date: Mon Dec 5 03:18:40 2011 New Revision: 228273 URL: http://svn.freebsd.org/changeset/base/228273 Log: Disable KDB/DDB options for XLP N32 compile. n32 abi is not supported in KDB/DDB yet, disable the option in XLPN32 conf. Reported by: gonzo, bz Modified: head/sys/mips/conf/XLPN32 Modified: head/sys/mips/conf/XLPN32 ============================================================================== --- head/sys/mips/conf/XLPN32 Mon Dec 5 03:10:01 2011 (r228272) +++ head/sys/mips/conf/XLPN32 Mon Dec 5 03:18:40 2011 (r228273) @@ -26,5 +26,11 @@ makeoptions KERNLOADADDR=0x80100000 include "std.XLP" +nooption DDB +nooption KDB +nooption GDB +nooption BREAK_TO_DEBUGGER +nooption ALT_BREAK_TO_DEBUGGER + makeoptions TRAMPLOADADDR=0xffffffff85000000 makeoptions TRAMP_ARCH_FLAGS="-mabi=64 -march=mips64" From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 04:20:14 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27BB81065670; Mon, 5 Dec 2011 04:20:14 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F1E068FC16; Mon, 5 Dec 2011 04:20:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB54KDF2016882; Mon, 5 Dec 2011 04:20:13 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB54KDNg016878; Mon, 5 Dec 2011 04:20:13 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201112050420.pB54KDNg016878@svn.freebsd.org> From: Eitan Adler Date: Mon, 5 Dec 2011 04:20:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228274 - head/tools/regression/pipe X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 04:20:14 -0000 Author: eadler (ports committer) Date: Mon Dec 5 04:20:13 2011 New Revision: 228274 URL: http://svn.freebsd.org/changeset/base/228274 Log: Fix some uninitialized variables in pipe regression tests that result in failure. PR: misc/161175 Submitted by: gianni@ Approved by: nwhitehorn@ MFC after: 1 week Modified: head/tools/regression/pipe/pipe-fstatbug.c head/tools/regression/pipe/pipe-reverse.c head/tools/regression/pipe/pipe-wraparound.c Modified: head/tools/regression/pipe/pipe-fstatbug.c ============================================================================== --- head/tools/regression/pipe/pipe-fstatbug.c Mon Dec 5 03:18:40 2011 (r228273) +++ head/tools/regression/pipe/pipe-fstatbug.c Mon Dec 5 04:20:13 2011 (r228274) @@ -41,7 +41,7 @@ int main (void) { char buffer[32768], buffer2[32768]; int desc[2]; -int error, successes; +int error, successes = 0; struct stat status; pid_t new_pid; Modified: head/tools/regression/pipe/pipe-reverse.c ============================================================================== --- head/tools/regression/pipe/pipe-reverse.c Mon Dec 5 03:18:40 2011 (r228273) +++ head/tools/regression/pipe/pipe-reverse.c Mon Dec 5 04:20:13 2011 (r228274) @@ -44,6 +44,7 @@ struct stat status; pid_t new_pid; buggy = 0; +total = 0; error = pipe(desc); @@ -52,7 +53,7 @@ if (error) buffer[0] = 'A'; -for (i = 0; i < 65535; i++) { +for (i = 1; i < 65535; i++) { buffer[i] = buffer[i - 1] + 1; if (buffer[i] > 'Z') buffer[i] = 'A'; Modified: head/tools/regression/pipe/pipe-wraparound.c ============================================================================== --- head/tools/regression/pipe/pipe-wraparound.c Mon Dec 5 03:18:40 2011 (r228273) +++ head/tools/regression/pipe/pipe-wraparound.c Mon Dec 5 04:20:13 2011 (r228274) @@ -44,6 +44,7 @@ struct stat status; pid_t new_pid; buggy = 0; +total = 0; error = pipe(desc); @@ -52,7 +53,7 @@ if (error) buffer[0] = 'A'; -for (i = 0; i < 32768; i++) { +for (i = 1; i < 32768; i++) { buffer[i] = buffer[i - 1] + 1; if (buffer[i] > 'Z') buffer[i] = 'A'; From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 10:34:53 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33EE01065743; Mon, 5 Dec 2011 10:34:53 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A2CA8FC1D; Mon, 5 Dec 2011 10:34:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5AYqX2031129; Mon, 5 Dec 2011 10:34:52 GMT (envelope-from kevlo@svn.freebsd.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5AYqfq031127; Mon, 5 Dec 2011 10:34:52 GMT (envelope-from kevlo@svn.freebsd.org) Message-Id: <201112051034.pB5AYqfq031127@svn.freebsd.org> From: Kevin Lo Date: Mon, 5 Dec 2011 10:34:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228275 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 10:34:53 -0000 Author: kevlo Date: Mon Dec 5 10:34:52 2011 New Revision: 228275 URL: http://svn.freebsd.org/changeset/base/228275 Log: Add a missing curly bracket Modified: head/sys/kern/kern_cpuset.c Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Mon Dec 5 04:20:13 2011 (r228274) +++ head/sys/kern/kern_cpuset.c Mon Dec 5 10:34:52 2011 (r228275) @@ -900,6 +900,7 @@ struct cpuset_getid_args { cpuwhich_t which; id_t id; cpusetid_t *setid; +}; #endif int sys_cpuset_getid(struct thread *td, struct cpuset_getid_args *uap) From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 11:04:39 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A08011065673; Mon, 5 Dec 2011 11:04:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 3ADF08FC0A; Mon, 5 Dec 2011 11:04:38 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pB5B4ZBE006113 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 5 Dec 2011 13:04:35 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id pB5B4ZAk002152; Mon, 5 Dec 2011 13:04:35 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id pB5B4Zr8002151; Mon, 5 Dec 2011 13:04:35 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 5 Dec 2011 13:04:35 +0200 From: Kostik Belousov To: Jilles Tjoelker Message-ID: <20111205110435.GP50300@deviant.kiev.zoral.com.ua> References: <201112050000.pB500mrQ008548@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jCr45KaQ2ES41j5N" Content-Disposition: inline In-Reply-To: <201112050000.pB500mrQ008548@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228269 - head/lib/libc/locale X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 11:04:39 -0000 --jCr45KaQ2ES41j5N Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 05, 2011 at 12:00:48AM +0000, Jilles Tjoelker wrote: > Author: jilles > Date: Mon Dec 5 00:00:47 2011 > New Revision: 228269 > URL: http://svn.freebsd.org/changeset/base/228269 >=20 > Log: > libc: Eliminate 13 relative relocations in wctype(). >=20 This reminds me the following change I had intended to do for quite some time. The hack for openssl is due to buggy assembler, which exactly the case I want to avoid for the base code. commit 3fdba61936a011b768845a8336ad2529e77e8ddb Author: Kostik Belousov Date: Mon Dec 5 13:01:48 2011 +0200 Fail the build when text relocations are generated for dso. diff --git a/secure/lib/libcrypto/Makefile b/secure/lib/libcrypto/Makefile index 0a1704c..73f5cb7 100644 --- a/secure/lib/libcrypto/Makefile +++ b/secure/lib/libcrypto/Makefile @@ -7,6 +7,7 @@ SUBDIR=3D engines =20 LIB=3D crypto SHLIB_MAJOR=3D 6 +ALLOW_SHARED_TEXTREL=3D =20 NO_LINT=3D =20 diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 1e43921..40632de 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -167,6 +167,11 @@ SOBJS+=3D ${OBJS:.o=3D.So} .if defined(SHLIB_NAME) _LIBS+=3D ${SHLIB_NAME} =20 +SOLINKOPTS=3D -shared -Wl,-x -Wl,--fatal-warnings +.if !defined(ALLOW_SHARED_TEXTREL) +SOLINKOPTS+=3D -Wl,--warn-shared-textrel +.endif + .if target(beforelinking) ${SHLIB_NAME}: ${SOBJS} beforelinking .else @@ -178,11 +183,11 @@ ${SHLIB_NAME}: ${SOBJS} @ln -fs ${.TARGET} ${SHLIB_LINK} .endif .if !defined(NM) - @${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \ + @${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ -o ${.TARGET} -Wl,-soname,${SONAME} \ `lorder ${SOBJS} | tsort -q` ${LDADD} .else - @${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \ + @${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ -o ${.TARGET} -Wl,-soname,${SONAME} \ `NM=3D'${NM}' lorder ${SOBJS} | tsort -q` ${LDADD} .endif --jCr45KaQ2ES41j5N Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7cpUIACgkQC3+MBN1Mb4jvuQCgrtwpBdGs62gNlrbc//IbwAck FpwAn1viuk26sLf0u/u0E7g4Ncz3ti3k =x5Y3 -----END PGP SIGNATURE----- --jCr45KaQ2ES41j5N-- From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 12:06:53 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75662106564A; Mon, 5 Dec 2011 12:06:53 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 626A58FC0C; Mon, 5 Dec 2011 12:06:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5C6rWr036349; Mon, 5 Dec 2011 12:06:53 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5C6rxH036343; Mon, 5 Dec 2011 12:06:53 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201112051206.pB5C6rxH036343@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 5 Dec 2011 12:06:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228276 - in head: sys/dev/ixgbe sys/dev/netmap sys/net tools/tools/netmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 12:06:53 -0000 Author: luigi Date: Mon Dec 5 12:06:53 2011 New Revision: 228276 URL: http://svn.freebsd.org/changeset/base/228276 Log: 1. Fix the handling of link reset while in netmap more. A link reset now is completely transparent for the netmap client: even if the NIC resets its own ring (e.g. restarting from 0), the client will not see any change in the current rx/tx positions, because the driver will keep track of the offset between the two. 2. make the device-specific code more uniform across different drivers There were some inconsistencies in the implementation of the netmap support routines, now drivers have been aligned to a common code structure. 3. import netmap support for ixgbe . This is implemented as a very small patch for ixgbe.c (233 lines, 11 chunks, mostly comments: in total the patch has only 54 lines of new code) , as most of the code is in an external file sys/dev/netmap/ixgbe_netmap.h , following some initial comments from Jack Vogel about making changes less intrusive. (Note, i have emailed Jack multiple times asking if he had comments on this structure of the code; i got no reply so i assume he is fine with it). Support for other drivers (em, lem, re, igb) will come later. "ixgbe" is now the reference driver for netmap support. Both the external file (sys/dev/netmap/ixgbe_netmap.h) and the device-specific patches (in sys/dev/ixgbe/ixgbe.c) are heavily commented and should serve as a reference for other device drivers. Tested on i386 and amd64 with the pkt-gen program in tools/tools/netmap, the sender does 14.88 Mpps at 1050 Mhz and 14.2 Mpps at 900 MHz on an i7-860 with 4 cores and 82599 card. Haven't tried yet more aggressive optimizations such as adding 'prefetch' instructions in the time-critical parts of the code. Modified: head/sys/dev/ixgbe/ixgbe.c head/sys/dev/netmap/if_em_netmap.h head/sys/dev/netmap/if_igb_netmap.h head/sys/dev/netmap/if_lem_netmap.h head/sys/dev/netmap/if_re_netmap.h head/sys/dev/netmap/ixgbe_netmap.h head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_kern.h head/sys/net/netmap.h head/tools/tools/netmap/pkt-gen.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Mon Dec 5 10:34:52 2011 (r228275) +++ head/sys/dev/ixgbe/ixgbe.c Mon Dec 5 12:06:53 2011 (r228276) @@ -313,6 +313,18 @@ static int atr_sample_rate = 20; static int fdir_pballoc = 1; #endif +#ifdef DEV_NETMAP +/* + * The #ifdef DEV_NETMAP / #endif blocks in this file are meant to + * be a reference on how to implement netmap support in a driver. + * Additional comments are in ixgbe_netmap.h . + * + * contains functions for netmap support + * that extend the standard driver. + */ +#include +#endif /* DEV_NETMAP */ + /********************************************************************* * Device identification routine * @@ -578,6 +590,9 @@ ixgbe_attach(device_t dev) ixgbe_add_hw_stats(adapter); +#ifdef DEV_NETMAP + ixgbe_netmap_attach(adapter); +#endif /* DEV_NETMAP */ INIT_DEBUGOUT("ixgbe_attach: end"); return (0); err_late: @@ -652,6 +667,9 @@ ixgbe_detach(device_t dev) ether_ifdetach(adapter->ifp); callout_drain(&adapter->timer); +#ifdef DEV_NETMAP + netmap_detach(adapter->ifp); +#endif /* DEV_NETMAP */ ixgbe_free_pci_resources(adapter); bus_generic_detach(dev); if_free(adapter->ifp); @@ -2813,9 +2831,20 @@ ixgbe_setup_transmit_ring(struct tx_ring struct adapter *adapter = txr->adapter; struct ixgbe_tx_buf *txbuf; int i; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot; +#endif /* DEV_NETMAP */ /* Clear the old ring contents */ IXGBE_TX_LOCK(txr); +#ifdef DEV_NETMAP + /* + * (under lock): if in netmap mode, do some consistency + * checks and set slot to entry 0 of the netmap ring. + */ + slot = netmap_reset(na, NR_TX, txr->me, 0); +#endif /* DEV_NETMAP */ bzero((void *)txr->tx_base, (sizeof(union ixgbe_adv_tx_desc)) * adapter->num_tx_desc); /* Reset indices */ @@ -2832,6 +2861,26 @@ ixgbe_setup_transmit_ring(struct tx_ring m_freem(txbuf->m_head); txbuf->m_head = NULL; } +#ifdef DEV_NETMAP + /* + * In netmap mode, set the map for the packet buffer. + * NOTE: Some drivers (not this one) also need to set + * the physical buffer address in the NIC ring. + * Slots in the netmap ring (indexed by "si") are + * kring->nkr_hwofs positions "ahead" wrt the + * corresponding slot in the NIC ring. In some drivers + * (not here) nkr_hwofs can be negative. When computing + * si = i + kring->nkr_hwofs make sure to handle wraparounds. + */ + if (slot) { + int si = i + na->tx_rings[txr->me].nkr_hwofs; + + if (si >= na->num_tx_desc) + si -= na->num_tx_desc; + netmap_load_map(txr->txtag, txbuf->map, + NMB(slot + si), na->buff_size); + } +#endif /* DEV_NETMAP */ /* Clear the EOP index */ txbuf->eop_index = -1; } @@ -3310,6 +3359,29 @@ ixgbe_txeof(struct tx_ring *txr) mtx_assert(&txr->tx_mtx, MA_OWNED); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(ifp); + + /* + * In netmap mode, all the work is done in the context + * of the client thread. Interrupt handlers only wake up + * clients, which may be sleeping on individual rings + * or on a global resource for all rings. + * When the driver has separate locks, we need to + * release and re-acquire txlock to avoid deadlocks. + * XXX see if we can find a better way. + */ + selwakeuppri(&na->tx_rings[txr->me].si, PI_NET); + IXGBE_TX_UNLOCK(txr); + IXGBE_CORE_LOCK(adapter); + selwakeuppri(&na->tx_rings[na->num_queues + 1].si, PI_NET); + IXGBE_CORE_UNLOCK(adapter); + IXGBE_TX_LOCK(txr); + return FALSE; + } +#endif /* DEV_NETMAP */ + if (txr->tx_avail == adapter->num_tx_desc) { txr->queue_status = IXGBE_QUEUE_IDLE; return FALSE; @@ -3698,6 +3770,10 @@ ixgbe_setup_receive_ring(struct rx_ring bus_dma_segment_t pseg[1], hseg[1]; struct lro_ctrl *lro = &rxr->lro; int rsize, nsegs, error = 0; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(rxr->adapter->ifp); + struct netmap_slot *slot; +#endif /* DEV_NETMAP */ adapter = rxr->adapter; ifp = adapter->ifp; @@ -3705,6 +3781,10 @@ ixgbe_setup_receive_ring(struct rx_ring /* Clear the ring contents */ IXGBE_RX_LOCK(rxr); +#ifdef DEV_NETMAP + /* same as in ixgbe_setup_transmit_ring() */ + slot = netmap_reset(na, NR_RX, rxr->me, 0); +#endif /* DEV_NETMAP */ rsize = roundup2(adapter->num_rx_desc * sizeof(union ixgbe_adv_rx_desc), DBA_ALIGN); bzero((void *)rxr->rx_base, rsize); @@ -3721,6 +3801,29 @@ ixgbe_setup_receive_ring(struct rx_ring struct mbuf *mh, *mp; rxbuf = &rxr->rx_buffers[j]; +#ifdef DEV_NETMAP + /* + * In netmap mode, fill the map and set the buffer + * address in the NIC ring, considering the offset + * between the netmap and NIC rings (see comment in + * ixgbe_setup_transmit_ring() ). No need to allocate + * an mbuf, so end the block with a continue; + */ + if (slot) { + int sj = j + na->rx_rings[rxr->me].nkr_hwofs; + void *addr; + + if (sj >= na->num_rx_desc) + sj -= na->num_rx_desc; + addr = NMB(slot + sj); + netmap_load_map(rxr->ptag, + rxbuf->pmap, addr, na->buff_size); + /* Update descriptor */ + rxr->rx_base[j].read.pkt_addr = + htole64(vtophys(addr)); + continue; + } +#endif /* DEV_NETMAP */ /* ** Don't allocate mbufs if not ** doing header split, its wasteful @@ -3913,6 +4016,35 @@ ixgbe_initialize_receive_units(struct ad /* Setup the HW Rx Head and Tail Descriptor Pointers */ IXGBE_WRITE_REG(hw, IXGBE_RDH(i), 0); +#ifdef DEV_NETMAP + /* + * In netmap mode, we must preserve the buffers made + * available to userspace before the if_init() + * (this is true by default on the TX side, because + * init makes all buffers available to userspace). + * + * netmap_reset() and the device specific routines + * (e.g. ixgbe_setup_receive_rings()) map these + * buffers at the end of the NIC ring, so here we + * must set the RDT (tail) register to make sure + * they are not overwritten. + * + * In this driver the NIC ring starts at RDH = 0, + * RDT points to the first 'busy' slot, so RDT = 0 + * means the whole ring is available, and + * RDT = (num_rx_desc - X) means X slots are available. + * Computations are done modulo the ring size. + */ + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_kring *kring = &na->rx_rings[i]; + int t = na->num_rx_desc - kring->nr_hwavail; + + if (t >= na->num_rx_desc) + t -= adapter->num_rx_desc; + IXGBE_WRITE_REG(hw, IXGBE_RDT(i), t); + } else +#endif /* DEV_NETMAP */ IXGBE_WRITE_REG(hw, IXGBE_RDT(i), 0); } @@ -4148,6 +4280,22 @@ ixgbe_rxeof(struct ix_queue *que, int co IXGBE_RX_LOCK(rxr); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + /* + * Same as the txeof routine, only wakeup clients + * and make sure there are no deadlocks. + */ + struct netmap_adapter *na = NA(ifp); + + selwakeuppri(&na->rx_rings[rxr->me].si, PI_NET); + IXGBE_RX_UNLOCK(rxr); + IXGBE_CORE_LOCK(adapter); + selwakeuppri(&na->rx_rings[na->num_queues + 1].si, PI_NET); + IXGBE_CORE_UNLOCK(adapter); + return (FALSE); + } +#endif /* DEV_NETMAP */ for (i = rxr->next_to_check; count != 0;) { struct mbuf *sendmp, *mh, *mp; u32 rsc, ptype; Modified: head/sys/dev/netmap/if_em_netmap.h ============================================================================== --- head/sys/dev/netmap/if_em_netmap.h Mon Dec 5 10:34:52 2011 (r228275) +++ head/sys/dev/netmap/if_em_netmap.h Mon Dec 5 12:06:53 2011 (r228276) @@ -9,7 +9,7 @@ * 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 @@ -25,9 +25,12 @@ /* * $FreeBSD$ - * $Id: if_em_netmap.h 9662 2011-11-16 13:18:06Z luigi $ + * $Id: if_em_netmap.h 9802 2011-12-02 18:42:37Z luigi $ * * netmap changes for if_em. + * + * For structure and details on the individual functions please see + * ixgbe_netmap.h */ #include @@ -58,12 +61,7 @@ em_netmap_attach(struct adapter *adapter na.nm_rxsync = em_netmap_rxsync; na.nm_lock = em_netmap_lock_wrapper; na.nm_register = em_netmap_reg; - /* - * adapter->rx_mbuf_sz is set by SIOCSETMTU, but in netmap mode - * we allocate the buffers on the first register. So we must - * disallow a SIOCSETMTU when if_capenable & IFCAP_NETMAP is set. - */ - na.buff_size = MCLBYTES; + na.buff_size = NETMAP_BUF_SIZE; netmap_attach(&na, adapter->num_queues); } @@ -100,6 +98,7 @@ em_netmap_lock_wrapper(void *_a, int wha } +// XXX do we need to block/unblock the tasks ? static void em_netmap_block_tasks(struct adapter *adapter) { @@ -162,9 +161,6 @@ em_netmap_reg(struct ifnet *ifp, int ono if (onoff) { ifp->if_capenable |= IFCAP_NETMAP; - /* save if_transmit for later restore. - * XXX also if_start and if_qflush ? - */ na->if_transmit = ifp->if_transmit; ifp->if_transmit = netmap_start; @@ -179,15 +175,13 @@ fail: ifp->if_transmit = na->if_transmit; ifp->if_capenable &= ~IFCAP_NETMAP; em_init_locked(adapter); /* also enable intr */ - } em_netmap_unblock_tasks(adapter); return (error); } /* - * Reconcile hardware and user view of the transmit ring, see - * ixgbe.c for details. + * Reconcile hardware and user view of the transmit ring. */ static int em_netmap_txsync(void *a, u_int ring_nr, int do_lock) @@ -197,13 +191,13 @@ em_netmap_txsync(void *a, u_int ring_nr, struct netmap_adapter *na = NA(adapter->ifp); struct netmap_kring *kring = &na->tx_rings[ring_nr]; struct netmap_ring *ring = kring->ring; - int j, k, n, lim = kring->nkr_num_slots - 1; + int j, k, l, n = 0, lim = kring->nkr_num_slots - 1; /* generate an interrupt approximately every half ring */ int report_frequency = kring->nkr_num_slots >> 1; k = ring->cur; - if ( (kring->nr_kflags & NR_REINIT) || k > lim) + if (k > lim) return netmap_ring_reinit(kring); if (do_lock) @@ -211,35 +205,20 @@ em_netmap_txsync(void *a, u_int ring_nr, bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, BUS_DMASYNC_POSTREAD); - /* record completed transmissions TODO - * - * instead of using TDH, we could read the transmitted status bit. + /* check for new packets to send. + * j indexes the netmap ring, l indexes the nic ring, and + * j = kring->nr_hwcur, l = E1000_TDT (not tracked), + * j == (l + kring->nkr_hwofs) % ring_size */ - j = E1000_READ_REG(&adapter->hw, E1000_TDH(ring_nr)); - if (j >= kring->nkr_num_slots) { /* XXX can happen */ - D("TDH wrap %d", j); - j -= kring->nkr_num_slots; - } - int delta = j - txr->next_to_clean; - if (delta) { - /* new transmissions were completed, increment - ring->nr_hwavail. */ - if (delta < 0) - delta += kring->nkr_num_slots; - txr->next_to_clean = j; - kring->nr_hwavail += delta; - } - - /* update avail to what the hardware knows */ - ring->avail = kring->nr_hwavail; - j = kring->nr_hwcur; if (j != k) { /* we have packets to send */ - n = 0; + l = j - kring->nkr_hwofs; + if (l < 0) + l += lim + 1; while (j != k) { struct netmap_slot *slot = &ring->slot[j]; - struct e1000_tx_desc *curr = &txr->tx_base[j]; - struct em_buffer *txbuf = &txr->tx_buffers[j]; + struct e1000_tx_desc *curr = &txr->tx_base[l]; + struct em_buffer *txbuf = &txr->tx_buffers[l]; int flags = ((slot->flags & NS_REPORT) || j == 0 || j == report_frequency) ? E1000_TXD_CMD_RS : 0; @@ -254,42 +233,61 @@ em_netmap_txsync(void *a, u_int ring_nr, slot->flags &= ~NS_REPORT; curr->upper.data = 0; curr->lower.data = - htole32( - adapter->txd_cmd | - (E1000_TXD_CMD_EOP | flags) | - slot->len); + htole32(adapter->txd_cmd | len | + (E1000_TXD_CMD_EOP | flags) ); if (slot->flags & NS_BUF_CHANGED) { curr->buffer_addr = htole64(vtophys(addr)); - /* buffer has changed, unload and reload map */ + /* buffer has changed, reload map */ netmap_reload_map(txr->txtag, txbuf->map, - addr, na->buff_size); + addr, na->buff_size); slot->flags &= ~NS_BUF_CHANGED; } bus_dmamap_sync(txr->txtag, txbuf->map, BUS_DMASYNC_PREWRITE); j = (j == lim) ? 0 : j + 1; + l = (l == lim) ? 0 : l + 1; n++; } - kring->nr_hwcur = ring->cur; + kring->nr_hwcur = k; /* decrease avail by number of sent packets */ - ring->avail -= n; - kring->nr_hwavail = ring->avail; + kring->nr_hwavail -= n; bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - E1000_WRITE_REG(&adapter->hw, E1000_TDT(txr->me), - ring->cur); + E1000_WRITE_REG(&adapter->hw, E1000_TDT(txr->me), l); } + + if (n == 0 || kring->nr_hwavail < 1) { + int delta; + + /* record completed transmissions using THD. */ + l = E1000_READ_REG(&adapter->hw, E1000_TDH(ring_nr)); + if (l >= kring->nkr_num_slots) { /* XXX can happen */ + D("TDH wrap %d", l); + l -= kring->nkr_num_slots; + } + delta = l - txr->next_to_clean; + if (delta) { + /* some completed, increment hwavail. */ + if (delta < 0) + delta += kring->nkr_num_slots; + txr->next_to_clean = l; + kring->nr_hwavail += delta; + } + } + /* update avail to what the hardware knows */ + ring->avail = kring->nr_hwavail; + if (do_lock) EM_TX_UNLOCK(txr); return 0; } /* - * Reconcile kernel and user view of the receive ring, see ixgbe.c + * Reconcile kernel and user view of the receive ring. */ static int em_netmap_rxsync(void *a, u_int ring_nr, int do_lock) @@ -299,10 +297,10 @@ em_netmap_rxsync(void *a, u_int ring_nr, struct netmap_adapter *na = NA(adapter->ifp); struct netmap_kring *kring = &na->rx_rings[ring_nr]; struct netmap_ring *ring = kring->ring; - int j, k, n, lim = kring->nkr_num_slots - 1; + int j, k, l, n, lim = kring->nkr_num_slots - 1; k = ring->cur; - if ( (kring->nr_kflags & NR_REINIT) || k > lim) + if (k > lim) return netmap_ring_reinit(kring); if (do_lock) @@ -311,36 +309,52 @@ em_netmap_rxsync(void *a, u_int ring_nr, bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - /* acknowledge all the received packets. */ - j = rxr->next_to_check; + /* import newly received packets into the netmap ring. + * j is an index in the netmap ring, l in the NIC ring, and + * j = (kring->nr_hwcur + kring->nr_hwavail) % ring_size + * l = rxr->next_to_check; + * and + * j == (l + kring->nkr_hwofs) % ring_size + */ + l = rxr->next_to_check; + j = l + kring->nkr_hwofs; + /* here nkr_hwofs can be negative so must check for j < 0 */ + if (j < 0) + j += lim + 1; + else if (j > lim) + j -= lim + 1; for (n = 0; ; n++) { - struct e1000_rx_desc *curr = &rxr->rx_base[j]; + struct e1000_rx_desc *curr = &rxr->rx_base[l]; if ((curr->status & E1000_RXD_STAT_DD) == 0) break; ring->slot[j].len = le16toh(curr->length); - bus_dmamap_sync(rxr->tag, rxr->rx_buffers[j].map, + bus_dmamap_sync(rxr->tag, rxr->rx_buffers[l].map, BUS_DMASYNC_POSTREAD); j = (j == lim) ? 0 : j + 1; + /* make sure next_to_refresh follows next_to_check */ + rxr->next_to_refresh = l; // XXX + l = (l == lim) ? 0 : l + 1; } if (n) { - rxr->next_to_check = j; + rxr->next_to_check = l; kring->nr_hwavail += n; } - /* skip past packets that userspace has already processed: - * making them available for reception. - * advance nr_hwcur and issue a bus_dmamap_sync on the - * buffers so it is safe to write to them. - * Also increase nr_hwavail - */ + /* skip past packets that userspace has already processed */ j = kring->nr_hwcur; if (j != k) { /* userspace has read some packets. */ n = 0; + l = j - kring->nkr_hwofs; /* NIC ring index */ + /* here nkr_hwofs can be negative so check for l > lim */ + if (l < 0) + l += lim + 1; + else if (l > lim) + l -= lim + 1; while (j != k) { struct netmap_slot *slot = &ring->slot[j]; - struct e1000_rx_desc *curr = &rxr->rx_base[j]; - struct em_buffer *rxbuf = &rxr->rx_buffers[j]; + struct e1000_rx_desc *curr = &rxr->rx_base[l]; + struct em_buffer *rxbuf = &rxr->rx_buffers[l]; void *addr = NMB(slot); if (addr == netmap_buffer_base) { /* bad buf */ @@ -352,28 +366,29 @@ em_netmap_rxsync(void *a, u_int ring_nr, curr->status = 0; if (slot->flags & NS_BUF_CHANGED) { curr->buffer_addr = htole64(vtophys(addr)); - /* buffer has changed, unload and reload map */ + /* buffer has changed, reload map */ netmap_reload_map(rxr->rxtag, rxbuf->map, - addr, na->buff_size); + addr, na->buff_size); slot->flags &= ~NS_BUF_CHANGED; } bus_dmamap_sync(rxr->rxtag, rxbuf->map, - BUS_DMASYNC_PREREAD); + BUS_DMASYNC_PREREAD); j = (j == lim) ? 0 : j + 1; + l = (l == lim) ? 0 : l + 1; n++; } kring->nr_hwavail -= n; - kring->nr_hwcur = ring->cur; + kring->nr_hwcur = k; bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); /* * IMPORTANT: we must leave one free slot in the ring, - * so move j back by one unit + * so move l back by one unit */ - j = (j == 0) ? lim : j - 1; - E1000_WRITE_REG(&adapter->hw, E1000_RDT(rxr->me), j); + l = (l == 0) ? lim : l - 1; + E1000_WRITE_REG(&adapter->hw, E1000_RDT(rxr->me), l); } /* tell userspace that there are new packets */ ring->avail = kring->nr_hwavail ; Modified: head/sys/dev/netmap/if_igb_netmap.h ============================================================================== --- head/sys/dev/netmap/if_igb_netmap.h Mon Dec 5 10:34:52 2011 (r228275) +++ head/sys/dev/netmap/if_igb_netmap.h Mon Dec 5 12:06:53 2011 (r228276) @@ -25,7 +25,7 @@ /* * $FreeBSD$ - * $Id: if_igb_netmap.h 9662 2011-11-16 13:18:06Z luigi $ + * $Id: if_igb_netmap.h 9802 2011-12-02 18:42:37Z luigi $ * * netmap modifications for igb * contribured by Ahmed Kooli @@ -58,12 +58,7 @@ igb_netmap_attach(struct adapter *adapte na.nm_rxsync = igb_netmap_rxsync; na.nm_lock = igb_netmap_lock_wrapper; na.nm_register = igb_netmap_reg; - /* - * adapter->rx_mbuf_sz is set by SIOCSETMTU, but in netmap mode - * we allocate the buffers on the first register. So we must - * disallow a SIOCSETMTU when if_capenable & IFCAP_NETMAP is set. - */ - na.buff_size = MCLBYTES; + na.buff_size = NETMAP_BUF_SIZE; netmap_attach(&na, adapter->num_queues); } @@ -111,7 +106,7 @@ igb_netmap_reg(struct ifnet *ifp, int on struct netmap_adapter *na = NA(ifp); int error = 0; - if (!na) + if (na == NULL) return EINVAL; igb_disable_intr(adapter); @@ -144,21 +139,6 @@ fail: /* * Reconcile kernel and user view of the transmit ring. - * - * Userspace has filled tx slots up to cur (excluded). - * The last unused slot previously known to the kernel was nr_hwcur, - * and the last interrupt reported nr_hwavail slots available - * (using the special value -1 to indicate idle transmit ring). - * The function must first update avail to what the kernel - * knows, subtract the newly used slots (cur - nr_hwcur) - * from both avail and nr_hwavail, and set nr_hwcur = cur - * issuing a dmamap_sync on all slots. - * - * Check parameters in the struct netmap_ring. - * We don't use avail, only check for bogus values. - * Make sure cur is valid, and same goes for buffer indexes and lengths. - * To avoid races, read the values once, and never use those from - * the ring afterwards. */ static int igb_netmap_txsync(void *a, u_int ring_nr, int do_lock) @@ -168,54 +148,40 @@ igb_netmap_txsync(void *a, u_int ring_nr struct netmap_adapter *na = NA(adapter->ifp); struct netmap_kring *kring = &na->tx_rings[ring_nr]; struct netmap_ring *ring = kring->ring; - int j, k, n, lim = kring->nkr_num_slots - 1; + int j, k, l, n = 0, lim = kring->nkr_num_slots - 1; /* generate an interrupt approximately every half ring */ int report_frequency = kring->nkr_num_slots >> 1; - k = ring->cur; /* ring is not protected by any lock */ - if ( (kring->nr_kflags & NR_REINIT) || k > lim) + k = ring->cur; + if (k > lim) return netmap_ring_reinit(kring); if (do_lock) IGB_TX_LOCK(txr); bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, - BUS_DMASYNC_POSTREAD); - - /* record completed transmissions. TODO - * - * Instead of reading from the TDH register, we could and try to check - * the status bit of descriptor packets. - */ - j = E1000_READ_REG(&adapter->hw, E1000_TDH(ring_nr)); - if (j >= kring->nkr_num_slots) /* XXX can it happen ? */ - j -= kring->nkr_num_slots; - int delta = j - txr->next_to_clean; - if (delta) { - /* new tx were completed */ - if (delta < 0) - delta += kring->nkr_num_slots; - txr->next_to_clean = j; - kring->nr_hwavail += delta; - } + BUS_DMASYNC_POSTREAD); /* update avail to what the hardware knows */ ring->avail = kring->nr_hwavail; - j = kring->nr_hwcur; + j = kring->nr_hwcur; /* netmap ring index */ if (j != k) { /* we have new packets to send */ u32 olinfo_status = 0; - n = 0; + int n = 0; + l = j - kring->nkr_hwofs; /* NIC ring index */ + if (l < 0) + l += lim + 1; /* 82575 needs the queue index added */ if (adapter->hw.mac.type == e1000_82575) olinfo_status |= txr->me << 4; while (j != k) { struct netmap_slot *slot = &ring->slot[j]; - struct igb_tx_buffer *txbuf = &txr->tx_buffers[j]; + struct igb_tx_buffer *txbuf = &txr->tx_buffers[l]; union e1000_adv_tx_desc *curr = - (union e1000_adv_tx_desc *)&txr->tx_base[j]; + (union e1000_adv_tx_desc *)&txr->tx_base[l]; void *addr = NMB(slot); int flags = ((slot->flags & NS_REPORT) || j == 0 || j == report_frequency) ? @@ -229,6 +195,7 @@ igb_netmap_txsync(void *a, u_int ring_nr } slot->flags &= ~NS_REPORT; + // XXX do we need to set the address ? curr->read.buffer_addr = htole64(vtophys(addr)); curr->read.olinfo_status = htole32(olinfo_status | @@ -239,7 +206,7 @@ igb_netmap_txsync(void *a, u_int ring_nr E1000_ADVTXD_DCMD_DEXT | E1000_ADVTXD_DCMD_EOP | flags); if (slot->flags & NS_BUF_CHANGED) { - /* buffer has changed, unload and reload map */ + /* buffer has changed, reload map */ netmap_reload_map(txr->txtag, txbuf->map, addr, na->buff_size); slot->flags &= ~NS_BUF_CHANGED; @@ -248,22 +215,40 @@ igb_netmap_txsync(void *a, u_int ring_nr bus_dmamap_sync(txr->txtag, txbuf->map, BUS_DMASYNC_PREWRITE); j = (j == lim) ? 0 : j + 1; + l = (l == lim) ? 0 : l + 1; n++; } kring->nr_hwcur = k; /* decrease avail by number of sent packets */ - ring->avail -= n; - kring->nr_hwavail = ring->avail; + kring->nr_hwavail -= n; + ring->avail = kring->nr_hwavail; - /* Set the watchdog */ + /* Set the watchdog XXX ? */ txr->queue_status = IGB_QUEUE_WORKING; txr->watchdog_time = ticks; bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - E1000_WRITE_REG(&adapter->hw, E1000_TDT(txr->me), k); + E1000_WRITE_REG(&adapter->hw, E1000_TDT(txr->me), l); + } + if (n == 0 || kring->nr_hwavail < 1) { + int delta; + + /* record completed transmission using TDH */ + l = E1000_READ_REG(&adapter->hw, E1000_TDH(ring_nr)); + if (l >= kring->nkr_num_slots) /* XXX can it happen ? */ + l -= kring->nkr_num_slots; + delta = l - txr->next_to_clean; + if (delta) { + /* new tx were completed */ + if (delta < 0) + delta += kring->nkr_num_slots; + txr->next_to_clean = l; + kring->nr_hwavail += delta; + ring->avail = kring->nr_hwavail; + } } if (do_lock) IGB_TX_UNLOCK(txr); @@ -273,15 +258,6 @@ igb_netmap_txsync(void *a, u_int ring_nr /* * Reconcile kernel and user view of the receive ring. - * - * Userspace has read rx slots up to cur (excluded). - * The last unread slot previously known to the kernel was nr_hwcur, - * and the last interrupt reported nr_hwavail slots available. - * We must subtract the newly consumed slots (cur - nr_hwcur) - * from nr_hwavail, clearing the descriptors for the next - * read, tell the hardware that they are available, - * and set nr_hwcur = cur and avail = nr_hwavail. - * issuing a dmamap_sync on all slots. */ static int igb_netmap_rxsync(void *a, u_int ring_nr, int do_lock) @@ -291,10 +267,10 @@ igb_netmap_rxsync(void *a, u_int ring_nr struct netmap_adapter *na = NA(adapter->ifp); struct netmap_kring *kring = &na->rx_rings[ring_nr]; struct netmap_ring *ring = kring->ring; - int j, k, n, lim = kring->nkr_num_slots - 1; + int j, k, l, n, lim = kring->nkr_num_slots - 1; - k = ring->cur; /* ring is not protected by any lock */ - if ( (kring->nr_kflags & NR_REINIT) || k > lim) + k = ring->cur; + if (k > lim) return netmap_ring_reinit(kring); if (do_lock) @@ -304,9 +280,12 @@ igb_netmap_rxsync(void *a, u_int ring_nr bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - j = rxr->next_to_check; + l = rxr->next_to_check; + j = l + kring->nkr_hwofs; + if (j > lim) + j -= lim + 1; for (n = 0; ; n++) { - union e1000_adv_rx_desc *curr = &rxr->rx_base[j]; + union e1000_adv_rx_desc *curr = &rxr->rx_base[l]; uint32_t staterr = le32toh(curr->wb.upper.status_error); if ((staterr & E1000_RXD_STAT_DD) == 0) @@ -314,15 +293,13 @@ igb_netmap_rxsync(void *a, u_int ring_nr ring->slot[j].len = le16toh(curr->wb.upper.length); bus_dmamap_sync(rxr->ptag, - rxr->rx_buffers[j].pmap, BUS_DMASYNC_POSTREAD); + rxr->rx_buffers[l].pmap, BUS_DMASYNC_POSTREAD); j = (j == lim) ? 0 : j + 1; + l = (l == lim) ? 0 : l + 1; } if (n) { - rxr->next_to_check = j; + rxr->next_to_check = l; kring->nr_hwavail += n; - if (kring->nr_hwavail >= lim - 10) { - ND("rx ring %d almost full %d", ring_nr, kring->nr_hwavail); - } } /* skip past packets that userspace has already processed, @@ -332,12 +309,15 @@ igb_netmap_rxsync(void *a, u_int ring_nr * Also increase nr_hwavail */ j = kring->nr_hwcur; + l = kring->nr_hwcur - kring->nkr_hwofs; + if (l < 0) + l += lim + 1; if (j != k) { /* userspace has read some packets. */ n = 0; while (j != k) { struct netmap_slot *slot = ring->slot + j; - union e1000_adv_rx_desc *curr = &rxr->rx_base[j]; - struct igb_rx_buf *rxbuf = rxr->rx_buffers + j; + union e1000_adv_rx_desc *curr = &rxr->rx_base[l]; + struct igb_rx_buf *rxbuf = rxr->rx_buffers + l; void *addr = NMB(slot); if (addr == netmap_buffer_base) { /* bad buf */ @@ -358,6 +338,7 @@ igb_netmap_rxsync(void *a, u_int ring_nr BUS_DMASYNC_PREREAD); j = (j == lim) ? 0 : j + 1; + l = (l == lim) ? 0 : l + 1; n++; } kring->nr_hwavail -= n; @@ -365,10 +346,10 @@ igb_netmap_rxsync(void *a, u_int ring_nr bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); /* IMPORTANT: we must leave one free slot in the ring, - * so move j back by one unit + * so move l back by one unit */ - j = (j == 0) ? lim : j - 1; - E1000_WRITE_REG(&adapter->hw, E1000_RDT(rxr->me), j); + l = (l == 0) ? lim : l - 1; + E1000_WRITE_REG(&adapter->hw, E1000_RDT(rxr->me), l); } /* tell userspace that there are new packets */ ring->avail = kring->nr_hwavail ; Modified: head/sys/dev/netmap/if_lem_netmap.h ============================================================================== --- head/sys/dev/netmap/if_lem_netmap.h Mon Dec 5 10:34:52 2011 (r228275) +++ head/sys/dev/netmap/if_lem_netmap.h Mon Dec 5 12:06:53 2011 (r228276) @@ -25,9 +25,12 @@ /* * $FreeBSD$ - * $Id: if_lem_netmap.h 9662 2011-11-16 13:18:06Z luigi $ + * $Id: if_lem_netmap.h 9802 2011-12-02 18:42:37Z luigi $ * * netmap support for if_lem.c + * + * For structure and details on the individual functions please see + * ixgbe_netmap.h */ #include @@ -59,7 +62,7 @@ lem_netmap_attach(struct adapter *adapte na.nm_rxsync = lem_netmap_rxsync; na.nm_lock = lem_netmap_lock_wrapper; na.nm_register = lem_netmap_reg; - na.buff_size = MCLBYTES; + na.buff_size = NETMAP_BUF_SIZE; netmap_attach(&na, 1); } @@ -94,7 +97,61 @@ lem_netmap_lock_wrapper(void *_a, int wh /* - * Reconcile kernel and user view of the transmit ring. see ixgbe.c + * Register/unregister routine + */ +static int +lem_netmap_reg(struct ifnet *ifp, int onoff) +{ + struct adapter *adapter = ifp->if_softc; + struct netmap_adapter *na = NA(ifp); + int error = 0; + + if (na == NULL) + return EINVAL; + + lem_disable_intr(adapter); + + /* Tell the stack that the interface is no longer active */ + ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + + /* lem_netmap_block_tasks(adapter); */ +#ifndef EM_LEGACY_IRQ // XXX do we need this ? + taskqueue_block(adapter->tq); + taskqueue_drain(adapter->tq, &adapter->rxtx_task); + taskqueue_drain(adapter->tq, &adapter->link_task); +#endif /* !EM_LEGCY_IRQ */ + if (onoff) { + ifp->if_capenable |= IFCAP_NETMAP; + + /* save if_transmit to restore it when exiting. + * XXX what about if_start and if_qflush ? + */ + na->if_transmit = ifp->if_transmit; + ifp->if_transmit = netmap_start; + + lem_init_locked(adapter); + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) == 0) { + error = ENOMEM; + goto fail; + } + } else { +fail: + /* restore non-netmap mode */ + ifp->if_transmit = na->if_transmit; + ifp->if_capenable &= ~IFCAP_NETMAP; + lem_init_locked(adapter); /* also enables intr */ + } + +#ifndef EM_LEGACY_IRQ + taskqueue_unblock(adapter->tq); // XXX do we need this ? +#endif /* !EM_LEGCY_IRQ */ + + return (error); +} + + +/* + * Reconcile kernel and user view of the transmit ring. */ static int lem_netmap_txsync(void *a, u_int ring_nr, int do_lock) @@ -103,13 +160,13 @@ lem_netmap_txsync(void *a, u_int ring_nr struct netmap_adapter *na = NA(adapter->ifp); struct netmap_kring *kring = &na->tx_rings[0]; struct netmap_ring *ring = kring->ring; - int j, k, n, lim = kring->nkr_num_slots - 1; + int j, k, l, n = 0, lim = kring->nkr_num_slots - 1; /* generate an interrupt approximately every half ring */ int report_frequency = kring->nkr_num_slots >> 1; k = ring->cur; - if ( (kring->nr_kflags & NR_REINIT) || k > lim) + if (k > lim) return netmap_ring_reinit(kring); if (do_lock) @@ -117,33 +174,18 @@ lem_netmap_txsync(void *a, u_int ring_nr bus_dmamap_sync(adapter->txdma.dma_tag, adapter->txdma.dma_map, BUS_DMASYNC_POSTREAD); - /* record completed transmissions TODO - * - * instead of using TDH, we could read the transmitted status bit. - */ - j = E1000_READ_REG(&adapter->hw, E1000_TDH(0)); - if (j >= kring->nkr_num_slots) { /* can it happen ? */ - D("bad TDH %d", j); - j -= kring->nkr_num_slots; - } - int delta = j - adapter->next_tx_to_clean; - if (delta) { - if (delta < 0) - delta += kring->nkr_num_slots; - adapter->next_tx_to_clean = j; - kring->nr_hwavail += delta; - } - /* update avail to what the hardware knows */ ring->avail = kring->nr_hwavail; - j = kring->nr_hwcur; + j = kring->nr_hwcur; /* points into the netmap ring */ if (j != k) { /* we have new packets to send */ - n = 0; + l = j - kring->nkr_hwofs; /* points into the NIC ring */ + if (l < 0) + l += lim + 1; while (j != k) { struct netmap_slot *slot = &ring->slot[j]; - struct e1000_tx_desc *curr = &adapter->tx_desc_base[j]; - struct em_buffer *txbuf = &adapter->tx_buffer_area[j]; + struct e1000_tx_desc *curr = &adapter->tx_desc_base[l]; + struct em_buffer *txbuf = &adapter->tx_buffer_area[l]; void *addr = NMB(slot); int flags = ((slot->flags & NS_REPORT) || j == 0 || j == report_frequency) ? @@ -156,34 +198,54 @@ lem_netmap_txsync(void *a, u_int ring_nr return netmap_ring_reinit(kring); } + slot->flags &= ~NS_REPORT; curr->upper.data = 0; - /* always interrupt. XXX make it conditional */ curr->lower.data = htole32( adapter->txd_cmd | len | (E1000_TXD_CMD_EOP | flags) ); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 14:13:22 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41EAB1065678; Mon, 5 Dec 2011 14:13:22 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 312788FC13; Mon, 5 Dec 2011 14:13:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5EDMLX040471; Mon, 5 Dec 2011 14:13:22 GMT (envelope-from jhibbits@svn.freebsd.org) Received: (from jhibbits@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5EDLr0040468; Mon, 5 Dec 2011 14:13:21 GMT (envelope-from jhibbits@svn.freebsd.org) Message-Id: <201112051413.pB5EDLr0040468@svn.freebsd.org> From: Justin Hibbits Date: Mon, 5 Dec 2011 14:13:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228277 - in head: etc/devd sys/powerpc/powermac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 14:13:22 -0000 Author: jhibbits Date: Mon Dec 5 14:13:21 2011 New Revision: 228277 URL: http://svn.freebsd.org/changeset/base/228277 Log: Fix style(9) issues from r228270. Approved by: nwhitehorn (mentor) Modified: head/etc/devd/apple.conf head/sys/powerpc/powermac/pmu.c Modified: head/etc/devd/apple.conf ============================================================================== --- head/etc/devd/apple.conf Mon Dec 5 12:06:53 2011 (r228276) +++ head/etc/devd/apple.conf Mon Dec 5 14:13:21 2011 (r228277) @@ -11,7 +11,7 @@ notify 0 { }; -# Keyboard power key +# PowerBook and iBook lid close. notify 0 { match "system" "PMU"; match "subsystem" "lid"; Modified: head/sys/powerpc/powermac/pmu.c ============================================================================== --- head/sys/powerpc/powermac/pmu.c Mon Dec 5 12:06:53 2011 (r228276) +++ head/sys/powerpc/powermac/pmu.c Mon Dec 5 14:13:21 2011 (r228277) @@ -702,14 +702,14 @@ pmu_intr(void *arg) len - 3,&resp[3]); } if (resp[1] & PMU_INT_ENVIRONMENT) { - // if the lid was just closed, notify devd. + /* if the lid was just closed, notify devd. */ if ((resp[2] & PMU_ENV_LID_CLOSED) && (!sc->lid_closed)) { sc->lid_closed = 1; if (devctl_process_running()) devctl_notify("PMU", "lid", "close", NULL); } else if (!(resp[2] & PMU_ENV_LID_CLOSED) && (sc->lid_closed)) { - // if the lid was just opened, notify devd. + /* if the lid was just opened, notify devd. */ if (devctl_process_running()) devctl_notify("PMU", "lid", "open", NULL); sc->lid_closed = 0; From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 15:11:35 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EB2C106566B; Mon, 5 Dec 2011 15:11:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EFC58FC15; Mon, 5 Dec 2011 15:11:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5FBZ2v042262; Mon, 5 Dec 2011 15:11:35 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5FBZoS042260; Mon, 5 Dec 2011 15:11:35 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201112051511.pB5FBZoS042260@svn.freebsd.org> From: John Baldwin Date: Mon, 5 Dec 2011 15:11:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228278 - head/usr.sbin/mfiutil X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 15:11:35 -0000 Author: jhb Date: Mon Dec 5 15:11:35 2011 New Revision: 228278 URL: http://svn.freebsd.org/changeset/base/228278 Log: Use the correct volume identifier field when parsing MR_EVT_ARG_LD_STRIP arguments. MFC after: 2 weeks Modified: head/usr.sbin/mfiutil/mfi_evt.c Modified: head/usr.sbin/mfiutil/mfi_evt.c ============================================================================== --- head/usr.sbin/mfiutil/mfi_evt.c Mon Dec 5 14:13:21 2011 (r228277) +++ head/usr.sbin/mfiutil/mfi_evt.c Mon Dec 5 15:11:35 2011 (r228278) @@ -438,7 +438,7 @@ mfi_decode_evt(int fd, struct mfi_evt_de printf(": "); break; case MR_EVT_ARGS_LD_STRIP: - printf("VOL %s", volume_name(fd, &detail->args.ld_prog.ld)); + printf("VOL %s", volume_name(fd, &detail->args.ld_strip.ld)); if (verbose) { printf(" strip %lld", (long long)detail->args.ld_strip.strip); From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 15:21:22 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B8781065670; Mon, 5 Dec 2011 15:21:22 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5B39C8FC0A; Mon, 5 Dec 2011 15:21:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5FLMfX042648; Mon, 5 Dec 2011 15:21:22 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5FLM2e042646; Mon, 5 Dec 2011 15:21:22 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201112051521.pB5FLM2e042646@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 5 Dec 2011 15:21:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228280 - head/sys/dev/netmap X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 15:21:22 -0000 Author: luigi Date: Mon Dec 5 15:21:21 2011 New Revision: 228280 URL: http://svn.freebsd.org/changeset/base/228280 Log: revise the implementation of the rings connected to the host stack Modified: head/sys/dev/netmap/netmap.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Mon Dec 5 15:16:47 2011 (r228279) +++ head/sys/dev/netmap/netmap.c Mon Dec 5 15:21:21 2011 (r228280) @@ -575,7 +575,13 @@ netmap_mmap(__unused struct cdev *dev, v /* - * handler for synchronization of the queues from/to the host + * Handlers for synchronization of the queues from/to the host. + * + * netmap_sync_to_host() passes packets up. We are called from a + * system call in user process context, and the only contention + * can be among multiple user threads erroneously calling + * this routine concurrently. In principle we should not even + * need to lock. */ static void netmap_sync_to_host(struct netmap_adapter *na) @@ -583,15 +589,20 @@ netmap_sync_to_host(struct netmap_adapte struct netmap_kring *kring = &na->tx_rings[na->num_queues]; struct netmap_ring *ring = kring->ring; struct mbuf *head = NULL, *tail = NULL, *m; - u_int n, lim = kring->nkr_num_slots - 1; + u_int k, n, lim = kring->nkr_num_slots - 1; - na->nm_lock(na->ifp->if_softc, NETMAP_CORE_LOCK, 0); + k = ring->cur; + if (k > lim) { + netmap_ring_reinit(kring); + return; + } + // na->nm_lock(na->ifp->if_softc, NETMAP_CORE_LOCK, 0); /* Take packets from hwcur to cur and pass them up. * In case of no buffers we give up. At the end of the loop, * the queue is drained in all cases. */ - for (n = kring->nr_hwcur; n != ring->cur;) { + for (n = kring->nr_hwcur; n != k;) { struct netmap_slot *slot = &ring->slot[n]; n = (n == lim) ? 0 : n + 1; @@ -610,9 +621,9 @@ netmap_sync_to_host(struct netmap_adapte tail = m; m->m_nextpkt = NULL; } - kring->nr_hwcur = ring->cur; + kring->nr_hwcur = k; kring->nr_hwavail = ring->avail = lim; - na->nm_lock(na->ifp->if_softc, NETMAP_CORE_UNLOCK, 0); + // na->nm_lock(na->ifp->if_softc, NETMAP_CORE_UNLOCK, 0); /* send packets up, outside the lock */ while ((m = head) != NULL) { @@ -626,6 +637,10 @@ netmap_sync_to_host(struct netmap_adapte } /* + * rxsync backend for packets coming from the host stack. + * They have been put in the queue by netmap_start() so we + * need to protect access to the kring using a lock. + * * This routine also does the selrecord if called from the poll handler * (we know because td != NULL). */ @@ -634,24 +649,29 @@ netmap_sync_from_host(struct netmap_adap { struct netmap_kring *kring = &na->rx_rings[na->num_queues]; struct netmap_ring *ring = kring->ring; - int delta; + int error = 1, delta; + u_int k = ring->cur, lim = kring->nkr_num_slots; na->nm_lock(na->ifp->if_softc, NETMAP_CORE_LOCK, 0); - - /* skip past packets processed by userspace, - * and then sync cur/avail with hwcur/hwavail - */ - delta = ring->cur - kring->nr_hwcur; + if (k >= lim) /* bad value */ + goto done; + delta = k - kring->nr_hwcur; if (delta < 0) - delta += kring->nkr_num_slots; + delta += lim; kring->nr_hwavail -= delta; - kring->nr_hwcur = ring->cur; - ring->avail = kring->nr_hwavail; - if (ring->avail == 0 && td) + if (kring->nr_hwavail < 0) /* error */ + goto done; + kring->nr_hwcur = k; + error = 0; + k = ring->avail = kring->nr_hwavail; + if (k == 0 && td) selrecord(td, &kring->si); - if (ring->avail && (netmap_verbose & NM_VERB_HOST)) - D("%d pkts from stack", ring->avail); + if (k && (netmap_verbose & NM_VERB_HOST)) + D("%d pkts from stack", k); +done: na->nm_lock(na->ifp->if_softc, NETMAP_CORE_UNLOCK, 0); + if (error) + netmap_ring_reinit(kring); } @@ -1262,25 +1282,24 @@ netmap_detach(struct ifnet *ifp) /* - * intercept packets coming from the network stack and present - * them to netmap as incoming packets on a separate ring. + * Intercept packets from the network stack and pass them + * to netmap as incoming packets on the 'software' ring. * We are not locked when called. */ int netmap_start(struct ifnet *ifp, struct mbuf *m) { struct netmap_adapter *na = NA(ifp); - u_int i, len, n = na->num_queues; - int error = EBUSY; - struct netmap_kring *kring = &na->rx_rings[n]; + struct netmap_kring *kring = &na->rx_rings[na->num_queues]; + u_int i, len = m->m_pkthdr.len; + int error = EBUSY, lim = kring->nkr_num_slots - 1; struct netmap_slot *slot; - len = m->m_pkthdr.len; if (netmap_verbose & NM_VERB_HOST) D("%s packet %d len %d from the stack", ifp->if_xname, kring->nr_hwcur + kring->nr_hwavail, len); na->nm_lock(ifp->if_softc, NETMAP_CORE_LOCK, 0); - if (kring->nr_hwavail >= (int)kring->nkr_num_slots - 1) { + if (kring->nr_hwavail >= lim) { D("stack ring %s full\n", ifp->if_xname); goto done; /* no space */ } @@ -1291,8 +1310,8 @@ netmap_start(struct ifnet *ifp, struct m /* compute the insert position */ i = kring->nr_hwcur + kring->nr_hwavail; - if (i >= kring->nkr_num_slots) - i -= kring->nkr_num_slots; + if (i > lim) + i -= lim + 1; slot = &kring->ring->slot[i]; m_copydata(m, 0, len, NMB(slot)); slot->len = len; From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 15:33:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5383D106564A; Mon, 5 Dec 2011 15:33:14 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 42A848FC19; Mon, 5 Dec 2011 15:33:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5FXEBV043068; Mon, 5 Dec 2011 15:33:14 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5FXEuh043063; Mon, 5 Dec 2011 15:33:14 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201112051533.pB5FXEuh043063@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 5 Dec 2011 15:33:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228281 - in head/sys/dev: e1000 re X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 15:33:15 -0000 Author: luigi Date: Mon Dec 5 15:33:13 2011 New Revision: 228281 URL: http://svn.freebsd.org/changeset/base/228281 Log: add netmap support for "em", "lem", "igb" and "re". On my hardware, "em" in netmap mode does about 1.388 Mpps on one card (on an Asus motherboard), and 1.1 Mpps on another card (PCIe bus). Both seem to be NIC-limited, because i have the same rate even with the CPU running at 150 MHz. On the "re" driver the tx throughput is around 420-450 Kpps on various (8111C and the like) chipsets. On the Rx side performance seems much better, and i can receive the full load generated by the "em" cards. "igb" is untested as i don't have the hardware. Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_lem.c head/sys/dev/re/if_re.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Mon Dec 5 15:21:21 2011 (r228280) +++ head/sys/dev/e1000/if_em.c Mon Dec 5 15:33:13 2011 (r228281) @@ -399,6 +399,10 @@ SYSCTL_INT(_hw_em, OID_AUTO, eee_setting /* Global used in WOL setup with multiport cards */ static int global_quad_port_a = 0; +#ifdef DEV_NETMAP /* see ixgbe.c for details */ +#include +#endif /* DEV_NETMAP */ + /********************************************************************* * Device identification routine * @@ -714,6 +718,9 @@ em_attach(device_t dev) adapter->led_dev = led_create(em_led_func, adapter, device_get_nameunit(dev)); +#ifdef DEV_NETMAP + em_netmap_attach(adapter); +#endif /* DEV_NETMAP */ INIT_DEBUGOUT("em_attach: end"); @@ -785,6 +792,10 @@ em_detach(device_t dev) ether_ifdetach(adapter->ifp); callout_drain(&adapter->timer); +#ifdef DEV_NETMAP + netmap_detach(ifp); +#endif /* DEV_NETMAP */ + em_free_pci_resources(adapter); bus_generic_detach(dev); if_free(ifp); @@ -3213,9 +3224,17 @@ em_setup_transmit_ring(struct tx_ring *t struct adapter *adapter = txr->adapter; struct em_buffer *txbuf; int i; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot; +#endif /* DEV_NETMAP */ /* Clear the old descriptor contents */ EM_TX_LOCK(txr); +#ifdef DEV_NETMAP + slot = netmap_reset(na, NR_TX, txr->me, 0); +#endif /* DEV_NETMAP */ + bzero((void *)txr->tx_base, (sizeof(struct e1000_tx_desc)) * adapter->num_tx_desc); /* Reset indices */ @@ -3232,6 +3251,22 @@ em_setup_transmit_ring(struct tx_ring *t m_freem(txbuf->m_head); txbuf->m_head = NULL; } +#ifdef DEV_NETMAP + if (slot) { + int si = i + na->tx_rings[txr->me].nkr_hwofs; + void *addr; + + if (si >= na->num_tx_desc) + si -= na->num_tx_desc; + addr = NMB(slot + si); + txr->tx_base[i].buffer_addr = + htole64(vtophys(addr)); + /* reload the map for netmap mode */ + netmap_load_map(txr->txtag, + txbuf->map, addr, na->buff_size); + } +#endif /* DEV_NETMAP */ + /* clear the watch index */ txbuf->next_eop = -1; } @@ -3682,6 +3717,19 @@ em_txeof(struct tx_ring *txr) struct ifnet *ifp = adapter->ifp; EM_TX_LOCK_ASSERT(txr); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(ifp); + + selwakeuppri(&na->tx_rings[txr->me].si, PI_NET); + EM_TX_UNLOCK(txr); + EM_CORE_LOCK(adapter); + selwakeuppri(&na->tx_rings[na->num_queues + 1].si, PI_NET); + EM_CORE_UNLOCK(adapter); + EM_TX_LOCK(txr); + return (FALSE); + } +#endif /* DEV_NETMAP */ /* No work, make sure watchdog is off */ if (txr->tx_avail == adapter->num_tx_desc) { @@ -3978,6 +4026,57 @@ em_setup_receive_ring(struct rx_ring *rx if (++j == adapter->num_rx_desc) j = 0; } +#ifdef DEV_NETMAP + { + /* + * This driver is slightly different from the standard: + * it refills the rings in blocks of 8, so the while() + * above completes any leftover work. Also, after if_init() + * the ring starts at rxr->next_to_check instead of 0. + * + * Currently: we leave the mbufs allocated even in netmap + * mode, and simply make the NIC ring point to the + * correct buffer (netmap_buf or mbuf) depending on + * the mode. To avoid mbuf leaks, when in netmap mode we + * must make sure that next_to_refresh == next_to_check - 1 + * so that the above while() loop is never run on init. + * + * A better way would be to free the mbufs when entering + * netmap mode, and set next_to_refresh/check in + * a way that the mbufs are completely reallocated + * when going back to standard mode. + */ + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot = netmap_reset(na, + NR_RX, rxr->me, rxr->next_to_check); + int sj = slot ? na->rx_rings[rxr->me].nkr_hwofs : 0; + + /* slot sj corresponds to entry j in the NIC ring */ + if (sj < 0) + sj += adapter->num_rx_desc; + + for (j = 0; j != adapter->num_rx_desc; j++, sj++) { + void *addr; + int sz; + + rxbuf = &rxr->rx_buffers[j]; + /* no mbuf and regular mode -> skip this entry */ + if (rxbuf->m_head == NULL && !slot) + continue; + /* Handle wrap. Cannot use "na" here, could be NULL */ + if (sj >= adapter->num_rx_desc) + sj -= adapter->num_rx_desc; + /* see comment, set slot addr and map */ + addr = slot ? NMB(slot + sj) : rxbuf->m_head->m_data; + sz = slot ? na->buff_size : adapter->rx_mbuf_sz; + // XXX load or reload ? + netmap_load_map(rxr->rxtag, rxbuf->map, addr, sz); + /* Update descriptor */ + rxr->rx_base[j].buffer_addr = htole64(vtophys(addr)); + bus_dmamap_sync(rxr->rxtag, rxbuf->map, BUS_DMASYNC_PREREAD); + } + } +#endif /* DEV_NETMAP */ fail: rxr->next_to_refresh = i; @@ -4170,6 +4269,23 @@ em_initialize_receive_unit(struct adapte E1000_WRITE_REG(hw, E1000_RDBAL(i), (u32)bus_addr); /* Setup the Head and Tail Descriptor Pointers */ E1000_WRITE_REG(hw, E1000_RDH(i), rxr->next_to_check); +#ifdef DEV_NETMAP + /* + * an init() while a netmap client is active must + * preserve the rx buffers passed to userspace. + * In this driver it means we adjust RDT to + * something different from next_to_refresh. + */ + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_kring *kring = &na->rx_rings[i]; + int t = rxr->next_to_refresh - kring->nr_hwavail; + + if (t < 0) + t += na->num_rx_desc; + E1000_WRITE_REG(hw, E1000_RDT(i), t); + } else +#endif /* DEV_NETMAP */ E1000_WRITE_REG(hw, E1000_RDT(i), rxr->next_to_refresh); } @@ -4247,6 +4363,19 @@ em_rxeof(struct rx_ring *rxr, int count, EM_RX_LOCK(rxr); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(ifp); + + selwakeuppri(&na->rx_rings[rxr->me].si, PI_NET); + EM_RX_UNLOCK(rxr); + EM_CORE_LOCK(adapter); + selwakeuppri(&na->rx_rings[na->num_queues + 1].si, PI_NET); + EM_CORE_UNLOCK(adapter); + return (0); + } +#endif /* DEV_NETMAP */ + for (i = rxr->next_to_check, processed = 0; count != 0;) { if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Mon Dec 5 15:21:21 2011 (r228280) +++ head/sys/dev/e1000/if_igb.c Mon Dec 5 15:33:13 2011 (r228281) @@ -369,6 +369,9 @@ SYSCTL_INT(_hw_igb, OID_AUTO, rx_process &igb_rx_process_limit, 0, "Maximum number of received packets to process at a time, -1 means unlimited"); +#ifdef DEV_NETMAP /* see ixgbe.c for details */ +#include +#endif /* DEV_NETMAP */ /********************************************************************* * Device identification routine * @@ -664,6 +667,9 @@ igb_attach(device_t dev) adapter->led_dev = led_create(igb_led_func, adapter, device_get_nameunit(dev)); +#ifdef DEV_NETMAP + igb_netmap_attach(adapter); +#endif /* DEV_NETMAP */ INIT_DEBUGOUT("igb_attach: end"); return (0); @@ -742,6 +748,9 @@ igb_detach(device_t dev) callout_drain(&adapter->timer); +#ifdef DEV_NETMAP + netmap_detach(adapter->ifp); +#endif /* DEV_NETMAP */ igb_free_pci_resources(adapter); bus_generic_detach(dev); if_free(ifp); @@ -3212,9 +3221,16 @@ igb_setup_transmit_ring(struct tx_ring * struct adapter *adapter = txr->adapter; struct igb_tx_buffer *txbuf; int i; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot; +#endif /* DEV_NETMAP */ /* Clear the old descriptor contents */ IGB_TX_LOCK(txr); +#ifdef DEV_NETMAP + slot = netmap_reset(na, NR_TX, txr->me, 0); +#endif /* DEV_NETMAP */ bzero((void *)txr->tx_base, (sizeof(union e1000_adv_tx_desc)) * adapter->num_tx_desc); /* Reset indices */ @@ -3231,6 +3247,17 @@ igb_setup_transmit_ring(struct tx_ring * m_freem(txbuf->m_head); txbuf->m_head = NULL; } +#ifdef DEV_NETMAP + if (slot) { + /* slot si is mapped to the i-th NIC-ring entry */ + int si = i + na->tx_rings[txr->me].nkr_hwofs; + + if (si < 0) + si += na->num_tx_desc; + netmap_load_map(txr->txtag, txbuf->map, + NMB(slot + si), na->buff_size); + } +#endif /* DEV_NETMAP */ /* clear the watch index */ txbuf->next_eop = -1; } @@ -3626,6 +3653,19 @@ igb_txeof(struct tx_ring *txr) IGB_TX_LOCK_ASSERT(txr); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(ifp); + + selwakeuppri(&na->tx_rings[txr->me].si, PI_NET); + IGB_TX_UNLOCK(txr); + IGB_CORE_LOCK(adapter); + selwakeuppri(&na->tx_rings[na->num_queues + 1].si, PI_NET); + IGB_CORE_UNLOCK(adapter); + IGB_TX_LOCK(txr); + return FALSE; + } +#endif /* DEV_NETMAP */ if (txr->tx_avail == adapter->num_tx_desc) { txr->queue_status = IGB_QUEUE_IDLE; return FALSE; @@ -3949,6 +3989,10 @@ igb_setup_receive_ring(struct rx_ring *r bus_dma_segment_t pseg[1], hseg[1]; struct lro_ctrl *lro = &rxr->lro; int rsize, nsegs, error = 0; +#ifdef DEV_NETMAP + struct netmap_adapter *na = NA(rxr->adapter->ifp); + struct netmap_slot *slot; +#endif /* DEV_NETMAP */ adapter = rxr->adapter; dev = adapter->dev; @@ -3956,6 +4000,9 @@ igb_setup_receive_ring(struct rx_ring *r /* Clear the ring contents */ IGB_RX_LOCK(rxr); +#ifdef DEV_NETMAP + slot = netmap_reset(na, NR_RX, rxr->me, 0); +#endif /* DEV_NETMAP */ rsize = roundup2(adapter->num_rx_desc * sizeof(union e1000_adv_rx_desc), IGB_DBA_ALIGN); bzero((void *)rxr->rx_base, rsize); @@ -3974,6 +4021,22 @@ igb_setup_receive_ring(struct rx_ring *r struct mbuf *mh, *mp; rxbuf = &rxr->rx_buffers[j]; +#ifdef DEV_NETMAP + if (slot) { + /* slot sj is mapped to the i-th NIC-ring entry */ + int sj = j + na->rx_rings[rxr->me].nkr_hwofs; + void *addr; + + if (sj < 0) + sj += na->num_rx_desc; + addr = NMB(slot + sj); + netmap_load_map(rxr->ptag, + rxbuf->pmap, addr, na->buff_size); + /* Update descriptor */ + rxr->rx_base[j].read.pkt_addr = htole64(vtophys(addr)); + continue; + } +#endif /* DEV_NETMAP */ if (rxr->hdr_split == FALSE) goto skip_head; @@ -4258,6 +4321,26 @@ igb_initialize_receive_units(struct adap for (int i = 0; i < adapter->num_queues; i++) { rxr = &adapter->rx_rings[i]; E1000_WRITE_REG(hw, E1000_RDH(i), rxr->next_to_check); +#ifdef DEV_NETMAP + /* + * an init() while a netmap client is active must + * preserve the rx buffers passed to userspace. + * In this driver it means we adjust RDT to + * somthing different from next_to_refresh + * (which is not used in netmap mode). + */ + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_kring *kring = &na->rx_rings[i]; + int t = rxr->next_to_refresh - kring->nr_hwavail; + + if (t >= adapter->num_rx_desc) + t -= adapter->num_rx_desc; + else if (t < 0) + t += adapter->num_rx_desc; + E1000_WRITE_REG(hw, E1000_RDT(i), t); + } else +#endif /* DEV_NETMAP */ E1000_WRITE_REG(hw, E1000_RDT(i), rxr->next_to_refresh); } return; @@ -4436,6 +4519,19 @@ igb_rxeof(struct igb_queue *que, int cou bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(ifp); + + selwakeuppri(&na->rx_rings[rxr->me].si, PI_NET); + IGB_RX_UNLOCK(rxr); + IGB_CORE_LOCK(adapter); + selwakeuppri(&na->rx_rings[na->num_queues + 1].si, PI_NET); + IGB_CORE_UNLOCK(adapter); + return (0); + } +#endif /* DEV_NETMAP */ + /* Main clean loop */ for (i = rxr->next_to_check; count != 0;) { struct mbuf *sendmp, *mh, *mp; Modified: head/sys/dev/e1000/if_lem.c ============================================================================== --- head/sys/dev/e1000/if_lem.c Mon Dec 5 15:21:21 2011 (r228280) +++ head/sys/dev/e1000/if_lem.c Mon Dec 5 15:33:13 2011 (r228281) @@ -316,6 +316,10 @@ TUNABLE_INT("hw.em.fc_setting", &lem_fc_ /* Global used in WOL setup with multiport cards */ static int global_quad_port_a = 0; +#ifdef DEV_NETMAP /* see ixgbe.c for details */ +#include +#endif /* DEV_NETMAP */ + /********************************************************************* * Device identification routine * @@ -646,6 +650,9 @@ lem_attach(device_t dev) adapter->led_dev = led_create(lem_led_func, adapter, device_get_nameunit(dev)); +#ifdef DEV_NETMAP + lem_netmap_attach(adapter); +#endif /* DEV_NETMAP */ INIT_DEBUGOUT("lem_attach: end"); return (0); @@ -724,6 +731,9 @@ lem_detach(device_t dev) callout_drain(&adapter->timer); callout_drain(&adapter->tx_fifo_timer); +#ifdef DEV_NETMAP + netmap_detach(ifp); +#endif /* DEV_NETMAP */ lem_free_pci_resources(adapter); bus_generic_detach(dev); if_free(ifp); @@ -2637,6 +2647,11 @@ static void lem_setup_transmit_structures(struct adapter *adapter) { struct em_buffer *tx_buffer; +#ifdef DEV_NETMAP + /* we are already locked */ + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot = netmap_reset(na, NR_TX, 0, 0); +#endif /* DEV_NETMAP */ /* Clear the old ring contents */ bzero(adapter->tx_desc_base, @@ -2650,6 +2665,22 @@ lem_setup_transmit_structures(struct ada bus_dmamap_unload(adapter->txtag, tx_buffer->map); m_freem(tx_buffer->m_head); tx_buffer->m_head = NULL; +#ifdef DEV_NETMAP + if (slot) { + /* slot si is mapped to the i-th NIC-ring entry */ + int si = i + na->tx_rings[0].nkr_hwofs; + void *addr; + + if (si > na->num_tx_desc) + si -= na->num_tx_desc; + addr = NMB(slot + si); + adapter->tx_desc_base[si].buffer_addr = + htole64(vtophys(addr)); + /* reload the map for netmap mode */ + netmap_load_map(adapter->txtag, + tx_buffer->map, addr, na->buff_size); + } +#endif /* DEV_NETMAP */ tx_buffer->next_eop = -1; } @@ -2951,6 +2982,12 @@ lem_txeof(struct adapter *adapter) EM_TX_LOCK_ASSERT(adapter); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + selwakeuppri(&NA(ifp)->tx_rings[0].si, PI_NET); + return; + } +#endif /* DEV_NETMAP */ if (adapter->num_tx_desc_avail == adapter->num_tx_desc) return; @@ -3181,6 +3218,11 @@ lem_setup_receive_structures(struct adap { struct em_buffer *rx_buffer; int i, error; +#ifdef DEV_NETMAP + /* we are already under lock */ + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_slot *slot = netmap_reset(na, NR_RX, 0, 0); +#endif /* Reset descriptor ring */ bzero(adapter->rx_desc_base, @@ -3200,6 +3242,23 @@ lem_setup_receive_structures(struct adap /* Allocate new ones. */ for (i = 0; i < adapter->num_rx_desc; i++) { +#ifdef DEV_NETMAP + if (slot) { + /* slot si is mapped to the i-th NIC-ring entry */ + int si = i + na->rx_rings[0].nkr_hwofs; + void *addr; + + if (si > na->num_rx_desc) + si -= na->num_rx_desc; + addr = NMB(slot + si); + netmap_load_map(adapter->rxtag, + rx_buffer->map, addr, na->buff_size); + /* Update descriptor */ + adapter->rx_desc_base[i].buffer_addr = + htole64(vtophys(addr)); + continue; + } +#endif /* DEV_NETMAP */ error = lem_get_buf(adapter, i); if (error) return (error); @@ -3324,6 +3383,18 @@ lem_initialize_receive_unit(struct adapt * Tail Descriptor Pointers */ E1000_WRITE_REG(&adapter->hw, E1000_RDH(0), 0); +#ifdef DEV_NETMAP + /* preserve buffers already made available to clients */ + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_adapter *na = NA(adapter->ifp); + struct netmap_kring *kring = &na->rx_rings[0]; + int t = na->num_rx_desc - 1 - kring->nr_hwavail; + + if (t >= na->num_rx_desc) + t -= na->num_rx_desc; + E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), t); + } else +#endif /* DEV_NETMAP */ E1000_WRITE_REG(&adapter->hw, E1000_RDT(0), adapter->num_rx_desc - 1); return; @@ -3407,6 +3478,14 @@ lem_rxeof(struct adapter *adapter, int c bus_dmamap_sync(adapter->rxdma.dma_tag, adapter->rxdma.dma_map, BUS_DMASYNC_POSTREAD); +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + selwakeuppri(&NA(ifp)->rx_rings[0].si, PI_NET); + EM_RX_UNLOCK(adapter); + return (0); + } +#endif /* DEV_NETMAP */ + if (!((current_desc->status) & E1000_RXD_STAT_DD)) { if (done != NULL) *done = rx_sent; Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Mon Dec 5 15:21:21 2011 (r228280) +++ head/sys/dev/re/if_re.c Mon Dec 5 15:33:13 2011 (r228281) @@ -296,6 +296,10 @@ static void re_setwol (struct rl_softc static void re_clrwol (struct rl_softc *); static void re_set_linkspeed (struct rl_softc *); +#ifdef DEV_NETMAP /* see ixgbe.c for details */ +#include +#endif /* !DEV_NETMAP */ + #ifdef RE_DIAG static int re_diag (struct rl_softc *); #endif @@ -1620,6 +1624,9 @@ re_attach(device_t dev) */ ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); +#ifdef DEV_NETMAP + re_netmap_attach(sc); +#endif /* DEV_NETMAP */ #ifdef RE_DIAG /* * Perform hardware diagnostic on the original RTL8169. @@ -1815,6 +1822,9 @@ re_detach(device_t dev) bus_dma_tag_destroy(sc->rl_ldata.rl_stag); } +#ifdef DEV_NETMAP + netmap_detach(ifp); +#endif /* DEV_NETMAP */ if (sc->rl_parent_tag) bus_dma_tag_destroy(sc->rl_parent_tag); @@ -1989,6 +1999,9 @@ re_tx_list_init(struct rl_softc *sc) sc->rl_ldata.rl_tx_desc_cnt * sizeof(struct rl_desc)); for (i = 0; i < sc->rl_ldata.rl_tx_desc_cnt; i++) sc->rl_ldata.rl_tx_desc[i].tx_m = NULL; +#ifdef DEV_NETMAP + re_netmap_tx_init(sc); +#endif /* DEV_NETMAP */ /* Set EOR. */ desc = &sc->rl_ldata.rl_tx_list[sc->rl_ldata.rl_tx_desc_cnt - 1]; desc->rl_cmdstat |= htole32(RL_TDESC_CMD_EOR); @@ -2016,6 +2029,9 @@ re_rx_list_init(struct rl_softc *sc) if ((error = re_newbuf(sc, i)) != 0) return (error); } +#ifdef DEV_NETMAP + re_netmap_rx_init(sc); +#endif /* DEV_NETMAP */ /* Flush the RX descriptors */ @@ -2072,6 +2088,12 @@ re_rxeof(struct rl_softc *sc, int *rx_np RL_LOCK_ASSERT(sc); ifp = sc->rl_ifp; +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + selwakeuppri(&NA(ifp)->rx_rings->si, PI_NET); + return 0; + } +#endif /* DEV_NETMAP */ if (ifp->if_mtu > RL_MTU && (sc->rl_flags & RL_FLAG_JUMBOV2) != 0) jumbo = 1; else @@ -2313,6 +2335,12 @@ re_txeof(struct rl_softc *sc) return; ifp = sc->rl_ifp; +#ifdef DEV_NETMAP + if (ifp->if_capenable & IFCAP_NETMAP) { + selwakeuppri(&NA(ifp)->tx_rings[0].si, PI_NET); + return; + } +#endif /* DEV_NETMAP */ /* Invalidate the TX descriptor list */ bus_dmamap_sync(sc->rl_ldata.rl_tx_list_tag, sc->rl_ldata.rl_tx_list_map, @@ -2831,6 +2859,21 @@ re_start_locked(struct ifnet *ifp) sc = ifp->if_softc; +#ifdef DEV_NETMAP + /* XXX is this necessary ? */ + if (ifp->if_capenable & IFCAP_NETMAP) { + struct netmap_kring *kring = &NA(ifp)->tx_rings[0]; + if (sc->rl_ldata.rl_tx_prodidx != kring->nr_hwcur) { + /* kick the tx unit */ + CSR_WRITE_1(sc, sc->rl_txstart, RL_TXSTART_START); +#ifdef RE_TX_MODERATION + CSR_WRITE_4(sc, RL_TIMERCNT, 1); +#endif + sc->rl_watchdog_timer = 5; + } + return; + } +#endif /* DEV_NETMAP */ if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING || (sc->rl_flags & RL_FLAG_LINK) == 0) return; From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 16:08:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1613106564A; Mon, 5 Dec 2011 16:08:18 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A14028FC12; Mon, 5 Dec 2011 16:08:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5G8IL3044250; Mon, 5 Dec 2011 16:08:18 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5G8IbS044248; Mon, 5 Dec 2011 16:08:18 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112051608.pB5G8IbS044248@svn.freebsd.org> From: Ed Schouten Date: Mon, 5 Dec 2011 16:08:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228283 - head/sys/x86/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 16:08:18 -0000 Author: ed Date: Mon Dec 5 16:08:18 2011 New Revision: 228283 URL: http://svn.freebsd.org/changeset/base/228283 Log: Get rid of kludgy per-descriptor state handling in acpi_apm. Where i386/bios/apm.c requires no per-descriptor state, the ACPI version of these device do. Instead of using hackish clone lists that leave stale device nodes lying around, use the cdevpriv API. Modified: head/sys/x86/acpica/acpi_apm.c Modified: head/sys/x86/acpica/acpi_apm.c ============================================================================== --- head/sys/x86/acpica/acpi_apm.c Mon Dec 5 16:06:12 2011 (r228282) +++ head/sys/x86/acpica/acpi_apm.c Mon Dec 5 16:08:18 2011 (r228283) @@ -51,12 +51,10 @@ __FBSDID("$FreeBSD$"); #define APM_UNKNOWN 0xff static int apm_active; -static struct clonedevs *apm_clones; static MALLOC_DEFINE(M_APMDEV, "apmdev", "APM device emulation"); static d_open_t apmopen; -static d_close_t apmclose; static d_write_t apmwrite; static d_ioctl_t apmioctl; static d_poll_t apmpoll; @@ -71,9 +69,7 @@ static struct filterops apm_readfiltops static struct cdevsw apm_cdevsw = { .d_version = D_VERSION, - .d_flags = D_TRACKCLOSE | D_NEEDMINOR, .d_open = apmopen, - .d_close = apmclose, .d_write = apmwrite, .d_ioctl = apmioctl, .d_poll = apmpoll, @@ -202,39 +198,6 @@ acpi_capm_get_pwstatus(apm_pwstatus_t ap return (0); } -/* Create single-use devices for /dev/apm and /dev/apmctl. */ -static void -apm_clone(void *arg, struct ucred *cred, char *name, int namelen, - struct cdev **dev) -{ - int ctl_dev, unit; - - if (*dev != NULL) - return; - if (strcmp(name, "apmctl") == 0) - ctl_dev = TRUE; - else if (strcmp(name, "apm") == 0) - ctl_dev = FALSE; - else - return; - - /* Always create a new device and unit number. */ - unit = -1; - if (clone_create(&apm_clones, &apm_cdevsw, &unit, dev, 0)) { - if (ctl_dev) { - *dev = make_dev(&apm_cdevsw, unit, - UID_ROOT, GID_OPERATOR, 0660, "apmctl%d", unit); - } else { - *dev = make_dev(&apm_cdevsw, unit, - UID_ROOT, GID_OPERATOR, 0664, "apm%d", unit); - } - if (*dev != NULL) { - dev_ref(*dev); - (*dev)->si_flags |= SI_CHEAPCLONE; - } - } -} - /* Create a struct for tracking per-device suspend notification. */ static struct apm_clone_data * apm_create_clone(struct cdev *dev, struct acpi_softc *acpi_sc) @@ -263,30 +226,13 @@ apm_create_clone(struct cdev *dev, struc return (clone); } -static int -apmopen(struct cdev *dev, int flag, int fmt, struct thread *td) -{ - struct acpi_softc *acpi_sc; - struct apm_clone_data *clone; - - acpi_sc = devclass_get_softc(devclass_find("acpi"), 0); - clone = apm_create_clone(dev, acpi_sc); - dev->si_drv1 = clone; - - /* If the device is opened for write, record that. */ - if ((flag & FWRITE) != 0) - clone->flags |= ACPI_EVF_WRITE; - - return (0); -} - -static int -apmclose(struct cdev *dev, int flag, int fmt, struct thread *td) +static void +apmdtor(void *data) { struct apm_clone_data *clone; struct acpi_softc *acpi_sc; - clone = dev->si_drv1; + clone = data; acpi_sc = clone->acpi_sc; /* We are about to lose a reference so check if suspend should occur */ @@ -301,7 +247,22 @@ apmclose(struct cdev *dev, int flag, int knlist_destroy(&clone->sel_read.si_note); ACPI_UNLOCK(acpi); free(clone, M_APMDEV); - destroy_dev_sched(dev); +} + +static int +apmopen(struct cdev *dev, int flag, int fmt, struct thread *td) +{ + struct acpi_softc *acpi_sc; + struct apm_clone_data *clone; + + acpi_sc = devclass_get_softc(devclass_find("acpi"), 0); + clone = apm_create_clone(dev, acpi_sc); + devfs_set_cdevpriv(clone, apmdtor); + + /* If the device is opened for write, record that. */ + if ((flag & FWRITE) != 0) + clone->flags |= ACPI_EVF_WRITE; + return (0); } @@ -316,7 +277,7 @@ apmioctl(struct cdev *dev, u_long cmd, c apm_info_old_t aiop; error = 0; - clone = dev->si_drv1; + devfs_get_cdevpriv((void **)&clone); acpi_sc = clone->acpi_sc; switch (cmd) { @@ -430,8 +391,8 @@ apmpoll(struct cdev *dev, int events, st int revents; revents = 0; + devfs_get_cdevpriv((void **)&clone); ACPI_LOCK(acpi); - clone = dev->si_drv1; if (clone->acpi_sc->acpi_next_sstate) revents |= events & (POLLIN | POLLRDNORM); else @@ -445,8 +406,8 @@ apmkqfilter(struct cdev *dev, struct kno { struct apm_clone_data *clone; + devfs_get_cdevpriv((void **)&clone); ACPI_LOCK(acpi); - clone = dev->si_drv1; kn->kn_hook = clone; kn->kn_fop = &apm_readfiltops; knlist_add(&clone->sel_read.si_note, kn, 0); @@ -485,6 +446,7 @@ acpi_apm_init(struct acpi_softc *sc) /* Create a clone for /dev/acpi also. */ STAILQ_INIT(&sc->apm_cdevs); sc->acpi_clone = apm_create_clone(sc->acpi_dev_t, sc); - clone_setup(&apm_clones); - EVENTHANDLER_REGISTER(dev_clone, apm_clone, 0, 1000); + + make_dev(&apm_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0660, "apmctl"); + make_dev(&apm_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0664, "apm"); } From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 16:38:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C11ED106564A; Mon, 5 Dec 2011 16:38:52 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B174F8FC12; Mon, 5 Dec 2011 16:38:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5GcqYe047945; Mon, 5 Dec 2011 16:38:52 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5GcqPo047942; Mon, 5 Dec 2011 16:38:52 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201112051638.pB5GcqPo047942@svn.freebsd.org> From: Hajimu UMEMOTO Date: Mon, 5 Dec 2011 16:38:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228284 - in head/kerberos5: . lib/libhdb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 16:38:52 -0000 Author: ume Date: Mon Dec 5 16:38:52 2011 New Revision: 228284 URL: http://svn.freebsd.org/changeset/base/228284 Log: - Make heimdal buildable with WITH_OPENLDAP defined, again. - Our heimdal uses the deprecated OpenLDAP functions. Modified: head/kerberos5/Makefile.inc head/kerberos5/lib/libhdb/Makefile Modified: head/kerberos5/Makefile.inc ============================================================================== --- head/kerberos5/Makefile.inc Mon Dec 5 16:08:18 2011 (r228283) +++ head/kerberos5/Makefile.inc Mon Dec 5 16:38:52 2011 (r228284) @@ -10,7 +10,7 @@ CFLAGS+= -DHAVE_CONFIG_H -I${.CURDIR}/.. OPENLDAPBASE?= /usr/local LDAPLDADD= -lldap -llber LDAPDPADD= ${LDAPLDADD:C;^-l(.*)$;${OPENLDAPBASE}/lib/lib\1.a;} -LDAPCFLAGS= -I${OPENLDAPBASE}/include -DOPENLDAP=1 +LDAPCFLAGS= -I${OPENLDAPBASE}/include -DOPENLDAP=1 -DLDAP_DEPRECATED=1 LDAPLDFLAGS= -L${OPENLDAPBASE}/lib -Wl,-rpath,${OPENLDAPBASE}/lib .endif Modified: head/kerberos5/lib/libhdb/Makefile ============================================================================== --- head/kerberos5/lib/libhdb/Makefile Mon Dec 5 16:08:18 2011 (r228283) +++ head/kerberos5/lib/libhdb/Makefile Mon Dec 5 16:38:52 2011 (r228284) @@ -1,9 +1,9 @@ # $FreeBSD$ LIB= hdb -LDFLAGS= -Wl,--no-undefined -LDADD= -lasn1 -lcom_err -lkrb5 -lroken -DPADD= ${LIBASN1} ${LIBCOM_ERR} ${LIBKRB5} ${LIBROKEN} +LDFLAGS= -Wl,--no-undefined ${LDAPLDFLAGS} +LDADD= -lasn1 -lcom_err -lkrb5 -lroken ${LDAPLDADD} +DPADD= ${LIBASN1} ${LIBCOM_ERR} ${LIBKRB5} ${LIBROKEN} ${LDAPDPADD} INCS= hdb-private.h \ hdb-protos.h \ From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 18:10:43 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76BDD1065675; Mon, 5 Dec 2011 18:10:43 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6721C8FC0C; Mon, 5 Dec 2011 18:10:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5IAh0e051864; Mon, 5 Dec 2011 18:10:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5IAhgg051862; Mon, 5 Dec 2011 18:10:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112051810.pB5IAhgg051862@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 5 Dec 2011 18:10:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228286 - head/sys/dev/ed X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 18:10:43 -0000 Author: yongari Date: Mon Dec 5 18:10:43 2011 New Revision: 228286 URL: http://svn.freebsd.org/changeset/base/228286 Log: Fix off by one error in mbuf access. Previously it caused panic. While I'm here use NULL to compare mbuf pointer and add additional check for zero length mbuf before accessing the mbuf. PR: kern/162932 Modified: head/sys/dev/ed/if_ed.c Modified: head/sys/dev/ed/if_ed.c ============================================================================== --- head/sys/dev/ed/if_ed.c Mon Dec 5 17:44:12 2011 (r228285) +++ head/sys/dev/ed/if_ed.c Mon Dec 5 18:10:43 2011 (r228286) @@ -1709,12 +1709,19 @@ ed_shmem_write_mbufs(struct ed_softc *sc break; } } - for (len = 0; m != 0; m = m->m_next) { - if (sc->isa16bit) - bus_space_write_region_2(sc->mem_bst, - sc->mem_bsh, dst, - mtod(m, uint16_t *), (m->m_len + 1)/ 2); - else + for (len = 0; m != NULL; m = m->m_next) { + if (m->m_len == 0) + continue; + if (sc->isa16bit) { + if (m->m_len > 1) + bus_space_write_region_2(sc->mem_bst, + sc->mem_bsh, dst, + mtod(m, uint16_t *), m->m_len / 2); + if ((m->m_len & 1) != 0) + bus_space_write_1(sc->mem_bst, sc->mem_bsh, + dst + m->m_len - 1, + *(mtod(m, uint8_t *) + m->m_len - 1)); + } else bus_space_write_region_1(sc->mem_bst, sc->mem_bsh, dst, mtod(m, uint8_t *), m->m_len); From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 18:29:25 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6066B1065677; Mon, 5 Dec 2011 18:29:25 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5042F8FC1E; Mon, 5 Dec 2011 18:29:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5ITPWd052447; Mon, 5 Dec 2011 18:29:25 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5ITP1f052443; Mon, 5 Dec 2011 18:29:25 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112051829.pB5ITP1f052443@svn.freebsd.org> From: Alan Cox Date: Mon, 5 Dec 2011 18:29:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228287 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 18:29:25 -0000 Author: alc Date: Mon Dec 5 18:29:25 2011 New Revision: 228287 URL: http://svn.freebsd.org/changeset/base/228287 Log: Introduce vm_reserv_alloc_contig() and teach vm_page_alloc_contig() how to use superpage reservations. So, for the first time, kernel virtual memory that is allocated by contigmalloc(), kmem_alloc_attr(), and kmem_alloc_contig() can be promoted to superpages. In fact, even a series of small contigmalloc() allocations may collectively result in a promoted superpage. Eliminate some duplication of code in vm_reserv_alloc_page(). Change the type of vm_reserv_reclaim_contig()'s first parameter in order that it be consistent with other vm_*_contig() functions. Tested by: marius (sparc64) Modified: head/sys/vm/vm_page.c head/sys/vm/vm_reserv.c head/sys/vm/vm_reserv.h Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Dec 5 18:10:43 2011 (r228286) +++ head/sys/vm/vm_page.c Mon Dec 5 18:29:25 2011 (r228287) @@ -1554,9 +1554,12 @@ vm_page_alloc_contig(vm_object_t object, cnt.v_free_count + cnt.v_cache_count >= npages)) { #if VM_NRESERVLEVEL > 0 retry: + if (object == NULL || (object->flags & OBJ_COLORED) == 0 || + (m_ret = vm_reserv_alloc_contig(object, pindex, npages, + low, high, alignment, boundary)) == NULL) #endif - m_ret = vm_phys_alloc_contig(npages, low, high, alignment, - boundary); + m_ret = vm_phys_alloc_contig(npages, low, high, + alignment, boundary); } else { mtx_unlock(&vm_page_queue_free_mtx); atomic_add_int(&vm_pageout_deficit, npages); @@ -1581,8 +1584,8 @@ retry: } else { #if VM_NRESERVLEVEL > 0 - if (vm_reserv_reclaim_contig(npages << PAGE_SHIFT, low, high, - alignment, boundary)) + if (vm_reserv_reclaim_contig(npages, low, high, alignment, + boundary)) goto retry; #endif } Modified: head/sys/vm/vm_reserv.c ============================================================================== --- head/sys/vm/vm_reserv.c Mon Dec 5 18:10:43 2011 (r228286) +++ head/sys/vm/vm_reserv.c Mon Dec 5 18:29:25 2011 (r228287) @@ -31,6 +31,9 @@ /* * Superpage reservation management module + * + * Any external functions defined by this module are only to be used by the + * virtual memory system. */ #include @@ -285,25 +288,54 @@ vm_reserv_populate(vm_reserv_t rv) } /* - * Allocates a page from an existing or newly-created reservation. + * Allocates a contiguous set of physical pages of the given size "npages" + * from an existing or newly-created reservation. All of the physical pages + * must be at or above the given physical address "low" and below the given + * physical address "high". The given value "alignment" determines the + * alignment of the first physical page in the set. If the given value + * "boundary" is non-zero, then the set of physical pages cannot cross any + * physical address boundary that is a multiple of that value. Both + * "alignment" and "boundary" must be a power of two. * * The object and free page queue must be locked. */ vm_page_t -vm_reserv_alloc_page(vm_object_t object, vm_pindex_t pindex) +vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t pindex, u_long npages, + vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary) { - vm_page_t m, mpred, msucc; + vm_paddr_t pa, size; + vm_page_t m, m_ret, mpred, msucc; vm_pindex_t first, leftcap, rightcap; vm_reserv_t rv; + u_long allocpages, maxpages, minpages; + int i, index, n; mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); + VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + KASSERT(npages != 0, ("vm_reserv_alloc_contig: npages is 0")); /* - * Is a reservation fundamentally not possible? + * Is a reservation fundamentally impossible? */ - VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); if (pindex < VM_RESERV_INDEX(object, pindex) || - pindex >= object->size) + pindex + npages > object->size) + return (NULL); + + /* + * All reservations of a particular size have the same alignment. + * Assuming that the first page is allocated from a reservation, the + * least significant bits of its physical address can be determined + * from its offset from the beginning of the reservation and the size + * of the reservation. + * + * Could the specified index within a reservation of the smallest + * possible size satisfy the alignment and boundary requirements? + */ + pa = VM_RESERV_INDEX(object, pindex) << PAGE_SHIFT; + if ((pa & (alignment - 1)) != 0) + return (NULL); + size = npages << PAGE_SHIFT; + if (((pa ^ (pa + size - 1)) & ~(boundary - 1)) != 0) return (NULL); /* @@ -313,31 +345,21 @@ vm_reserv_alloc_page(vm_object_t object, mpred = object->root; while (mpred != NULL) { KASSERT(mpred->pindex != pindex, - ("vm_reserv_alloc_page: pindex already allocated")); + ("vm_reserv_alloc_contig: pindex already allocated")); rv = vm_reserv_from_page(mpred); - if (rv->object == object && vm_reserv_has_pindex(rv, pindex)) { - m = &rv->pages[VM_RESERV_INDEX(object, pindex)]; - /* Handle vm_page_rename(m, new_object, ...). */ - if ((m->flags & (PG_CACHED | PG_FREE)) == 0) - return (NULL); - vm_reserv_populate(rv); - return (m); - } else if (mpred->pindex < pindex) { + if (rv->object == object && vm_reserv_has_pindex(rv, pindex)) + goto found; + else if (mpred->pindex < pindex) { if (msucc != NULL || (msucc = TAILQ_NEXT(mpred, listq)) == NULL) break; KASSERT(msucc->pindex != pindex, - ("vm_reserv_alloc_page: pindex already allocated")); + ("vm_reserv_alloc_contig: pindex already allocated")); rv = vm_reserv_from_page(msucc); if (rv->object == object && - vm_reserv_has_pindex(rv, pindex)) { - m = &rv->pages[VM_RESERV_INDEX(object, pindex)]; - /* Handle vm_page_rename(m, new_object, ...). */ - if ((m->flags & (PG_CACHED | PG_FREE)) == 0) - return (NULL); - vm_reserv_populate(rv); - return (m); - } else if (pindex < msucc->pindex) + vm_reserv_has_pindex(rv, pindex)) + goto found; + else if (pindex < msucc->pindex) break; } else if (msucc == NULL) { msucc = mpred; @@ -349,72 +371,238 @@ vm_reserv_alloc_page(vm_object_t object, } /* - * Determine the first index to the left that can be used. - */ - if (mpred == NULL) - leftcap = 0; - else if ((rv = vm_reserv_from_page(mpred))->object != object) - leftcap = mpred->pindex + 1; - else - leftcap = rv->pindex + VM_LEVEL_0_NPAGES; - - /* - * Determine the first index to the right that cannot be used. - */ - if (msucc == NULL) - rightcap = pindex + VM_LEVEL_0_NPAGES; - else if ((rv = vm_reserv_from_page(msucc))->object != object) - rightcap = msucc->pindex; - else - rightcap = rv->pindex; - - /* - * Determine if a reservation fits between the first index to - * the left that can be used and the first index to the right - * that cannot be used. + * Could at least one reservation fit between the first index to the + * left that can be used and the first index to the right that cannot + * be used? */ first = pindex - VM_RESERV_INDEX(object, pindex); - if (first < leftcap || first + VM_LEVEL_0_NPAGES > rightcap) - return (NULL); + if (mpred != NULL) { + if ((rv = vm_reserv_from_page(mpred))->object != object) + leftcap = mpred->pindex + 1; + else + leftcap = rv->pindex + VM_LEVEL_0_NPAGES; + if (leftcap > first) + return (NULL); + } + minpages = VM_RESERV_INDEX(object, pindex) + npages; + maxpages = roundup2(minpages, VM_LEVEL_0_NPAGES); + allocpages = maxpages; + if (msucc != NULL) { + if ((rv = vm_reserv_from_page(msucc))->object != object) + rightcap = msucc->pindex; + else + rightcap = rv->pindex; + if (first + maxpages > rightcap) { + if (maxpages == VM_LEVEL_0_NPAGES) + return (NULL); + allocpages = minpages; + } + } /* - * Would a new reservation extend past the end of the given object? + * Would the last new reservation extend past the end of the object? */ - if (object->size < first + VM_LEVEL_0_NPAGES) { + if (first + maxpages > object->size) { /* - * Don't allocate a new reservation if the object is a vnode or - * backed by another object that is a vnode. + * Don't allocate the last new reservation if the object is a + * vnode or backed by another object that is a vnode. */ if (object->type == OBJT_VNODE || (object->backing_object != NULL && - object->backing_object->type == OBJT_VNODE)) - return (NULL); + object->backing_object->type == OBJT_VNODE)) { + if (maxpages == VM_LEVEL_0_NPAGES) + return (NULL); + allocpages = minpages; + } /* Speculate that the object may grow. */ } /* - * Allocate a new reservation. - */ - m = vm_phys_alloc_pages(VM_FREEPOOL_DEFAULT, VM_LEVEL_0_ORDER); - if (m != NULL) { + * Allocate and populate the new reservations. The alignment and + * boundary specified for this allocation may be different from the + * alignment and boundary specified for the requested pages. For + * instance, the specified index may not be the first page within the + * first new reservation. + */ + m = vm_phys_alloc_contig(allocpages, low, high, ulmax(alignment, + VM_LEVEL_0_SIZE), boundary > VM_LEVEL_0_SIZE ? boundary : 0); + if (m == NULL) + return (NULL); + m_ret = NULL; + index = VM_RESERV_INDEX(object, pindex); + do { rv = vm_reserv_from_page(m); KASSERT(rv->pages == m, - ("vm_reserv_alloc_page: reserv %p's pages is corrupted", + ("vm_reserv_alloc_contig: reserv %p's pages is corrupted", rv)); KASSERT(rv->object == NULL, - ("vm_reserv_alloc_page: reserv %p isn't free", rv)); + ("vm_reserv_alloc_contig: reserv %p isn't free", rv)); LIST_INSERT_HEAD(&object->rvq, rv, objq); rv->object = object; rv->pindex = first; KASSERT(rv->popcnt == 0, - ("vm_reserv_alloc_page: reserv %p's popcnt is corrupted", + ("vm_reserv_alloc_contig: reserv %p's popcnt is corrupted", rv)); KASSERT(!rv->inpartpopq, - ("vm_reserv_alloc_page: reserv %p's inpartpopq is TRUE", + ("vm_reserv_alloc_contig: reserv %p's inpartpopq is TRUE", rv)); + n = ulmin(VM_LEVEL_0_NPAGES - index, npages); + for (i = 0; i < n; i++) + vm_reserv_populate(rv); + npages -= n; + if (m_ret == NULL) { + m_ret = &rv->pages[index]; + index = 0; + } + m += VM_LEVEL_0_NPAGES; + first += VM_LEVEL_0_NPAGES; + allocpages -= VM_LEVEL_0_NPAGES; + } while (allocpages > VM_LEVEL_0_NPAGES); + return (m_ret); + + /* + * Found a matching reservation. + */ +found: + index = VM_RESERV_INDEX(object, pindex); + /* Does the allocation fit within the reservation? */ + if (index + npages > VM_LEVEL_0_NPAGES) + return (NULL); + m = &rv->pages[index]; + pa = VM_PAGE_TO_PHYS(m); + if (pa < low || pa + size > high || (pa & (alignment - 1)) != 0 || + ((pa ^ (pa + size - 1)) & ~(boundary - 1)) != 0) + return (NULL); + /* Handle vm_page_rename(m, new_object, ...). */ + for (i = 0; i < npages; i++) + if ((rv->pages[index + i].flags & (PG_CACHED | PG_FREE)) == 0) + return (NULL); + for (i = 0; i < npages; i++) vm_reserv_populate(rv); - m = &rv->pages[VM_RESERV_INDEX(object, pindex)]; + return (m); +} + +/* + * Allocates a page from an existing or newly-created reservation. + * + * The object and free page queue must be locked. + */ +vm_page_t +vm_reserv_alloc_page(vm_object_t object, vm_pindex_t pindex) +{ + vm_page_t m, mpred, msucc; + vm_pindex_t first, leftcap, rightcap; + vm_reserv_t rv; + + mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); + VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); + + /* + * Is a reservation fundamentally impossible? + */ + if (pindex < VM_RESERV_INDEX(object, pindex) || + pindex >= object->size) + return (NULL); + + /* + * Look for an existing reservation. + */ + msucc = NULL; + mpred = object->root; + while (mpred != NULL) { + KASSERT(mpred->pindex != pindex, + ("vm_reserv_alloc_page: pindex already allocated")); + rv = vm_reserv_from_page(mpred); + if (rv->object == object && vm_reserv_has_pindex(rv, pindex)) + goto found; + else if (mpred->pindex < pindex) { + if (msucc != NULL || + (msucc = TAILQ_NEXT(mpred, listq)) == NULL) + break; + KASSERT(msucc->pindex != pindex, + ("vm_reserv_alloc_page: pindex already allocated")); + rv = vm_reserv_from_page(msucc); + if (rv->object == object && + vm_reserv_has_pindex(rv, pindex)) + goto found; + else if (pindex < msucc->pindex) + break; + } else if (msucc == NULL) { + msucc = mpred; + mpred = TAILQ_PREV(msucc, pglist, listq); + continue; + } + msucc = NULL; + mpred = object->root = vm_page_splay(pindex, object->root); } + + /* + * Could a reservation fit between the first index to the left that + * can be used and the first index to the right that cannot be used? + */ + first = pindex - VM_RESERV_INDEX(object, pindex); + if (mpred != NULL) { + if ((rv = vm_reserv_from_page(mpred))->object != object) + leftcap = mpred->pindex + 1; + else + leftcap = rv->pindex + VM_LEVEL_0_NPAGES; + if (leftcap > first) + return (NULL); + } + if (msucc != NULL) { + if ((rv = vm_reserv_from_page(msucc))->object != object) + rightcap = msucc->pindex; + else + rightcap = rv->pindex; + if (first + VM_LEVEL_0_NPAGES > rightcap) + return (NULL); + } + + /* + * Would a new reservation extend past the end of the object? + */ + if (first + VM_LEVEL_0_NPAGES > object->size) { + /* + * Don't allocate a new reservation if the object is a vnode or + * backed by another object that is a vnode. + */ + if (object->type == OBJT_VNODE || + (object->backing_object != NULL && + object->backing_object->type == OBJT_VNODE)) + return (NULL); + /* Speculate that the object may grow. */ + } + + /* + * Allocate and populate the new reservation. + */ + m = vm_phys_alloc_pages(VM_FREEPOOL_DEFAULT, VM_LEVEL_0_ORDER); + if (m == NULL) + return (NULL); + rv = vm_reserv_from_page(m); + KASSERT(rv->pages == m, + ("vm_reserv_alloc_page: reserv %p's pages is corrupted", rv)); + KASSERT(rv->object == NULL, + ("vm_reserv_alloc_page: reserv %p isn't free", rv)); + LIST_INSERT_HEAD(&object->rvq, rv, objq); + rv->object = object; + rv->pindex = first; + KASSERT(rv->popcnt == 0, + ("vm_reserv_alloc_page: reserv %p's popcnt is corrupted", rv)); + KASSERT(!rv->inpartpopq, + ("vm_reserv_alloc_page: reserv %p's inpartpopq is TRUE", rv)); + vm_reserv_populate(rv); + return (&rv->pages[VM_RESERV_INDEX(object, pindex)]); + + /* + * Found a matching reservation. + */ +found: + m = &rv->pages[VM_RESERV_INDEX(object, pindex)]; + /* Handle vm_page_rename(m, new_object, ...). */ + if ((m->flags & (PG_CACHED | PG_FREE)) == 0) + return (NULL); + vm_reserv_populate(rv); return (m); } @@ -627,16 +815,17 @@ vm_reserv_reclaim_inactive(void) * The free page queue lock must be held. */ boolean_t -vm_reserv_reclaim_contig(vm_paddr_t size, vm_paddr_t low, vm_paddr_t high, +vm_reserv_reclaim_contig(u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary) { - vm_paddr_t pa, pa_length; + vm_paddr_t pa, pa_length, size; vm_reserv_t rv; int i; mtx_assert(&vm_page_queue_free_mtx, MA_OWNED); - if (size > VM_LEVEL_0_SIZE - PAGE_SIZE) + if (npages > VM_LEVEL_0_NPAGES - 1) return (FALSE); + size = npages << PAGE_SHIFT; TAILQ_FOREACH(rv, &vm_rvq_partpop, partpopq) { pa = VM_PAGE_TO_PHYS(&rv->pages[VM_LEVEL_0_NPAGES - 1]); if (pa + PAGE_SIZE - size < low) { Modified: head/sys/vm/vm_reserv.h ============================================================================== --- head/sys/vm/vm_reserv.h Mon Dec 5 18:10:43 2011 (r228286) +++ head/sys/vm/vm_reserv.h Mon Dec 5 18:29:25 2011 (r228287) @@ -42,13 +42,19 @@ #if VM_NRESERVLEVEL > 0 +/* + * The following functions are only to be used by the virtual memory system. + */ +vm_page_t vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t pindex, + u_long npages, vm_paddr_t low, vm_paddr_t high, + u_long alignment, vm_paddr_t boundary); vm_page_t vm_reserv_alloc_page(vm_object_t object, vm_pindex_t pindex); void vm_reserv_break_all(vm_object_t object); boolean_t vm_reserv_free_page(vm_page_t m); void vm_reserv_init(void); int vm_reserv_level_iffullpop(vm_page_t m); boolean_t vm_reserv_reactivate_page(vm_page_t m); -boolean_t vm_reserv_reclaim_contig(vm_paddr_t size, vm_paddr_t low, +boolean_t vm_reserv_reclaim_contig(u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary); boolean_t vm_reserv_reclaim_inactive(void); void vm_reserv_rename(vm_page_t m, vm_object_t new_object, From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 18:38:56 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 560ED106564A; Mon, 5 Dec 2011 18:38:56 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id E0B298FC12; Mon, 5 Dec 2011 18:38:55 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id pB5IcsOx097863; Mon, 5 Dec 2011 19:38:54 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id pB5Icskr097862; Mon, 5 Dec 2011 19:38:54 +0100 (CET) (envelope-from marius) Date: Mon, 5 Dec 2011 19:38:54 +0100 From: Marius Strobl To: Luigi Rizzo Message-ID: <20111205183854.GC54475@alchemy.franken.de> References: <201112051533.pB5FXEuh043063@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201112051533.pB5FXEuh043063@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228281 - in head/sys/dev: e1000 re X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 18:38:56 -0000 On Mon, Dec 05, 2011 at 03:33:14PM +0000, Luigi Rizzo wrote: > Author: luigi > Date: Mon Dec 5 15:33:13 2011 > New Revision: 228281 > URL: http://svn.freebsd.org/changeset/base/228281 > > Log: > add netmap support for "em", "lem", "igb" and "re". > > On my hardware, "em" in netmap mode does about 1.388 Mpps > on one card (on an Asus motherboard), and 1.1 Mpps on another > card (PCIe bus). Both seem to be NIC-limited, because > i have the same rate even with the CPU running at 150 MHz. > > On the "re" driver the tx throughput is around 420-450 Kpps > on various (8111C and the like) chipsets. On the Rx side > performance seems much better, and i can receive the full > load generated by the "em" cards. > > "igb" is untested as i don't have the hardware. > <...> > +#ifdef DEV_NETMAP > + if (slot) { > + int si = i + na->tx_rings[txr->me].nkr_hwofs; > + void *addr; > + > + if (si >= na->num_tx_desc) > + si -= na->num_tx_desc; > + addr = NMB(slot + si); > + txr->tx_base[i].buffer_addr = > + htole64(vtophys(addr)); > + /* reload the map for netmap mode */ > + netmap_load_map(txr->txtag, > + txbuf->map, addr, na->buff_size); > + } > +#endif /* DEV_NETMAP */ Can these vtophys(9) usages be fixed to use bus_dma(9) instead so netmap works with bounce buffers, IOMMUs etc? Marius From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 19:32:31 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE521106566B; Mon, 5 Dec 2011 19:32:31 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 9AC5A8FC1A; Mon, 5 Dec 2011 19:32:31 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 6613E7300A; Mon, 5 Dec 2011 20:31:50 +0100 (CET) Date: Mon, 5 Dec 2011 20:31:50 +0100 From: Luigi Rizzo To: Marius Strobl Message-ID: <20111205193150.GB49118@onelab2.iet.unipi.it> References: <201112051533.pB5FXEuh043063@svn.freebsd.org> <20111205183854.GC54475@alchemy.franken.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111205183854.GC54475@alchemy.franken.de> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r228281 - in head/sys/dev: e1000 re X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 19:32:32 -0000 On Mon, Dec 05, 2011 at 07:38:54PM +0100, Marius Strobl wrote: > On Mon, Dec 05, 2011 at 03:33:14PM +0000, Luigi Rizzo wrote: ... > > +#ifdef DEV_NETMAP > > + if (slot) { > > + int si = i + na->tx_rings[txr->me].nkr_hwofs; > > + void *addr; > > + > > + if (si >= na->num_tx_desc) > > + si -= na->num_tx_desc; > > + addr = NMB(slot + si); > > + txr->tx_base[i].buffer_addr = > > + htole64(vtophys(addr)); > > + /* reload the map for netmap mode */ > > + netmap_load_map(txr->txtag, > > + txbuf->map, addr, na->buff_size); > > + } > > +#endif /* DEV_NETMAP */ > > Can these vtophys(9) usages be fixed to use bus_dma(9) instead so netmap > works with bounce buffers, IOMMUs etc? maybe. Can you suggest how to change it ? Consider that (not here but in other places) vtophys() is called in a time-critical loop so performance matters a lot. As long as i can compute the physical address in advance and cache it in my own array, i suppose that should be fine (in which case the calls to vtophys(addr) would become NMPB(slot + si) where the NMPB() macro would hide translations and checks. cheers luigi > From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 19:34:03 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4262B106564A; Mon, 5 Dec 2011 19:34:03 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32CF88FC15; Mon, 5 Dec 2011 19:34:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5JY36f054962; Mon, 5 Dec 2011 19:34:03 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5JY3iK054960; Mon, 5 Dec 2011 19:34:03 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201112051934.pB5JY3iK054960@svn.freebsd.org> From: Mikolaj Golub Date: Mon, 5 Dec 2011 19:34:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228288 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 19:34:03 -0000 Author: trociny Date: Mon Dec 5 19:34:02 2011 New Revision: 228288 URL: http://svn.freebsd.org/changeset/base/228288 Log: Protect kern.proc.auxv and kern.proc.ps_strings sysctls with p_candebug(). Citing jilles: If we are ever going to do ASLR, the AUXV information tells an attacker where the stack, executable and RTLD are located, which defeats much of the point of randomizing the addresses in the first place. Given that the AUXV information seems to be used by debuggers only anyway, I think it would be good to move it to p_candebug() now. The full virtual memory maps (KERN_PROC_VMMAP, procstat -v) are already under p_candebug(). Suggested by: jilles Discussed with: rwatson MFC after: 1 week Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Mon Dec 5 18:29:25 2011 (r228287) +++ head/sys/kern/kern_proc.c Mon Dec 5 19:34:02 2011 (r228288) @@ -1782,7 +1782,8 @@ sysctl_kern_proc_auxv(SYSCTL_HANDLER_ARG PROC_UNLOCK(p); return (ESRCH); } - if ((error = p_cansee(curthread, p)) != 0) { + error = p_candebug(curthread, p); + if (error != 0) { PROC_UNLOCK(p); return (error); } @@ -2456,7 +2457,8 @@ sysctl_kern_proc_ps_strings(SYSCTL_HANDL p = pfind((pid_t)name[0]); if (p == NULL) return (ESRCH); - if ((error = p_cansee(curthread, p)) != 0) { + error = p_cansee(curthread, p); + if (error != 0) { PROC_UNLOCK(p); return (error); } From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 19:39:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DF57106564A; Mon, 5 Dec 2011 19:39:15 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E3958FC08; Mon, 5 Dec 2011 19:39:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5JdFAN055153; Mon, 5 Dec 2011 19:39:15 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5JdF7k055151; Mon, 5 Dec 2011 19:39:15 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201112051939.pB5JdF7k055151@svn.freebsd.org> From: Mikolaj Golub Date: Mon, 5 Dec 2011 19:39:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228289 - head/usr.bin/procstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 19:39:15 -0000 Author: trociny Date: Mon Dec 5 19:39:15 2011 New Revision: 228289 URL: http://svn.freebsd.org/changeset/base/228289 Log: Don't output a warning if kern.proc.auxv sysctl has returned EPERM. After r228288 this is rather a normal situation. MFC after: 1 week Modified: head/usr.bin/procstat/procstat_auxv.c Modified: head/usr.bin/procstat/procstat_auxv.c ============================================================================== --- head/usr.bin/procstat/procstat_auxv.c Mon Dec 5 19:34:02 2011 (r228288) +++ head/usr.bin/procstat/procstat_auxv.c Mon Dec 5 19:39:15 2011 (r228289) @@ -66,7 +66,7 @@ procstat_auxv(struct kinfo_proc *kipp) name[3] = kipp->ki_pid; len = sizeof(auxv) * sizeof(*auxv); error = sysctl(name, 4, auxv, &len, NULL, 0); - if (error < 0 && errno != ESRCH) { + if (error < 0 && errno != ESRCH && errno != EPERM) { warn("sysctl: kern.proc.auxv: %d: %d", kipp->ki_pid, errno); return; } From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 20:14:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39D731065672; Mon, 5 Dec 2011 20:14:52 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id A91E88FC18; Mon, 5 Dec 2011 20:14:51 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id pB5KEomL098182; Mon, 5 Dec 2011 21:14:50 +0100 (CET) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id pB5KEomJ098181; Mon, 5 Dec 2011 21:14:50 +0100 (CET) (envelope-from marius) Date: Mon, 5 Dec 2011 21:14:50 +0100 From: Marius Strobl To: Luigi Rizzo Message-ID: <20111205201450.GR60194@alchemy.franken.de> References: <201112051533.pB5FXEuh043063@svn.freebsd.org> <20111205183854.GC54475@alchemy.franken.de> <20111205193150.GB49118@onelab2.iet.unipi.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20111205193150.GB49118@onelab2.iet.unipi.it> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r228281 - in head/sys/dev: e1000 re X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 20:14:52 -0000 On Mon, Dec 05, 2011 at 08:31:50PM +0100, Luigi Rizzo wrote: > On Mon, Dec 05, 2011 at 07:38:54PM +0100, Marius Strobl wrote: > > On Mon, Dec 05, 2011 at 03:33:14PM +0000, Luigi Rizzo wrote: > ... > > > +#ifdef DEV_NETMAP > > > + if (slot) { > > > + int si = i + na->tx_rings[txr->me].nkr_hwofs; > > > + void *addr; > > > + > > > + if (si >= na->num_tx_desc) > > > + si -= na->num_tx_desc; > > > + addr = NMB(slot + si); > > > + txr->tx_base[i].buffer_addr = > > > + htole64(vtophys(addr)); > > > + /* reload the map for netmap mode */ > > > + netmap_load_map(txr->txtag, > > > + txbuf->map, addr, na->buff_size); > > > + } > > > +#endif /* DEV_NETMAP */ > > > > Can these vtophys(9) usages be fixed to use bus_dma(9) instead so netmap > > works with bounce buffers, IOMMUs etc? > > maybe. Can you suggest how to change it ? > > Consider that (not here but in other places) vtophys() is called > in a time-critical loop so performance matters a lot. As long as i > can compute the physical address in advance and cache it in my own > array, i suppose that should be fine (in which case the calls to > vtophys(addr) would become NMPB(slot + si) where the NMPB() macro > would hide translations and checks. > Basically, you'd call bus_dmamap_load(9) on the netmap buffers using the tags and maps the driver also uses in the !netmap case to load mbufs. If you're generally pre-allocating the netmap buffers (sorry, I don't have time to check the netmap code) it should also be fine to cache the resulting physical addresses obtained via the bus_dma callback. You'd still need to call bus_dmamap_sync(9) whenever you actually assign a buffer to the hardware and when taking off of it so the bounce buffers are copied over, streaming buffers are synced etc. Marius From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 20:46:38 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D06A7106566B; Mon, 5 Dec 2011 20:46:38 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe09.c2i.net [212.247.155.2]) by mx1.freebsd.org (Postfix) with ESMTP id 999788FC08; Mon, 5 Dec 2011 20:46:37 +0000 (UTC) X-T2-Spam-Status: No, hits=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe09.swip.net (CommuniGate Pro SMTP 5.4.2) with ESMTPA id 38381043; Mon, 05 Dec 2011 21:46:34 +0100 From: Hans Petter Selasky To: Max Khon Date: Mon, 5 Dec 2011 21:43:59 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <201111301811.pAUIBnr6008539@svn.freebsd.org> In-Reply-To: <201111301811.pAUIBnr6008539@svn.freebsd.org> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Message-Id: <201112052143.59972.hselasky@c2i.net> Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r228158 - in head: . share/mk sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 20:46:38 -0000 Hi, I see regressions when building kernel modules from /usr/ports: On Monday 05 December 2011 14:39:56 Robert Huff wrote: > Hello: > When trying to update I get: > > ===> Building for cuse4bsd-kmod-0.1.21_2 > make -f > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > 21/Makefile.lib HAVE_DEBUG=YES all Warning: Object directory not changed > from original > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > 21 make -f > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > 21/Makefile.kmod all "/sys/conf/kmod.mk", line 204: Malformed conditional > (${MK_CTF} != "no") "/sys/conf/kmod.mk", line 206: if-less endif > make: fatal errors encountered -- cannot continue > *** Error code 1 --HPS From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 21:38:45 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA1301065678; Mon, 5 Dec 2011 21:38:45 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA4718FC12; Mon, 5 Dec 2011 21:38:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5LcjMe058891; Mon, 5 Dec 2011 21:38:45 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5LcjH0058889; Mon, 5 Dec 2011 21:38:45 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201112052138.pB5LcjH0058889@svn.freebsd.org> From: Marius Strobl Date: Mon, 5 Dec 2011 21:38:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228290 - head/sys/dev/mii X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 21:38:46 -0000 Author: marius Date: Mon Dec 5 21:38:45 2011 New Revision: 228290 URL: http://svn.freebsd.org/changeset/base/228290 Log: - In mii_attach(9) just set the driver for a newly added miibus(4) instance before calling bus_enumerate_hinted_children(9) (which is the minimum for this to work) instead of fully probing it so later on we can just call bus_generic_attach(9) on the parent of the miibus(4) instance. The latter is necessary in order to work around what seems to be a bzzarre race in newbus affecting a few machines since r227687, causing no driver being probed for the newly added miibus(4) instance. Presumably this is the same race that was the motivation for the work around done in r215348. Reported and tested by: yongari - Revert the removal of a static in r221913 in order to help compilers to produce more optimal code. Modified: head/sys/dev/mii/mii.c Modified: head/sys/dev/mii/mii.c ============================================================================== --- head/sys/dev/mii/mii.c Mon Dec 5 19:39:15 2011 (r228289) +++ head/sys/dev/mii/mii.c Mon Dec 5 21:38:45 2011 (r228290) @@ -499,7 +499,7 @@ mii_attach(device_t dev, device_t *miibu free(children, M_TEMP); if (first != 0) { - rv = device_probe(*miibus); + rv = device_set_driver(*miibus, &miibus_driver); if (rv != 0) goto fail; bus_enumerate_hinted_children(*miibus); @@ -511,7 +511,7 @@ mii_attach(device_t dev, device_t *miibu rv = ENXIO; goto fail; } - rv = device_attach(*miibus); + rv = bus_generic_attach(dev); if (rv != 0) goto fail; @@ -626,7 +626,7 @@ mii_down(struct mii_data *mii) static unsigned char mii_bitreverse(unsigned char x) { - unsigned const char const nibbletab[16] = { + static unsigned const char const nibbletab[16] = { 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15 }; From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 22:09:07 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1192106566C; Mon, 5 Dec 2011 22:09:07 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C7E438FC1B; Mon, 5 Dec 2011 22:09:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5M97tA060262; Mon, 5 Dec 2011 22:09:07 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5M97vE060260; Mon, 5 Dec 2011 22:09:07 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112052209.pB5M97vE060260@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 5 Dec 2011 22:09:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228291 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 22:09:08 -0000 Author: yongari Date: Mon Dec 5 22:09:07 2011 New Revision: 228291 URL: http://svn.freebsd.org/changeset/base/228291 Log: Remove NetBSD license. r199548 removed all bit macros that were derived from NetBSD. Modified: head/sys/dev/et/if_etreg.h Modified: head/sys/dev/et/if_etreg.h ============================================================================== --- head/sys/dev/et/if_etreg.h Mon Dec 5 21:38:45 2011 (r228290) +++ head/sys/dev/et/if_etreg.h Mon Dec 5 22:09:07 2011 (r228291) @@ -34,41 +34,6 @@ * $DragonFly: src/sys/dev/netif/et/if_etreg.h,v 1.3 2007/10/23 14:28:42 sephe Exp $ * $FreeBSD$ */ -/*- - * Portions of this code is derived from NetBSD which is covered by - * the following license: - * - * Copyright (c) 2004, 2005 David Young. All rights reserved. - * - * Programmed for NetBSD by David Young. - * - * 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. The name of David Young may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY David Young ``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 David - * Young 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. - * - * $DragonFly: src/sys/sys/bitops.h,v 1.1 2007/10/14 04:15:17 sephe Exp $ - */ #ifndef _IF_ETREG_H #define _IF_ETREG_H From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 22:22:39 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 949A91065670; Mon, 5 Dec 2011 22:22:39 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 84C5B8FC0A; Mon, 5 Dec 2011 22:22:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5MMdRw060736; Mon, 5 Dec 2011 22:22:39 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5MMdNU060734; Mon, 5 Dec 2011 22:22:39 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112052222.pB5MMdNU060734@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 5 Dec 2011 22:22:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228292 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 22:22:39 -0000 Author: yongari Date: Mon Dec 5 22:22:39 2011 New Revision: 228292 URL: http://svn.freebsd.org/changeset/base/228292 Log: Implement suspend/resume methods. Driver has no issue with suspend/resume. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Mon Dec 5 22:09:07 2011 (r228291) +++ head/sys/dev/et/if_et.c Mon Dec 5 22:22:39 2011 (r228292) @@ -87,6 +87,8 @@ static int et_probe(device_t); static int et_attach(device_t); static int et_detach(device_t); static int et_shutdown(device_t); +static int et_suspend(device_t); +static int et_resume(device_t); static int et_miibus_readreg(device_t, int, int); static int et_miibus_writereg(device_t, int, int, int); @@ -169,6 +171,8 @@ static device_method_t et_methods[] = { DEVMETHOD(device_attach, et_attach), DEVMETHOD(device_detach, et_detach), DEVMETHOD(device_shutdown, et_shutdown), + DEVMETHOD(device_suspend, et_suspend), + DEVMETHOD(device_resume, et_resume), DEVMETHOD(miibus_readreg, et_miibus_readreg), DEVMETHOD(miibus_writereg, et_miibus_writereg), @@ -2451,3 +2455,29 @@ et_setup_rxdesc(struct et_rxbuf_data *rb bus_dmamap_sync(rx_ring->rr_dtag, rx_ring->rr_dmap, BUS_DMASYNC_PREWRITE); } + +static int +et_suspend(device_t dev) +{ + struct et_softc *sc; + + sc = device_get_softc(dev); + ET_LOCK(sc); + if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + et_stop(sc); + ET_UNLOCK(sc); + return (0); +} + +static int +et_resume(device_t dev) +{ + struct et_softc *sc; + + sc = device_get_softc(dev); + ET_LOCK(sc); + if ((sc->ifp->if_flags & IFF_UP) != 0) + et_init_locked(sc); + ET_UNLOCK(sc); + return (0); +} From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 22:55:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A4CE3106564A; Mon, 5 Dec 2011 22:55:52 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7B49F8FC1B; Mon, 5 Dec 2011 22:55:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5Mtqi7061721; Mon, 5 Dec 2011 22:55:52 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5MtqVt061719; Mon, 5 Dec 2011 22:55:52 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112052255.pB5MtqVt061719@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 5 Dec 2011 22:55:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228293 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 22:55:52 -0000 Author: yongari Date: Mon Dec 5 22:55:52 2011 New Revision: 228293 URL: http://svn.freebsd.org/changeset/base/228293 Log: Fix alt(4) support. Also add check for number of available TX descriptors before trying to send frames. If we're not able to send a frame, make sure to prepend it to if_snd queue such that alt(4) should work. While I'm here prefer ETHER_BPF_MTAP to BPF_MTAP. ETHER_BPF_MTAP should be used for controllers that support VLAN hardware tag insertion. The controller supports VLAN tag insertion but lacks VLAN tag stripping in RX path though. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Mon Dec 5 22:22:39 2011 (r228292) +++ head/sys/dev/et/if_et.c Mon Dec 5 22:55:52 2011 (r228293) @@ -338,7 +338,8 @@ et_attach(device_t dev) ifp->if_mtu = ETHERMTU; ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_VLAN_MTU; ifp->if_capenable = ifp->if_capabilities; - IFQ_SET_MAXLEN(&ifp->if_snd, ET_TX_NDESC); + ifp->if_snd.ifq_drv_maxlen = ET_TX_NDESC - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, ET_TX_NDESC - 1); IFQ_SET_READY(&ifp->if_snd); et_chip_attach(sc); @@ -1257,12 +1258,13 @@ et_ioctl(struct ifnet *ifp, u_long cmd, static void et_start_locked(struct ifnet *ifp) { - struct et_softc *sc = ifp->if_softc; + struct et_softc *sc; + struct mbuf *m_head = NULL; struct et_txbuf_data *tbd; - int trans; + int enq; + sc = ifp->if_softc; ET_LOCK_ASSERT(sc); - tbd = &sc->sc_tx_data; if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0) return; @@ -1270,30 +1272,32 @@ et_start_locked(struct ifnet *ifp) if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; - trans = 0; - for (;;) { - struct mbuf *m; - - if ((tbd->tbd_used + ET_NSEG_SPARE) > ET_TX_NDESC) { + tbd = &sc->sc_tx_data; + for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { + if (tbd->tbd_used + ET_NSEG_SPARE >= ET_TX_NDESC) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - IFQ_DEQUEUE(&ifp->if_snd, m); - if (m == NULL) + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); + if (m_head == NULL) break; - if (et_encap(sc, &m)) { - ifp->if_oerrors++; - ifp->if_drv_flags |= IFF_DRV_OACTIVE; + if (et_encap(sc, &m_head)) { + if (m_head == NULL) { + ifp->if_oerrors++; + break; + } + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); + if (tbd->tbd_used > 0) + ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } - trans = 1; - - BPF_MTAP(ifp, m); + enq++; + ETHER_BPF_MTAP(ifp, m_head); } - if (trans) + if (enq > 0) sc->watchdog_timer = 5; } From owner-svn-src-all@FreeBSD.ORG Mon Dec 5 23:29:27 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B258D106564A; Mon, 5 Dec 2011 23:29:27 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1CBA8FC13; Mon, 5 Dec 2011 23:29:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB5NTRfx062802; Mon, 5 Dec 2011 23:29:27 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB5NTRJV062800; Mon, 5 Dec 2011 23:29:27 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201112052329.pB5NTRJV062800@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Mon, 5 Dec 2011 23:29:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228294 - stable/8/share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Dec 2011 23:29:27 -0000 Author: gonzo Date: Mon Dec 5 23:29:27 2011 New Revision: 228294 URL: http://svn.freebsd.org/changeset/base/228294 Log: Unbreak Modified: stable/8/share/mk/bsd.cpu.mk Modified: stable/8/share/mk/bsd.cpu.mk ============================================================================== --- stable/8/share/mk/bsd.cpu.mk Mon Dec 5 22:55:52 2011 (r228293) +++ stable/8/share/mk/bsd.cpu.mk Mon Dec 5 23:29:27 2011 (r228294) @@ -242,11 +242,11 @@ LD += -EB .if ${MACHINE_ARCH} == "mips" . if defined(TARGET_BIG_ENDIAN) CFLAGS += -EB -LDFLAGS += -Wl,-EB +LDFLAGS += -EB LD += -EB . else CFLAGS += -EL -LDFLAGS += -Wl,-EL +LDFLAGS += -EL LD += -EL . endif CFLAGS += -msoft-float -G0 -mno-dsp -mabicalls From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 00:05:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2AE31065670; Tue, 6 Dec 2011 00:05:12 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B23E28FC12; Tue, 6 Dec 2011 00:05:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB605CIg063969; Tue, 6 Dec 2011 00:05:12 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB605CO8063967; Tue, 6 Dec 2011 00:05:12 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201112060005.pB605CO8063967@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Tue, 6 Dec 2011 00:05:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228295 - stable/8/sys/mips/mips X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 00:05:12 -0000 Author: gonzo Date: Tue Dec 6 00:05:12 2011 New Revision: 228295 URL: http://svn.freebsd.org/changeset/base/228295 Log: Unbreak build: add missing coma Modified: stable/8/sys/mips/mips/elf_machdep.c Modified: stable/8/sys/mips/mips/elf_machdep.c ============================================================================== --- stable/8/sys/mips/mips/elf_machdep.c Mon Dec 5 23:29:27 2011 (r228294) +++ stable/8/sys/mips/mips/elf_machdep.c Tue Dec 6 00:05:12 2011 (r228295) @@ -78,7 +78,7 @@ struct sysentvec elf64_freebsd_sysvec = .sv_setregs = exec_setregs, .sv_fixlimit = NULL, .sv_maxssiz = NULL, - .sv_flags = SV_ABI_FREEBSD | SV_LP64 + .sv_flags = SV_ABI_FREEBSD | SV_LP64, .sv_schedtail = NULL, }; From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 00:11:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2265106564A; Tue, 6 Dec 2011 00:11:20 +0000 (UTC) (envelope-from gonzo@hq.bluezbox.com) Received: from hq.bluezbox.com (hq.bluezbox.com [70.38.37.145]) by mx1.freebsd.org (Postfix) with ESMTP id 3667B8FC16; Tue, 6 Dec 2011 00:11:20 +0000 (UTC) Received: from localhost ([127.0.0.1]) by hq.bluezbox.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.73 (FreeBSD)) (envelope-from ) id 1RXiBp-000HFX-Vq; Mon, 05 Dec 2011 15:43:18 -0800 Message-ID: <4EDD5716.6030006@freebsd.org> Date: Mon, 05 Dec 2011 15:43:18 -0800 From: Oleksandr Tymoshenko User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 References: <201112052329.pB5NTRJV062800@svn.freebsd.org> In-Reply-To: <201112052329.pB5NTRJV062800@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: gonzo@hq.bluezbox.com X-Spam-Level: --- X-Spam-Report: Spam detection software, running on the system "hq.bluezbox.com", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: Sorry for short comment. It was editor glitch :( Proper comment is: Unbreak 8-STABLE build. LDFLAGS is used as an argument for both ld (in kmod.mk) and cc when it acts as a linker. In latter case cc properly passes byte-order settings to ld so there is no need for -Wl, part. [...] Content analysis details: (-3.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.8 ALL_TRUSTED Passed through trusted hosts only via SMTP 1.3 MISSING_HEADERS Missing To: header -2.6 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r228294 - stable/8/share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 00:11:20 -0000 Sorry for short comment. It was editor glitch :( Proper comment is: Unbreak 8-STABLE build. LDFLAGS is used as an argument for both ld (in kmod.mk) and cc when it acts as a linker. In latter case cc properly passes byte-order settings to ld so there is no need for -Wl, part. On 05/12/2011 3:29 PM, Oleksandr Tymoshenko wrote: > Author: gonzo > Date: Mon Dec 5 23:29:27 2011 > New Revision: 228294 > URL: http://svn.freebsd.org/changeset/base/228294 > > Log: > Unbreak > > Modified: > stable/8/share/mk/bsd.cpu.mk > > Modified: stable/8/share/mk/bsd.cpu.mk > ============================================================================== > --- stable/8/share/mk/bsd.cpu.mk Mon Dec 5 22:55:52 2011 (r228293) > +++ stable/8/share/mk/bsd.cpu.mk Mon Dec 5 23:29:27 2011 (r228294) > @@ -242,11 +242,11 @@ LD += -EB > .if ${MACHINE_ARCH} == "mips" > . if defined(TARGET_BIG_ENDIAN) > CFLAGS += -EB > -LDFLAGS += -Wl,-EB > +LDFLAGS += -EB > LD += -EB > . else > CFLAGS += -EL > -LDFLAGS += -Wl,-EL > +LDFLAGS += -EL > LD += -EL > . endif > CFLAGS += -msoft-float -G0 -mno-dsp -mabicalls > From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 00:13:40 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9E47106566B; Tue, 6 Dec 2011 00:13:40 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D944C8FC17; Tue, 6 Dec 2011 00:13:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB60DeAI064248; Tue, 6 Dec 2011 00:13:40 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB60DelX064246; Tue, 6 Dec 2011 00:13:40 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201112060013.pB60DelX064246@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Tue, 6 Dec 2011 00:13:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228296 - stable/8/sys/mips/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 00:13:41 -0000 Author: gonzo Date: Tue Dec 6 00:13:40 2011 New Revision: 228296 URL: http://svn.freebsd.org/changeset/base/228296 Log: Unbreak mips64 build by MFCing r202031 that fixes _ALIGN macros Modified: stable/8/sys/mips/include/param.h Modified: stable/8/sys/mips/include/param.h ============================================================================== --- stable/8/sys/mips/include/param.h Tue Dec 6 00:05:12 2011 (r228295) +++ stable/8/sys/mips/include/param.h Tue Dec 6 00:13:40 2011 (r228296) @@ -77,11 +77,11 @@ /* * Round p (pointer or byte index) up to a correctly-aligned value for all - * data types (int, long, ...). The result is u_int and must be cast to + * data types (int, long, ...). The result is u_long and must be cast to * any desired pointer type. */ #define _ALIGNBYTES 7 -#define _ALIGN(p) (((u_int)(p) + _ALIGNBYTES) &~ _ALIGNBYTES) +#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) &~ _ALIGNBYTES) #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 00:18:38 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 084091065670; Tue, 6 Dec 2011 00:18:38 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC8168FC0A; Tue, 6 Dec 2011 00:18:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB60IbOj064428; Tue, 6 Dec 2011 00:18:37 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB60Ibfa064426; Tue, 6 Dec 2011 00:18:37 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112060018.pB60Ibfa064426@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 6 Dec 2011 00:18:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228297 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 00:18:38 -0000 Author: yongari Date: Tue Dec 6 00:18:37 2011 New Revision: 228297 URL: http://svn.freebsd.org/changeset/base/228297 Log: et(4) supports VLAN oversized frame so correctly set header length. While I'm here remove initializing if_mtu, it is set by ether_ifattach(9). Also move callout_init_mtx(9) to the right below driver lock initialization. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Tue Dec 6 00:13:40 2011 (r228296) +++ head/sys/dev/et/if_et.c Tue Dec 6 00:18:37 2011 (r228297) @@ -244,6 +244,7 @@ et_attach(device_t dev) sc->dev = dev; mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); + callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0); ifp = sc->ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { @@ -335,7 +336,6 @@ et_attach(device_t dev) ifp->if_init = et_init; ifp->if_ioctl = et_ioctl; ifp->if_start = et_start; - ifp->if_mtu = ETHERMTU; ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_VLAN_MTU; ifp->if_capenable = ifp->if_capabilities; ifp->if_snd.ifq_drv_maxlen = ET_TX_NDESC - 1; @@ -352,7 +352,9 @@ et_attach(device_t dev) } ether_ifattach(ifp, eaddr); - callout_init_mtx(&sc->sc_tick, &sc->sc_mtx, 0); + + /* Tell the upper layer(s) we support long frames. */ + ifp->if_hdrlen = sizeof(struct ether_vlan_header); error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_NET | INTR_MPSAFE, NULL, et_intr, sc, &sc->sc_irq_handle); From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 00:58:43 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 64E8D106564A; Tue, 6 Dec 2011 00:58:43 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B8ED8FC0C; Tue, 6 Dec 2011 00:58:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB60whQ0065619; Tue, 6 Dec 2011 00:58:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB60whiT065617; Tue, 6 Dec 2011 00:58:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112060058.pB60whiT065617@svn.freebsd.org> From: Pyun YongHyeon Date: Tue, 6 Dec 2011 00:58:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228298 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 00:58:43 -0000 Author: yongari Date: Tue Dec 6 00:58:42 2011 New Revision: 228298 URL: http://svn.freebsd.org/changeset/base/228298 Log: Make et_probe() return BUS_PROBE_DEFAULT such that allow other driver that has high precedence for the controller override et(4). Add missing callout_drain(9) in device detach and rework detach routine. While I'm here use rman_get_rid(9) instead of using cached resource id because bus methods are free to change the id. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Tue Dec 6 00:18:37 2011 (r228297) +++ head/sys/dev/et/if_et.c Tue Dec 6 00:58:42 2011 (r228298) @@ -226,7 +226,7 @@ et_probe(device_t dev) for (d = et_devices; d->desc != NULL; ++d) { if (vid == d->vid && did == d->did) { device_set_desc(dev, d->desc); - return (0); + return (BUS_PROBE_DEFAULT); } } return (ENXIO); @@ -378,31 +378,27 @@ et_detach(device_t dev) struct et_softc *sc = device_get_softc(dev); if (device_is_attached(dev)) { - struct ifnet *ifp = sc->ifp; - + ether_ifdetach(sc->ifp); ET_LOCK(sc); et_stop(sc); - bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_handle); ET_UNLOCK(sc); - - ether_ifdetach(ifp); + callout_drain(&sc->sc_tick); } if (sc->sc_miibus != NULL) device_delete_child(dev, sc->sc_miibus); bus_generic_detach(dev); - if (sc->sc_irq_res != NULL) { - bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, - sc->sc_irq_res); - } + if (sc->sc_irq_handle != NULL) + bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_handle); + if (sc->sc_irq_res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->sc_irq_res), sc->sc_irq_res); if ((sc->sc_flags & ET_FLAG_MSI) != 0) pci_release_msi(dev); - - if (sc->sc_mem_res != NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, sc->sc_mem_rid, - sc->sc_mem_res); - } + if (sc->sc_mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->sc_mem_res), sc->sc_mem_res); if (sc->ifp != NULL) if_free(sc->ifp); From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 06:28:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E259106566C; Tue, 6 Dec 2011 06:28:33 +0000 (UTC) (envelope-from grehan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C2628FC18; Tue, 6 Dec 2011 06:28:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB66SX09076104; Tue, 6 Dec 2011 06:28:33 GMT (envelope-from grehan@svn.freebsd.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB66SWVG076093; Tue, 6 Dec 2011 06:28:32 GMT (envelope-from grehan@svn.freebsd.org) Message-Id: <201112060628.pB66SWVG076093@svn.freebsd.org> From: Peter Grehan Date: Tue, 6 Dec 2011 06:28:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228301 - in head/sys/dev/virtio: . balloon block network pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 06:28:33 -0000 Author: grehan Date: Tue Dec 6 06:28:32 2011 New Revision: 228301 URL: http://svn.freebsd.org/changeset/base/228301 Log: Catch up with Bryan Venteicher's virtio Hg repo: c162516 Remove vtblk_sector_size c162515 Wrap long license lines c162514 Remove vtblk_unit c162513 Wrap long lines in the license. c162512 Remove verbose messages when link goes up/down. A similar message is printed elsewhere as a result of if_link_state_change(). c162511 Explicity compare pointer to NULL c162510 Allocate the mac filter table at attach time. c162509 Add real BSD licenses to the header files copied from Linux. The chases upstream changes made in Linux awhile ago. c162508 Only notify if we actually dequeued something. c162507 Change a couple of if () { KASSERT(...) } to just KASSERTs. In non-debug kernels, the if() { } probably get optomized away, but I guess this is clearer. c162506 Remove VIRTIO_BLK_F_TOPOLOGY fields in the config. TOPOLOGY has since been removed from the spec, and the FreeBSD didn't really do anything with the fields anyways. c162505 Move vtblk_enqueue_request() outside the locks when getting the ident. c162504 Remove soon to be uneeded trylock during dump [1]. http://lists.freebsd.org/pipermail/freebsd-current/2011-November/029226.html c162503 Remove emtpy line c162502 Drop frame if cannot allocate a vtnet_tx_header. If we don't, we set OACTIVE, but if there are no other frames in flight, vtnet_txeof() will never be called to unset OACTIVE. The interface would have to be down/up'ed in order to become usable. We could be cuter here and only do this if the virtqueue is emtpy, but its probably not worth the complication. c162501 Start mbuf replacement loop at 1 for clarity Obtained from: Bryan Venteicher bryanv at daemoninthecloset dot org Modified: head/sys/dev/virtio/balloon/virtio_balloon.c head/sys/dev/virtio/balloon/virtio_balloon.h head/sys/dev/virtio/block/virtio_blk.c head/sys/dev/virtio/block/virtio_blk.h head/sys/dev/virtio/network/if_vtnet.c head/sys/dev/virtio/network/if_vtnetvar.h head/sys/dev/virtio/network/virtio_net.h head/sys/dev/virtio/pci/virtio_pci.h head/sys/dev/virtio/virtio.h head/sys/dev/virtio/virtio_ring.h Modified: head/sys/dev/virtio/balloon/virtio_balloon.c ============================================================================== --- head/sys/dev/virtio/balloon/virtio_balloon.c Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/balloon/virtio_balloon.c Tue Dec 6 06:28:32 2011 (r228301) @@ -475,7 +475,6 @@ vtballoon_update_size(struct vtballoon_s virtio_write_dev_config_4(sc->vtballoon_dev, offsetof(struct virtio_balloon_config, actual), htole32(sc->vtballoon_current_npages)); - } static int Modified: head/sys/dev/virtio/balloon/virtio_balloon.h ============================================================================== --- head/sys/dev/virtio/balloon/virtio_balloon.h Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/balloon/virtio_balloon.h Tue Dec 6 06:28:32 2011 (r228301) @@ -1,7 +1,30 @@ -/* +/*- * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of IBM nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM 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$ */ Modified: head/sys/dev/virtio/block/virtio_blk.c ============================================================================== --- head/sys/dev/virtio/block/virtio_blk.c Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/block/virtio_blk.c Tue Dec 6 06:28:32 2011 (r228301) @@ -87,9 +87,7 @@ struct vtblk_softc { struct taskqueue *vtblk_tq; struct task vtblk_intr_task; - int vtblk_sector_size; int vtblk_max_nsegs; - int vtblk_unit; int vtblk_request_count; struct vtblk_request vtblk_dump_request; @@ -185,7 +183,6 @@ TUNABLE_INT("hw.vtblk.no_ident", &vtblk_ mtx_init(VTBLK_MTX((_sc)), (_name), \ "VTBLK Lock", MTX_DEF) #define VTBLK_LOCK(_sc) mtx_lock(VTBLK_MTX((_sc))) -#define VTBLK_TRYLOCK(_sc) mtx_trylock(VTBLK_MTX((_sc))) #define VTBLK_UNLOCK(_sc) mtx_unlock(VTBLK_MTX((_sc))) #define VTBLK_LOCK_DESTROY(_sc) mtx_destroy(VTBLK_MTX((_sc))) #define VTBLK_LOCK_ASSERT(_sc) mtx_assert(VTBLK_MTX((_sc)), MA_OWNED) @@ -281,7 +278,6 @@ vtblk_attach(device_t dev) sc = device_get_softc(dev); sc->vtblk_dev = dev; - sc->vtblk_unit = device_get_unit(dev); VTBLK_LOCK_INIT(sc, device_get_nameunit(dev)); @@ -299,13 +295,8 @@ vtblk_attach(device_t dev) sc->vtblk_flags |= VTBLK_FLAG_READONLY; /* Get local copy of config. */ - if (virtio_with_feature(dev, VIRTIO_BLK_F_TOPOLOGY) == 0) { - bzero(&blkcfg, sizeof(struct virtio_blk_config)); - virtio_read_device_config(dev, 0, &blkcfg, - offsetof(struct virtio_blk_config, physical_block_exp)); - } else - virtio_read_device_config(dev, 0, &blkcfg, - sizeof(struct virtio_blk_config)); + virtio_read_device_config(dev, 0, &blkcfg, + sizeof(struct virtio_blk_config)); /* * With the current sglist(9) implementation, it is not easy @@ -498,12 +489,6 @@ vtblk_dump(void *arg, void *virtual, vm_ if ((sc = dp->d_drv1) == NULL) return (ENXIO); - if (VTBLK_TRYLOCK(sc) == 0) { - device_printf(sc->vtblk_dev, - "softc already locked, cannot dump...\n"); - return (EBUSY); - } - if ((sc->vtblk_flags & VTBLK_FLAG_DUMPING) == 0) { vtblk_prepare_dump(sc); sc->vtblk_flags |= VTBLK_FLAG_DUMPING; @@ -622,7 +607,7 @@ vtblk_alloc_disk(struct vtblk_softc *sc, dp->d_ioctl = vtblk_ioctl; dp->d_strategy = vtblk_strategy; dp->d_name = VTBLK_DISK_NAME; - dp->d_unit = sc->vtblk_unit; + dp->d_unit = device_get_unit(dev); dp->d_drv1 = sc; if ((sc->vtblk_flags & VTBLK_FLAG_READONLY) == 0) @@ -632,10 +617,9 @@ vtblk_alloc_disk(struct vtblk_softc *sc, dp->d_mediasize = blkcfg->capacity * 512; if (virtio_with_feature(dev, VIRTIO_BLK_F_BLK_SIZE)) - sc->vtblk_sector_size = blkcfg->blk_size; + dp->d_sectorsize = blkcfg->blk_size; else - sc->vtblk_sector_size = 512; - dp->d_sectorsize = sc->vtblk_sector_size; + dp->d_sectorsize = 512; /* * The VirtIO maximum I/O size is given in terms of segments. @@ -905,9 +889,10 @@ vtblk_get_ident(struct vtblk_softc *sc) VTBLK_LOCK(sc); error = vtblk_poll_request(sc, req); - vtblk_enqueue_request(sc, req); VTBLK_UNLOCK(sc); + vtblk_enqueue_request(sc, req); + if (error) { device_printf(sc->vtblk_dev, "error getting device identifier: %d\n", error); Modified: head/sys/dev/virtio/block/virtio_blk.h ============================================================================== --- head/sys/dev/virtio/block/virtio_blk.h Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/block/virtio_blk.h Tue Dec 6 06:28:32 2011 (r228301) @@ -1,7 +1,30 @@ -/* +/*- * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of IBM nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM 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$ */ @@ -39,16 +62,6 @@ struct virtio_blk_config { /* block size of device (if VIRTIO_BLK_F_BLK_SIZE) */ uint32_t blk_size; - - /* the next 4 entries are guarded by VIRTIO_BLK_F_TOPOLOGY */ - /* exponent for physical block per logical block. */ - uint8_t physical_block_exp; - /* alignment offset in logical blocks. */ - uint8_t alignment_offset; - /* minimum I/O size without performance penalty in logical blocks. */ - uint16_t min_io_size; - /* optimal sustained I/O size in logical blocks. */ - uint32_t opt_io_size; } __packed; /* Modified: head/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- head/sys/dev/virtio/network/if_vtnet.c Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/network/if_vtnet.c Tue Dec 6 06:28:32 2011 (r228301) @@ -317,8 +317,20 @@ vtnet_attach(device_t dev) if (virtio_with_feature(dev, VIRTIO_NET_F_CTRL_VQ)) { sc->vtnet_flags |= VTNET_FLAG_CTRL_VQ; - if (virtio_with_feature(dev, VIRTIO_NET_F_CTRL_RX)) + if (virtio_with_feature(dev, VIRTIO_NET_F_CTRL_RX)) { + sc->vtnet_mac_filter = malloc( + sizeof(struct vtnet_mac_filter), M_DEVBUF, + M_NOWAIT | M_ZERO); + if (sc->vtnet_mac_filter == NULL) { + device_printf(dev, + "cannot allocate mac filter table\n"); + error = ENOMEM; + goto fail; + } + sc->vtnet_flags |= VTNET_FLAG_CTRL_RX; + } + if (virtio_with_feature(dev, VIRTIO_NET_F_CTRL_VLAN)) sc->vtnet_flags |= VTNET_FLAG_VLAN_FILTER; } @@ -505,7 +517,12 @@ vtnet_detach(device_t dev) sc->vtnet_vlan_detach = NULL; } - if (ifp) { + if (sc->vtnet_mac_filter != NULL) { + free(sc->vtnet_mac_filter, M_DEVBUF); + sc->vtnet_mac_filter = NULL; + } + + if (ifp != NULL) { if_free(ifp); sc->vtnet_ifp = NULL; } @@ -742,17 +759,11 @@ vtnet_update_link_status(struct vtnet_so if (link && ((sc->vtnet_flags & VTNET_FLAG_LINK) == 0)) { sc->vtnet_flags |= VTNET_FLAG_LINK; - if (bootverbose) - device_printf(dev, "Link is up\n"); - if_link_state_change(ifp, LINK_STATE_UP); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) vtnet_start_locked(ifp); } else if (!link && (sc->vtnet_flags & VTNET_FLAG_LINK)) { sc->vtnet_flags &= ~VTNET_FLAG_LINK; - if (bootverbose) - device_printf(dev, "Link is down\n"); - if_link_state_change(ifp, LINK_STATE_DOWN); } } @@ -1105,7 +1116,7 @@ vtnet_alloc_rxbuf(struct vtnet_softc *sc KASSERT(sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG, ("chained Rx mbuf requested without LRO_NOMRG")); - for (i = 0; i < nbufs - 1; i++) { + for (i = 1; i < nbufs; i++) { m = m_getjcl(M_DONTWAIT, MT_DATA, 0, clsize); if (m == NULL) goto fail; @@ -1143,9 +1154,8 @@ vtnet_replace_rxbuf(struct vtnet_softc * clsize = sc->vtnet_rx_mbuf_size; nreplace = 0; - if (m->m_next != NULL) - KASSERT(sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG, - ("chained Rx mbuf without LRO_NOMRG")); + KASSERT(sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG || + m->m_next == NULL, ("chained Rx mbuf without LRO_NOMRG")); /* * Since LRO_NOMRG mbuf chains are so large, we want to avoid @@ -1275,8 +1285,8 @@ vtnet_enqueue_rxbuf(struct vtnet_softc * int offset, error; VTNET_LOCK_ASSERT(sc); - if ((sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG) == 0) - KASSERT(m->m_next == NULL, ("chained Rx mbuf")); + KASSERT(sc->vtnet_flags & VTNET_FLAG_LRO_NOMRG || + m->m_next == NULL, ("chained Rx mbuf without LRO_NOMRG")); sglist_init(&sg, VTNET_MAX_RX_SEGS, segs); @@ -1688,7 +1698,8 @@ vtnet_rxeof(struct vtnet_softc *sc, int break; } - virtqueue_notify(vq); + if (deq > 0) + virtqueue_notify(vq); if (rx_npktsp != NULL) *rx_npktsp = rx_npkts; @@ -1946,9 +1957,14 @@ vtnet_encap(struct vtnet_softc *sc, stru struct mbuf *m; int error; + m = *m_head; + txhdr = uma_zalloc(vtnet_tx_header_zone, M_NOWAIT | M_ZERO); - if (txhdr == NULL) + if (txhdr == NULL) { + *m_head = NULL; + m_freem(m); return (ENOMEM); + } /* * Always use the non-mergeable header to simplify things. When @@ -1957,21 +1973,22 @@ vtnet_encap(struct vtnet_softc *sc, stru * the correct header size to the host. */ hdr = &txhdr->vth_uhdr.hdr; - m = *m_head; - - error = ENOBUFS; if (m->m_flags & M_VLANTAG) { m = ether_vlanencap(m, m->m_pkthdr.ether_vtag); - if ((*m_head = m) == NULL) + if ((*m_head = m) == NULL) { + error = ENOBUFS; goto fail; + } m->m_flags &= ~M_VLANTAG; } if (m->m_pkthdr.csum_flags != 0) { m = vtnet_tx_offload(sc, m, hdr); - if ((*m_head = m) == NULL) + if ((*m_head = m) == NULL) { + error = ENOBUFS; goto fail; + } } error = vtnet_enqueue_txbuf(sc, m_head, txhdr); @@ -2387,6 +2404,7 @@ vtnet_rx_filter_mac(struct vtnet_softc * uint8_t ack; ifp = sc->vtnet_ifp; + filter = sc->vtnet_mac_filter; ucnt = 0; mcnt = 0; promisc = 0; @@ -2397,19 +2415,6 @@ vtnet_rx_filter_mac(struct vtnet_softc * KASSERT(sc->vtnet_flags & VTNET_FLAG_CTRL_RX, ("CTRL_RX feature not negotiated")); - /* - * Allocate the MAC filtering table. Note we could do this - * at attach time, but it is probably not worth keeping it - * around for an infrequent occurrence. - */ - filter = malloc(sizeof(struct vtnet_mac_filter), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (filter == NULL) { - device_printf(sc->vtnet_dev, - "cannot allocate MAC address filtering table\n"); - return; - } - /* Unicast MAC addresses: */ if_addr_rlock(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { @@ -2481,8 +2486,6 @@ vtnet_rx_filter_mac(struct vtnet_softc * if_printf(ifp, "error setting host MAC filter table\n"); out: - free(filter, M_DEVBUF); - if (promisc) if (vtnet_set_promisc(sc, 1) != 0) if_printf(ifp, "cannot enable promiscuous mode\n"); Modified: head/sys/dev/virtio/network/if_vtnetvar.h ============================================================================== --- head/sys/dev/virtio/network/if_vtnetvar.h Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/network/if_vtnetvar.h Tue Dec 6 06:28:32 2011 (r228301) @@ -99,6 +99,7 @@ struct vtnet_softc { #define VTNET_MEDIATYPE (IFM_ETHER | IFM_1000_T | IFM_FDX) char vtnet_hwaddr[ETHER_ADDR_LEN]; + struct vtnet_mac_filter *vtnet_mac_filter; /* * During reset, the host's VLAN filtering table is lost. The * array below is used to restore all the VLANs configured on Modified: head/sys/dev/virtio/network/virtio_net.h ============================================================================== --- head/sys/dev/virtio/network/virtio_net.h Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/network/virtio_net.h Tue Dec 6 06:28:32 2011 (r228301) @@ -1,7 +1,30 @@ -/* +/*- * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of IBM nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM 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$ */ Modified: head/sys/dev/virtio/pci/virtio_pci.h ============================================================================== --- head/sys/dev/virtio/pci/virtio_pci.h Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/pci/virtio_pci.h Tue Dec 6 06:28:32 2011 (r228301) @@ -1,4 +1,4 @@ -/* +/*- * Copyright IBM Corp. 2007 * * Authors: @@ -7,6 +7,29 @@ * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of IBM nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM 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$ */ Modified: head/sys/dev/virtio/virtio.h ============================================================================== --- head/sys/dev/virtio/virtio.h Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/virtio.h Tue Dec 6 06:28:32 2011 (r228301) @@ -1,7 +1,30 @@ -/* +/*- * This header is BSD licensed so anyone can use the definitions to implement * compatible drivers/servers. * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of IBM nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM 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$ */ Modified: head/sys/dev/virtio/virtio_ring.h ============================================================================== --- head/sys/dev/virtio/virtio_ring.h Tue Dec 6 03:35:23 2011 (r228300) +++ head/sys/dev/virtio/virtio_ring.h Tue Dec 6 06:28:32 2011 (r228301) @@ -1,10 +1,34 @@ -/* - * This header is BSD licensed so anyone can use the definitions - * to implement compatible drivers/servers. - * +/*- * Copyright Rusty Russell IBM Corporation 2007. + * + * This header is BSD licensed so anyone can use the definitions to implement + * compatible drivers/servers. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of IBM nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL IBM 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$ */ -/* $FreeBSD$ */ #ifndef VIRTIO_RING_H #define VIRTIO_RING_H From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 06:40:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C33D1065676; Tue, 6 Dec 2011 06:40:15 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C7F88FC14; Tue, 6 Dec 2011 06:40:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB66eFrm076480; Tue, 6 Dec 2011 06:40:15 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB66eFuQ076478; Tue, 6 Dec 2011 06:40:15 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201112060640.pB66eFuQ076478@svn.freebsd.org> From: Mikolaj Golub Date: Tue, 6 Dec 2011 06:40:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228302 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 06:40:15 -0000 Author: trociny Date: Tue Dec 6 06:40:14 2011 New Revision: 228302 URL: http://svn.freebsd.org/changeset/base/228302 Log: Really protect kern.proc.ps_strings sysctls with p_candebug(). This was intended to be in r228288. Spotted by: many MFC after: 1 week Modified: head/sys/kern/kern_proc.c Modified: head/sys/kern/kern_proc.c ============================================================================== --- head/sys/kern/kern_proc.c Tue Dec 6 06:28:32 2011 (r228301) +++ head/sys/kern/kern_proc.c Tue Dec 6 06:40:14 2011 (r228302) @@ -2457,7 +2457,7 @@ sysctl_kern_proc_ps_strings(SYSCTL_HANDL p = pfind((pid_t)name[0]); if (p == NULL) return (ESRCH); - error = p_cansee(curthread, p); + error = p_candebug(curthread, p); if (error != 0) { PROC_UNLOCK(p); return (error); From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 07:55:25 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D2B0106566C; Tue, 6 Dec 2011 07:55:25 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7CEFB8FC13; Tue, 6 Dec 2011 07:55:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB67tP0i078742; Tue, 6 Dec 2011 07:55:25 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB67tPQC078740; Tue, 6 Dec 2011 07:55:25 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201112060755.pB67tPQC078740@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 6 Dec 2011 07:55:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228303 - head/sys/dev/usb/wlan X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 07:55:25 -0000 Author: hselasky Date: Tue Dec 6 07:55:25 2011 New Revision: 228303 URL: http://svn.freebsd.org/changeset/base/228303 Log: Fix compile warning when using clang to compile the code. Submitted by: arundel @ MFC after: 3 days Modified: head/sys/dev/usb/wlan/if_zyd.c Modified: head/sys/dev/usb/wlan/if_zyd.c ============================================================================== --- head/sys/dev/usb/wlan/if_zyd.c Tue Dec 6 06:40:14 2011 (r228302) +++ head/sys/dev/usb/wlan/if_zyd.c Tue Dec 6 07:55:25 2011 (r228303) @@ -686,7 +686,7 @@ zyd_intr_read_callback(struct usb_xfer * memcpy(rqp->odata, cmd->data, rqp->olen); DPRINTF(sc, ZYD_DEBUG_CMD, "command %p complete, data = %*D \n", - rqp, rqp->olen, rqp->odata, ":"); + rqp, rqp->olen, (char *)rqp->odata, ":"); wakeup(rqp); /* wakeup caller */ break; } From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 08:08:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E834106564A; Tue, 6 Dec 2011 08:08:52 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83EED8FC0A; Tue, 6 Dec 2011 08:08:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB688qXJ079176; Tue, 6 Dec 2011 08:08:52 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB688qNq079171; Tue, 6 Dec 2011 08:08:52 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201112060808.pB688qNq079171@svn.freebsd.org> From: Hans Petter Selasky Date: Tue, 6 Dec 2011 08:08:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228304 - head/sys/dev/usb/template X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 08:08:52 -0000 Author: hselasky Date: Tue Dec 6 08:08:52 2011 New Revision: 228304 URL: http://svn.freebsd.org/changeset/base/228304 Log: Correct some bInterval USB template descriptor values. MFC after: 3 days Modified: head/sys/dev/usb/template/usb_template.c head/sys/dev/usb/template/usb_template_kbd.c head/sys/dev/usb/template/usb_template_modem.c head/sys/dev/usb/template/usb_template_mouse.c Modified: head/sys/dev/usb/template/usb_template.c ============================================================================== --- head/sys/dev/usb/template/usb_template.c Tue Dec 6 07:55:25 2011 (r228303) +++ head/sys/dev/usb/template/usb_template.c Tue Dec 6 08:08:52 2011 (r228304) @@ -260,7 +260,7 @@ usb_make_endpoint_desc(struct usb_temp_s ed->bInterval = 1; /* 1 ms */ break; default: - ed->bInterval = 8; /* 8*125 us */ + ed->bInterval = 4; /* 1 ms */ break; } break; Modified: head/sys/dev/usb/template/usb_template_kbd.c ============================================================================== --- head/sys/dev/usb/template/usb_template_kbd.c Tue Dec 6 07:55:25 2011 (r228303) +++ head/sys/dev/usb/template/usb_template_kbd.c Tue Dec 6 08:08:52 2011 (r228304) @@ -89,9 +89,9 @@ static const struct usb_temp_packet_size }; static const struct usb_temp_interval keyboard_intr_interval = { - .bInterval[USB_SPEED_LOW] = 2, /* ms */ - .bInterval[USB_SPEED_FULL] = 2, - .bInterval[USB_SPEED_HIGH] = 2 * 8, + .bInterval[USB_SPEED_LOW] = 2, /* 2 ms */ + .bInterval[USB_SPEED_FULL] = 2, /* 2 ms */ + .bInterval[USB_SPEED_HIGH] = 5, /* 2 ms */ }; /* The following HID descriptor was dumped from a HP keyboard. */ Modified: head/sys/dev/usb/template/usb_template_modem.c ============================================================================== --- head/sys/dev/usb/template/usb_template_modem.c Tue Dec 6 07:55:25 2011 (r228303) +++ head/sys/dev/usb/template/usb_template_modem.c Tue Dec 6 08:08:52 2011 (r228304) @@ -98,9 +98,9 @@ static const struct usb_temp_packet_size }; static const struct usb_temp_interval modem_intr_interval = { - .bInterval[USB_SPEED_LOW] = 10, - .bInterval[USB_SPEED_FULL] = 10, - .bInterval[USB_SPEED_HIGH] = 10 * 8, + .bInterval[USB_SPEED_LOW] = 8, /* 8ms */ + .bInterval[USB_SPEED_FULL] = 8, /* 8ms */ + .bInterval[USB_SPEED_HIGH] = 7, /* 8ms */ }; static const struct usb_temp_endpoint_desc modem_ep_0 = { Modified: head/sys/dev/usb/template/usb_template_mouse.c ============================================================================== --- head/sys/dev/usb/template/usb_template_mouse.c Tue Dec 6 07:55:25 2011 (r228303) +++ head/sys/dev/usb/template/usb_template_mouse.c Tue Dec 6 08:08:52 2011 (r228304) @@ -101,9 +101,9 @@ static const struct usb_temp_packet_size }; static const struct usb_temp_interval mouse_intr_interval = { - .bInterval[USB_SPEED_LOW] = 2, - .bInterval[USB_SPEED_FULL] = 2, - .bInterval[USB_SPEED_HIGH] = 2 * 8, + .bInterval[USB_SPEED_LOW] = 2, /* 2ms */ + .bInterval[USB_SPEED_FULL] = 2, /* 2ms */ + .bInterval[USB_SPEED_HIGH] = 5, /* 2ms */ }; static const struct usb_temp_endpoint_desc mouse_ep_0 = { From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 09:12:12 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07F4A106566C; Tue, 6 Dec 2011 09:12:12 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBE368FC0A; Tue, 6 Dec 2011 09:12:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB69CBQf081189; Tue, 6 Dec 2011 09:12:11 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB69CBcJ081187; Tue, 6 Dec 2011 09:12:11 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201112060912.pB69CBcJ081187@svn.freebsd.org> From: Alexander Motin Date: Tue, 6 Dec 2011 09:12:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228305 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 09:12:12 -0000 Author: mav Date: Tue Dec 6 09:12:11 2011 New Revision: 228305 URL: http://svn.freebsd.org/changeset/base/228305 Log: Mention that Cold Presence Detection feature used for hot-plug detection when interface power management is enabled. Modified: head/share/man/man4/ahci.4 Modified: head/share/man/man4/ahci.4 ============================================================================== --- head/share/man/man4/ahci.4 Tue Dec 6 08:08:52 2011 (r228304) +++ head/share/man/man4/ahci.4 Tue Dec 6 09:12:11 2011 (r228305) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 2, 2011 +.Dd December 6, 2011 .Dt AHCI 4 .Os .Sh NAME @@ -90,9 +90,9 @@ Some controllers, such as ICH8, do not i Because of artificial entering latency, performance degradation in modes 4 and 5 is much smaller then in modes 2 and 3. .Pp -Note that interface Power Management is not compatible with -device presence detection. -A manual bus reset is needed on device hot-plug. +Note that interface Power Management complicates device presence detection. +A manual bus reset/rescan may be needed after device hot-plug, unless hardware +implements Cold Presence Detection. .It Va hint.ahcich. Ns Ar X Ns Va .sata_rev setting to nonzero value limits maximum SATA revision (speed). Values 1, 2 and 3 are respectively 1.5, 3 and 6Gbps. From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 09:31:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F8AB106564A; Tue, 6 Dec 2011 09:31:20 +0000 (UTC) (envelope-from gljennjohn@googlemail.com) Received: from mail-ey0-f182.google.com (mail-ey0-f182.google.com [209.85.215.182]) by mx1.freebsd.org (Postfix) with ESMTP id C8BAA8FC14; Tue, 6 Dec 2011 09:31:19 +0000 (UTC) Received: by eaai12 with SMTP id i12so6830222eaa.13 for ; Tue, 06 Dec 2011 01:31:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :x-mailer:mime-version:content-type:content-transfer-encoding; bh=rqSzNaDu3EZnkAl5CCOk/JjdL02EdWksO88FXSavH8A=; b=UwLtrrrAvLGA3oT3dyu2ZbD9ebnZVTg+EBr92JFA+yK+coOjxiPMVtk3JOCLCvuvE+ /OOiZP5lgYgXof/lVV5523mNts+HGseyfaHHnyVJhsIwb4IC5xwa9zZF9uEFQwk8KqxP vECfKxlHf+VKRxDIyRyz2KeGMyyrmuGgiNBWA= Received: by 10.213.28.8 with SMTP id k8mr2138518ebc.61.1323162408259; Tue, 06 Dec 2011 01:06:48 -0800 (PST) Received: from ernst.jennejohn.org (p578E3F12.dip.t-dialin.net. [87.142.63.18]) by mx.google.com with ESMTPS id d6sm68844135eec.10.2011.12.06.01.06.46 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Dec 2011 01:06:47 -0800 (PST) Date: Tue, 6 Dec 2011 10:06:44 +0100 From: Gary Jennejohn To: Hans Petter Selasky Message-ID: <20111206100644.6f61eb4c@ernst.jennejohn.org> In-Reply-To: <201112052143.59972.hselasky@c2i.net> References: <201111301811.pAUIBnr6008539@svn.freebsd.org> <201112052143.59972.hselasky@c2i.net> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.6; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "svn-src-head@freebsd.org" , Max Khon , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r228158 - in head: . share/mk sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: gljennjohn@googlemail.com List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 09:31:20 -0000 On Mon, 5 Dec 2011 21:43:59 +0100 Hans Petter Selasky wrote: > Hi, > > I see regressions when building kernel modules from /usr/ports: > > On Monday 05 December 2011 14:39:56 Robert Huff wrote: > > Hello: > > When trying to update I get: > > > > ===> Building for cuse4bsd-kmod-0.1.21_2 > > make -f > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > 21/Makefile.lib HAVE_DEBUG=YES all Warning: Object directory not changed > > from original > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > 21 make -f > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > 21/Makefile.kmod all "/sys/conf/kmod.mk", line 204: Malformed conditional > > (${MK_CTF} != "no") "/sys/conf/kmod.mk", line 206: if-less endif > > make: fatal errors encountered -- cannot continue > > *** Error code 1 > I encountered this problem yesterday. My quick hack was to put .if defined(MK_CTF) .endif around the offending lines, similar to EXPORT_SYMS. -- Gary Jennejohn From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 11:24:04 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BB791065676; Tue, 6 Dec 2011 11:24:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32ED28FC21; Tue, 6 Dec 2011 11:24:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB6BO4aG087536; Tue, 6 Dec 2011 11:24:04 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB6BO4Sc087534; Tue, 6 Dec 2011 11:24:04 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112061124.pB6BO4Sc087534@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 6 Dec 2011 11:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228306 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 11:24:04 -0000 Author: kib Date: Tue Dec 6 11:24:03 2011 New Revision: 228306 URL: http://svn.freebsd.org/changeset/base/228306 Log: Most users of pipe(2) do not call fstat(2) on the returned pipe descriptors. Optimize for the case, by lazily allocating the pipe inode number at the fstat(2) time. If alloc_unr(9) returns failure, do not fail fstat(2), since uses of inode numbers are even rare then fstat(2), but provide zero inode forever. Note that alloc_unr() failure is unlikely due to total number of pipes in the system limited by the number of file descriptors. Based on the submission by: gianni MFC after: 2 weeks Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Tue Dec 6 09:12:11 2011 (r228305) +++ head/sys/kern/sys_pipe.c Tue Dec 6 11:24:03 2011 (r228306) @@ -569,12 +569,7 @@ pipe_create(pipe, backing) /* If we're not backing this pipe, no need to do anything. */ error = 0; } - if (error == 0) { - pipe->pipe_ino = alloc_unr(pipeino_unr); - if (pipe->pipe_ino == -1) - /* pipeclose will clear allocated kva */ - error = ENOMEM; - } + pipe->pipe_ino = -1; return (error); } @@ -1398,16 +1393,40 @@ pipe_stat(fp, ub, active_cred, td) struct ucred *active_cred; struct thread *td; { - struct pipe *pipe = fp->f_data; + struct pipe *pipe; + int new_unr; #ifdef MAC int error; +#endif + pipe = fp->f_data; PIPE_LOCK(pipe); +#ifdef MAC error = mac_pipe_check_stat(active_cred, pipe->pipe_pair); - PIPE_UNLOCK(pipe); - if (error) + if (error) { + PIPE_UNLOCK(pipe); return (error); + } #endif + /* + * Lazily allocate an inode number for the pipe. Most pipe + * users do not call fstat(2) on the pipe, which means that + * postponing the inode allocation until it is must be + * returned to userland is useful. If alloc_unr failed, + * assign st_ino zero instead of returning an error. + * Special pipe_ino values: + * -1 - not yet initialized; + * 0 - alloc_unr failed, return 0 as st_ino forever. + */ + if (pipe->pipe_ino == (ino_t)-1) { + new_unr = alloc_unr(pipeino_unr); + if (new_unr != -1) + pipe->pipe_ino = new_unr; + else + pipe->pipe_ino = 0; + } + PIPE_UNLOCK(pipe); + bzero(ub, sizeof(*ub)); ub->st_mode = S_IFIFO; ub->st_blksize = PAGE_SIZE; From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 11:28:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 863D4106566B; Tue, 6 Dec 2011 11:28:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75BB08FC18; Tue, 6 Dec 2011 11:28:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB6BSH9u087707; Tue, 6 Dec 2011 11:28:17 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB6BSH3t087704; Tue, 6 Dec 2011 11:28:17 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112061128.pB6BSH3t087704@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 6 Dec 2011 11:28:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228307 - in head: secure/lib/libcrypto share/mk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 11:28:17 -0000 Author: kib Date: Tue Dec 6 11:28:17 2011 New Revision: 228307 URL: http://svn.freebsd.org/changeset/base/228307 Log: Force linker error when created shared library contains a relocation against text. Provide the override switch to turn off the strict behaviour. Apparently, openssl libcrypto needs it due to assembler code not being PIC. Discussed with: bf MFC after: 2 weeks Modified: head/secure/lib/libcrypto/Makefile head/share/mk/bsd.lib.mk Modified: head/secure/lib/libcrypto/Makefile ============================================================================== --- head/secure/lib/libcrypto/Makefile Tue Dec 6 11:24:03 2011 (r228306) +++ head/secure/lib/libcrypto/Makefile Tue Dec 6 11:28:17 2011 (r228307) @@ -7,6 +7,7 @@ SUBDIR= engines LIB= crypto SHLIB_MAJOR= 6 +ALLOW_SHARED_TEXTREL= NO_LINT= Modified: head/share/mk/bsd.lib.mk ============================================================================== --- head/share/mk/bsd.lib.mk Tue Dec 6 11:24:03 2011 (r228306) +++ head/share/mk/bsd.lib.mk Tue Dec 6 11:28:17 2011 (r228307) @@ -167,6 +167,11 @@ SOBJS+= ${OBJS:.o=.So} .if defined(SHLIB_NAME) _LIBS+= ${SHLIB_NAME} +SOLINKOPTS= -shared -Wl,-x +.if !defined(ALLOW_SHARED_TEXTREL) +SOLINKOPTS+= -Wl,--fatal-warnings -Wl,--warn-shared-textrel +.endif + .if target(beforelinking) ${SHLIB_NAME}: ${SOBJS} beforelinking .else @@ -178,11 +183,11 @@ ${SHLIB_NAME}: ${SOBJS} @ln -fs ${.TARGET} ${SHLIB_LINK} .endif .if !defined(NM) - @${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \ + @${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ -o ${.TARGET} -Wl,-soname,${SONAME} \ `lorder ${SOBJS} | tsort -q` ${LDADD} .else - @${CC} ${LDFLAGS} ${SSP_CFLAGS} -shared -Wl,-x \ + @${CC} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ -o ${.TARGET} -Wl,-soname,${SONAME} \ `NM='${NM}' lorder ${SOBJS} | tsort -q` ${LDADD} .endif From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 12:03:02 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B25C106566B; Tue, 6 Dec 2011 12:03:02 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4ADBD8FC12; Tue, 6 Dec 2011 12:03:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB6C323o088821; Tue, 6 Dec 2011 12:03:02 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB6C32vm088819; Tue, 6 Dec 2011 12:03:02 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201112061203.pB6C32vm088819@svn.freebsd.org> From: Hajimu UMEMOTO Date: Tue, 6 Dec 2011 12:03:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228308 - head/kerberos5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 12:03:02 -0000 Author: ume Date: Tue Dec 6 12:03:01 2011 New Revision: 228308 URL: http://svn.freebsd.org/changeset/base/228308 Log: Don't support OpenLDAP during lib32 build. Modified: head/kerberos5/Makefile.inc Modified: head/kerberos5/Makefile.inc ============================================================================== --- head/kerberos5/Makefile.inc Tue Dec 6 11:28:17 2011 (r228307) +++ head/kerberos5/Makefile.inc Tue Dec 6 12:03:01 2011 (r228308) @@ -6,7 +6,7 @@ KRB5DIR= ${.CURDIR}/../../../crypto/heim CFLAGS+= -DHAVE_CONFIG_H -I${.CURDIR}/../../include -.if defined(WITH_OPENLDAP) +.if defined(WITH_OPENLDAP) && !defined(COMPAT_32BIT) OPENLDAPBASE?= /usr/local LDAPLDADD= -lldap -llber LDAPDPADD= ${LDAPLDADD:C;^-l(.*)$;${OPENLDAPBASE}/lib/lib\1.a;} From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 13:00:03 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7BF5C106566C; Tue, 6 Dec 2011 13:00:03 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 491B18FC12; Tue, 6 Dec 2011 13:00:02 +0000 (UTC) Received: by lagv3 with SMTP id v3so1090138lag.13 for ; Tue, 06 Dec 2011 05:00:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=SVsPmA4STmuZJayrSbm2a3jx+qx2eKeeroeRc4MRMUw=; b=qmfs0BL0JTpsHtTSNWsAmDyvutu9wRgKbFAFuqbZyzBjvQdx2UzleydZSTMgRD+8Hc hNrYduJYdt3hYHgYuLMcZp/dAA56ItBlrhi6K+mMfKH2CW8cgb9QdDfhP35M23k/YABX xg8Hl636hcuC7cWoHQgzIj11LpGNiqO1alyGY= Received: by 10.152.111.1 with SMTP id ie1mr9149996lab.7.1323176400289; Tue, 06 Dec 2011 05:00:00 -0800 (PST) Received: from localhost ([78.157.92.5]) by mx.google.com with ESMTPS id mi5sm20934229lab.14.2011.12.06.04.59.59 (version=SSLv3 cipher=OTHER); Tue, 06 Dec 2011 04:59:59 -0800 (PST) Date: Tue, 6 Dec 2011 15:00:02 +0200 From: Gleb Kurtsou To: Hans Petter Selasky Message-ID: <20111206130002.GA1915@reks> References: <201111301811.pAUIBnr6008539@svn.freebsd.org> <201112052143.59972.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201112052143.59972.hselasky@c2i.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: "svn-src-head@freebsd.org" , Max Khon , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Subject: Re: svn commit: r228158 - in head: . share/mk sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 13:00:03 -0000 On (05/12/2011 21:43), Hans Petter Selasky wrote: > Hi, > > I see regressions when building kernel modules from /usr/ports: make buildworld && make installworld should fix it > > On Monday 05 December 2011 14:39:56 Robert Huff wrote: > > Hello: > > When trying to update I get: > > > > ===> Building for cuse4bsd-kmod-0.1.21_2 > > make -f > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > 21/Makefile.lib HAVE_DEBUG=YES all Warning: Object directory not changed > > from original > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > 21 make -f > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > 21/Makefile.kmod all "/sys/conf/kmod.mk", line 204: Malformed conditional > > (${MK_CTF} != "no") "/sys/conf/kmod.mk", line 206: if-less endif > > make: fatal errors encountered -- cannot continue > > *** Error code 1 > > > --HPS From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 17:27:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C498E106567A; Tue, 6 Dec 2011 17:27:17 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 62B948FC08; Tue, 6 Dec 2011 17:27:17 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 16D9746B06; Tue, 6 Dec 2011 12:27:17 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 9AEEFB946; Tue, 6 Dec 2011 12:27:16 -0500 (EST) From: John Baldwin To: Ivan Klymenko Date: Tue, 6 Dec 2011 12:24:48 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <201112021959.pB2Jxka6006739@svn.freebsd.org> <20111203125142.442e4bf6@nonamehost.> In-Reply-To: <20111203125142.442e4bf6@nonamehost.> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201112061224.48146.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 06 Dec 2011 12:27:16 -0500 (EST) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228207 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 17:27:17 -0000 On Saturday, December 03, 2011 5:51:42 am Ivan Klymenko wrote: > =D0=92 Fri, 2 Dec 2011 19:59:46 +0000 (UTC) > John Baldwin =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >=20 > > Author: jhb > > Date: Fri Dec 2 19:59:46 2011 > > New Revision: 228207 > > URL: http://svn.freebsd.org/changeset/base/228207 > >=20 > > Log: > > When changing the user priority of a thread, change the real > > priority in addition to the user priority for threads whose current > > real priority is equal to the previous user priority or if the new > > priority is a real-time priority. This allows priority changes of > > other threads to have an immediate effect. > > =20 > Thank you! > It's a little corrected the situation with interactivity with using ULE > scheduler... > But quite a bit... :) Hmm, I would not have expected this to make much of a difference unless you= =20 are explicitly running the 'rtprio' command. =2D-=20 John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 17:27:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D2071065673; Tue, 6 Dec 2011 17:27:17 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id F3B9E8FC17; Tue, 6 Dec 2011 17:27:16 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id A5D5D46B2A; Tue, 6 Dec 2011 12:27:16 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id DD1EAB915; Tue, 6 Dec 2011 12:27:15 -0500 (EST) From: John Baldwin To: Andriy Gapon Date: Tue, 6 Dec 2011 12:24:03 -0500 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p8; KDE/4.5.5; amd64; ; ) References: <1769030615.700252.1322693541806.JavaMail.root@erie.cs.uoguelph.ca> <201112011642.53968.jhb@freebsd.org> <4ED7FE64.9010909@FreeBSD.org> In-Reply-To: <4ED7FE64.9010909@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201112061224.03891.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 06 Dec 2011 12:27:16 -0500 (EST) X-Mailman-Approved-At: Tue, 06 Dec 2011 17:33:19 +0000 Cc: Doug Barton , svn-src-stable@freebsd.org, Mark Saad , Alfred Perlstein , src-committers@freebsd.org, svn-src-stable-7@freebsd.org, Rick Macklem , svn-src-all@freebsd.org, Rick Macklem Subject: Re: svn commit: r227549 - stable/7/sys/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 17:27:17 -0000 On Thursday, December 01, 2011 5:23:32 pm Andriy Gapon wrote: > on 01/12/2011 23:42 John Baldwin said the following: > > On Thursday, December 01, 2011 10:59:54 am Mark Saad wrote: > >> On Wed, Nov 30, 2011 at 6:10 PM, Doug Barton wrote: > >>> On 11/30/2011 14:52, Rick Macklem wrote: > >>>> I'm relatively new to FreeBSD, but I've never heard of an MFC to a > >>>> Release branch. (As far as I know, if it ever happens, it's for a > >>>> serious errata or security issue.) > >>> > >>> You are correct sir. :) > >>> > >> So how would I ever see this in an official release as an errata fix ? > > > > At this point you likely won't. The vast majority of patches to releases are > > only for security advisories. Very few errata are merged back to releases > > currently. It may be that we are too hesitant to do so, but the manpower > > overhead of actually getting the changes merged back and getting appropriate > > folks to sign off on everything is extremely high (and the exact process for > > getting an EN approved is not very clear or really even documented to my > > knowledge). > > > > Just to clarify - the fix will be in the future (official) releases from 8, 9 > and so on branches. Yes, but without EN's there is no currently supported release a user can use to get this bug fix. I still think we are too hesitant to merge EN's. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 18:01:09 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9203106566C; Tue, 6 Dec 2011 18:01:09 +0000 (UTC) (envelope-from fjoe@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A97198FC08; Tue, 6 Dec 2011 18:01:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB6I19Aj002345; Tue, 6 Dec 2011 18:01:09 GMT (envelope-from fjoe@svn.freebsd.org) Received: (from fjoe@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB6I19dU002343; Tue, 6 Dec 2011 18:01:09 GMT (envelope-from fjoe@svn.freebsd.org) Message-Id: <201112061801.pB6I19dU002343@svn.freebsd.org> From: Max Khon Date: Tue, 6 Dec 2011 18:01:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228311 - head/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 18:01:09 -0000 Author: fjoe Date: Tue Dec 6 18:01:09 2011 New Revision: 228311 URL: http://svn.freebsd.org/changeset/base/228311 Log: MK_CTF is not defined when kmod.mk is used with old bsd.own.mk. Modified: head/sys/conf/kmod.mk Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Tue Dec 6 17:54:59 2011 (r228310) +++ head/sys/conf/kmod.mk Tue Dec 6 18:01:09 2011 (r228311) @@ -201,7 +201,7 @@ ${KMOD}.kld: ${OBJS} ${FULLPROG}: ${OBJS} .endif ${LD} ${LDFLAGS} -r -d -o ${.TARGET} ${OBJS} -.if ${MK_CTF} != "no" +.if defined(MK_CTF) && ${MK_CTF} != "no" ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} .endif .if defined(EXPORT_SYMS) From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 18:01:53 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82E201065679; Tue, 6 Dec 2011 18:01:53 +0000 (UTC) (envelope-from fjoe@samodelkin.net) Received: from mail-qw0-f47.google.com (mail-qw0-f47.google.com [209.85.216.47]) by mx1.freebsd.org (Postfix) with ESMTP id 194108FC0A; Tue, 6 Dec 2011 18:01:52 +0000 (UTC) Received: by qadb17 with SMTP id b17so3059325qad.13 for ; Tue, 06 Dec 2011 10:01:51 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.88.99 with SMTP id bf3mr2870738obb.73.1323194511398; Tue, 06 Dec 2011 10:01:51 -0800 (PST) Sender: fjoe@samodelkin.net Received: by 10.182.76.225 with HTTP; Tue, 6 Dec 2011 10:01:51 -0800 (PST) X-Originating-IP: [80.89.199.122] In-Reply-To: <20111206100644.6f61eb4c@ernst.jennejohn.org> References: <201111301811.pAUIBnr6008539@svn.freebsd.org> <201112052143.59972.hselasky@c2i.net> <20111206100644.6f61eb4c@ernst.jennejohn.org> Date: Wed, 7 Dec 2011 00:01:51 +0600 X-Google-Sender-Auth: cqCRpZh4GT29_iRnoKOfI4jEyqU Message-ID: From: Max Khon To: gljennjohn@googlemail.com Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" , Hans Petter Selasky Subject: Re: svn commit: r228158 - in head: . share/mk sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 18:01:53 -0000 Gary, Hans, On Tue, Dec 6, 2011 at 4:06 PM, Gary Jennejohn wrote: > I see regressions when building kernel modules from /usr/ports: > > > > On Monday 05 December 2011 14:39:56 Robert Huff wrote: > > > Hello: > > > When trying to update I get: > > > > > > ===> Building for cuse4bsd-kmod-0.1.21_2 > > > make -f > > > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > > 21/Makefile.lib HAVE_DEBUG=YES all Warning: Object directory not > changed > > > from original > > > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > > 21 make -f > > > > /data/port-work/usr/ports/multimedia/cuse4bsd-kmod/work/cuse4bsd-kmod-0.1. > > > 21/Makefile.kmod all "/sys/conf/kmod.mk", line 204: Malformed > conditional > > > (${MK_CTF} != "no") "/sys/conf/kmod.mk", line 206: if-less endif > > > make: fatal errors encountered -- cannot continue > > > *** Error code 1 > > > > I encountered this problem yesterday. My quick hack was to put > .if defined(MK_CTF) .endif around the offending lines, similar to > EXPORT_SYMS. > This should be fixed now (rev. 228311) Max From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 20:55:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 813C8106564A; Tue, 6 Dec 2011 20:55:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 579158FC13; Tue, 6 Dec 2011 20:55:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB6KtKiK007949; Tue, 6 Dec 2011 20:55:20 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB6KtKlX007947; Tue, 6 Dec 2011 20:55:20 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112062055.pB6KtKlX007947@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 6 Dec 2011 20:55:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228313 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 20:55:20 -0000 Author: glebius Date: Tue Dec 6 20:55:20 2011 New Revision: 228313 URL: http://svn.freebsd.org/changeset/base/228313 Log: Fix a very special case when SIOCAIFADDR supplies mask of 0.0.0.0, don't overwrite the mask with autoguessing based on classes. Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Tue Dec 6 19:04:45 2011 (r228312) +++ head/sys/netinet/in.c Tue Dec 6 20:55:20 2011 (r228313) @@ -73,7 +73,7 @@ static int in_addprefix(struct in_ifaddr static int in_scrubprefix(struct in_ifaddr *, u_int); static void in_socktrim(struct sockaddr_in *); static int in_ifinit(struct ifnet *, - struct in_ifaddr *, struct sockaddr_in *, int); + struct in_ifaddr *, struct sockaddr_in *, int, int); static void in_purgemaddrs(struct ifnet *); static VNET_DEFINE(int, sameprefixcarponly); @@ -517,7 +517,7 @@ in_control(struct socket *so, u_long cmd case SIOCSIFADDR: error = in_ifinit(ifp, ia, - (struct sockaddr_in *) &ifr->ifr_addr, 1); + (struct sockaddr_in *) &ifr->ifr_addr, 1, 0); if (error != 0 && iaIsNew) break; if (error == 0) { @@ -569,7 +569,8 @@ in_control(struct socket *so, u_long cmd maskIsNew = 1; /* We lie; but the effect's the same */ } if (hostIsNew || maskIsNew) - error = in_ifinit(ifp, ia, &ifra->ifra_addr, 0); + error = in_ifinit(ifp, ia, &ifra->ifra_addr, 0, + maskIsNew); if (error != 0 && iaIsNew) break; @@ -842,7 +843,7 @@ in_ifscrub(struct ifnet *ifp, struct in_ */ static int in_ifinit(struct ifnet *ifp, struct in_ifaddr *ia, struct sockaddr_in *sin, - int scrub) + int scrub, int masksupplied) { register u_long i = ntohl(sin->sin_addr.s_addr); int flags = RTF_UP, error = 0; @@ -872,7 +873,7 @@ in_ifinit(struct ifnet *ifp, struct in_i * Be compatible with network classes, if netmask isn't supplied, * guess it based on classes. */ - if (ia->ia_subnetmask == 0) { + if (!masksupplied) { if (IN_CLASSA(i)) ia->ia_subnetmask = IN_CLASSA_NET; else if (IN_CLASSB(i)) From owner-svn-src-all@FreeBSD.ORG Tue Dec 6 23:07:51 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E99BA1065677; Tue, 6 Dec 2011 23:07:51 +0000 (UTC) (envelope-from uqs@spoerlein.net) Received: from acme.spoerlein.net (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by mx1.freebsd.org (Postfix) with ESMTP id 7FB8B8FC12; Tue, 6 Dec 2011 23:07:48 +0000 (UTC) Received: from localhost (acme.spoerlein.net [IPv6:2a01:4f8:131:23c2::1]) by acme.spoerlein.net (8.14.4/8.14.4) with ESMTP id pB6N7kMC078143 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 7 Dec 2011 00:07:47 +0100 (CET) (envelope-from uqs@spoerlein.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=spoerlein.net; s=dkim200908; t=1323212867; bh=AgRy+25qCLBZsLB9kBHH3rQcJlzydoNW1Aet1EF+pS0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=LPbjsBIlUMtWvexqMFSiSlDutaZPKus6rVEqvYkZK5G1orX33IiC6T909sspGXyuL C6/GNIcA6eU+dBkSgTbf+0Ol7fq4odzM9DwdSR0dWzhY1SiCiiw/PrKgjwqwZhbCV2 MpGo8bxq5H8rSqpJGHPqYncnKDEvdXvhRE+ouJT4= Date: Wed, 7 Dec 2011 00:07:46 +0100 From: Ulrich =?utf-8?B?U3DDtnJsZWlu?= To: David Chisnall Message-ID: <20111206230746.GE83814@acme.spoerlein.net> Mail-Followup-To: Ulrich =?utf-8?B?U3DDtnJsZWlu?= , David Chisnall , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-vendor@FreeBSD.org References: <201111261420.pAQEKYKu094828@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201111261420.pAQEKYKu094828@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-vendor@FreeBSD.org Subject: Re: svn commit: r227997 - vendor/libcxxrt/8931d9e5180830a5433d16ae6b3ad8dd9e629512 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Dec 2011 23:07:52 -0000 On Sat, 2011-11-26 at 14:20:34 +0000, David Chisnall wrote: > Author: theraven > Date: Sat Nov 26 14:20:34 2011 > New Revision: 227997 > URL: http://svn.freebsd.org/changeset/base/227997 > > Log: > Versioned snapshot for libcxxrt > > Approved by: dim (mentor) > > Added: > vendor/libcxxrt/8931d9e5180830a5433d16ae6b3ad8dd9e629512/ > - copied from r227996, vendor/libcxxrt/dist/ Ho humm, would you really call this a versioned directory? It's kinda silly, IMHO, as it provides no clues as to the evolution of the code. It's just a content identifier and cannot even be sorted. Please consider using dated snapshots instead, e.g. YYYY-MM-DD, etc. Thanks Uli From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 07:03:14 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7401106564A; Wed, 7 Dec 2011 07:03:14 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A73F48FC14; Wed, 7 Dec 2011 07:03:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB773EW4026851; Wed, 7 Dec 2011 07:03:14 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB773EWl026849; Wed, 7 Dec 2011 07:03:14 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112070703.pB773EWl026849@svn.freebsd.org> From: Alan Cox Date: Wed, 7 Dec 2011 07:03:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228317 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 07:03:14 -0000 Author: alc Date: Wed Dec 7 07:03:14 2011 New Revision: 228317 URL: http://svn.freebsd.org/changeset/base/228317 Log: Eliminate the possibility of 32-bit arithmetic overflow in the calculation of vm_kmem_size that may occur if the system administrator has specified a vm.vm_kmem_size tunable value that exceeds the hard cap. PR: 162741 Submitted by: Adam McDougall Reviewed by: bde@ MFC after: 3 weeks Modified: head/sys/kern/kern_malloc.c Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Wed Dec 7 00:22:34 2011 (r228316) +++ head/sys/kern/kern_malloc.c Wed Dec 7 07:03:14 2011 (r228317) @@ -740,11 +740,11 @@ kmeminit(void *dummy) /* * Limit kmem virtual size to twice the physical memory. * This allows for kmem map sparseness, but limits the size - * to something sane. Be careful to not overflow the 32bit - * ints while doing the check. + * to something sane. Be careful to not overflow the 32bit + * ints while doing the check or the adjustment. */ - if (((vm_kmem_size / 2) / PAGE_SIZE) > cnt.v_page_count) - vm_kmem_size = 2 * cnt.v_page_count * PAGE_SIZE; + if (vm_kmem_size / 2 / PAGE_SIZE > mem_size) + vm_kmem_size = 2 * mem_size * PAGE_SIZE; #ifdef DEBUG_MEMGUARD tmp = memguard_fudge(vm_kmem_size, vm_kmem_size_max); From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 11:06:19 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44A7A106564A; Wed, 7 Dec 2011 11:06:19 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BDFC58FC08; Wed, 7 Dec 2011 11:06:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7B6IJU036781; Wed, 7 Dec 2011 11:06:18 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7B6Iot036779; Wed, 7 Dec 2011 11:06:18 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201112071106.pB7B6Iot036779@svn.freebsd.org> From: Ruslan Ermilov Date: Wed, 7 Dec 2011 11:06:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228318 - head/lib/libc/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 11:06:19 -0000 Author: ru Date: Wed Dec 7 11:06:18 2011 New Revision: 228318 URL: http://svn.freebsd.org/changeset/base/228318 Log: The NOTE_COPY should have been named NOTE_FFCOPY from the very beginning. Submitted by: Igor Sysoev Modified: head/lib/libc/sys/kqueue.2 Modified: head/lib/libc/sys/kqueue.2 ============================================================================== --- head/lib/libc/sys/kqueue.2 Wed Dec 7 07:03:14 2011 (r228317) +++ head/lib/libc/sys/kqueue.2 Wed Dec 7 11:06:18 2011 (r228318) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 15, 2009 +.Dd December 7, 2011 .Dt KQUEUE 2 .Os .Sh NAME @@ -459,7 +459,7 @@ Bitwise AND .It Dv NOTE_FFOR Bitwise OR .Va fflags . -.It Dv NOTE_COPY +.It Dv NOTE_FFCOPY Copy .Va fflags . .It Dv NOTE_FFCTRLMASK From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 12:00:49 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 496EF106567A; Wed, 7 Dec 2011 12:00:49 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from mx0.hoeg.nl (mx0.hoeg.nl [IPv6:2a01:4f8:101:5343::aa]) by mx1.freebsd.org (Postfix) with ESMTP id DC88C8FC1A; Wed, 7 Dec 2011 12:00:48 +0000 (UTC) Received: by mx0.hoeg.nl (Postfix, from userid 1000) id 271FB2A28CC3; Wed, 7 Dec 2011 13:00:48 +0100 (CET) Date: Wed, 7 Dec 2011 13:00:48 +0100 From: Ed Schouten To: Ulrich =?iso-8859-1?Q?Sp=F6rlein?= , David Chisnall , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, svn-src-vendor@FreeBSD.org Message-ID: <20111207120048.GK59489@hoeg.nl> References: <201111261420.pAQEKYKu094828@svn.freebsd.org> <20111206230746.GE83814@acme.spoerlein.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="tDYGg60iReQ7u8wj" Content-Disposition: inline In-Reply-To: <20111206230746.GE83814@acme.spoerlein.net> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Subject: Re: svn commit: r227997 - vendor/libcxxrt/8931d9e5180830a5433d16ae6b3ad8dd9e629512 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 12:00:49 -0000 --tDYGg60iReQ7u8wj Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Uli, * Ulrich Sp=F6rlein , 20111207 00:07: > Please consider using dated snapshots instead, e.g. YYYY-MM-DD, etc. Maybe a combination of both? YYYY-MM-DD-shortrev --=20 Ed Schouten WWW: http://80386.nl/ --tDYGg60iReQ7u8wj Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iQIcBAEBAgAGBQJO31VwAAoJEG5e2P40kaK7JFYP/RNmZ4MxQO42SmyTiQQy2qoK NUArpq4CS0QHCeoq4pH+eMP2k5yHyeLwdcSpnQAJ08lOB2ue/sfmMk2MwdTu2ahM 0cJ+dcbBfKymMgkahxMHM2kXFJXuPBADqlPWK/YlhEK95GnfM2Gb6cjBa9boi836 jtagqvPhepLdCy7nly9QretnPVAp0FmI8Vg8mz9P80RcGX4PQ2thZvtOOMg8SGKo 6WOUeA3SyOhPi668ZaGXNKQfg8Mi3HExtoqVksWNLPhJLzwmIufuBerNE9W1TFCk lS7KagyH6UFE7i/W8uC02+kOuPfwRANq+18S4OPRx9m5h2IN+lsoCm50BouscXOX h1iuvWp6mT230MzAFZ8oOkBdRG5spVkKzu45Go6FPnsGyyzkFJHDCd4LEIpGQuaN HUysOxkpRwvX89EoJgY6zbWfPxrBeAgtkQwCcnfLyVzYzw984A/H8ORYbvwkzfhD hYguTTJyZkEHkTl6ObdhZKDeL2nbSHyPISgyLjFhqoQjzZZDsnBGKqqDgwgAW8aE O0fX0YLRLftrHWog8EF/YmLBIDvVsLeA478ls9gVhN9VPF3DiecGnjkRI7B+hZfU oxqjsWVt7/rrlmfqlQ6yPldUKt2ZflL3vE6yCDU6qxkRN4ItiOR4olY4AF/3k53G JOo9uZ/0SegqtrC2VD5L =k5Ly -----END PGP SIGNATURE----- --tDYGg60iReQ7u8wj-- From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 12:25:29 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39FCA106566B; Wed, 7 Dec 2011 12:25:29 +0000 (UTC) (envelope-from gabor@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 105CC8FC0C; Wed, 7 Dec 2011 12:25:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7CPSxt039284; Wed, 7 Dec 2011 12:25:28 GMT (envelope-from gabor@svn.freebsd.org) Received: (from gabor@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7CPS1D039280; Wed, 7 Dec 2011 12:25:28 GMT (envelope-from gabor@svn.freebsd.org) Message-Id: <201112071225.pB7CPS1D039280@svn.freebsd.org> From: Gabor Kovesdan Date: Wed, 7 Dec 2011 12:25:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228319 - head/usr.bin/grep X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 12:25:29 -0000 Author: gabor Date: Wed Dec 7 12:25:28 2011 New Revision: 228319 URL: http://svn.freebsd.org/changeset/base/228319 Log: - Match GNU behavior of exit code - Rename variable that has a different meaning now PR: bin/162930 Submitted by: Jan Beich MFC after: 1 week Modified: head/usr.bin/grep/grep.c head/usr.bin/grep/grep.h head/usr.bin/grep/util.c Modified: head/usr.bin/grep/grep.c ============================================================================== --- head/usr.bin/grep/grep.c Wed Dec 7 11:06:18 2011 (r228318) +++ head/usr.bin/grep/grep.c Wed Dec 7 12:25:28 2011 (r228319) @@ -148,7 +148,7 @@ static inline const char *init_color(con bool first = true; /* flag whether we are processing the first match */ bool prev; /* flag whether or not the previous line matched */ int tail; /* lines left to print */ -bool notfound; /* file not found */ +bool file_err; /* file reading error */ /* * Prints usage information and returns 2. @@ -728,5 +728,5 @@ main(int argc, char *argv[]) /* Find out the correct return value according to the results and the command line option. */ - exit(c ? (notfound ? (qflag ? 0 : 2) : 0) : (notfound ? 2 : 1)); + exit(c ? (file_err ? (qflag ? 0 : 2) : 0) : (file_err ? 2 : 1)); } Modified: head/usr.bin/grep/grep.h ============================================================================== --- head/usr.bin/grep/grep.h Wed Dec 7 11:06:18 2011 (r228318) +++ head/usr.bin/grep/grep.h Wed Dec 7 12:25:28 2011 (r228319) @@ -119,7 +119,7 @@ extern char *label; extern const char *color; extern int binbehave, devbehave, dirbehave, filebehave, grepbehave, linkbehave; -extern bool first, matchall, notfound, prev; +extern bool file_err, first, matchall, prev; extern int tail; extern unsigned int dpatterns, fpatterns, patterns; extern struct pat *pattern; Modified: head/usr.bin/grep/util.c ============================================================================== --- head/usr.bin/grep/util.c Wed Dec 7 11:06:18 2011 (r228318) +++ head/usr.bin/grep/util.c Wed Dec 7 12:25:28 2011 (r228319) @@ -130,7 +130,7 @@ grep_tree(char **argv) case FTS_DNR: /* FALLTHROUGH */ case FTS_ERR: - notfound = true; + file_err = true; if(!sflag) warnx("%s: %s", p->fts_path, strerror(p->fts_errno)); break; @@ -195,10 +195,9 @@ procfile(const char *fn) f = grep_open(fn); } if (f == NULL) { + file_err = true; if (!sflag) warn("%s", fn); - if (errno == ENOENT) - notfound = true; return (0); } From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 13:37:43 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39D07106564A; Wed, 7 Dec 2011 13:37:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29A2A8FC0C; Wed, 7 Dec 2011 13:37:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7DbhTm041523; Wed, 7 Dec 2011 13:37:43 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7Dbhqv041521; Wed, 7 Dec 2011 13:37:43 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201112071337.pB7Dbhqv041521@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 7 Dec 2011 13:37:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228321 - head/sys/netinet6 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 13:37:43 -0000 Author: glebius Date: Wed Dec 7 13:37:42 2011 New Revision: 228321 URL: http://svn.freebsd.org/changeset/base/228321 Log: Fix double free. PR: kern/163089 Submitted by: Herbie Robinson Modified: head/sys/netinet6/mld6.c Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Wed Dec 7 12:48:11 2011 (r228320) +++ head/sys/netinet6/mld6.c Wed Dec 7 13:37:42 2011 (r228321) @@ -3090,7 +3090,6 @@ mld_dispatch_packet(struct mbuf *m) m0 = mld_v2_encap_report(ifp, m); if (m0 == NULL) { CTR2(KTR_MLD, "%s: dropped %p", __func__, m); - m_freem(m); IP6STAT_INC(ip6s_odropped); goto out; } From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 15:25:49 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45663106564A; Wed, 7 Dec 2011 15:25:49 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32DFC8FC16; Wed, 7 Dec 2011 15:25:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7FPnAX044906; Wed, 7 Dec 2011 15:25:49 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7FPmkH044896; Wed, 7 Dec 2011 15:25:48 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201112071525.pB7FPmkH044896@svn.freebsd.org> From: David Chisnall Date: Wed, 7 Dec 2011 15:25:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228322 - in head: include lib/libc/stdlib sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 15:25:49 -0000 Author: theraven Date: Wed Dec 7 15:25:48 2011 New Revision: 228322 URL: http://svn.freebsd.org/changeset/base/228322 Log: Implement quick_exit() / at_quick_exit() from C++11 / C1x. Also add a __noreturn macro and modify the other exiting functions to use it. The __noreturn macro, unlike __dead2, must be used BEFORE the function. This is in line with the C and C++ specifications that place _Noreturn (c1x) and [[noreturn]] (C++11) in front of the functions. As with __dead2, this macro falls back to using the GCC attribute. Unfortunately, clang currently sets the same value for the C version macro in C99 and C1x modes, so these functions are hidden by default. At some point before 10.0, I need to go through the headers and clean up the C1x / C++11 visibility. Reviewed by: brooks (mentor) Added: head/lib/libc/stdlib/at_quick_exit.3 (contents, props changed) head/lib/libc/stdlib/quick_exit.3 (contents, props changed) head/lib/libc/stdlib/quick_exit.c (contents, props changed) Modified: head/include/stdlib.h head/lib/libc/stdlib/Makefile.inc head/lib/libc/stdlib/Symbol.map head/lib/libc/stdlib/atexit.3 head/lib/libc/stdlib/exit.3 head/sys/sys/cdefs.h Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Wed Dec 7 13:37:42 2011 (r228321) +++ head/include/stdlib.h Wed Dec 7 15:25:48 2011 (r228322) @@ -76,7 +76,7 @@ extern int __mb_cur_max; extern int ___mb_cur_max(void); #define MB_CUR_MAX (___mb_cur_max()) -void abort(void) __dead2; +__noreturn void abort(void); int abs(int) __pure2; int atexit(void (*)(void)); double atof(const char *); @@ -86,7 +86,7 @@ void *bsearch(const void *, const void * size_t, int (*)(const void *, const void *)); void *calloc(size_t, size_t) __malloc_like; div_t div(int, int) __pure2; -void exit(int) __dead2; +__noreturn void exit(int); void free(void *); char *getenv(const char *); long labs(long) __pure2; @@ -145,10 +145,18 @@ unsigned long long strtoull(const char * __restrict, char ** __restrict, int); #endif /* __LONG_LONG_SUPPORTED */ -void _Exit(int) __dead2; +__noreturn void _Exit(int); #endif /* __ISO_C_VISIBLE >= 1999 */ /* + * If we're in a mode greater than C99, expose C1x functions. + */ +#if __ISO_C_VISIBLE > 1999 +__noreturn void quick_exit(int) +int +at_quick_exit(void (*func)(void)); +#endif /* __ISO_C_VISIBLE > 1999 */ +/* * Extensions made by POSIX relative to C. We don't know yet which edition * of POSIX made these extensions, so assume they've always been there until * research can be done. Modified: head/lib/libc/stdlib/Makefile.inc ============================================================================== --- head/lib/libc/stdlib/Makefile.inc Wed Dec 7 13:37:42 2011 (r228321) +++ head/lib/libc/stdlib/Makefile.inc Wed Dec 7 15:25:48 2011 (r228322) @@ -8,8 +8,8 @@ MISRCS+=_Exit.c a64l.c abort.c abs.c ate bsearch.c div.c exit.c getenv.c getopt.c getopt_long.c \ getsubopt.c hcreate.c heapsort.c imaxabs.c imaxdiv.c \ insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c malloc.c \ - merge.c ptsname.c qsort.c qsort_r.c radixsort.c rand.c random.c \ - reallocf.c realpath.c remque.c strfmon.c strtoimax.c \ + merge.c ptsname.c qsort.c qsort_r.c quick_exit.c radixsort.c rand.c \ + random.c reallocf.c realpath.c remque.c strfmon.c strtoimax.c \ strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c @@ -18,10 +18,12 @@ SYM_MAPS+= ${.CURDIR}/stdlib/Symbol.map # machine-dependent stdlib sources .sinclude "${.CURDIR}/${LIBC_ARCH}/stdlib/Makefile.inc" -MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 bsearch.3 \ +MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 \ + at_quick_exit.3 bsearch.3 \ div.3 exit.3 getenv.3 getopt.3 getopt_long.3 getsubopt.3 \ hcreate.3 imaxabs.3 imaxdiv.3 insque.3 labs.3 ldiv.3 llabs.3 lldiv.3 \ lsearch.3 malloc.3 memory.3 posix_memalign.3 ptsname.3 qsort.3 \ + quick_exit.3 \ radixsort.3 rand.3 random.3 \ realpath.3 strfmon.3 strtod.3 strtol.3 strtonum.3 strtoul.3 system.3 \ tsearch.3 Modified: head/lib/libc/stdlib/Symbol.map ============================================================================== --- head/lib/libc/stdlib/Symbol.map Wed Dec 7 13:37:42 2011 (r228321) +++ head/lib/libc/stdlib/Symbol.map Wed Dec 7 15:25:48 2011 (r228322) @@ -97,6 +97,8 @@ FBSD_1.3 { atoi_l; atol_l; atoll_l; + at_quick_exit; + quick_exit; strtod_l; strtol_l; strtoll_l; Added: head/lib/libc/stdlib/at_quick_exit.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdlib/at_quick_exit.3 Wed Dec 7 15:25:48 2011 (r228322) @@ -0,0 +1,58 @@ +.\" Copyright (c) 2011 David Chisnall +.\" 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 December 7, 2011o.Dt ATEXIT 3 +.Dt AT_QUICK_EXIT 3 +.Os +.Sh NAME +.Nm at_quick_exit +.Nd Registers a cleanup function to run on quick exit. +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In stdlib.h +.Ft int +.Fn at_quick_exit "void (*func)(void)" +.Sh DESCRIPTION +The +.Fn at_quick_exit +function registers a cleanup function to be called when the program exits as a +result of calling +.Xr quick_exit 3 . +The cleanup functions are called in the reverse order and will not be called if +the program exits by calling +.Xr exit 3 , +.Xr _Exit 3 , +or +.Xr abort 3 . +.El +.Sh SEE ALSO +.Xr exit 3 , +.Xr at_quick_exit 3 +.Sh STANDARDS +The +.Fn at_quick_exit +function conforms to the C1x draft specification. Modified: head/lib/libc/stdlib/atexit.3 ============================================================================== --- head/lib/libc/stdlib/atexit.3 Wed Dec 7 13:37:42 2011 (r228321) +++ head/lib/libc/stdlib/atexit.3 Wed Dec 7 15:25:48 2011 (r228322) @@ -79,6 +79,7 @@ No memory was available to add the funct The existing list of functions is unmodified. .El .Sh SEE ALSO +.Xr at_quick_exit 3 .Xr exit 3 .Sh STANDARDS The Modified: head/lib/libc/stdlib/exit.3 ============================================================================== --- head/lib/libc/stdlib/exit.3 Wed Dec 7 13:37:42 2011 (r228321) +++ head/lib/libc/stdlib/exit.3 Wed Dec 7 15:25:48 2011 (r228322) @@ -118,7 +118,9 @@ never return. .Xr _exit 2 , .Xr wait 2 , .Xr atexit 3 , +.Xr at_quick_exit 3 , .Xr intro 3 , +.Xr quick_exit 3 , .Xr sysexits 3 , .Xr tmpfile 3 .Sh STANDARDS Added: head/lib/libc/stdlib/quick_exit.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdlib/quick_exit.3 Wed Dec 7 15:25:48 2011 (r228322) @@ -0,0 +1,55 @@ +.\" Copyright (c) 2011 David Chisnall +.\" 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 December 7, 2011o.Dt ATEXIT 3 +.Dt QUICK_EXIT 3 +.Os +.Sh NAME +.Nm quick_exit +.Nd Exits a program quickly, running minimal cleanup +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In stdlib.h +.Ft _Noreturn void +.Fn quick_exit "void" +.Sh DESCRIPTION +The +.Fn quick_exit +function exits the program quickly calling any cleanup functions registered +with +.Xr at_quick_exit 3 +but not any C++ destructors or cleanup code registered with +.Xr atexit 3 . +.El +.Sh SEE ALSO +.Xr exit 3 , +.Xr at_quick_exit 3 +.Sh STANDARDS +The +.Fn quick_exit +function conforms to the C1x draft specification. + Added: head/lib/libc/stdlib/quick_exit.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/stdlib/quick_exit.c Wed Dec 7 15:25:48 2011 (r228322) @@ -0,0 +1,81 @@ +/*- + * Copyright (c) 2011 David Chisnall + * 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$ + */ + +#include +#include + +/** + * Linked list of quick exit handlers. This is simpler than the atexit() + * version, because it is not required to support C++ destructors or + * DSO-specific cleanups. + */ +struct quick_exit_handler { + struct quick_exit_handler *next; + void (*cleanup)(void); +}; + +__attribute((weak)) +void _ZSt9terminatev(void); + +/** + * Lock protecting the handlers list. + */ +static pthread_mutex_t atexit_mutex = PTHREAD_MUTEX_INITIALIZER; +/** + * Stack of cleanup handlers. These will be invoked in reverse order when + */ +static struct quick_exit_handler *handlers; + +int +at_quick_exit(void (*func)(void)) +{ + struct quick_exit_handler *h = malloc(sizeof(struct quick_exit_handler)); + + if (0 == h) { + return 1; + } + h->cleanup = func; + pthread_mutex_lock(&atexit_mutex); + h->next = handlers; + handlers = h; + pthread_mutex_unlock(&atexit_mutex); + return 0; +} + +void quick_exit(int status) +{ + /* + * XXX: The C++ spec requires us to call std::terminate if there is an + * exception here. + */ + for (struct quick_exit_handler *h = handlers ; NULL != h ; h = h->next) + { + h->cleanup(); + } + _Exit(status); +} Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Wed Dec 7 13:37:42 2011 (r228321) +++ head/sys/sys/cdefs.h Wed Dec 7 15:25:48 2011 (r228322) @@ -218,6 +218,17 @@ #endif #endif + +#if defined(__cplusplus) && __cplusplus >= 201103L +#define __noreturn [[noreturn]] +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 201000L +#define __noreturn _Noreturn +#elif defined(__GNUC__) +#define __noreturn __attribute__((__noreturn__)) +#else +#define __noreturn +#endif + #if __GNUC_PREREQ__(2, 96) #define __malloc_like __attribute__((__malloc__)) #define __pure __attribute__((__pure__)) From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 15:53:14 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB56A1065670; Wed, 7 Dec 2011 15:53:14 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 84AF78FC0A; Wed, 7 Dec 2011 15:53:14 +0000 (UTC) Received: from alf.home (alf.kiev.zoral.com.ua [10.1.1.177]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id pB7FrA5R028188 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 7 Dec 2011 17:53:10 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from alf.home (kostik@localhost [127.0.0.1]) by alf.home (8.14.5/8.14.5) with ESMTP id pB7FrA7A011466; Wed, 7 Dec 2011 17:53:10 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by alf.home (8.14.5/8.14.5/Submit) id pB7Fr9Bm011465; Wed, 7 Dec 2011 17:53:09 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: alf.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 7 Dec 2011 17:53:09 +0200 From: Kostik Belousov To: David Chisnall , brooks@freebsd.org Message-ID: <20111207155309.GH50300@deviant.kiev.zoral.com.ua> References: <201112071525.pB7FPmkH044896@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5qk+VjjGZp9A4i1j" Content-Disposition: inline In-Reply-To: <201112071525.pB7FPmkH044896@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228322 - in head: include lib/libc/stdlib sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 15:53:15 -0000 --5qk+VjjGZp9A4i1j Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 07, 2011 at 03:25:48PM +0000, David Chisnall wrote: > Author: theraven > Date: Wed Dec 7 15:25:48 2011 > New Revision: 228322 > URL: http://svn.freebsd.org/changeset/base/228322 >=20 > Log: > Implement quick_exit() / at_quick_exit() from C++11 / C1x. Also add a > __noreturn macro and modify the other exiting functions to use it. > =20 > The __noreturn macro, unlike __dead2, must be used BEFORE the function. > This is in line with the C and C++ specifications that place _Noreturn = (c1x) > and [[noreturn]] (C++11) in front of the functions. As with __dead2, t= his > macro falls back to using the GCC attribute. > =20 > Unfortunately, clang currently sets the same value for the C version ma= cro > in C99 and C1x modes, so these functions are hidden by default. At some > point before 10.0, I need to go through the headers and clean up the C1= x / > C++11 visibility. > =20 > Reviewed by: brooks (mentor) And, was it approved ? > +#include > +#include > + > +/** > + * Linked list of quick exit handlers. This is simpler than the atexit() > + * version, because it is not required to support C++ destructors or > + * DSO-specific cleanups. > + */ > +struct quick_exit_handler { > + struct quick_exit_handler *next; > + void (*cleanup)(void); > +}; > + > +__attribute((weak)) > +void _ZSt9terminatev(void); Why do you need this ? You are not calling terminate() anyway, and added an explicit comment. > + > +/** > + * Lock protecting the handlers list. > + */ > +static pthread_mutex_t atexit_mutex =3D PTHREAD_MUTEX_INITIALIZER; > +/** > + * Stack of cleanup handlers. These will be invoked in reverse order wh= en=20 > + */ > +static struct quick_exit_handler *handlers; > + > +int > +at_quick_exit(void (*func)(void)) > +{ > + struct quick_exit_handler *h =3D malloc(sizeof(struct quick_exit_handle= r)); You are making initialization at the declaration place, which is not recommended by style. > + > + if (0 =3D=3D h) { Why 0 and not NULL ? Later, you use NULL. The {} are not needed. > + return 1; This shall be return (1); > + } > + h->cleanup =3D func; > + pthread_mutex_lock(&atexit_mutex); Note that libc code is careful to only call pthread mutex functions if __isthreaded variable is set. Also note that libc uses mangled names to allow the application interpositi= on of the functions. E.g. ANSI C code is allowed to have pthread_mutex_lock() function defined. > + h->next =3D handlers; > + handlers =3D h; > + pthread_mutex_unlock(&atexit_mutex); > + return 0; And this shall be return (0); > +} > + > +void quick_exit(int status) The function name shall start at the column 0. > +{ > + /* > + * XXX: The C++ spec requires us to call std::terminate if there is an > + * exception here. > + */ > + for (struct quick_exit_handler *h =3D handlers ; NULL !=3D h ; h =3D h-= >next) This fragment violates so many style requirements that I probably fail to enumerate them all. The h declaration shall go at the start of function, and not at the for statement. The opening '{' shall be placed on the line of 'for'. More, the {} bracing is not needed there. No space is needed before ';', three times. > + { > + h->cleanup(); > + } > + _Exit(status); > +} --5qk+VjjGZp9A4i1j Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iEYEARECAAYFAk7fi+UACgkQC3+MBN1Mb4gx/gCg7LO58prTbsavYzvPC6I1zPaO szsAnR0Bk2AII9fhoa30RsMP3oEgbrXr =qn2t -----END PGP SIGNATURE----- --5qk+VjjGZp9A4i1j-- From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 16:03:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23C2B106566B; Wed, 7 Dec 2011 16:03:33 +0000 (UTC) (envelope-from stefan@fafoe.narf.at) Received: from fep20.mx.upcmail.net (fep20.mx.upcmail.net [62.179.121.40]) by mx1.freebsd.org (Postfix) with ESMTP id E1AE58FC19; Wed, 7 Dec 2011 16:03:31 +0000 (UTC) Received: from edge04.upcmail.net ([192.168.13.239]) by viefep20-int.chello.at (InterMail vM.8.01.05.04 201-2260-151-105-20111014) with ESMTP id <20111207160330.NBGI11861.viefep20-int.chello.at@edge04.upcmail.net>; Wed, 7 Dec 2011 17:03:30 +0100 Received: from mole.fafoe.narf.at ([213.47.85.26]) by edge04.upcmail.net with edge id 6G301i00s0a5KZh04G30PU; Wed, 07 Dec 2011 17:03:30 +0100 X-SourceIP: 213.47.85.26 Received: by mole.fafoe.narf.at (Postfix, from userid 1001) id 4861B6D432; Wed, 7 Dec 2011 17:03:00 +0100 (CET) Date: Wed, 7 Dec 2011 17:03:00 +0100 From: Stefan Farfeleder To: David Chisnall Message-ID: <20111207160259.GA1622@mole.fafoe.narf.at> References: <201112071525.pB7FPmkH044896@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201112071525.pB7FPmkH044896@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228322 - in head: include lib/libc/stdlib sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 16:03:33 -0000 On Wed, Dec 07, 2011 at 03:25:48PM +0000, David Chisnall wrote: > > /* > + * If we're in a mode greater than C99, expose C1x functions. > + */ > +#if __ISO_C_VISIBLE > 1999 > +__noreturn void quick_exit(int) > +int > +at_quick_exit(void (*func)(void)); > +#endif /* __ISO_C_VISIBLE > 1999 */ > +/* > * Extensions made by POSIX relative to C. We don't know yet which edition Shouldn't it be visible in the default mode too (__BSD_VISIBLE)? From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 16:12:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9742C1065675; Wed, 7 Dec 2011 16:12:54 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 874BF8FC0C; Wed, 7 Dec 2011 16:12:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7GCs6E046454; Wed, 7 Dec 2011 16:12:54 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7GCsjN046451; Wed, 7 Dec 2011 16:12:54 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201112071612.pB7GCsjN046451@svn.freebsd.org> From: David Chisnall Date: Wed, 7 Dec 2011 16:12:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228323 - head/lib/libc/stdlib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 16:12:54 -0000 Author: theraven Date: Wed Dec 7 16:12:54 2011 New Revision: 228323 URL: http://svn.freebsd.org/changeset/base/228323 Log: style(9) cleanups. Approved by: brooks (mentor) Modified: head/lib/libc/stdlib/quick_exit.c Modified: head/lib/libc/stdlib/quick_exit.c ============================================================================== --- head/lib/libc/stdlib/quick_exit.c Wed Dec 7 15:25:48 2011 (r228322) +++ head/lib/libc/stdlib/quick_exit.c Wed Dec 7 16:12:54 2011 (r228323) @@ -39,9 +39,6 @@ struct quick_exit_handler { void (*cleanup)(void); }; -__attribute((weak)) -void _ZSt9terminatev(void); - /** * Lock protecting the handlers list. */ @@ -56,26 +53,26 @@ at_quick_exit(void (*func)(void)) { struct quick_exit_handler *h = malloc(sizeof(struct quick_exit_handler)); - if (0 == h) { + if (NULL == h) return 1; - } h->cleanup = func; pthread_mutex_lock(&atexit_mutex); h->next = handlers; handlers = h; pthread_mutex_unlock(&atexit_mutex); - return 0; + return (0); } -void quick_exit(int status) +void +quick_exit(int status) { + struct quick_exit_handler *h; + /* * XXX: The C++ spec requires us to call std::terminate if there is an * exception here. */ - for (struct quick_exit_handler *h = handlers ; NULL != h ; h = h->next) - { + for (h = handlers; NULL != h; h = h->next) h->cleanup(); - } _Exit(status); } From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 16:27:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86A67106567A; Wed, 7 Dec 2011 16:27:24 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 76B828FC18; Wed, 7 Dec 2011 16:27:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7GROTp046914; Wed, 7 Dec 2011 16:27:24 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7GRORQ046912; Wed, 7 Dec 2011 16:27:24 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112071627.pB7GRORQ046912@svn.freebsd.org> From: Alan Cox Date: Wed, 7 Dec 2011 16:27:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228324 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 16:27:24 -0000 Author: alc Date: Wed Dec 7 16:27:23 2011 New Revision: 228324 URL: http://svn.freebsd.org/changeset/base/228324 Log: Eliminate stale numbers from a comment. Modified: head/sys/kern/kern_malloc.c Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Wed Dec 7 16:12:54 2011 (r228323) +++ head/sys/kern/kern_malloc.c Wed Dec 7 16:27:23 2011 (r228324) @@ -698,12 +698,9 @@ kmeminit(void *dummy) /* * Try to auto-tune the kernel memory size, so that it is - * more applicable for a wider range of machine sizes. - * On an X86, a VM_KMEM_SIZE_SCALE value of 4 is good, while - * a VM_KMEM_SIZE of 12MB is a fair compromise. The + * more applicable for a wider range of machine sizes. The * VM_KMEM_SIZE_MAX is dependent on the maximum KVA space - * available, and on an X86 with a total KVA space of 256MB, - * try to keep VM_KMEM_SIZE_MAX at 80MB or below. + * available. * * Note that the kmem_map is also used by the zone allocator, * so make sure that there is enough space. From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 17:30:29 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2915F106567B; Wed, 7 Dec 2011 17:30:29 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id B7ADC8FC14; Wed, 7 Dec 2011 17:30:28 +0000 (UTC) Received: from c211-28-227-231.carlnfd1.nsw.optusnet.com.au (c211-28-227-231.carlnfd1.nsw.optusnet.com.au [211.28.227.231]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pB7HUQAj022580 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 8 Dec 2011 04:30:27 +1100 Date: Thu, 8 Dec 2011 04:30:26 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Kostik Belousov In-Reply-To: <20111207155309.GH50300@deviant.kiev.zoral.com.ua> Message-ID: <20111208041138.Q2451@besplex.bde.org> References: <201112071525.pB7FPmkH044896@svn.freebsd.org> <20111207155309.GH50300@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, brooks@FreeBSD.org, David Chisnall , src-committers@FreeBSD.org Subject: Re: svn commit: r228322 - in head: include lib/libc/stdlib sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 17:30:29 -0000 On Wed, 7 Dec 2011, Kostik Belousov wrote: > On Wed, Dec 07, 2011 at 03:25:48PM +0000, David Chisnall wrote: >> Log: >> Implement quick_exit() / at_quick_exit() from C++11 / C1x. Also add a >> __noreturn macro and modify the other exiting functions to use it. >> ... >> +struct quick_exit_handler { >> + struct quick_exit_handler *next; >> + void (*cleanup)(void); >> +}; >> + >> +__attribute((weak)) >> +void _ZSt9terminatev(void); >> ... >> +{ >> + /* >> + * XXX: The C++ spec requires us to call std::terminate if there is an >> + * exception here. >> + */ >> + for (struct quick_exit_handler *h = handlers ; NULL != h ; h = h->next) > This fragment violates so many style requirements that I probably fail > to enumerate them all. > ... :-). And you didn't point the style violations in the __attribute(()) declaration above. These include - a hard-coded gccism - formatting of part of the declaration on a separate line - spelling __attribute__(()) unusually. I'm not sure what the weak attribute does by itself. only defines __weak_reference() and does it less unportably without using __attribute__(). > The h declaration shall go at the start of function, and not at the for > statement. The style rules may be different for C++. It is hard to know what they are since we don't have any. This declaration wouldn't even compile in C90, and style(9) barely supports that since it is based on K&R C. The declaration compiles in C99, but unnecessary use of C99 features is a style bug (because style(9) gives no examples of it). > ... Bruce From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 17:37:27 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41D261065672; Wed, 7 Dec 2011 17:37:27 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail09.syd.optusnet.com.au (mail09.syd.optusnet.com.au [211.29.132.190]) by mx1.freebsd.org (Postfix) with ESMTP id BAB8C8FC12; Wed, 7 Dec 2011 17:37:26 +0000 (UTC) Received: from c211-28-227-231.carlnfd1.nsw.optusnet.com.au (c211-28-227-231.carlnfd1.nsw.optusnet.com.au [211.28.227.231]) by mail09.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pB7HbOOl026013 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 8 Dec 2011 04:37:25 +1100 Date: Thu, 8 Dec 2011 04:37:24 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: David Chisnall In-Reply-To: <201112071612.pB7GCsjN046451@svn.freebsd.org> Message-ID: <20111208043100.M2451@besplex.bde.org> References: <201112071612.pB7GCsjN046451@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228323 - head/lib/libc/stdlib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 17:37:27 -0000 On Wed, 7 Dec 2011, David Chisnall wrote: > Log: > style(9) cleanups. Thanks, but many style bugs are still visible. > Modified: head/lib/libc/stdlib/quick_exit.c > ============================================================================== > --- head/lib/libc/stdlib/quick_exit.c Wed Dec 7 15:25:48 2011 (r228322) > +++ head/lib/libc/stdlib/quick_exit.c Wed Dec 7 16:12:54 2011 (r228323) > ... > @@ -56,26 +53,26 @@ at_quick_exit(void (*func)(void)) > { > struct quick_exit_handler *h = malloc(sizeof(struct quick_exit_handler)); This still has: - initialization in declaration - line too long - sizeof(typename) instead of sizeof(var). Maybe this is only a style bug for me, but for long typename's the verboseness given by sizeof(typename) helps implement the previous bug. > > - if (0 == h) { > + if (NULL == h) (h == NULL) would be normal. > return 1; This return is still missing parentheses. > - } > h->cleanup = func; > pthread_mutex_lock(&atexit_mutex); > h->next = handlers; > handlers = h; > pthread_mutex_unlock(&atexit_mutex); > - return 0; > + return (0); The one is fixed, so now the style for returns in this file is internally inconsistent. Bruce From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 18:17:09 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EF741065672; Wed, 7 Dec 2011 18:17:09 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3CEC38FC12; Wed, 7 Dec 2011 18:17:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7IH9hO050216; Wed, 7 Dec 2011 18:17:09 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7IH9e4050213; Wed, 7 Dec 2011 18:17:09 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112071817.pB7IH9e4050213@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Dec 2011 18:17:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228325 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 18:17:09 -0000 Author: yongari Date: Wed Dec 7 18:17:09 2011 New Revision: 228325 URL: http://svn.freebsd.org/changeset/base/228325 Log: Overhaul bus_dma(9) usage in et(4) and clean up TX/RX path. This change should make et(4) work on any architectures. o Remove m_getl inline function and replace it with stanard mbuf interfaces. Previous code tried to minimize code duplication but this came from incorrect use of common DMA tag. Driver may be still use a common RX allocation handler with additional structure changes but I don't see much point to do that it would make it hard to understand the code. o Remove DragonflyBSD specific constant EVL_ENCAPLEN, use ETHER_VLAN_ENCAP_LEN instead. o Add bunch of new RX status definition. It seems controller supports RX checksum offloading but I was not able to make the feature work yet. Currently driver checks whether recevied frame is good one or not. o Avoid a typedef ending in '_t' as style(9) says. o Controller has no restriction on DMA address space, so there is no reason to limit the DMA address to 32bit. Descriptor rings, status blocks and TX/RX buffers now use full 64bit DMA addressing. o Allocate DMA memory shared between host and controller as coherent. o Create 3 separate DMA tags to be used as TX, mini RX ring and stanard RX ring. Previously it created a single DMA tag and it was used to all three rings. o et(4) does not support jumbo frame at this moment and I still don't quite understand how jumbo frame works on this controller so use two RX rings to handle small sized frame and normal sized frame respectively. The mini RX ring will be used to receive frames that are less than or equal to 127 bytes. The second RX ring is used to receive frames that are not handled by the first RX ring. If jumbo frame support is implemented, driver may have to choose better RX scheme by letting the second RX ring handle jumbo frames. This scheme will mimic Broadcom's efficient jumbo frame handling feature. However RAM buffer size(16KB) of the controller is too small to hold 2 jumbo frames, if 9KB jumbo frame is used, I'm not sure how good performance would it have. o In et_rxeof(), make sure to check whether controller received good frame or not. Passing corrupted frame to upper layer is bad idea. o If driver receives a bad frame or driver fails to allocate RX buffer due to resource shortage condition, reuse previously loaded DMA map for RX buffer instead of unloading/loading RX buffer again. o et_init_tx_ring() never fails so change return type to void. o In watchdog handler, show TX DMA write back status of errored frame which could be used as a clue to debug watchdog timeout. o Add missing bus_dmamap_sync() in various places such that et(4) should work with bounce buffers(e.g. PAE). o TX side bus_dmamap_load_mbuf_sg(9) support. o RX side bus_dmamap_load_mbuf_sg(9) support. o Controller has no DMA alignment limit in RX buffer so use m_adj(9) in RX buffer allocation to make IP header align on 2 bytes boundary. Otherwise it would trigger unaligned access error in upper layer on strict alignment architectures. One of down side of controller is it provides limited set of RX buffer length like most Intel controllers. This is not problem at this moment because driver does not support jumbo frame yet but it may require alignment fixup code to support jumbo frame on strict alignment architectures. o In et_txeof(), don't zero TX descriptors for transmitted frames. TX descriptors don't need write access after transmission. Driver sets IFF_DRV_OACTIVE when the number of available TX descriptors are less than or equal to ET_NSEG_SPARE. Make sure to clear IFF_DRV_OACTIVE only when the number of available TX descriptor is greater than ET_NSEG_SPARE. Modified: head/sys/dev/et/if_et.c head/sys/dev/et/if_etvar.h Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Wed Dec 7 16:27:23 2011 (r228324) +++ head/sys/dev/et/if_et.c Wed Dec 7 18:17:09 2011 (r228325) @@ -99,7 +99,7 @@ static void et_init(void *); static int et_ioctl(struct ifnet *, u_long, caddr_t); static void et_start_locked(struct ifnet *); static void et_start(struct ifnet *); -static void et_watchdog(struct et_softc *); +static int et_watchdog(struct et_softc *); static int et_ifmedia_upd_locked(struct ifnet *); static int et_ifmedia_upd(struct ifnet *); static void et_ifmedia_sts(struct ifnet *, struct ifmediareq *); @@ -114,24 +114,22 @@ static void et_disable_intrs(struct et_s static void et_rxeof(struct et_softc *); static void et_txeof(struct et_softc *); -static int et_dma_alloc(device_t); -static void et_dma_free(device_t); -static int et_dma_mem_create(device_t, bus_size_t, bus_dma_tag_t *, - void **, bus_addr_t *, bus_dmamap_t *); -static void et_dma_mem_destroy(bus_dma_tag_t, void *, bus_dmamap_t); -static int et_dma_mbuf_create(device_t); -static void et_dma_mbuf_destroy(device_t, int, const int[]); -static void et_dma_ring_addr(void *, bus_dma_segment_t *, int, int); -static void et_dma_buf_addr(void *, bus_dma_segment_t *, int, - bus_size_t, int); -static int et_init_tx_ring(struct et_softc *); +static int et_dma_alloc(struct et_softc *); +static void et_dma_free(struct et_softc *); +static void et_dma_map_addr(void *, bus_dma_segment_t *, int, int); +static int et_dma_ring_alloc(struct et_softc *, bus_size_t, bus_size_t, + bus_dma_tag_t *, uint8_t **, bus_dmamap_t *, bus_addr_t *, + const char *); +static void et_dma_ring_free(struct et_softc *, bus_dma_tag_t *, uint8_t **, + bus_dmamap_t *); +static void et_init_tx_ring(struct et_softc *); static int et_init_rx_ring(struct et_softc *); static void et_free_tx_ring(struct et_softc *); static void et_free_rx_ring(struct et_softc *); static int et_encap(struct et_softc *, struct mbuf **); -static int et_newbuf(struct et_rxbuf_data *, int, int, int); -static int et_newbuf_cluster(struct et_rxbuf_data *, int, int); -static int et_newbuf_hdr(struct et_rxbuf_data *, int, int); +static int et_newbuf_cluster(struct et_rxbuf_data *, int); +static int et_newbuf_hdr(struct et_rxbuf_data *, int); +static void et_rxbuf_discard(struct et_rxbuf_data *, int); static void et_stop(struct et_softc *); static int et_chip_init(struct et_softc *); @@ -152,7 +150,6 @@ static void et_get_eaddr(device_t, uint8 static void et_setmulti(struct et_softc *); static void et_tick(void *); static void et_setmedia(struct et_softc *); -static void et_setup_rxdesc(struct et_rxbuf_data *, int, bus_addr_t); static const struct et_dev { uint16_t vid; @@ -202,18 +199,6 @@ TUNABLE_INT("hw.et.rx_intr_npkts", &et_r TUNABLE_INT("hw.et.rx_intr_delay", &et_rx_intr_delay); TUNABLE_INT("hw.et.tx_intr_nsegs", &et_tx_intr_nsegs); -struct et_bsize { - int bufsize; - et_newbuf_t newbuf; -}; - -static const struct et_bsize et_bufsize_std[ET_RX_NRING] = { - { .bufsize = ET_RXDMA_CTRL_RING0_128, - .newbuf = et_newbuf_hdr }, - { .bufsize = ET_RXDMA_CTRL_RING1_2048, - .newbuf = et_newbuf_cluster }, -}; - static int et_probe(device_t dev) { @@ -326,7 +311,7 @@ et_attach(device_t dev) et_disable_intrs(sc); - error = et_dma_alloc(dev); + error = et_dma_alloc(sc); if (error) goto fail; @@ -403,7 +388,7 @@ et_detach(device_t dev) if (sc->ifp != NULL) if_free(sc->ifp); - et_dma_free(dev); + et_dma_free(sc); mtx_destroy(&sc->sc_mtx); @@ -699,235 +684,250 @@ et_enable_intrs(struct et_softc *sc, uin CSR_WRITE_4(sc, ET_INTR_MASK, ~intrs); } +struct et_dmamap_arg { + bus_addr_t et_busaddr; +}; + +static void +et_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error) +{ + struct et_dmamap_arg *ctx; + + if (error) + return; + + KASSERT(nseg == 1, ("%s: %d segments returned!", __func__, nseg)); + + ctx = arg; + ctx->et_busaddr = segs->ds_addr; +} + static int -et_dma_alloc(device_t dev) +et_dma_ring_alloc(struct et_softc *sc, bus_size_t alignment, bus_size_t maxsize, + bus_dma_tag_t *tag, uint8_t **ring, bus_dmamap_t *map, bus_addr_t *paddr, + const char *msg) { - struct et_softc *sc = device_get_softc(dev); - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - int i, error; + struct et_dmamap_arg ctx; + int error; - /* - * Create top level DMA tag - */ - error = bus_dma_tag_create(NULL, 1, 0, - BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, - NULL, NULL, - MAXBSIZE, - BUS_SPACE_UNRESTRICTED, - BUS_SPACE_MAXSIZE_32BIT, - 0, NULL, NULL, &sc->sc_dtag); - if (error) { - device_printf(dev, "can't create DMA tag\n"); + error = bus_dma_tag_create(sc->sc_dtag, alignment, 0, BUS_SPACE_MAXADDR, + BUS_SPACE_MAXADDR, NULL, NULL, maxsize, 1, maxsize, 0, NULL, NULL, + tag); + if (error != 0) { + device_printf(sc->dev, "could not create %s dma tag\n", msg); return (error); } - - /* - * Create TX ring DMA stuffs - */ - error = et_dma_mem_create(dev, ET_TX_RING_SIZE, &tx_ring->tr_dtag, - (void **)&tx_ring->tr_desc, - &tx_ring->tr_paddr, &tx_ring->tr_dmap); - if (error) { - device_printf(dev, "can't create TX ring DMA stuffs\n"); + /* Allocate DMA'able memory for ring. */ + error = bus_dmamem_alloc(*tag, (void **)ring, + BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, map); + if (error != 0) { + device_printf(sc->dev, + "could not allocate DMA'able memory for %s\n", msg); return (error); } - - /* - * Create TX status DMA stuffs - */ - error = et_dma_mem_create(dev, sizeof(uint32_t), &txsd->txsd_dtag, - (void **)&txsd->txsd_status, - &txsd->txsd_paddr, &txsd->txsd_dmap); - if (error) { - device_printf(dev, "can't create TX status DMA stuffs\n"); + /* Load the address of the ring. */ + ctx.et_busaddr = 0; + error = bus_dmamap_load(*tag, *map, *ring, maxsize, et_dma_map_addr, + &ctx, BUS_DMA_NOWAIT); + if (error != 0) { + device_printf(sc->dev, + "could not load DMA'able memory for %s\n", msg); return (error); } + *paddr = ctx.et_busaddr; + return (0); +} - /* - * Create DMA stuffs for RX rings - */ - for (i = 0; i < ET_RX_NRING; ++i) { - static const uint32_t rx_ring_posreg[ET_RX_NRING] = - { ET_RX_RING0_POS, ET_RX_RING1_POS }; - - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[i]; +static void +et_dma_ring_free(struct et_softc *sc, bus_dma_tag_t *tag, uint8_t **ring, + bus_dmamap_t *map) +{ - error = et_dma_mem_create(dev, ET_RX_RING_SIZE, - &rx_ring->rr_dtag, - (void **)&rx_ring->rr_desc, - &rx_ring->rr_paddr, - &rx_ring->rr_dmap); - if (error) { - device_printf(dev, "can't create DMA stuffs for " - "the %d RX ring\n", i); - return (error); - } - rx_ring->rr_posreg = rx_ring_posreg[i]; + if (*map != NULL) + bus_dmamap_unload(*tag, *map); + if (*map != NULL && *ring != NULL) { + bus_dmamem_free(*tag, *ring, *map); + *ring = NULL; + *map = NULL; } - - /* - * Create RX stat ring DMA stuffs - */ - error = et_dma_mem_create(dev, ET_RXSTAT_RING_SIZE, - &rxst_ring->rsr_dtag, - (void **)&rxst_ring->rsr_stat, - &rxst_ring->rsr_paddr, &rxst_ring->rsr_dmap); - if (error) { - device_printf(dev, "can't create RX stat ring DMA stuffs\n"); - return (error); + if (*tag) { + bus_dma_tag_destroy(*tag); + *tag = NULL; } +} - /* - * Create RX status DMA stuffs - */ - error = et_dma_mem_create(dev, sizeof(struct et_rxstatus), - &rxsd->rxsd_dtag, - (void **)&rxsd->rxsd_status, - &rxsd->rxsd_paddr, &rxsd->rxsd_dmap); - if (error) { - device_printf(dev, "can't create RX status DMA stuffs\n"); +static int +et_dma_alloc(struct et_softc *sc) +{ + struct et_txdesc_ring *tx_ring; + struct et_rxdesc_ring *rx_ring; + struct et_rxstat_ring *rxst_ring; + struct et_rxstatus_data *rxsd; + struct et_rxbuf_data *rbd; + struct et_txbuf_data *tbd; + struct et_txstatus_data *txsd; + int i, error; + + error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, + &sc->sc_dtag); + if (error != 0) { + device_printf(sc->dev, "could not allocate parent dma tag\n"); return (error); } - /* - * Create mbuf DMA stuffs - */ - error = et_dma_mbuf_create(dev); + /* TX ring. */ + tx_ring = &sc->sc_tx_ring; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_TX_RING_SIZE, + &tx_ring->tr_dtag, (uint8_t **)&tx_ring->tr_desc, &tx_ring->tr_dmap, + &tx_ring->tr_paddr, "TX ring"); if (error) return (error); - return (0); -} + /* TX status block. */ + txsd = &sc->sc_tx_status; + error = et_dma_ring_alloc(sc, ET_STATUS_ALIGN, sizeof(uint32_t), + &txsd->txsd_dtag, (uint8_t **)&txsd->txsd_status, &txsd->txsd_dmap, + &txsd->txsd_paddr, "TX status block"); + if (error) + return (error); -static void -et_dma_free(device_t dev) -{ - struct et_softc *sc = device_get_softc(dev); - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - int i, rx_done[ET_RX_NRING]; + /* RX ring 0, used as to recive small sized frames. */ + rx_ring = &sc->sc_rx_ring[0]; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RX_RING_SIZE, + &rx_ring->rr_dtag, (uint8_t **)&rx_ring->rr_desc, &rx_ring->rr_dmap, + &rx_ring->rr_paddr, "RX ring 0"); + rx_ring->rr_posreg = ET_RX_RING0_POS; + if (error) + return (error); - /* - * Destroy TX ring DMA stuffs - */ - et_dma_mem_destroy(tx_ring->tr_dtag, tx_ring->tr_desc, - tx_ring->tr_dmap); + /* RX ring 1, used as to store normal sized frames. */ + rx_ring = &sc->sc_rx_ring[1]; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RX_RING_SIZE, + &rx_ring->rr_dtag, (uint8_t **)&rx_ring->rr_desc, &rx_ring->rr_dmap, + &rx_ring->rr_paddr, "RX ring 1"); + rx_ring->rr_posreg = ET_RX_RING1_POS; + if (error) + return (error); - /* - * Destroy TX status DMA stuffs - */ - et_dma_mem_destroy(txsd->txsd_dtag, txsd->txsd_status, - txsd->txsd_dmap); + /* RX stat ring. */ + rxst_ring = &sc->sc_rxstat_ring; + error = et_dma_ring_alloc(sc, ET_RING_ALIGN, ET_RXSTAT_RING_SIZE, + &rxst_ring->rsr_dtag, (uint8_t **)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap, &rxst_ring->rsr_paddr, "RX stat ring"); + if (error) + return (error); - /* - * Destroy DMA stuffs for RX rings - */ - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[i]; + /* RX status block. */ + rxsd = &sc->sc_rx_status; + error = et_dma_ring_alloc(sc, ET_STATUS_ALIGN, + sizeof(struct et_rxstatus), &rxsd->rxsd_dtag, + (uint8_t **)&rxsd->rxsd_status, &rxsd->rxsd_dmap, + &rxsd->rxsd_paddr, "RX status block"); + if (error) + return (error); - et_dma_mem_destroy(rx_ring->rr_dtag, rx_ring->rr_desc, - rx_ring->rr_dmap); + /* Create parent DMA tag for mbufs. */ + error = bus_dma_tag_create(bus_get_dma_tag(sc->dev), 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, + &sc->sc_mbuf_dtag); + if (error != 0) { + device_printf(sc->dev, + "could not allocate parent dma tag for mbuf\n"); + return (error); } - /* - * Destroy RX stat ring DMA stuffs - */ - et_dma_mem_destroy(rxst_ring->rsr_dtag, rxst_ring->rsr_stat, - rxst_ring->rsr_dmap); - - /* - * Destroy RX status DMA stuffs - */ - et_dma_mem_destroy(rxsd->rxsd_dtag, rxsd->rxsd_status, - rxsd->rxsd_dmap); - - /* - * Destroy mbuf DMA stuffs - */ - for (i = 0; i < ET_RX_NRING; ++i) - rx_done[i] = ET_RX_NDESC; - et_dma_mbuf_destroy(dev, ET_TX_NDESC, rx_done); - - /* - * Destroy top level DMA tag - */ - if (sc->sc_dtag != NULL) - bus_dma_tag_destroy(sc->sc_dtag); -} - -static int -et_dma_mbuf_create(device_t dev) -{ - struct et_softc *sc = device_get_softc(dev); - struct et_txbuf_data *tbd = &sc->sc_tx_data; - int i, error, rx_done[ET_RX_NRING]; + /* Create DMA tag for mini RX mbufs to use RX ring 0. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MHLEN, 1, + MHLEN, 0, NULL, NULL, &sc->sc_rx_mini_tag); + if (error) { + device_printf(sc->dev, "could not create mini RX dma tag\n"); + return (error); + } - /* - * Create mbuf DMA tag - */ - error = bus_dma_tag_create(sc->sc_dtag, 1, 0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, - NULL, NULL, - ET_JUMBO_FRAMELEN, ET_NSEG_MAX, - BUS_SPACE_MAXSIZE_32BIT, - BUS_DMA_ALLOCNOW, NULL, NULL, &sc->sc_mbuf_dtag); + /* Create DMA tag for standard RX mbufs to use RX ring 1. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, + MCLBYTES, 0, NULL, NULL, &sc->sc_rx_tag); if (error) { - device_printf(dev, "can't create mbuf DMA tag\n"); + device_printf(sc->dev, "could not create RX dma tag\n"); return (error); } - /* - * Create spare DMA map for RX mbufs - */ - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, &sc->sc_mbuf_tmp_dmap); + /* Create DMA tag for TX mbufs. */ + error = bus_dma_tag_create(sc->sc_mbuf_dtag, 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + MCLBYTES * ET_NSEG_MAX, ET_NSEG_MAX, MCLBYTES, 0, NULL, NULL, + &sc->sc_tx_tag); if (error) { - device_printf(dev, "can't create spare mbuf DMA map\n"); - bus_dma_tag_destroy(sc->sc_mbuf_dtag); - sc->sc_mbuf_dtag = NULL; + device_printf(sc->dev, "could not create TX dma tag\n"); return (error); } - /* - * Create DMA maps for RX mbufs - */ - bzero(rx_done, sizeof(rx_done)); - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[i]; - int j; + /* Initialize RX ring 0. */ + rbd = &sc->sc_rx_data[0]; + rbd->rbd_bufsize = ET_RXDMA_CTRL_RING0_128; + rbd->rbd_newbuf = et_newbuf_hdr; + rbd->rbd_discard = et_rxbuf_discard; + rbd->rbd_softc = sc; + rbd->rbd_ring = &sc->sc_rx_ring[0]; + /* Create DMA maps for mini RX buffers, ring 0. */ + for (i = 0; i < ET_RX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_rx_mini_tag, 0, + &rbd->rbd_buf[i].rb_dmap); + if (error) { + device_printf(sc->dev, + "could not create DMA map for mini RX mbufs\n"); + return (error); + } + } - for (j = 0; j < ET_RX_NDESC; ++j) { - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, - &rbd->rbd_buf[j].rb_dmap); - if (error) { - device_printf(dev, "can't create %d RX mbuf " - "for %d RX ring\n", j, i); - rx_done[i] = j; - et_dma_mbuf_destroy(dev, 0, rx_done); - return (error); - } + /* Create a spare DMA map for mini RX buffers, ring 0. */ + error = bus_dmamap_create(sc->sc_rx_mini_tag, 0, + &sc->sc_rx_mini_sparemap); + if (error) { + device_printf(sc->dev, + "could not create spare DMA map for mini RX mbuf\n"); + return (error); + } + + /* Initialize RX ring 1. */ + rbd = &sc->sc_rx_data[1]; + rbd->rbd_bufsize = ET_RXDMA_CTRL_RING1_2048; + rbd->rbd_newbuf = et_newbuf_cluster; + rbd->rbd_discard = et_rxbuf_discard; + rbd->rbd_softc = sc; + rbd->rbd_ring = &sc->sc_rx_ring[1]; + /* Create DMA maps for standard RX buffers, ring 1. */ + for (i = 0; i < ET_RX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_rx_tag, 0, + &rbd->rbd_buf[i].rb_dmap); + if (error) { + device_printf(sc->dev, + "could not create DMA map for mini RX mbufs\n"); + return (error); } - rx_done[i] = ET_RX_NDESC; + } - rbd->rbd_softc = sc; - rbd->rbd_ring = &sc->sc_rx_ring[i]; + /* Create a spare DMA map for standard RX buffers, ring 1. */ + error = bus_dmamap_create(sc->sc_rx_tag, 0, &sc->sc_rx_sparemap); + if (error) { + device_printf(sc->dev, + "could not create spare DMA map for RX mbuf\n"); + return (error); } - /* - * Create DMA maps for TX mbufs - */ - for (i = 0; i < ET_TX_NDESC; ++i) { - error = bus_dmamap_create(sc->sc_mbuf_dtag, 0, - &tbd->tbd_buf[i].tb_dmap); + /* Create DMA maps for TX buffers. */ + tbd = &sc->sc_tx_data; + for (i = 0; i < ET_TX_NDESC; i++) { + error = bus_dmamap_create(sc->sc_tx_tag, 0, + &tbd->tbd_buf[i].tb_dmap); if (error) { - device_printf(dev, "can't create %d TX mbuf " - "DMA map\n", i); - et_dma_mbuf_destroy(dev, i, rx_done); + device_printf(sc->dev, + "could not create DMA map for TX mbufs\n"); return (error); } } @@ -936,106 +936,97 @@ et_dma_mbuf_create(device_t dev) } static void -et_dma_mbuf_destroy(device_t dev, int tx_done, const int rx_done[]) +et_dma_free(struct et_softc *sc) { - struct et_softc *sc = device_get_softc(dev); - struct et_txbuf_data *tbd = &sc->sc_tx_data; + struct et_txdesc_ring *tx_ring; + struct et_rxdesc_ring *rx_ring; + struct et_txstatus_data *txsd; + struct et_rxstat_ring *rxst_ring; + struct et_rxstatus_data *rxsd; + struct et_rxbuf_data *rbd; + struct et_txbuf_data *tbd; int i; - if (sc->sc_mbuf_dtag == NULL) - return; - - /* - * Destroy DMA maps for RX mbufs - */ - for (i = 0; i < ET_RX_NRING; ++i) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[i]; - int j; - - for (j = 0; j < rx_done[i]; ++j) { - struct et_rxbuf *rb = &rbd->rbd_buf[j]; - - KASSERT(rb->rb_mbuf == NULL, - ("RX mbuf in %d RX ring is not freed yet\n", i)); - bus_dmamap_destroy(sc->sc_mbuf_dtag, rb->rb_dmap); + /* Destroy DMA maps for mini RX buffers, ring 0. */ + rbd = &sc->sc_rx_data[0]; + for (i = 0; i < ET_RX_NDESC; i++) { + if (rbd->rbd_buf[i].rb_dmap) { + bus_dmamap_destroy(sc->sc_rx_mini_tag, + rbd->rbd_buf[i].rb_dmap); + rbd->rbd_buf[i].rb_dmap = NULL; } } - - /* - * Destroy DMA maps for TX mbufs - */ - for (i = 0; i < tx_done; ++i) { - struct et_txbuf *tb = &tbd->tbd_buf[i]; - - KASSERT(tb->tb_mbuf == NULL, ("TX mbuf is not freed yet\n")); - bus_dmamap_destroy(sc->sc_mbuf_dtag, tb->tb_dmap); + if (sc->sc_rx_mini_sparemap) { + bus_dmamap_destroy(sc->sc_rx_mini_tag, sc->sc_rx_mini_sparemap); + sc->sc_rx_mini_sparemap = NULL; } - - /* - * Destroy spare mbuf DMA map - */ - bus_dmamap_destroy(sc->sc_mbuf_dtag, sc->sc_mbuf_tmp_dmap); - - /* - * Destroy mbuf DMA tag - */ - bus_dma_tag_destroy(sc->sc_mbuf_dtag); - sc->sc_mbuf_dtag = NULL; -} - -static int -et_dma_mem_create(device_t dev, bus_size_t size, bus_dma_tag_t *dtag, - void **addr, bus_addr_t *paddr, bus_dmamap_t *dmap) -{ - struct et_softc *sc = device_get_softc(dev); - int error; - - error = bus_dma_tag_create(sc->sc_dtag, ET_ALIGN, 0, - BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, - NULL, NULL, - size, 1, BUS_SPACE_MAXSIZE_32BIT, - 0, NULL, NULL, dtag); - if (error) { - device_printf(dev, "can't create DMA tag\n"); - return (error); + if (sc->sc_rx_mini_tag) { + bus_dma_tag_destroy(sc->sc_rx_mini_tag); + sc->sc_rx_mini_tag = NULL; } - error = bus_dmamem_alloc(*dtag, addr, BUS_DMA_WAITOK | BUS_DMA_ZERO, - dmap); - if (error) { - device_printf(dev, "can't allocate DMA mem\n"); - bus_dma_tag_destroy(*dtag); - *dtag = NULL; - return (error); + /* Destroy DMA maps for standard RX buffers, ring 1. */ + rbd = &sc->sc_rx_data[1]; + for (i = 0; i < ET_RX_NDESC; i++) { + if (rbd->rbd_buf[i].rb_dmap) { + bus_dmamap_destroy(sc->sc_rx_tag, + rbd->rbd_buf[i].rb_dmap); + rbd->rbd_buf[i].rb_dmap = NULL; + } } - - error = bus_dmamap_load(*dtag, *dmap, *addr, size, - et_dma_ring_addr, paddr, BUS_DMA_WAITOK); - if (error) { - device_printf(dev, "can't load DMA mem\n"); - bus_dmamem_free(*dtag, *addr, *dmap); - bus_dma_tag_destroy(*dtag); - *dtag = NULL; - return (error); + if (sc->sc_rx_sparemap) { + bus_dmamap_destroy(sc->sc_rx_tag, sc->sc_rx_sparemap); + sc->sc_rx_sparemap = NULL; + } + if (sc->sc_rx_tag) { + bus_dma_tag_destroy(sc->sc_rx_tag); + sc->sc_rx_tag = NULL; } - return (0); -} -static void -et_dma_mem_destroy(bus_dma_tag_t dtag, void *addr, bus_dmamap_t dmap) -{ - if (dtag != NULL) { - bus_dmamap_unload(dtag, dmap); - bus_dmamem_free(dtag, addr, dmap); - bus_dma_tag_destroy(dtag); + /* Destroy DMA maps for TX buffers. */ + tbd = &sc->sc_tx_data; + for (i = 0; i < ET_TX_NDESC; i++) { + if (tbd->tbd_buf[i].tb_dmap) { + bus_dmamap_destroy(sc->sc_tx_tag, + tbd->tbd_buf[i].tb_dmap); + tbd->tbd_buf[i].tb_dmap = NULL; + } + } + if (sc->sc_tx_tag) { + bus_dma_tag_destroy(sc->sc_tx_tag); + sc->sc_tx_tag = NULL; } -} -static void -et_dma_ring_addr(void *arg, bus_dma_segment_t *seg, int nseg, int error) -{ - KASSERT(nseg == 1, ("too many segments\n")); - *((bus_addr_t *)arg) = seg->ds_addr; + /* Destroy mini RX ring, ring 0. */ + rx_ring = &sc->sc_rx_ring[0]; + et_dma_ring_free(sc, &rx_ring->rr_dtag, (void *)&rx_ring->rr_desc, + &rx_ring->rr_dmap); + /* Destroy standard RX ring, ring 1. */ + rx_ring = &sc->sc_rx_ring[1]; + et_dma_ring_free(sc, &rx_ring->rr_dtag, (void *)&rx_ring->rr_desc, + &rx_ring->rr_dmap); + /* Destroy RX stat ring. */ + rxst_ring = &sc->sc_rxstat_ring; + et_dma_ring_free(sc, &rxst_ring->rsr_dtag, (void *)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap); + /* Destroy RX status block. */ + rxsd = &sc->sc_rx_status; + et_dma_ring_free(sc, &rxst_ring->rsr_dtag, (void *)&rxst_ring->rsr_stat, + &rxst_ring->rsr_dmap); + /* Destroy TX ring. */ + tx_ring = &sc->sc_tx_ring; + et_dma_ring_free(sc, &tx_ring->tr_dtag, (void *)&tx_ring->tr_desc, + &tx_ring->tr_dmap); + /* Destroy TX status block. */ + txsd = &sc->sc_tx_status; + et_dma_ring_free(sc, &txsd->txsd_dtag, (void *)&txsd->txsd_status, + &txsd->txsd_dmap); + + /* Destroy the parent tag. */ + if (sc->sc_dtag) { + bus_dma_tag_destroy(sc->sc_dtag); + sc->sc_dtag = NULL; + } } static void @@ -1113,30 +1104,21 @@ back: static void et_init_locked(struct et_softc *sc) { - struct ifnet *ifp = sc->ifp; - const struct et_bsize *arr; - int error, i; + struct ifnet *ifp; + int error; ET_LOCK_ASSERT(sc); + ifp = sc->ifp; if (ifp->if_drv_flags & IFF_DRV_RUNNING) return; et_stop(sc); - arr = et_bufsize_std; - for (i = 0; i < ET_RX_NRING; ++i) { - sc->sc_rx_data[i].rbd_bufsize = arr[i].bufsize; - sc->sc_rx_data[i].rbd_newbuf = arr[i].newbuf; - } - - error = et_init_tx_ring(sc); - if (error) - goto back; - + et_init_tx_ring(sc); error = et_init_rx_ring(sc); if (error) - goto back; + return; error = et_chip_init(sc); if (error) @@ -1309,20 +1291,26 @@ et_start(struct ifnet *ifp) ET_UNLOCK(sc); } -static void +static int et_watchdog(struct et_softc *sc) { + uint32_t status; + ET_LOCK_ASSERT(sc); if (sc->watchdog_timer == 0 || --sc->watchdog_timer) - return; + return (0); - if_printf(sc->ifp, "watchdog timed out\n"); + bus_dmamap_sync(sc->sc_tx_status.txsd_dtag, sc->sc_tx_status.txsd_dmap, + BUS_DMASYNC_POSTREAD); + status = le32toh(*(sc->sc_tx_status.txsd_status)); + if_printf(sc->ifp, "watchdog timed out (0x%08x) -- resetting\n", + status); sc->ifp->if_oerrors++; sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; et_init_locked(sc); - et_start_locked(sc->ifp); + return (EJUSTRETURN); } static int @@ -1350,49 +1338,59 @@ et_stop_txdma(struct et_softc *sc) static void et_free_tx_ring(struct et_softc *sc) { - struct et_txbuf_data *tbd = &sc->sc_tx_data; - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; + struct et_txdesc_ring *tx_ring; + struct et_txbuf_data *tbd; + struct et_txbuf *tb; int i; + tbd = &sc->sc_tx_data; + tx_ring = &sc->sc_tx_ring; for (i = 0; i < ET_TX_NDESC; ++i) { - struct et_txbuf *tb = &tbd->tbd_buf[i]; - + tb = &tbd->tbd_buf[i]; if (tb->tb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_tx_tag, tb->tb_dmap, + BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->sc_mbuf_dtag, tb->tb_dmap); m_freem(tb->tb_mbuf); tb->tb_mbuf = NULL; } } - - bzero(tx_ring->tr_desc, ET_TX_RING_SIZE); - bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); } static void et_free_rx_ring(struct et_softc *sc) { - int n; - - for (n = 0; n < ET_RX_NRING; ++n) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[n]; - struct et_rxdesc_ring *rx_ring = &sc->sc_rx_ring[n]; - int i; - - for (i = 0; i < ET_RX_NDESC; ++i) { - struct et_rxbuf *rb = &rbd->rbd_buf[i]; + struct et_rxbuf_data *rbd; + struct et_rxdesc_ring *rx_ring; + struct et_rxbuf *rb; + int i; - if (rb->rb_mbuf != NULL) { - bus_dmamap_unload(sc->sc_mbuf_dtag, - rb->rb_dmap); - m_freem(rb->rb_mbuf); - rb->rb_mbuf = NULL; - } + /* Ring 0 */ + rx_ring = &sc->sc_rx_ring[0]; + rbd = &sc->sc_rx_data[0]; + for (i = 0; i < ET_RX_NDESC; ++i) { + rb = &rbd->rbd_buf[i]; + if (rb->rb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_rx_mini_tag, rx_ring->rr_dmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->sc_rx_mini_tag, rb->rb_dmap); + m_freem(rb->rb_mbuf); + rb->rb_mbuf = NULL; } + } - bzero(rx_ring->rr_desc, ET_RX_RING_SIZE); - bus_dmamap_sync(rx_ring->rr_dtag, rx_ring->rr_dmap, - BUS_DMASYNC_PREWRITE); + /* Ring 1 */ + rx_ring = &sc->sc_rx_ring[1]; + rbd = &sc->sc_rx_data[1]; + for (i = 0; i < ET_RX_NDESC; ++i) { + rb = &rbd->rbd_buf[i]; + if (rb->rb_mbuf != NULL) { + bus_dmamap_sync(sc->sc_rx_tag, rx_ring->rr_dmap, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->sc_rx_tag, rb->rb_dmap); + m_freem(rb->rb_mbuf); + rb->rb_mbuf = NULL; + } } } @@ -1519,40 +1517,41 @@ et_chip_init(struct et_softc *sc) return (0); } -static int +static void et_init_tx_ring(struct et_softc *sc) { - struct et_txdesc_ring *tx_ring = &sc->sc_tx_ring; - struct et_txstatus_data *txsd = &sc->sc_tx_status; - struct et_txbuf_data *tbd = &sc->sc_tx_data; + struct et_txdesc_ring *tx_ring; + struct et_txbuf_data *tbd; + struct et_txstatus_data *txsd; + tx_ring = &sc->sc_tx_ring; bzero(tx_ring->tr_desc, ET_TX_RING_SIZE); bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREWRITE); + tbd = &sc->sc_tx_data; tbd->tbd_start_index = 0; tbd->tbd_start_wrap = 0; tbd->tbd_used = 0; + txsd = &sc->sc_tx_status; bzero(txsd->txsd_status, sizeof(uint32_t)); bus_dmamap_sync(txsd->txsd_dtag, txsd->txsd_dmap, - BUS_DMASYNC_PREWRITE); - return (0); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); } static int et_init_rx_ring(struct et_softc *sc) { - struct et_rxstatus_data *rxsd = &sc->sc_rx_status; - struct et_rxstat_ring *rxst_ring = &sc->sc_rxstat_ring; - int n; + struct et_rxstatus_data *rxsd; + struct et_rxstat_ring *rxst_ring; + struct et_rxbuf_data *rbd; + int i, error, n; for (n = 0; n < ET_RX_NRING; ++n) { - struct et_rxbuf_data *rbd = &sc->sc_rx_data[n]; - int i, error; - + rbd = &sc->sc_rx_data[n]; for (i = 0; i < ET_RX_NDESC; ++i) { - error = rbd->rbd_newbuf(rbd, i, 1); + error = rbd->rbd_newbuf(rbd, i); if (error) { if_printf(sc->ifp, "%d ring %d buf, " "newbuf failed: %d\n", n, i, error); @@ -1561,37 +1560,19 @@ et_init_rx_ring(struct et_softc *sc) } } + rxsd = &sc->sc_rx_status; bzero(rxsd->rxsd_status, sizeof(struct et_rxstatus)); bus_dmamap_sync(rxsd->rxsd_dtag, rxsd->rxsd_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + rxst_ring = &sc->sc_rxstat_ring; bzero(rxst_ring->rsr_stat, ET_RXSTAT_RING_SIZE); bus_dmamap_sync(rxst_ring->rsr_dtag, rxst_ring->rsr_dmap, - BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); return (0); } -static void -et_dma_buf_addr(void *xctx, bus_dma_segment_t *segs, int nsegs, - bus_size_t mapsz __unused, int error) -{ - struct et_dmamap_ctx *ctx = xctx; - int i; - - if (error) - return; - - if (nsegs > ctx->nsegs) { - ctx->nsegs = 0; - return; - } - - ctx->nsegs = nsegs; - for (i = 0; i < nsegs; ++i) - ctx->segs[i] = segs[i]; -} - static int et_init_rxdma(struct et_softc *sc) { @@ -1929,13 +1910,20 @@ et_enable_txrx(struct et_softc *sc, int static void et_rxeof(struct et_softc *sc) { - struct ifnet *ifp; struct et_rxstatus_data *rxsd; struct et_rxstat_ring *rxst_ring; - uint32_t rxs_stat_ring, rxst_info2; - int rxst_wrap, rxst_index; + struct et_rxbuf_data *rbd; + struct et_rxdesc_ring *rx_ring; + struct et_rxstat *st; + struct ifnet *ifp; + struct mbuf *m; + uint32_t rxstat_pos, rxring_pos; + uint32_t rxst_info1, rxst_info2, rxs_stat_ring; + int buflen, buf_idx, npost[2], ring_idx; + int rxst_index, rxst_wrap; ET_LOCK_ASSERT(sc); + ifp = sc->ifp; rxsd = &sc->sc_rx_status; rxst_ring = &sc->sc_rxstat_ring; @@ -1944,26 +1932,24 @@ et_rxeof(struct et_softc *sc) return; bus_dmamap_sync(rxsd->rxsd_dtag, rxsd->rxsd_dmap, - BUS_DMASYNC_POSTREAD); + BUS_DMASYNC_POSTREAD); bus_dmamap_sync(rxst_ring->rsr_dtag, rxst_ring->rsr_dmap, - BUS_DMASYNC_POSTREAD); + BUS_DMASYNC_POSTREAD); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 19:08:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAE15106564A; Wed, 7 Dec 2011 19:08:54 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9FAB78FC08; Wed, 7 Dec 2011 19:08:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7J8sj0051833; Wed, 7 Dec 2011 19:08:54 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7J8sbo051830; Wed, 7 Dec 2011 19:08:54 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112071908.pB7J8sbo051830@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Dec 2011 19:08:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228326 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 19:08:54 -0000 Author: yongari Date: Wed Dec 7 19:08:54 2011 New Revision: 228326 URL: http://svn.freebsd.org/changeset/base/228326 Log: Controller does not require TX start command for every frame. So send a single TX command after setting up all TX frames. This removes unnecessary register accesses and bus_dmamap_sync(9) calls. et(4) uses TX interrupt moderation so it's possible to have TX buffers that were already transmitted but waiting for TX completion interrupt. If the number of available TX descriptor is less then 1/3 of total TX descriptor, try reclaiming first to get enough free TX descriptors before setting up TX descriptors. After r228325, et_txeof() no longer tries to send frames after reclaiming TX buffers. That change was made to give more chance to transmit frames in main interrupt handler since we can still send frames in interrupt handler with RX interrupt. So right before exiting interrupt hander, after enabling interrupt, try to send more frames. This gives slightly better performance numbers. While I'm here reduce number of spare TX descriptors from 8 to 4. Controller does not require reserved TX descriptors, it was just to reduce TX overhead. After r228325, driver has much lower TX overhead so it does not make sense to reserve 8 TX descriptors. Modified: head/sys/dev/et/if_et.c head/sys/dev/et/if_etvar.h Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Wed Dec 7 18:17:09 2011 (r228325) +++ head/sys/dev/et/if_et.c Wed Dec 7 19:08:54 2011 (r228326) @@ -1097,7 +1097,11 @@ et_intr(void *xsc) if (intrs & ET_INTR_TIMER) CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); back: - et_enable_intrs(sc, ET_INTRS); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + et_enable_intrs(sc, ET_INTRS); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + et_start_locked(ifp); + } ET_UNLOCK(sc); } @@ -1240,7 +1244,9 @@ et_start_locked(struct ifnet *ifp) { struct et_softc *sc; struct mbuf *m_head = NULL; + struct et_txdesc_ring *tx_ring; struct et_txbuf_data *tbd; + uint32_t tx_ready_pos; int enq; sc = ifp->if_softc; @@ -1252,7 +1258,18 @@ et_start_locked(struct ifnet *ifp) if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; + /* + * Driver does not request TX completion interrupt for every + * queued frames to prevent generating excessive interrupts. + * This means driver may wait for TX completion interrupt even + * though some frames were sucessfully transmitted. Reclaiming + * transmitted frames will ensure driver see all available + * descriptors. + */ tbd = &sc->sc_tx_data; + if (tbd->tbd_used > (ET_TX_NDESC * 2) / 3) + et_txeof(sc); + for (enq = 0; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { if (tbd->tbd_used + ET_NSEG_SPARE >= ET_TX_NDESC) { ifp->if_drv_flags |= IFF_DRV_OACTIVE; @@ -1277,8 +1294,17 @@ et_start_locked(struct ifnet *ifp) ETHER_BPF_MTAP(ifp, m_head); } - if (enq > 0) + if (enq > 0) { + tx_ring = &sc->sc_tx_ring; + bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, + BUS_DMASYNC_PREWRITE); + tx_ready_pos = tx_ring->tr_ready_index & + ET_TX_READY_POS_INDEX_MASK; + if (tx_ring->tr_ready_wrap) + tx_ready_pos |= ET_TX_READY_POS_WRAP; + CSR_WRITE_4(sc, ET_TX_READY_POS, tx_ready_pos); sc->watchdog_timer = 5; + } } static void @@ -2036,7 +2062,7 @@ et_encap(struct et_softc *sc, struct mbu struct mbuf *m; bus_dma_segment_t segs[ET_NSEG_MAX]; bus_dmamap_t map; - uint32_t csum_flags, last_td_ctrl2, tx_ready_pos; + uint32_t csum_flags, last_td_ctrl2; int error, i, idx, first_idx, last_idx, nsegs; tx_ring = &sc->sc_tx_ring; @@ -2121,12 +2147,6 @@ et_encap(struct et_softc *sc, struct mbu tbd->tbd_used += nsegs; MPASS(tbd->tbd_used <= ET_TX_NDESC); - bus_dmamap_sync(tx_ring->tr_dtag, tx_ring->tr_dmap, - BUS_DMASYNC_PREWRITE); - tx_ready_pos = tx_ring->tr_ready_index & ET_TX_READY_POS_INDEX_MASK; - if (tx_ring->tr_ready_wrap) - tx_ready_pos |= ET_TX_READY_POS_WRAP; - CSR_WRITE_4(sc, ET_TX_READY_POS, tx_ready_pos); return (0); } Modified: head/sys/dev/et/if_etvar.h ============================================================================== --- head/sys/dev/et/if_etvar.h Wed Dec 7 18:17:09 2011 (r228325) +++ head/sys/dev/et/if_etvar.h Wed Dec 7 19:08:54 2011 (r228326) @@ -41,7 +41,7 @@ #define ET_RING_ALIGN 4096 #define ET_STATUS_ALIGN 8 #define ET_NSEG_MAX 32 /* XXX no limit actually */ -#define ET_NSEG_SPARE 8 +#define ET_NSEG_SPARE 4 #define ET_TX_NDESC 512 #define ET_RX_NDESC 512 From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 19:11:36 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D295106566B; Wed, 7 Dec 2011 19:11:36 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (ZIM.MIT.EDU [18.95.3.101]) by mx1.freebsd.org (Postfix) with ESMTP id 447E18FC12; Wed, 7 Dec 2011 19:11:35 +0000 (UTC) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.5/8.14.2) with ESMTP id pB7JBYvg020928; Wed, 7 Dec 2011 14:11:34 -0500 (EST) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.5/8.14.2/Submit) id pB7JBYXQ020927; Wed, 7 Dec 2011 14:11:34 -0500 (EST) (envelope-from das@FreeBSD.ORG) Date: Wed, 7 Dec 2011 14:11:34 -0500 From: David Schultz To: David Chisnall Message-ID: <20111207191134.GA20850@zim.MIT.EDU> Mail-Followup-To: David Chisnall , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201112071525.pB7FPmkH044896@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201112071525.pB7FPmkH044896@svn.freebsd.org> Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r228322 - in head: include lib/libc/stdlib sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 19:11:36 -0000 On Wed, Dec 07, 2011, David Chisnall wrote: > Author: theraven > Date: Wed Dec 7 15:25:48 2011 > New Revision: 228322 > URL: http://svn.freebsd.org/changeset/base/228322 > > Log: > Implement quick_exit() / at_quick_exit() from C++11 / C1x. Also add a > __noreturn macro and modify the other exiting functions to use it. > > The __noreturn macro, unlike __dead2, must be used BEFORE the function. > This is in line with the C and C++ specifications that place _Noreturn (c1x) > and [[noreturn]] (C++11) in front of the functions. As with __dead2, this > macro falls back to using the GCC attribute. > > Unfortunately, clang currently sets the same value for the C version macro > in C99 and C1x modes, so these functions are hidden by default. At some > point before 10.0, I need to go through the headers and clean up the C1x / > C++11 visibility. Nice. Why not use the standard spelling, '_Noreturn'? In pre-C1X modes, _Noreturn is a reserved identifier since it starts with an underscore and capital letter, so it's not considered namespace pollution. From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 19:43:05 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6FF5C1065673; Wed, 7 Dec 2011 19:43:05 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45F3E8FC13; Wed, 7 Dec 2011 19:43:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7Jh5vY052896; Wed, 7 Dec 2011 19:43:05 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7Jh5VQ052894; Wed, 7 Dec 2011 19:43:05 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112071943.pB7Jh5VQ052894@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Dec 2011 19:43:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228327 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 19:43:05 -0000 Author: yongari Date: Wed Dec 7 19:43:04 2011 New Revision: 228327 URL: http://svn.freebsd.org/changeset/base/228327 Log: Remove et_enable_intrs(), et_disable_intrs() functions and manipulation of interrupt register access is done through CSR_WRITE_4 macro. Also add disabling interrupt into et_reset() because we want interrupt disabled state after controller reset. While I'm here slightly change interrupt handler to be more readable one. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Wed Dec 7 19:08:54 2011 (r228326) +++ head/sys/dev/et/if_et.c Wed Dec 7 19:43:04 2011 (r228327) @@ -109,8 +109,6 @@ static int et_sysctl_rx_intr_npkts(SYSCT static int et_sysctl_rx_intr_delay(SYSCTL_HANDLER_ARGS); static void et_intr(void *); -static void et_enable_intrs(struct et_softc *, uint32_t); -static void et_disable_intrs(struct et_softc *); static void et_rxeof(struct et_softc *); static void et_txeof(struct et_softc *); @@ -309,8 +307,6 @@ et_attach(device_t dev) et_reset(sc); - et_disable_intrs(sc); - error = et_dma_alloc(sc); if (error) goto fail; @@ -540,12 +536,12 @@ et_stop(struct et_softc *sc) ET_LOCK_ASSERT(sc); callout_stop(&sc->sc_tick); + /* Disable interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); et_stop_rxdma(sc); et_stop_txdma(sc); - et_disable_intrs(sc); - et_free_tx_ring(sc); et_free_rx_ring(sc); @@ -670,20 +666,10 @@ et_reset(struct et_softc *sc) ET_MAC_CFG1_RST_TXFUNC | ET_MAC_CFG1_RST_RXFUNC | ET_MAC_CFG1_RST_TXMC | ET_MAC_CFG1_RST_RXMC); CSR_WRITE_4(sc, ET_MAC_CFG1, 0); -} - -static void -et_disable_intrs(struct et_softc *sc) -{ + /* Disable interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); } -static void -et_enable_intrs(struct et_softc *sc, uint32_t intrs) -{ - CSR_WRITE_4(sc, ET_INTR_MASK, ~intrs); -} - struct et_dmamap_arg { bus_addr_t et_busaddr; }; @@ -1083,12 +1069,12 @@ et_intr(void *xsc) return; } - et_disable_intrs(sc); + /* Disable further interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); intrs = CSR_READ_4(sc, ET_INTR_STATUS); - intrs &= ET_INTRS; - if (intrs == 0) /* Not interested */ - goto back; + if ((intrs & ET_INTRS) == 0) + goto done; if (intrs & ET_INTR_RXEOF) et_rxeof(sc); @@ -1096,9 +1082,9 @@ et_intr(void *xsc) et_txeof(sc); if (intrs & ET_INTR_TIMER) CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); -back: +done: if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - et_enable_intrs(sc, ET_INTRS); + CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) et_start_locked(ifp); } @@ -1132,7 +1118,8 @@ et_init_locked(struct et_softc *sc) if (error) goto back; - et_enable_intrs(sc, ET_INTRS); + /* Enable interrupts. */ + CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); callout_reset(&sc->sc_tick, hz, et_tick, sc); From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 21:00:34 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 150A81065670; Wed, 7 Dec 2011 21:00:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DF1698FC22; Wed, 7 Dec 2011 21:00:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7L0XhX055352; Wed, 7 Dec 2011 21:00:33 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7L0XXd055349; Wed, 7 Dec 2011 21:00:33 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112072100.pB7L0XXd055349@svn.freebsd.org> From: Dimitry Andric Date: Wed, 7 Dec 2011 21:00:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228328 - head/contrib/libstdc++/include/debug X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 21:00:34 -0000 Author: dim Date: Wed Dec 7 21:00:33 2011 New Revision: 228328 URL: http://svn.freebsd.org/changeset/base/228328 Log: Make it possible to use the debug versions of std::map and std::multimap with clang, by removing two unneeded using declarations. Otherwise, you would get errors similar to: /usr/include/c++/4.2/debug/map.h:77:20: error: dependent using declaration resolved to type without 'typename' using _Base::value_compare; ^ N.B.: Take care when you actually use the debug versions of any libstdc++ header. They are more likely to contain problems, because they are exercised far less often, and since the standard library complexity guarantees don't always apply anymore, compile times can drastically increase. MFC after: 2 weeks Modified: head/contrib/libstdc++/include/debug/map.h head/contrib/libstdc++/include/debug/multimap.h Modified: head/contrib/libstdc++/include/debug/map.h ============================================================================== --- head/contrib/libstdc++/include/debug/map.h Wed Dec 7 19:43:04 2011 (r228327) +++ head/contrib/libstdc++/include/debug/map.h Wed Dec 7 21:00:33 2011 (r228328) @@ -74,8 +74,6 @@ namespace __debug typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; - using _Base::value_compare; - // 23.3.1.1 construct/copy/destroy: explicit map(const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) Modified: head/contrib/libstdc++/include/debug/multimap.h ============================================================================== --- head/contrib/libstdc++/include/debug/multimap.h Wed Dec 7 19:43:04 2011 (r228327) +++ head/contrib/libstdc++/include/debug/multimap.h Wed Dec 7 21:00:33 2011 (r228328) @@ -74,8 +74,6 @@ namespace __debug typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; - using _Base::value_compare; - // 23.3.1.1 construct/copy/destroy: explicit multimap(const _Compare& __comp = _Compare(), const _Allocator& __a = _Allocator()) From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 21:02:36 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 668C71065678; Wed, 7 Dec 2011 21:02:36 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3C47F8FC0C; Wed, 7 Dec 2011 21:02:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7L2aOe055452; Wed, 7 Dec 2011 21:02:36 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7L2at5055449; Wed, 7 Dec 2011 21:02:36 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201112072102.pB7L2at5055449@svn.freebsd.org> From: David Chisnall Date: Wed, 7 Dec 2011 21:02:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228329 - head/lib/libc/stdlib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 21:02:36 -0000 Author: theraven Date: Wed Dec 7 21:02:35 2011 New Revision: 228329 URL: http://svn.freebsd.org/changeset/base/228329 Log: Some fixes to the man pages for [at_]quick_exit(3) Reviewed by: pluknet Approved by: dim (mentor) Modified: head/lib/libc/stdlib/at_quick_exit.3 head/lib/libc/stdlib/quick_exit.3 Modified: head/lib/libc/stdlib/at_quick_exit.3 ============================================================================== --- head/lib/libc/stdlib/at_quick_exit.3 Wed Dec 7 21:00:33 2011 (r228328) +++ head/lib/libc/stdlib/at_quick_exit.3 Wed Dec 7 21:02:35 2011 (r228329) @@ -23,13 +23,13 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.\" / -.Dd December 7, 2011o.Dt ATEXIT 3 +.\" +.Dd December 7, 2011 .Dt AT_QUICK_EXIT 3 .Os .Sh NAME .Nm at_quick_exit -.Nd Registers a cleanup function to run on quick exit. +.Nd registers a cleanup function to run on quick exit .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -48,10 +48,13 @@ the program exits by calling .Xr _Exit 3 , or .Xr abort 3 . -.El +.Sh RETURN VALUES +The +.Fn at_quick_exit +function returns the value 0 if successful and a non-zero value on failure. .Sh SEE ALSO .Xr exit 3 , -.Xr at_quick_exit 3 +.Xr quick_exit 3 .Sh STANDARDS The .Fn at_quick_exit Modified: head/lib/libc/stdlib/quick_exit.3 ============================================================================== --- head/lib/libc/stdlib/quick_exit.3 Wed Dec 7 21:00:33 2011 (r228328) +++ head/lib/libc/stdlib/quick_exit.3 Wed Dec 7 21:02:35 2011 (r228329) @@ -23,13 +23,13 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.\" / -.Dd December 7, 2011o.Dt ATEXIT 3 +.\" +.Dd December 7, 2011 .Dt QUICK_EXIT 3 .Os .Sh NAME .Nm quick_exit -.Nd Exits a program quickly, running minimal cleanup +.Nd exits a program quickly, running minimal cleanup .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -44,12 +44,14 @@ with .Xr at_quick_exit 3 but not any C++ destructors or cleanup code registered with .Xr atexit 3 . -.El +.Sh RETURN VALUES +The +.Fn quick_exit +function does not return. .Sh SEE ALSO -.Xr exit 3 , -.Xr at_quick_exit 3 +.Xr at_quick_exit 3 , +.Xr exit 3 .Sh STANDARDS The .Fn quick_exit function conforms to the C1x draft specification. - From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 21:03:37 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73D451065672; Wed, 7 Dec 2011 21:03:37 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theravensnest.org [109.169.23.128]) by mx1.freebsd.org (Postfix) with ESMTP id ED0978FC08; Wed, 7 Dec 2011 21:03:36 +0000 (UTC) Received: from [192.168.0.2] (cpc2-cwma5-0-0-cust875.7-3.cable.virginmedia.com [86.11.39.108]) (authenticated bits=0) by theravensnest.org (8.14.4/8.14.4) with ESMTP id pB7L3Ywt087091 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES128-SHA bits=128 verify=NO); Wed, 7 Dec 2011 21:03:35 GMT (envelope-from theraven@FreeBSD.org) Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=us-ascii From: David Chisnall In-Reply-To: <20111207191134.GA20850@zim.MIT.EDU> Date: Wed, 7 Dec 2011 21:03:29 +0000 Content-Transfer-Encoding: 7bit Message-Id: References: <201112071525.pB7FPmkH044896@svn.freebsd.org> <20111207191134.GA20850@zim.MIT.EDU> To: David Schultz X-Mailer: Apple Mail (2.1251.1) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228322 - in head: include lib/libc/stdlib sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 21:03:37 -0000 On 7 Dec 2011, at 19:11, David Schultz wrote: > Why not use the standard spelling, '_Noreturn'? In pre-C1X modes, > _Noreturn is a reserved identifier since it starts with an underscore > and capital letter, so it's not considered namespace pollution. Because that would be too obvious... David From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 21:17:51 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21D05106564A; Wed, 7 Dec 2011 21:17:51 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EBCA88FC14; Wed, 7 Dec 2011 21:17:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7LHowI055975; Wed, 7 Dec 2011 21:17:50 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7LHoaL055972; Wed, 7 Dec 2011 21:17:50 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201112072117.pB7LHoaL055972@svn.freebsd.org> From: David Chisnall Date: Wed, 7 Dec 2011 21:17:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228330 - in head: include sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 21:17:51 -0000 Author: theraven Date: Wed Dec 7 21:17:50 2011 New Revision: 228330 URL: http://svn.freebsd.org/changeset/base/228330 Log: As per das@'s suggestion, s/__noreturn/_Noreturn/, since the latter is an identifier reserved for the implementation in C99 and earlier so there is no sensible reason for introducing yet another reserved identifier when we could just use the one C1x uses. Approved by: brooks (mentor) Modified: head/include/stdlib.h head/sys/sys/cdefs.h Modified: head/include/stdlib.h ============================================================================== --- head/include/stdlib.h Wed Dec 7 21:02:35 2011 (r228329) +++ head/include/stdlib.h Wed Dec 7 21:17:50 2011 (r228330) @@ -76,7 +76,7 @@ extern int __mb_cur_max; extern int ___mb_cur_max(void); #define MB_CUR_MAX (___mb_cur_max()) -__noreturn void abort(void); +_Noreturn void abort(void); int abs(int) __pure2; int atexit(void (*)(void)); double atof(const char *); @@ -86,7 +86,7 @@ void *bsearch(const void *, const void * size_t, int (*)(const void *, const void *)); void *calloc(size_t, size_t) __malloc_like; div_t div(int, int) __pure2; -__noreturn void exit(int); +_Noreturn void exit(int); void free(void *); char *getenv(const char *); long labs(long) __pure2; @@ -145,14 +145,14 @@ unsigned long long strtoull(const char * __restrict, char ** __restrict, int); #endif /* __LONG_LONG_SUPPORTED */ -__noreturn void _Exit(int); +_Noreturn void _Exit(int); #endif /* __ISO_C_VISIBLE >= 1999 */ /* * If we're in a mode greater than C99, expose C1x functions. */ #if __ISO_C_VISIBLE > 1999 -__noreturn void quick_exit(int) +_Noreturn void quick_exit(int) int at_quick_exit(void (*func)(void)); #endif /* __ISO_C_VISIBLE > 1999 */ Modified: head/sys/sys/cdefs.h ============================================================================== --- head/sys/sys/cdefs.h Wed Dec 7 21:02:35 2011 (r228329) +++ head/sys/sys/cdefs.h Wed Dec 7 21:17:50 2011 (r228330) @@ -220,13 +220,13 @@ #if defined(__cplusplus) && __cplusplus >= 201103L -#define __noreturn [[noreturn]] +#define _Noreturn [[noreturn]] #elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 201000L -#define __noreturn _Noreturn +/* Do nothing - _Noreturn is a keyword */ #elif defined(__GNUC__) -#define __noreturn __attribute__((__noreturn__)) +#define _Noreturn __attribute__((__noreturn__)) #else -#define __noreturn +#define _Noreturn #endif #if __GNUC_PREREQ__(2, 96) From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 21:19:49 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC1B1106566B; Wed, 7 Dec 2011 21:19:49 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail14.syd.optusnet.com.au (mail14.syd.optusnet.com.au [211.29.132.195]) by mx1.freebsd.org (Postfix) with ESMTP id 75D528FC15; Wed, 7 Dec 2011 21:19:49 +0000 (UTC) Received: from c211-28-227-231.carlnfd1.nsw.optusnet.com.au (c211-28-227-231.carlnfd1.nsw.optusnet.com.au [211.28.227.231]) by mail14.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pB7LJkgw029673 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 8 Dec 2011 08:19:47 +1100 Date: Thu, 8 Dec 2011 08:19:46 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: David Schultz In-Reply-To: <20111207191134.GA20850@zim.MIT.EDU> Message-ID: <20111208071024.J2931@besplex.bde.org> References: <201112071525.pB7FPmkH044896@svn.freebsd.org> <20111207191134.GA20850@zim.MIT.EDU> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, David Chisnall Subject: Re: svn commit: r228322 - in head: include lib/libc/stdlib sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 21:19:50 -0000 On Wed, 7 Dec 2011, David Schultz wrote: > On Wed, Dec 07, 2011, David Chisnall wrote: >> Log: >> Implement quick_exit() / at_quick_exit() from C++11 / C1x. Also add a >> __noreturn macro and modify the other exiting functions to use it. >> >> The __noreturn macro, unlike __dead2, must be used BEFORE the function. >> This is in line with the C and C++ specifications that place _Noreturn (c1x) >> and [[noreturn]] (C++11) in front of the functions. As with __dead2, this >> macro falls back to using the GCC attribute. >> >> Unfortunately, clang currently sets the same value for the C version macro >> in C99 and C1x modes, so these functions are hidden by default. At some >> point before 10.0, I need to go through the headers and clean up the C1x / >> C++11 visibility. > > Nice. > > Why not use the standard spelling, '_Noreturn'? In pre-C1X modes, > _Noreturn is a reserved identifier since it starts with an underscore > and capital letter, so it's not considered namespace pollution. There is also the __dead attribute for gcc-1 and some versions of gcc-2. It has the same syntax as __noreturn, since it was implemented as `volatile' in gcc-1, and `volatile' must be in the declarator BEFORE the function name. This was changed in gcc-2 because it was determined that `volatile' for a function has some defined meaning that of course can't be the gcc-1 one. FreeBSD introduced __dead2 for newer versions of gcc-2 and kept __dead for a while. __dead remains dead (reserved for gcc-1, or perhaps anything that uses the same syntax). Not quite similarly for __pure. Someone broke its reservedness by using it for gcc-2.96+'s new __pure__ attribute, which is subtly different from the old __pure and the current __pure2 FreeBSD macros. NetBSD still had the old __dead and __pure, and no __dead2 or __pure2, as late as 2005. It still use[d] (as well as defining) __dead in a few places, and uses a hard __attribute__((__noreturn__)) instead of __dead2. Sometimes both. This change seems to break compatibility cruft related to this in the critical header , since __Noreturn is actually used there and replaces __dead2 and has a different syntax that might not work with old compilers (sys/cdefs.h still has mounds of compatibility cruft for old compilers, although this doesn't include __dead for gcc-1, and probably mostly doesn't actually work). Here is the change in cdefs.h: % Index: cdefs.h % =================================================================== % RCS file: /home/ncvs/src/sys/sys/cdefs.h,v % retrieving revision 1.117 % retrieving revision 1.118 % diff -u -2 -r1.117 -r1.118 % --- cdefs.h 12 Nov 2011 23:17:54 -0000 1.117 % +++ cdefs.h 7 Dec 2011 15:25:48 -0000 1.118 % @@ -219,4 +219,15 @@ % #endif % % + Style bug (extra blank line). % +#if defined(__cplusplus) && __cplusplus >= 201103L % +#define __noreturn [[noreturn]] % +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 201000L % +#define __noreturn _Noreturn % +#elif defined(__GNUC__) % +#define __noreturn __attribute__((__noreturn__)) This assumes that all versions of gcc support the __noreturn__ attribute, and the new uses of this attribute assumes that __attribute__(()) works BEFORE the function name when it is used there, as it now is in . The first assumption bogotifies the fussy ifdefs used later in cdefs.h. __attribute__((__noreturn__)) is already used later, to define __dead2, and this is under several ifdefs with ugly duplication: - one for gcc-2.5 and 2.6 vs older gcc's - one for gcc >= 2.7 - one for __INTEL_COMPILER (twisted by interaction with the ones for very old gcc's) I don't trust most of the version numbers in the GNC_PREREQ()s, but these have more chance than most of being correct since they are old and detailed. If they are correct, then we see that the above is incorrect mainly for gcc-2.0 through 2.4. gcc-1 is already fully unsupported (except as a generic compiler). gcc-2.0 through gcc-2.4 are old enough to unsupport, so this is mainly a style bug. The second assumption is probably not satisfied by middle versions of gcc-2. IIRC, the reason for switching the syntax from __dead (placed before the function name) to __dead2 (placed after) was that early implementations of __attribute__() only worked if they were placed after. Otherwise, we would have just ifdefed another case for __dead. I don't know when gcc fixed this. % +#else % +#define __noreturn Defaulting to nothing for a generic/unknown compiler is good, but this combined with actually using __noreturn seems to break some previously supported cases, in particular __INTEL_COMPILER sees a null __noreturn for declarations in where it used to see a non-null __dead2. Apparently it doesn't pretend to be gcc, but it supports most gcc features so it mostly works, but it needs messy ifdefs to use these features. Perhaps __INTEL_COMPILER should be unsupported together with gcc-2. It is painful to maintain all these compatibilty ifdefs, especially if they are required to actually work. clang avoids most problems in this area by claiming to be gcc-4. % +#endif % + % ... Bruce From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 21:29:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 370E0106564A; Wed, 7 Dec 2011 21:29:52 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1BB408FC12; Wed, 7 Dec 2011 21:29:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7LTpGq056553; Wed, 7 Dec 2011 21:29:51 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7LTpLB056549; Wed, 7 Dec 2011 21:29:51 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112072129.pB7LTpLB056549@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Dec 2011 21:29:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228331 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 21:29:52 -0000 Author: yongari Date: Wed Dec 7 21:29:51 2011 New Revision: 228331 URL: http://svn.freebsd.org/changeset/base/228331 Log: Rework link state tracking and TX/RX MAC configuration. o Do not report link status if driver is not running. o TX/RX MAC configuration should be done with resolved speed, duplex and flow control after establishing a link so it can't be done in driver initialization routine. Move the configuration to miibus_statchg callback which will be called whenever any link state change is detected. At this moment, flow-control is not enabled yet mainly because I was not able to set correct flow control parameters to generate TX pause frames. o Now TX/RX MAC is enabled only when a valid link is detected. Rearragnge hardware initialization routine a bit to leave enabling MAC to miibus_statchg callback. In order to that, TX/RX DMA engine is enabled in et_init_locked(). o Introduce ET_FLAG_LINK flag to track current link state. o Introduce ET_FLAG_FASTETHER flag to mark whether controller is fast ethernet. This flag is checked in miibus_statchg callback to know whether PHY established a valid link. o In et_stop(), TX/RX MAC is explicitly disabled instead of relying on et_reset(). And move et_reset() from et_stop() to controller initialization. Controler reset is not required here and it would also clear critial registers(i.e station address, RX filter configuration, WOL etc) that are required to make WOL work. o Switching to current media is done in et_init_locked() after setting IFF_DRV_RUNNING flag. This should ensure reliable auto-negotiation/manual link establishment. o In et_start_locked(), check whether driver got a valid link before trying to send frames. o Remove checking a link in et_tick() as this is done by miibus_statchg callback. Modified: head/sys/dev/et/if_et.c head/sys/dev/et/if_etvar.h Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Wed Dec 7 21:17:50 2011 (r228330) +++ head/sys/dev/et/if_et.c Wed Dec 7 21:29:51 2011 (r228331) @@ -141,13 +141,11 @@ static int et_start_rxdma(struct et_soft static int et_start_txdma(struct et_softc *); static int et_stop_rxdma(struct et_softc *); static int et_stop_txdma(struct et_softc *); -static int et_enable_txrx(struct et_softc *, int); static void et_reset(struct et_softc *); static int et_bus_config(struct et_softc *); static void et_get_eaddr(device_t, uint8_t[]); static void et_setmulti(struct et_softc *); static void et_tick(void *); -static void et_setmedia(struct et_softc *); static const struct et_dev { uint16_t vid; @@ -296,6 +294,9 @@ et_attach(device_t dev) goto fail; } + if (pci_get_device(dev) == PCI_PRODUCT_LUCENT_ET1310_FAST) + sc->sc_flags |= ET_FLAG_FASTETHER; + error = et_bus_config(sc); if (error) goto fail; @@ -487,7 +488,89 @@ et_miibus_writereg(device_t dev, int phy static void et_miibus_statchg(device_t dev) { - et_setmedia(device_get_softc(dev)); + struct et_softc *sc; + struct mii_data *mii; + struct ifnet *ifp; + uint32_t cfg1, cfg2, ctrl; + int i; + + sc = device_get_softc(dev); + + mii = device_get_softc(sc->sc_miibus); + ifp = sc->ifp; + if (mii == NULL || ifp == NULL || + (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + + sc->sc_flags &= ~ET_FLAG_LINK; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + sc->sc_flags |= ET_FLAG_LINK; + break; + case IFM_1000_T: + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + sc->sc_flags |= ET_FLAG_LINK; + break; + } + } + + /* XXX Stop TX/RX MAC? */ + if ((sc->sc_flags & ET_FLAG_LINK) == 0) + return; + + /* Program MACs with resolved speed/duplex/flow-control. */ + ctrl = CSR_READ_4(sc, ET_MAC_CTRL); + ctrl &= ~(ET_MAC_CTRL_GHDX | ET_MAC_CTRL_MODE_MII); + cfg1 = CSR_READ_4(sc, ET_MAC_CFG1); + cfg1 &= ~(ET_MAC_CFG1_TXFLOW | ET_MAC_CFG1_RXFLOW | + ET_MAC_CFG1_LOOPBACK); + cfg2 = CSR_READ_4(sc, ET_MAC_CFG2); + cfg2 &= ~(ET_MAC_CFG2_MODE_MII | ET_MAC_CFG2_MODE_GMII | + ET_MAC_CFG2_FDX | ET_MAC_CFG2_BIGFRM); + cfg2 |= ET_MAC_CFG2_LENCHK | ET_MAC_CFG2_CRC | ET_MAC_CFG2_PADCRC | + ((7 << ET_MAC_CFG2_PREAMBLE_LEN_SHIFT) & + ET_MAC_CFG2_PREAMBLE_LEN_MASK); + + if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) + cfg2 |= ET_MAC_CFG2_MODE_GMII; + else { + cfg2 |= ET_MAC_CFG2_MODE_MII; + ctrl |= ET_MAC_CTRL_MODE_MII; + } + + if (IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) { + cfg2 |= ET_MAC_CFG2_FDX; +#ifdef notyet + if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) + cfg1 |= ET_MAC_CFG1_TXFLOW; + if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) + cfg1 |= ET_MAC_CFG1_RXFLOW; +#endif + } else + ctrl |= ET_MAC_CTRL_GHDX; + + CSR_WRITE_4(sc, ET_MAC_CTRL, ctrl); + CSR_WRITE_4(sc, ET_MAC_CFG2, cfg2); + cfg1 |= ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN; + CSR_WRITE_4(sc, ET_MAC_CFG1, cfg1); + +#define NRETRY 50 + + for (i = 0; i < NRETRY; ++i) { + cfg1 = CSR_READ_4(sc, ET_MAC_CFG1); + if ((cfg1 & (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) == + (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) + break; + DELAY(100); + } + if (i == NRETRY) + if_printf(ifp, "can't enable RX/TX\n"); + sc->sc_flags |= ET_FLAG_TXRX_ENABLED; + +#undef NRETRY } static int @@ -518,10 +601,17 @@ et_ifmedia_upd(struct ifnet *ifp) static void et_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { - struct et_softc *sc = ifp->if_softc; - struct mii_data *mii = device_get_softc(sc->sc_miibus); + struct et_softc *sc; + struct mii_data *mii; + sc = ifp->if_softc; ET_LOCK(sc); + if ((ifp->if_flags & IFF_UP) == 0) { + ET_UNLOCK(sc); + return; + } + + mii = device_get_softc(sc->sc_miibus); mii_pollstat(mii); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; @@ -539,14 +629,16 @@ et_stop(struct et_softc *sc) /* Disable interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); + CSR_WRITE_4(sc, ET_MAC_CFG1, CSR_READ_4(sc, ET_MAC_CFG1) & ~( + ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN)); + DELAY(100); + et_stop_rxdma(sc); et_stop_txdma(sc); et_free_tx_ring(sc); et_free_rx_ring(sc); - et_reset(sc); - sc->sc_tx = 0; sc->sc_tx_intr = 0; sc->sc_flags &= ~ET_FLAG_TXRX_ENABLED; @@ -1104,6 +1196,7 @@ et_init_locked(struct et_softc *sc) return; et_stop(sc); + et_reset(sc); et_init_tx_ring(sc); error = et_init_rx_ring(sc); @@ -1112,22 +1205,33 @@ et_init_locked(struct et_softc *sc) error = et_chip_init(sc); if (error) - goto back; + goto fail; - error = et_enable_txrx(sc, 1); + /* + * Start TX/RX DMA engine + */ + error = et_start_rxdma(sc); if (error) - goto back; + return; + + error = et_start_txdma(sc); + if (error) + return; /* Enable interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); - callout_reset(&sc->sc_tick, hz, et_tick, sc); - CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; -back: + + sc->sc_flags &= ~ET_FLAG_LINK; + et_ifmedia_upd_locked(ifp); + + callout_reset(&sc->sc_tick, hz, et_tick, sc); + +fail: if (error) et_stop(sc); } @@ -1239,10 +1343,10 @@ et_start_locked(struct ifnet *ifp) sc = ifp->if_softc; ET_LOCK_ASSERT(sc); - if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0) - return; - - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING || + (sc->sc_flags & (ET_FLAG_LINK | ET_FLAG_TXRX_ENABLED)) != + (ET_FLAG_LINK | ET_FLAG_TXRX_ENABLED)) return; /* @@ -1870,56 +1974,6 @@ et_start_txdma(struct et_softc *sc) return (0); } -static int -et_enable_txrx(struct et_softc *sc, int media_upd) -{ - struct ifnet *ifp = sc->ifp; - uint32_t val; - int i, error; - - val = CSR_READ_4(sc, ET_MAC_CFG1); - val |= ET_MAC_CFG1_TXEN | ET_MAC_CFG1_RXEN; - val &= ~(ET_MAC_CFG1_TXFLOW | ET_MAC_CFG1_RXFLOW | - ET_MAC_CFG1_LOOPBACK); - CSR_WRITE_4(sc, ET_MAC_CFG1, val); - - if (media_upd) - et_ifmedia_upd_locked(ifp); - else - et_setmedia(sc); - -#define NRETRY 50 - - for (i = 0; i < NRETRY; ++i) { - val = CSR_READ_4(sc, ET_MAC_CFG1); - if ((val & (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) == - (ET_MAC_CFG1_SYNC_TXEN | ET_MAC_CFG1_SYNC_RXEN)) - break; - - DELAY(100); - } - if (i == NRETRY) { - if_printf(ifp, "can't enable RX/TX\n"); - return (0); - } - sc->sc_flags |= ET_FLAG_TXRX_ENABLED; - -#undef NRETRY - - /* - * Start TX/RX DMA engine - */ - error = et_start_rxdma(sc); - if (error) - return (error); - - error = et_start_txdma(sc); - if (error) - return (error); - - return (0); -} - static void et_rxeof(struct et_softc *sc) { @@ -2192,6 +2246,7 @@ et_txeof(struct et_softc *sc) if (tbd->tbd_used + ET_NSEG_SPARE < ET_TX_NDESC) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } + static void et_tick(void *xsc) { @@ -2204,13 +2259,6 @@ et_tick(void *xsc) mii = device_get_softc(sc->sc_miibus); mii_tick(mii); - if ((sc->sc_flags & ET_FLAG_TXRX_ENABLED) == 0 && - (mii->mii_media_status & IFM_ACTIVE) && - IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { - if_printf(ifp, "Link up, enable TX/RX\n"); - if (et_enable_txrx(sc, 0) == 0) - et_start_locked(ifp); - } if (et_watchdog(sc) == EJUSTRETURN) return; callout_reset(&sc->sc_tick, hz, et_tick, sc); @@ -2398,38 +2446,6 @@ back: return (error); } -static void -et_setmedia(struct et_softc *sc) -{ - struct mii_data *mii = device_get_softc(sc->sc_miibus); - uint32_t cfg2, ctrl; - - cfg2 = CSR_READ_4(sc, ET_MAC_CFG2); - cfg2 &= ~(ET_MAC_CFG2_MODE_MII | ET_MAC_CFG2_MODE_GMII | - ET_MAC_CFG2_FDX | ET_MAC_CFG2_BIGFRM); - cfg2 |= ET_MAC_CFG2_LENCHK | ET_MAC_CFG2_CRC | ET_MAC_CFG2_PADCRC | - ((7 << ET_MAC_CFG2_PREAMBLE_LEN_SHIFT) & - ET_MAC_CFG2_PREAMBLE_LEN_MASK); - - ctrl = CSR_READ_4(sc, ET_MAC_CTRL); - ctrl &= ~(ET_MAC_CTRL_GHDX | ET_MAC_CTRL_MODE_MII); - - if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) { - cfg2 |= ET_MAC_CFG2_MODE_GMII; - } else { - cfg2 |= ET_MAC_CFG2_MODE_MII; - ctrl |= ET_MAC_CTRL_MODE_MII; - } - - if ((mii->mii_media_active & IFM_GMASK) == IFM_FDX) - cfg2 |= ET_MAC_CFG2_FDX; - else - ctrl |= ET_MAC_CTRL_GHDX; - - CSR_WRITE_4(sc, ET_MAC_CTRL, ctrl); - CSR_WRITE_4(sc, ET_MAC_CFG2, cfg2); -} - static int et_suspend(device_t dev) { Modified: head/sys/dev/et/if_etvar.h ============================================================================== --- head/sys/dev/et/if_etvar.h Wed Dec 7 21:17:50 2011 (r228330) +++ head/sys/dev/et/if_etvar.h Wed Dec 7 21:29:51 2011 (r228331) @@ -289,7 +289,9 @@ struct et_softc { #define ET_FLAG_PCIE 0x0001 #define ET_FLAG_MSI 0x0002 +#define ET_FLAG_FASTETHER 0x0004 #define ET_FLAG_TXRX_ENABLED 0x0100 #define ET_FLAG_JUMBO 0x0200 +#define ET_FLAG_LINK 0x8000 #endif /* !_IF_ETVAR_H */ From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 21:46:09 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E764106564A; Wed, 7 Dec 2011 21:46:09 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C44E8FC12; Wed, 7 Dec 2011 21:46:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7Lk9bD057130; Wed, 7 Dec 2011 21:46:09 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7Lk9L8057126; Wed, 7 Dec 2011 21:46:09 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112072146.pB7Lk9L8057126@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Dec 2011 21:46:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228332 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 21:46:09 -0000 Author: yongari Date: Wed Dec 7 21:46:09 2011 New Revision: 228332 URL: http://svn.freebsd.org/changeset/base/228332 Log: Implement hardware MAC statistics counter. Counters could be queried with dev.et.%d.stats sysctl node where %d is an instance of device. Modified: head/sys/dev/et/if_et.c head/sys/dev/et/if_etreg.h head/sys/dev/et/if_etvar.h Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Wed Dec 7 21:29:51 2011 (r228331) +++ head/sys/dev/et/if_et.c Wed Dec 7 21:46:09 2011 (r228332) @@ -146,6 +146,7 @@ static int et_bus_config(struct et_softc static void et_get_eaddr(device_t, uint8_t[]); static void et_setmulti(struct et_softc *); static void et_tick(void *); +static void et_stats_update(struct et_softc *); static const struct et_dev { uint16_t vid; @@ -635,6 +636,7 @@ et_stop(struct et_softc *sc) et_stop_rxdma(sc); et_stop_txdma(sc); + et_stats_update(sc); et_free_tx_ring(sc); et_free_rx_ring(sc); @@ -2049,7 +2051,6 @@ et_rxeof(struct et_softc *sc) m = rbd->rbd_buf[buf_idx].rb_mbuf; if ((rxst_info1 & ET_RXST_INFO1_OK) == 0){ /* Discard errored frame. */ - ifp->if_ierrors++; rbd->rbd_discard(rbd, buf_idx); } else if (rbd->rbd_newbuf(rbd, buf_idx) != 0) { /* No available mbufs, discard it. */ @@ -2063,7 +2064,6 @@ et_rxeof(struct et_softc *sc) } else { m->m_pkthdr.len = m->m_len = buflen; m->m_pkthdr.rcvif = ifp; - ifp->if_ipackets++; ET_UNLOCK(sc); ifp->if_input(ifp, m); ET_LOCK(sc); @@ -2229,7 +2229,6 @@ et_txeof(struct et_softc *sc) bus_dmamap_unload(sc->sc_tx_tag, tb->tb_dmap); m_freem(tb->tb_mbuf); tb->tb_mbuf = NULL; - ifp->if_opackets++; } if (++tbd->tbd_start_index == ET_TX_NDESC) { @@ -2259,6 +2258,7 @@ et_tick(void *xsc) mii = device_get_softc(sc->sc_miibus); mii_tick(mii); + et_stats_update(sc); if (et_watchdog(sc) == EJUSTRETURN) return; callout_reset(&sc->sc_tick, hz, et_tick, sc); @@ -2371,6 +2371,11 @@ et_newbuf_hdr(struct et_rxbuf_data *rbd, return (0); } +#define ET_SYSCTL_STAT_ADD32(c, h, n, p, d) \ + SYSCTL_ADD_UINT(c, h, OID_AUTO, n, CTLFLAG_RD, p, 0, d) +#define ET_SYSCTL_STAT_ADD64(c, h, n, p, d) \ + SYSCTL_ADD_UQUAD(c, h, OID_AUTO, n, CTLFLAG_RD, p, d) + /* * Create sysctl tree */ @@ -2378,7 +2383,9 @@ static void et_add_sysctls(struct et_softc * sc) { struct sysctl_ctx_list *ctx; - struct sysctl_oid_list *children; + struct sysctl_oid_list *children, *parent; + struct sysctl_oid *tree; + struct et_hw_stats *stats; ctx = device_get_sysctl_ctx(sc->dev); children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)); @@ -2394,8 +2401,116 @@ et_add_sysctls(struct et_softc * sc) "TX IM, # segments per TX interrupt"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "timer", CTLFLAG_RW, &sc->sc_timer, 0, "TX timer"); + + tree = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "stats", CTLFLAG_RD, + NULL, "ET statistics"); + parent = SYSCTL_CHILDREN(tree); + + /* TX/RX statistics. */ + stats = &sc->sc_stats; + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_64", &stats->pkts_64, + "0 to 64 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_65_127", &stats->pkts_65, + "65 to 127 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_128_255", &stats->pkts_128, + "128 to 255 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_256_511", &stats->pkts_256, + "256 to 511 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_512_1023", &stats->pkts_512, + "512 to 1023 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_1024_1518", &stats->pkts_1024, + "1024 to 1518 bytes frames"); + ET_SYSCTL_STAT_ADD64(ctx, parent, "frames_1519_1522", &stats->pkts_1519, + "1519 to 1522 bytes frames"); + + /* RX statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "rx", CTLFLAG_RD, + NULL, "RX MAC statistics"); + children = SYSCTL_CHILDREN(tree); + ET_SYSCTL_STAT_ADD64(ctx, children, "bytes", + &stats->rx_bytes, "Good bytes"); + ET_SYSCTL_STAT_ADD64(ctx, children, "frames", + &stats->rx_frames, "Good frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "crc_errs", + &stats->rx_crcerrs, "CRC errors"); + ET_SYSCTL_STAT_ADD64(ctx, children, "mcast_frames", + &stats->rx_mcast, "Multicast frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "bcast_frames", + &stats->rx_bcast, "Broadcast frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "control", + &stats->rx_control, "Control frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause", + &stats->rx_pause, "Pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "unknown_control", + &stats->rx_unknown_control, "Unknown control frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "align_errs", + &stats->rx_alignerrs, "Alignment errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "len_errs", + &stats->rx_lenerrs, "Frames with length mismatched"); + ET_SYSCTL_STAT_ADD32(ctx, children, "code_errs", + &stats->rx_codeerrs, "Frames with code error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "cs_errs", + &stats->rx_cserrs, "Frames with carrier sense error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "runts", + &stats->rx_runts, "Too short frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "oversize", + &stats->rx_oversize, "Oversized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "fragments", + &stats->rx_fragments, "Fragmented frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "jabbers", + &stats->rx_jabbers, "Frames with jabber error"); + ET_SYSCTL_STAT_ADD32(ctx, children, "drop", + &stats->rx_drop, "Dropped frames"); + + /* TX statistics. */ + tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "tx", CTLFLAG_RD, + NULL, "TX MAC statistics"); + children = SYSCTL_CHILDREN(tree); + ET_SYSCTL_STAT_ADD64(ctx, children, "bytes", + &stats->tx_bytes, "Good bytes"); + ET_SYSCTL_STAT_ADD64(ctx, children, "frames", + &stats->tx_frames, "Good frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "mcast_frames", + &stats->tx_mcast, "Multicast frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "bcast_frames", + &stats->tx_bcast, "Broadcast frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause", + &stats->tx_pause, "Pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "deferred", + &stats->tx_deferred, "Deferred frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "excess_deferred", + &stats->tx_excess_deferred, "Excessively deferred frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "single_colls", + &stats->tx_single_colls, "Single collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "multi_colls", + &stats->tx_multi_colls, "Multiple collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "late_colls", + &stats->tx_late_colls, "Late collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "excess_colls", + &stats->tx_excess_colls, "Excess collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "total_colls", + &stats->tx_total_colls, "Total collisions"); + ET_SYSCTL_STAT_ADD32(ctx, children, "pause_honored", + &stats->tx_pause_honored, "Honored pause frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "drop", + &stats->tx_drop, "Dropped frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "jabbers", + &stats->tx_jabbers, "Frames with jabber errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "crc_errs", + &stats->tx_crcerrs, "Frames with CRC errors"); + ET_SYSCTL_STAT_ADD32(ctx, children, "control", + &stats->tx_control, "Control frames"); + ET_SYSCTL_STAT_ADD64(ctx, children, "oversize", + &stats->tx_oversize, "Oversized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "undersize", + &stats->tx_undersize, "Undersized frames"); + ET_SYSCTL_STAT_ADD32(ctx, children, "fragments", + &stats->tx_fragments, "Fragmented frames"); } +#undef ET_SYSCTL_STAT_ADD32 +#undef ET_SYSCTL_STAT_ADD64 + static int et_sysctl_rx_intr_npkts(SYSCTL_HANDLER_ARGS) { @@ -2446,6 +2561,73 @@ back: return (error); } +static void +et_stats_update(struct et_softc *sc) +{ + struct ifnet *ifp; + struct et_hw_stats *stats; + + stats = &sc->sc_stats; + stats->pkts_64 += CSR_READ_4(sc, ET_STAT_PKTS_64); + stats->pkts_65 += CSR_READ_4(sc, ET_STAT_PKTS_65_127); + stats->pkts_128 += CSR_READ_4(sc, ET_STAT_PKTS_128_255); + stats->pkts_256 += CSR_READ_4(sc, ET_STAT_PKTS_256_511); + stats->pkts_512 += CSR_READ_4(sc, ET_STAT_PKTS_512_1023); + stats->pkts_1024 += CSR_READ_4(sc, ET_STAT_PKTS_1024_1518); + stats->pkts_1519 += CSR_READ_4(sc, ET_STAT_PKTS_1519_1522); + + stats->rx_bytes += CSR_READ_4(sc, ET_STAT_RX_BYTES); + stats->rx_frames += CSR_READ_4(sc, ET_STAT_RX_FRAMES); + stats->rx_crcerrs += CSR_READ_4(sc, ET_STAT_RX_CRC_ERR); + stats->rx_mcast += CSR_READ_4(sc, ET_STAT_RX_MCAST); + stats->rx_bcast += CSR_READ_4(sc, ET_STAT_RX_BCAST); + stats->rx_control += CSR_READ_4(sc, ET_STAT_RX_CTL); + stats->rx_pause += CSR_READ_4(sc, ET_STAT_RX_PAUSE); + stats->rx_unknown_control += CSR_READ_4(sc, ET_STAT_RX_UNKNOWN_CTL); + stats->rx_alignerrs += CSR_READ_4(sc, ET_STAT_RX_ALIGN_ERR); + stats->rx_lenerrs += CSR_READ_4(sc, ET_STAT_RX_LEN_ERR); + stats->rx_codeerrs += CSR_READ_4(sc, ET_STAT_RX_CODE_ERR); + stats->rx_cserrs += CSR_READ_4(sc, ET_STAT_RX_CS_ERR); + stats->rx_runts += CSR_READ_4(sc, ET_STAT_RX_RUNT); + stats->rx_oversize += CSR_READ_4(sc, ET_STAT_RX_OVERSIZE); + stats->rx_fragments += CSR_READ_4(sc, ET_STAT_RX_FRAG); + stats->rx_jabbers += CSR_READ_4(sc, ET_STAT_RX_JABBER); + stats->rx_drop += CSR_READ_4(sc, ET_STAT_RX_DROP); + + stats->tx_bytes += CSR_READ_4(sc, ET_STAT_TX_BYTES); + stats->tx_frames += CSR_READ_4(sc, ET_STAT_TX_FRAMES); + stats->tx_mcast += CSR_READ_4(sc, ET_STAT_TX_MCAST); + stats->tx_bcast += CSR_READ_4(sc, ET_STAT_TX_BCAST); + stats->tx_pause += CSR_READ_4(sc, ET_STAT_TX_PAUSE); + stats->tx_deferred += CSR_READ_4(sc, ET_STAT_TX_DEFER); + stats->tx_excess_deferred += CSR_READ_4(sc, ET_STAT_TX_EXCESS_DEFER); + stats->tx_single_colls += CSR_READ_4(sc, ET_STAT_TX_SINGLE_COL); + stats->tx_multi_colls += CSR_READ_4(sc, ET_STAT_TX_MULTI_COL); + stats->tx_late_colls += CSR_READ_4(sc, ET_STAT_TX_LATE_COL); + stats->tx_excess_colls += CSR_READ_4(sc, ET_STAT_TX_EXCESS_COL); + stats->tx_total_colls += CSR_READ_4(sc, ET_STAT_TX_TOTAL_COL); + stats->tx_pause_honored += CSR_READ_4(sc, ET_STAT_TX_PAUSE_HONOR); + stats->tx_drop += CSR_READ_4(sc, ET_STAT_TX_DROP); + stats->tx_jabbers += CSR_READ_4(sc, ET_STAT_TX_JABBER); + stats->tx_crcerrs += CSR_READ_4(sc, ET_STAT_TX_CRC_ERR); + stats->tx_control += CSR_READ_4(sc, ET_STAT_TX_CTL); + stats->tx_oversize += CSR_READ_4(sc, ET_STAT_TX_OVERSIZE); + stats->tx_undersize += CSR_READ_4(sc, ET_STAT_TX_UNDERSIZE); + stats->tx_fragments += CSR_READ_4(sc, ET_STAT_TX_FRAG); + + /* Update ifnet counters. */ + ifp = sc->ifp; + ifp->if_opackets = (u_long)stats->tx_frames; + ifp->if_collisions = stats->tx_total_colls; + ifp->if_oerrors = stats->tx_drop + stats->tx_jabbers + + stats->tx_crcerrs + stats->tx_excess_deferred + + stats->tx_late_colls; + ifp->if_ipackets = (u_long)stats->rx_frames; + ifp->if_ierrors = stats->rx_crcerrs + stats->rx_alignerrs + + stats->rx_lenerrs + stats->rx_codeerrs + stats->rx_cserrs + + stats->rx_runts + stats->rx_jabbers + stats->rx_drop; +} + static int et_suspend(device_t dev) { Modified: head/sys/dev/et/if_etreg.h ============================================================================== --- head/sys/dev/et/if_etreg.h Wed Dec 7 21:29:51 2011 (r228331) +++ head/sys/dev/et/if_etreg.h Wed Dec 7 21:46:09 2011 (r228332) @@ -318,6 +318,52 @@ #define ET_MAC_ADDR1 0x5040 #define ET_MAC_ADDR2 0x5044 +/* MAC statistics counters. */ +#define ET_STAT_PKTS_64 0x6080 +#define ET_STAT_PKTS_65_127 0x6084 +#define ET_STAT_PKTS_128_255 0x6088 +#define ET_STAT_PKTS_256_511 0x608C +#define ET_STAT_PKTS_512_1023 0x6090 +#define ET_STAT_PKTS_1024_1518 0x6094 +#define ET_STAT_PKTS_1519_1522 0x6098 +#define ET_STAT_RX_BYTES 0x609C +#define ET_STAT_RX_FRAMES 0x60A0 +#define ET_STAT_RX_CRC_ERR 0x60A4 +#define ET_STAT_RX_MCAST 0x60A8 +#define ET_STAT_RX_BCAST 0x60AC +#define ET_STAT_RX_CTL 0x60B0 +#define ET_STAT_RX_PAUSE 0x60B4 +#define ET_STAT_RX_UNKNOWN_CTL 0x60B8 +#define ET_STAT_RX_ALIGN_ERR 0x60BC +#define ET_STAT_RX_LEN_ERR 0x60C0 +#define ET_STAT_RX_CODE_ERR 0x60C4 +#define ET_STAT_RX_CS_ERR 0x60C8 +#define ET_STAT_RX_RUNT 0x60CC +#define ET_STAT_RX_OVERSIZE 0x60D0 +#define ET_STAT_RX_FRAG 0x60D4 +#define ET_STAT_RX_JABBER 0x60D8 +#define ET_STAT_RX_DROP 0x60DC +#define ET_STAT_TX_BYTES 0x60E0 +#define ET_STAT_TX_FRAMES 0x60E4 +#define ET_STAT_TX_MCAST 0x60E8 +#define ET_STAT_TX_BCAST 0x60EC +#define ET_STAT_TX_PAUSE 0x60F0 +#define ET_STAT_TX_DEFER 0x60F4 +#define ET_STAT_TX_EXCESS_DEFER 0x60F8 +#define ET_STAT_TX_SINGLE_COL 0x60FC +#define ET_STAT_TX_MULTI_COL 0x6100 +#define ET_STAT_TX_LATE_COL 0x6104 +#define ET_STAT_TX_EXCESS_COL 0x6108 +#define ET_STAT_TX_TOTAL_COL 0x610C +#define ET_STAT_TX_PAUSE_HONOR 0x6110 +#define ET_STAT_TX_DROP 0x6114 +#define ET_STAT_TX_JABBER 0x6118 +#define ET_STAT_TX_CRC_ERR 0x611C +#define ET_STAT_TX_CTL 0x6120 +#define ET_STAT_TX_OVERSIZE 0x6124 +#define ET_STAT_TX_UNDERSIZE 0x6128 +#define ET_STAT_TX_FRAG 0x612C + #define ET_MMC_CTRL 0x7000 #define ET_MMC_CTRL_ENABLE 0x00000001 #define ET_MMC_CTRL_ARB_DISABLE 0x00000002 Modified: head/sys/dev/et/if_etvar.h ============================================================================== --- head/sys/dev/et/if_etvar.h Wed Dec 7 21:29:51 2011 (r228331) +++ head/sys/dev/et/if_etvar.h Wed Dec 7 21:46:09 2011 (r228332) @@ -231,6 +231,56 @@ struct et_rxbuf_data { void (*rbd_discard)(struct et_rxbuf_data *, int); }; +struct et_hw_stats { + /* RX/TX stats. */ + uint64_t pkts_64; + uint64_t pkts_65; + uint64_t pkts_128; + uint64_t pkts_256; + uint64_t pkts_512; + uint64_t pkts_1024; + uint64_t pkts_1519; + /* RX stats. */ + uint64_t rx_bytes; + uint64_t rx_frames; + uint32_t rx_crcerrs; + uint64_t rx_mcast; + uint64_t rx_bcast; + uint32_t rx_control; + uint32_t rx_pause; + uint32_t rx_unknown_control; + uint32_t rx_alignerrs; + uint32_t rx_lenerrs; + uint32_t rx_codeerrs; + uint32_t rx_cserrs; + uint32_t rx_runts; + uint64_t rx_oversize; + uint32_t rx_fragments; + uint32_t rx_jabbers; + uint32_t rx_drop; + /* TX stats. */ + uint64_t tx_bytes; + uint64_t tx_frames; + uint64_t tx_mcast; + uint64_t tx_bcast; + uint32_t tx_pause; + uint32_t tx_deferred; + uint32_t tx_excess_deferred; + uint32_t tx_single_colls; + uint32_t tx_multi_colls; + uint32_t tx_late_colls; + uint32_t tx_excess_colls; + uint32_t tx_total_colls; + uint32_t tx_pause_honored; + uint32_t tx_drop; + uint32_t tx_jabbers; + uint32_t tx_crcerrs; + uint32_t tx_control; + uint64_t tx_oversize; + uint32_t tx_undersize; + uint32_t tx_fragments; +}; + struct et_softc { struct ifnet *ifp; device_t dev; @@ -271,6 +321,7 @@ struct et_softc { struct et_rxbuf_data sc_rx_data[ET_RX_NRING]; struct et_txbuf_data sc_tx_data; + struct et_hw_stats sc_stats; uint32_t sc_tx; uint32_t sc_tx_intr; From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 21:54:44 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DB30106564A; Wed, 7 Dec 2011 21:54:44 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D58D8FC0A; Wed, 7 Dec 2011 21:54:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7LsiKa057437; Wed, 7 Dec 2011 21:54:44 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7LsiXb057435; Wed, 7 Dec 2011 21:54:44 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112072154.pB7LsiXb057435@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Dec 2011 21:54:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228333 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 21:54:44 -0000 Author: yongari Date: Wed Dec 7 21:54:44 2011 New Revision: 228333 URL: http://svn.freebsd.org/changeset/base/228333 Log: Protect SIOCSIFMTU ioctl handler with driver lock. Don't blindly re-initialize controller whenever MTU is changed. Now, reinitializing is done only when driver is running. While here, remove unnecessary assignment of error value since it was already initialized to 0. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Wed Dec 7 21:46:09 2011 (r228332) +++ head/sys/dev/et/if_et.c Wed Dec 7 21:54:44 2011 (r228333) @@ -1287,11 +1287,11 @@ et_ioctl(struct ifnet *ifp, u_long cmd, ET_LOCK(sc); et_setmulti(sc); ET_UNLOCK(sc); - error = 0; } break; case SIOCSIFMTU: + ET_LOCK(sc); #if 0 if (sc->sc_flags & ET_FLAG_JUMBO) max_framelen = ET_JUMBO_FRAMELEN; @@ -1301,14 +1301,18 @@ et_ioctl(struct ifnet *ifp, u_long cmd, if (ET_FRAMELEN(ifr->ifr_mtu) > max_framelen) { error = EOPNOTSUPP; + ET_UNLOCK(sc); break; } if (ifp->if_mtu != ifr->ifr_mtu) { ifp->if_mtu = ifr->ifr_mtu; - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - et_init(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + et_init_locked(sc); + } } + ET_UNLOCK(sc); break; case SIOCSIFCAP: From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 22:04:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 610BF1065675; Wed, 7 Dec 2011 22:04:57 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 505228FC15; Wed, 7 Dec 2011 22:04:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7M4vl9057846; Wed, 7 Dec 2011 22:04:57 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7M4vfa057843; Wed, 7 Dec 2011 22:04:57 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112072204.pB7M4vfa057843@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Dec 2011 22:04:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228335 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 22:04:57 -0000 Author: yongari Date: Wed Dec 7 22:04:57 2011 New Revision: 228335 URL: http://svn.freebsd.org/changeset/base/228335 Log: Consistently use a tab character instead of using either a space or tab after #define. While I'm here consistently use capital letters when it uses hexadecimal notation. No functional changes. Modified: head/sys/dev/et/if_etreg.h head/sys/dev/et/if_etvar.h Modified: head/sys/dev/et/if_etreg.h ============================================================================== --- head/sys/dev/et/if_etreg.h Wed Dec 7 21:55:11 2011 (r228334) +++ head/sys/dev/et/if_etreg.h Wed Dec 7 22:04:57 2011 (r228335) @@ -38,11 +38,11 @@ #ifndef _IF_ETREG_H #define _IF_ETREG_H -#define ET_MEM_TXSIZE_EX 182 -#define ET_MEM_RXSIZE_MIN 608 -#define ET_MEM_RXSIZE_DEFAULT 11216 -#define ET_MEM_SIZE 16384 -#define ET_MEM_UNIT 16 +#define ET_MEM_TXSIZE_EX 182 +#define ET_MEM_RXSIZE_MIN 608 +#define ET_MEM_RXSIZE_DEFAULT 11216 +#define ET_MEM_SIZE 16384 +#define ET_MEM_UNIT 16 /* * PCI registers @@ -53,270 +53,270 @@ * ET_PCIV_REPLAY_TIMER_{128,256} are from * PCI EXPRESS BASE SPECIFICATION, REV. 1.0a, Table 3-4 */ -#define ET_PCIR_BAR PCIR_BAR(0) +#define ET_PCIR_BAR PCIR_BAR(0) -#define ET_PCIR_DEVICE_CAPS 0x4c -#define ET_PCIM_DEVICE_CAPS_MAX_PLSZ 0x7 /* Max playload size */ -#define ET_PCIV_DEVICE_CAPS_PLSZ_128 0x0 -#define ET_PCIV_DEVICE_CAPS_PLSZ_256 0x1 +#define ET_PCIR_DEVICE_CAPS 0x4C +#define ET_PCIM_DEVICE_CAPS_MAX_PLSZ 0x7 /* Max playload size */ +#define ET_PCIV_DEVICE_CAPS_PLSZ_128 0x0 +#define ET_PCIV_DEVICE_CAPS_PLSZ_256 0x1 -#define ET_PCIR_DEVICE_CTRL 0x50 -#define ET_PCIM_DEVICE_CTRL_MAX_RRSZ 0x7000 /* Max read request size */ -#define ET_PCIV_DEVICE_CTRL_RRSZ_2K 0x4000 +#define ET_PCIR_DEVICE_CTRL 0x50 +#define ET_PCIM_DEVICE_CTRL_MAX_RRSZ 0x7000 /* Max read request size */ +#define ET_PCIV_DEVICE_CTRL_RRSZ_2K 0x4000 -#define ET_PCIR_MAC_ADDR0 0xa4 -#define ET_PCIR_MAC_ADDR1 0xa8 +#define ET_PCIR_MAC_ADDR0 0xA4 +#define ET_PCIR_MAC_ADDR1 0xA8 -#define ET_PCIR_EEPROM_STATUS 0xb2 /* XXX undocumented */ -#define ET_PCIM_EEPROM_STATUS_ERROR 0x4c +#define ET_PCIR_EEPROM_STATUS 0xB2 /* XXX undocumented */ +#define ET_PCIM_EEPROM_STATUS_ERROR 0x4C -#define ET_PCIR_ACK_LATENCY 0xc0 -#define ET_PCIV_ACK_LATENCY_128 237 -#define ET_PCIV_ACK_LATENCY_256 416 +#define ET_PCIR_ACK_LATENCY 0xC0 +#define ET_PCIV_ACK_LATENCY_128 237 +#define ET_PCIV_ACK_LATENCY_256 416 -#define ET_PCIR_REPLAY_TIMER 0xc2 -#define ET_REPLAY_TIMER_RX_L0S_ADJ 250 /* XXX infered from default */ -#define ET_PCIV_REPLAY_TIMER_128 (711 + ET_REPLAY_TIMER_RX_L0S_ADJ) -#define ET_PCIV_REPLAY_TIMER_256 (1248 + ET_REPLAY_TIMER_RX_L0S_ADJ) +#define ET_PCIR_REPLAY_TIMER 0xC2 +#define ET_REPLAY_TIMER_RX_L0S_ADJ 250 /* XXX infered from default */ +#define ET_PCIV_REPLAY_TIMER_128 (711 + ET_REPLAY_TIMER_RX_L0S_ADJ) +#define ET_PCIV_REPLAY_TIMER_256 (1248 + ET_REPLAY_TIMER_RX_L0S_ADJ) -#define ET_PCIR_L0S_L1_LATENCY 0xcf +#define ET_PCIR_L0S_L1_LATENCY 0xCF /* * CSR */ -#define ET_TXQUEUE_START 0x0000 -#define ET_TXQUEUE_END 0x0004 -#define ET_RXQUEUE_START 0x0008 -#define ET_RXQUEUE_END 0x000c -#define ET_QUEUE_ADDR(addr) (((addr) / ET_MEM_UNIT) - 1) -#define ET_QUEUE_ADDR_START 0 -#define ET_QUEUE_ADDR_END ET_QUEUE_ADDR(ET_MEM_SIZE) - -#define ET_PM 0x0010 -#define ET_PM_SYSCLK_GATE 0x00000008 -#define ET_PM_TXCLK_GATE 0x00000010 -#define ET_PM_RXCLK_GATE 0x00000020 - -#define ET_INTR_STATUS 0x0018 -#define ET_INTR_MASK 0x001c - -#define ET_SWRST 0x0028 -#define ET_SWRST_TXDMA 0x00000001 -#define ET_SWRST_RXDMA 0x00000002 -#define ET_SWRST_TXMAC 0x00000004 -#define ET_SWRST_RXMAC 0x00000008 -#define ET_SWRST_MAC 0x00000010 -#define ET_SWRST_MAC_STAT 0x00000020 -#define ET_SWRST_MMC 0x00000040 -#define ET_SWRST_SELFCLR_DISABLE 0x80000000 - -#define ET_MSI_CFG 0x0030 - -#define ET_LOOPBACK 0x0034 - -#define ET_TIMER 0x0038 - -#define ET_TXDMA_CTRL 0x1000 -#define ET_TXDMA_CTRL_HALT 0x00000001 -#define ET_TXDMA_CTRL_CACHE_THR_MASK 0x000000F0 -#define ET_TXDMA_CTRL_SINGLE_EPKT 0x00000100 /* ??? */ - -#define ET_TX_RING_HI 0x1004 -#define ET_TX_RING_LO 0x1008 -#define ET_TX_RING_CNT 0x100c - -#define ET_TX_STATUS_HI 0x101c -#define ET_TX_STATUS_LO 0x1020 - -#define ET_TX_READY_POS 0x1024 -#define ET_TX_READY_POS_INDEX_MASK 0x000003FF -#define ET_TX_READY_POS_WRAP 0x00000400 - -#define ET_TX_DONE_POS 0x1060 -#define ET_TX_DONE_POS_INDEX_MASK 0x0000003FF -#define ET_TX_DONE_POS_WRAP 0x000000400 - -#define ET_RXDMA_CTRL 0x2000 -#define ET_RXDMA_CTRL_HALT 0x00000001 -#define ET_RXDMA_CTRL_RING0_SIZE_MASK 0x00000300 -#define ET_RXDMA_CTRL_RING0_128 0x00000000 /* 127 */ -#define ET_RXDMA_CTRL_RING0_256 0x00000100 /* 255 */ -#define ET_RXDMA_CTRL_RING0_512 0x00000200 /* 511 */ -#define ET_RXDMA_CTRL_RING0_1024 0x00000300 /* 1023 */ -#define ET_RXDMA_CTRL_RING0_ENABLE 0x00000400 -#define ET_RXDMA_CTRL_RING1_SIZE_MASK 0x00001800 -#define ET_RXDMA_CTRL_RING1_2048 0x00000000 /* 2047 */ -#define ET_RXDMA_CTRL_RING1_4096 0x00000800 /* 4095 */ -#define ET_RXDMA_CTRL_RING1_8192 0x00001000 /* 8191 */ -#define ET_RXDMA_CTRL_RING1_16384 0x00001800 /* 16383 (9022?) */ -#define ET_RXDMA_CTRL_RING1_ENABLE 0x00002000 -#define ET_RXDMA_CTRL_HALTED 0x00020000 - -#define ET_RX_STATUS_LO 0x2004 -#define ET_RX_STATUS_HI 0x2008 - -#define ET_RX_INTR_NPKTS 0x200c -#define ET_RX_INTR_DELAY 0x2010 - -#define ET_RXSTAT_LO 0x2020 -#define ET_RXSTAT_HI 0x2024 -#define ET_RXSTAT_CNT 0x2028 - -#define ET_RXSTAT_POS 0x2030 -#define ET_RXSTAT_POS_INDEX_MASK 0x00000FFF -#define ET_RXSTAT_POS_WRAP 0x00001000 - -#define ET_RXSTAT_MINCNT 0x2038 - -#define ET_RX_RING0_LO 0x203c -#define ET_RX_RING0_HI 0x2040 -#define ET_RX_RING0_CNT 0x2044 - -#define ET_RX_RING0_POS 0x204c -#define ET_RX_RING0_POS_INDEX_MASK 0x000003FF -#define ET_RX_RING0_POS_WRAP 0x00000400 - -#define ET_RX_RING0_MINCNT 0x2054 - -#define ET_RX_RING1_LO 0x2058 -#define ET_RX_RING1_HI 0x205c -#define ET_RX_RING1_CNT 0x2060 - -#define ET_RX_RING1_POS 0x2068 -#define ET_RX_RING1_POS_INDEX 0x000003FF -#define ET_RX_RING1_POS_WRAP 0x00000400 - -#define ET_RX_RING1_MINCNT 0x2070 - -#define ET_TXMAC_CTRL 0x3000 -#define ET_TXMAC_CTRL_ENABLE 0x00000001 -#define ET_TXMAC_CTRL_FC_DISABLE 0x00000008 - -#define ET_TXMAC_FLOWCTRL 0x3010 - -#define ET_RXMAC_CTRL 0x4000 -#define ET_RXMAC_CTRL_ENABLE 0x00000001 -#define ET_RXMAC_CTRL_NO_PKTFILT 0x00000004 -#define ET_RXMAC_CTRL_WOL_DISABLE 0x00000008 - -#define ET_WOL_CRC 0x4004 -#define ET_WOL_SA_LO 0x4010 -#define ET_WOL_SA_HI 0x4014 -#define ET_WOL_MASK 0x4018 - -#define ET_UCAST_FILTADDR1 0x4068 -#define ET_UCAST_FILTADDR2 0x406c -#define ET_UCAST_FILTADDR3 0x4070 - -#define ET_MULTI_HASH 0x4074 - -#define ET_PKTFILT 0x4084 -#define ET_PKTFILT_BCAST 0x00000001 -#define ET_PKTFILT_MCAST 0x00000002 -#define ET_PKTFILT_UCAST 0x00000004 -#define ET_PKTFILT_FRAG 0x00000008 -#define ET_PKTFILT_MINLEN_MASK 0x007F0000 -#define ET_PKTFILT_MINLEN_SHIFT 16 - -#define ET_RXMAC_MC_SEGSZ 0x4088 -#define ET_RXMAC_MC_SEGSZ_ENABLE 0x00000001 -#define ET_RXMAC_MC_SEGSZ_FC 0x00000002 -#define ET_RXMAC_MC_SEGSZ_MAX_MASK 0x000003FC -#define ET_RXMAC_SEGSZ(segsz) ((segsz) / ET_MEM_UNIT) -#define ET_RXMAC_CUT_THRU_FRMLEN 8074 - -#define ET_RXMAC_MC_WATERMARK 0x408c -#define ET_RXMAC_SPACE_AVL 0x4094 - -#define ET_RXMAC_MGT 0x4098 -#define ET_RXMAC_MGT_PASS_ECRC 0x00000010 -#define ET_RXMAC_MGT_PASS_ELEN 0x00000020 -#define ET_RXMAC_MGT_PASS_ETRUNC 0x00010000 -#define ET_RXMAC_MGT_CHECK_PKT 0x00020000 - -#define ET_MAC_CFG1 0x5000 -#define ET_MAC_CFG1_TXEN 0x00000001 -#define ET_MAC_CFG1_SYNC_TXEN 0x00000002 -#define ET_MAC_CFG1_RXEN 0x00000004 -#define ET_MAC_CFG1_SYNC_RXEN 0x00000008 -#define ET_MAC_CFG1_TXFLOW 0x00000010 -#define ET_MAC_CFG1_RXFLOW 0x00000020 -#define ET_MAC_CFG1_LOOPBACK 0x00000100 -#define ET_MAC_CFG1_RST_TXFUNC 0x00010000 -#define ET_MAC_CFG1_RST_RXFUNC 0x00020000 -#define ET_MAC_CFG1_RST_TXMC 0x00040000 -#define ET_MAC_CFG1_RST_RXMC 0x00080000 -#define ET_MAC_CFG1_SIM_RST 0x40000000 -#define ET_MAC_CFG1_SOFT_RST 0x80000000 - -#define ET_MAC_CFG2 0x5004 -#define ET_MAC_CFG2_FDX 0x00000001 -#define ET_MAC_CFG2_CRC 0x00000002 -#define ET_MAC_CFG2_PADCRC 0x00000004 -#define ET_MAC_CFG2_LENCHK 0x00000010 -#define ET_MAC_CFG2_BIGFRM 0x00000020 -#define ET_MAC_CFG2_MODE_MII 0x00000100 -#define ET_MAC_CFG2_MODE_GMII 0x00000200 -#define ET_MAC_CFG2_PREAMBLE_LEN_MASK 0x0000F000 -#define ET_MAC_CFG2_PREAMBLE_LEN_SHIFT 12 - -#define ET_IPG 0x5008 -#define ET_IPG_B2B_MASK 0x0000007F -#define ET_IPG_MINIFG_MASK 0x0000FF00 -#define ET_IPG_NONB2B_2_MASK 0x007F0000 -#define ET_IPG_NONB2B_1_MASK 0x7F000000 -#define ET_IPG_B2B_SHIFT 0 -#define ET_IPG_MINIFG_SHIFT 8 -#define ET_IPG_NONB2B_2_SHIFT 16 -#define ET_IPG_NONB2B_1_SHIFT 24 - -#define ET_MAC_HDX 0x500c -#define ET_MAC_HDX_COLLWIN_MASK 0x000003FF -#define ET_MAC_HDX_REXMIT_MAX_MASK 0x0000F000 -#define ET_MAC_HDX_EXC_DEFER 0x00010000 -#define ET_MAC_HDX_NOBACKOFF 0x00020000 -#define ET_MAC_HDX_BP_NOBACKOFF 0x00040000 -#define ET_MAC_HDX_ALT_BEB 0x00080000 -#define ET_MAC_HDX_ALT_BEB_TRUNC_MASK 0x00F00000 -#define ET_MAC_HDX_COLLWIN_SHIFT 0 -#define ET_MAC_HDX_REXMIT_MAX_SHIFT 12 -#define ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT 20 - -#define ET_MAX_FRMLEN 0x5010 - -#define ET_MII_CFG 0x5020 -#define ET_MII_CFG_CLKRST 0x00000007 -#define ET_MII_CFG_PREAMBLE_SUP 0x00000010 -#define ET_MII_CFG_SCAN_AUTOINC 0x00000020 -#define ET_MII_CFG_RST 0x80000000 - -#define ET_MII_CMD 0x5024 -#define ET_MII_CMD_READ 0x00000001 - -#define ET_MII_ADDR 0x5028 -#define ET_MII_ADDR_REG_MASK 0x0000001F -#define ET_MII_ADDR_PHY_MASK 0x00001F00 -#define ET_MII_ADDR_REG_SHIFT 0 -#define ET_MII_ADDR_PHY_SHIFT 8 - -#define ET_MII_CTRL 0x502c -#define ET_MII_CTRL_VALUE_MASK 0x0000FFFF -#define ET_MII_CTRL_VALUE_SHIFT 0 - -#define ET_MII_STAT 0x5030 -#define ET_MII_STAT_VALUE_MASK 0x0000FFFF - -#define ET_MII_IND 0x5034 -#define ET_MII_IND_BUSY 0x00000001 -#define ET_MII_IND_INVALID 0x00000004 - -#define ET_MAC_CTRL 0x5038 -#define ET_MAC_CTRL_MODE_MII 0x01000000 -#define ET_MAC_CTRL_LHDX 0x02000000 -#define ET_MAC_CTRL_GHDX 0x04000000 +#define ET_TXQUEUE_START 0x0000 +#define ET_TXQUEUE_END 0x0004 +#define ET_RXQUEUE_START 0x0008 +#define ET_RXQUEUE_END 0x000C +#define ET_QUEUE_ADDR(addr) (((addr) / ET_MEM_UNIT) - 1) +#define ET_QUEUE_ADDR_START 0 +#define ET_QUEUE_ADDR_END ET_QUEUE_ADDR(ET_MEM_SIZE) + +#define ET_PM 0x0010 +#define ET_PM_SYSCLK_GATE 0x00000008 +#define ET_PM_TXCLK_GATE 0x00000010 +#define ET_PM_RXCLK_GATE 0x00000020 + +#define ET_INTR_STATUS 0x0018 +#define ET_INTR_MASK 0x001C + +#define ET_SWRST 0x0028 +#define ET_SWRST_TXDMA 0x00000001 +#define ET_SWRST_RXDMA 0x00000002 +#define ET_SWRST_TXMAC 0x00000004 +#define ET_SWRST_RXMAC 0x00000008 +#define ET_SWRST_MAC 0x00000010 +#define ET_SWRST_MAC_STAT 0x00000020 +#define ET_SWRST_MMC 0x00000040 +#define ET_SWRST_SELFCLR_DISABLE 0x80000000 + +#define ET_MSI_CFG 0x0030 + +#define ET_LOOPBACK 0x0034 + +#define ET_TIMER 0x0038 + +#define ET_TXDMA_CTRL 0x1000 +#define ET_TXDMA_CTRL_HALT 0x00000001 +#define ET_TXDMA_CTRL_CACHE_THR_MASK 0x000000F0 +#define ET_TXDMA_CTRL_SINGLE_EPKT 0x00000100 /* ??? */ + +#define ET_TX_RING_HI 0x1004 +#define ET_TX_RING_LO 0x1008 +#define ET_TX_RING_CNT 0x100C + +#define ET_TX_STATUS_HI 0x101C +#define ET_TX_STATUS_LO 0x1020 + +#define ET_TX_READY_POS 0x1024 +#define ET_TX_READY_POS_INDEX_MASK 0x000003FF +#define ET_TX_READY_POS_WRAP 0x00000400 + +#define ET_TX_DONE_POS 0x1060 +#define ET_TX_DONE_POS_INDEX_MASK 0x0000003FF +#define ET_TX_DONE_POS_WRAP 0x000000400 + +#define ET_RXDMA_CTRL 0x2000 +#define ET_RXDMA_CTRL_HALT 0x00000001 +#define ET_RXDMA_CTRL_RING0_SIZE_MASK 0x00000300 +#define ET_RXDMA_CTRL_RING0_128 0x00000000 /* 127 */ +#define ET_RXDMA_CTRL_RING0_256 0x00000100 /* 255 */ +#define ET_RXDMA_CTRL_RING0_512 0x00000200 /* 511 */ +#define ET_RXDMA_CTRL_RING0_1024 0x00000300 /* 1023 */ +#define ET_RXDMA_CTRL_RING0_ENABLE 0x00000400 +#define ET_RXDMA_CTRL_RING1_SIZE_MASK 0x00001800 +#define ET_RXDMA_CTRL_RING1_2048 0x00000000 /* 2047 */ +#define ET_RXDMA_CTRL_RING1_4096 0x00000800 /* 4095 */ +#define ET_RXDMA_CTRL_RING1_8192 0x00001000 /* 8191 */ +#define ET_RXDMA_CTRL_RING1_16384 0x00001800 /* 16383 (9022?) */ +#define ET_RXDMA_CTRL_RING1_ENABLE 0x00002000 +#define ET_RXDMA_CTRL_HALTED 0x00020000 + +#define ET_RX_STATUS_LO 0x2004 +#define ET_RX_STATUS_HI 0x2008 + +#define ET_RX_INTR_NPKTS 0x200C +#define ET_RX_INTR_DELAY 0x2010 + +#define ET_RXSTAT_LO 0x2020 +#define ET_RXSTAT_HI 0x2024 +#define ET_RXSTAT_CNT 0x2028 + +#define ET_RXSTAT_POS 0x2030 +#define ET_RXSTAT_POS_INDEX_MASK 0x00000FFF +#define ET_RXSTAT_POS_WRAP 0x00001000 + +#define ET_RXSTAT_MINCNT 0x2038 + +#define ET_RX_RING0_LO 0x203C +#define ET_RX_RING0_HI 0x2040 +#define ET_RX_RING0_CNT 0x2044 + +#define ET_RX_RING0_POS 0x204C +#define ET_RX_RING0_POS_INDEX_MASK 0x000003FF +#define ET_RX_RING0_POS_WRAP 0x00000400 + +#define ET_RX_RING0_MINCNT 0x2054 + +#define ET_RX_RING1_LO 0x2058 +#define ET_RX_RING1_HI 0x205C +#define ET_RX_RING1_CNT 0x2060 + +#define ET_RX_RING1_POS 0x2068 +#define ET_RX_RING1_POS_INDEX 0x000003FF +#define ET_RX_RING1_POS_WRAP 0x00000400 + +#define ET_RX_RING1_MINCNT 0x2070 + +#define ET_TXMAC_CTRL 0x3000 +#define ET_TXMAC_CTRL_ENABLE 0x00000001 +#define ET_TXMAC_CTRL_FC_DISABLE 0x00000008 + +#define ET_TXMAC_FLOWCTRL 0x3010 + +#define ET_RXMAC_CTRL 0x4000 +#define ET_RXMAC_CTRL_ENABLE 0x00000001 +#define ET_RXMAC_CTRL_NO_PKTFILT 0x00000004 +#define ET_RXMAC_CTRL_WOL_DISABLE 0x00000008 + +#define ET_WOL_CRC 0x4004 +#define ET_WOL_SA_LO 0x4010 +#define ET_WOL_SA_HI 0x4014 +#define ET_WOL_MASK 0x4018 + +#define ET_UCAST_FILTADDR1 0x4068 +#define ET_UCAST_FILTADDR2 0x406C +#define ET_UCAST_FILTADDR3 0x4070 + +#define ET_MULTI_HASH 0x4074 + +#define ET_PKTFILT 0x4084 +#define ET_PKTFILT_BCAST 0x00000001 +#define ET_PKTFILT_MCAST 0x00000002 +#define ET_PKTFILT_UCAST 0x00000004 +#define ET_PKTFILT_FRAG 0x00000008 +#define ET_PKTFILT_MINLEN_MASK 0x007F0000 +#define ET_PKTFILT_MINLEN_SHIFT 16 + +#define ET_RXMAC_MC_SEGSZ 0x4088 +#define ET_RXMAC_MC_SEGSZ_ENABLE 0x00000001 +#define ET_RXMAC_MC_SEGSZ_FC 0x00000002 +#define ET_RXMAC_MC_SEGSZ_MAX_MASK 0x000003FC +#define ET_RXMAC_SEGSZ(segsz) ((segsz) / ET_MEM_UNIT) +#define ET_RXMAC_CUT_THRU_FRMLEN 8074 + +#define ET_RXMAC_MC_WATERMARK 0x408C +#define ET_RXMAC_SPACE_AVL 0x4094 + +#define ET_RXMAC_MGT 0x4098 +#define ET_RXMAC_MGT_PASS_ECRC 0x00000010 +#define ET_RXMAC_MGT_PASS_ELEN 0x00000020 +#define ET_RXMAC_MGT_PASS_ETRUNC 0x00010000 +#define ET_RXMAC_MGT_CHECK_PKT 0x00020000 + +#define ET_MAC_CFG1 0x5000 +#define ET_MAC_CFG1_TXEN 0x00000001 +#define ET_MAC_CFG1_SYNC_TXEN 0x00000002 +#define ET_MAC_CFG1_RXEN 0x00000004 +#define ET_MAC_CFG1_SYNC_RXEN 0x00000008 +#define ET_MAC_CFG1_TXFLOW 0x00000010 +#define ET_MAC_CFG1_RXFLOW 0x00000020 +#define ET_MAC_CFG1_LOOPBACK 0x00000100 +#define ET_MAC_CFG1_RST_TXFUNC 0x00010000 +#define ET_MAC_CFG1_RST_RXFUNC 0x00020000 +#define ET_MAC_CFG1_RST_TXMC 0x00040000 +#define ET_MAC_CFG1_RST_RXMC 0x00080000 +#define ET_MAC_CFG1_SIM_RST 0x40000000 +#define ET_MAC_CFG1_SOFT_RST 0x80000000 + +#define ET_MAC_CFG2 0x5004 +#define ET_MAC_CFG2_FDX 0x00000001 +#define ET_MAC_CFG2_CRC 0x00000002 +#define ET_MAC_CFG2_PADCRC 0x00000004 +#define ET_MAC_CFG2_LENCHK 0x00000010 +#define ET_MAC_CFG2_BIGFRM 0x00000020 +#define ET_MAC_CFG2_MODE_MII 0x00000100 +#define ET_MAC_CFG2_MODE_GMII 0x00000200 +#define ET_MAC_CFG2_PREAMBLE_LEN_MASK 0x0000F000 +#define ET_MAC_CFG2_PREAMBLE_LEN_SHIFT 12 + +#define ET_IPG 0x5008 +#define ET_IPG_B2B_MASK 0x0000007F +#define ET_IPG_MINIFG_MASK 0x0000FF00 +#define ET_IPG_NONB2B_2_MASK 0x007F0000 +#define ET_IPG_NONB2B_1_MASK 0x7F000000 +#define ET_IPG_B2B_SHIFT 0 +#define ET_IPG_MINIFG_SHIFT 8 +#define ET_IPG_NONB2B_2_SHIFT 16 +#define ET_IPG_NONB2B_1_SHIFT 24 + +#define ET_MAC_HDX 0x500C +#define ET_MAC_HDX_COLLWIN_MASK 0x000003FF +#define ET_MAC_HDX_REXMIT_MAX_MASK 0x0000F000 +#define ET_MAC_HDX_EXC_DEFER 0x00010000 +#define ET_MAC_HDX_NOBACKOFF 0x00020000 +#define ET_MAC_HDX_BP_NOBACKOFF 0x00040000 +#define ET_MAC_HDX_ALT_BEB 0x00080000 +#define ET_MAC_HDX_ALT_BEB_TRUNC_MASK 0x00F00000 +#define ET_MAC_HDX_COLLWIN_SHIFT 0 +#define ET_MAC_HDX_REXMIT_MAX_SHIFT 12 +#define ET_MAC_HDX_ALT_BEB_TRUNC_SHIFT 20 + +#define ET_MAX_FRMLEN 0x5010 + +#define ET_MII_CFG 0x5020 +#define ET_MII_CFG_CLKRST 0x00000007 +#define ET_MII_CFG_PREAMBLE_SUP 0x00000010 +#define ET_MII_CFG_SCAN_AUTOINC 0x00000020 +#define ET_MII_CFG_RST 0x80000000 + +#define ET_MII_CMD 0x5024 +#define ET_MII_CMD_READ 0x00000001 + +#define ET_MII_ADDR 0x5028 +#define ET_MII_ADDR_REG_MASK 0x0000001F +#define ET_MII_ADDR_PHY_MASK 0x00001F00 +#define ET_MII_ADDR_REG_SHIFT 0 +#define ET_MII_ADDR_PHY_SHIFT 8 + +#define ET_MII_CTRL 0x502C +#define ET_MII_CTRL_VALUE_MASK 0x0000FFFF +#define ET_MII_CTRL_VALUE_SHIFT 0 + +#define ET_MII_STAT 0x5030 +#define ET_MII_STAT_VALUE_MASK 0x0000FFFF + +#define ET_MII_IND 0x5034 +#define ET_MII_IND_BUSY 0x00000001 +#define ET_MII_IND_INVALID 0x00000004 + +#define ET_MAC_CTRL 0x5038 +#define ET_MAC_CTRL_MODE_MII 0x01000000 +#define ET_MAC_CTRL_LHDX 0x02000000 +#define ET_MAC_CTRL_GHDX 0x04000000 -#define ET_MAC_ADDR1 0x5040 -#define ET_MAC_ADDR2 0x5044 +#define ET_MAC_ADDR1 0x5040 +#define ET_MAC_ADDR2 0x5044 /* MAC statistics counters. */ #define ET_STAT_PKTS_64 0x6080 @@ -364,48 +364,48 @@ #define ET_STAT_TX_UNDERSIZE 0x6128 #define ET_STAT_TX_FRAG 0x612C -#define ET_MMC_CTRL 0x7000 -#define ET_MMC_CTRL_ENABLE 0x00000001 -#define ET_MMC_CTRL_ARB_DISABLE 0x00000002 -#define ET_MMC_CTRL_RXMAC_DISABLE 0x00000004 -#define ET_MMC_CTRL_TXMAC_DISABLE 0x00000008 -#define ET_MMC_CTRL_TXDMA_DISABLE 0x00000010 -#define ET_MMC_CTRL_RXDMA_DISABLE 0x00000020 -#define ET_MMC_CTRL_FORCE_CE 0x00000040 +#define ET_MMC_CTRL 0x7000 +#define ET_MMC_CTRL_ENABLE 0x00000001 +#define ET_MMC_CTRL_ARB_DISABLE 0x00000002 +#define ET_MMC_CTRL_RXMAC_DISABLE 0x00000004 +#define ET_MMC_CTRL_TXMAC_DISABLE 0x00000008 +#define ET_MMC_CTRL_TXDMA_DISABLE 0x00000010 +#define ET_MMC_CTRL_RXDMA_DISABLE 0x00000020 +#define ET_MMC_CTRL_FORCE_CE 0x00000040 /* * Interrupts */ -#define ET_INTR_TXEOF 0x00000008 -#define ET_INTR_TXDMA_ERROR 0x00000010 -#define ET_INTR_RXEOF 0x00000020 -#define ET_INTR_RXRING0_LOW 0x00000040 -#define ET_INTR_RXRING1_LOW 0x00000080 -#define ET_INTR_RXSTAT_LOW 0x00000100 -#define ET_INTR_RXDMA_ERROR 0x00000200 -#define ET_INTR_TIMER 0x00004000 -#define ET_INTR_WOL 0x00008000 -#define ET_INTR_PHY 0x00010000 -#define ET_INTR_TXMAC 0x00020000 -#define ET_INTR_RXMAC 0x00040000 -#define ET_INTR_MAC_STATS 0x00080000 -#define ET_INTR_SLAVE_TO 0x00100000 +#define ET_INTR_TXEOF 0x00000008 +#define ET_INTR_TXDMA_ERROR 0x00000010 +#define ET_INTR_RXEOF 0x00000020 +#define ET_INTR_RXRING0_LOW 0x00000040 +#define ET_INTR_RXRING1_LOW 0x00000080 +#define ET_INTR_RXSTAT_LOW 0x00000100 +#define ET_INTR_RXDMA_ERROR 0x00000200 +#define ET_INTR_TIMER 0x00004000 +#define ET_INTR_WOL 0x00008000 +#define ET_INTR_PHY 0x00010000 +#define ET_INTR_TXMAC 0x00020000 +#define ET_INTR_RXMAC 0x00040000 +#define ET_INTR_MAC_STATS 0x00080000 +#define ET_INTR_SLAVE_TO 0x00100000 -#define ET_INTRS (ET_INTR_TXEOF | \ +#define ET_INTRS (ET_INTR_TXEOF | \ ET_INTR_RXEOF | \ ET_INTR_TIMER) /* * RX ring position uses same layout */ -#define ET_RX_RING_POS_INDEX_MASK 0x000003FF -#define ET_RX_RING_POS_WRAP 0x00000400 +#define ET_RX_RING_POS_INDEX_MASK 0x000003FF +#define ET_RX_RING_POS_WRAP 0x00000400 /* * PCI IDs */ -#define PCI_VENDOR_LUCENT 0x11c1 -#define PCI_PRODUCT_LUCENT_ET1310 0xed00 /* ET1310 10/100/1000M Ethernet */ -#define PCI_PRODUCT_LUCENT_ET1310_FAST 0xed01 /* ET1310 10/100M Ethernet */ +#define PCI_VENDOR_LUCENT 0x11C1 +#define PCI_PRODUCT_LUCENT_ET1310 0xED00 /* ET1310 10/100/1000M Ethernet */ +#define PCI_PRODUCT_LUCENT_ET1310_FAST 0xED01 /* ET1310 10/100M Ethernet */ #endif /* !_IF_ETREG_H */ Modified: head/sys/dev/et/if_etvar.h ============================================================================== --- head/sys/dev/et/if_etvar.h Wed Dec 7 21:55:11 2011 (r228334) +++ head/sys/dev/et/if_etvar.h Wed Dec 7 22:04:57 2011 (r228335) @@ -38,39 +38,39 @@ #ifndef _IF_ETVAR_H #define _IF_ETVAR_H -#define ET_RING_ALIGN 4096 -#define ET_STATUS_ALIGN 8 -#define ET_NSEG_MAX 32 /* XXX no limit actually */ -#define ET_NSEG_SPARE 4 - -#define ET_TX_NDESC 512 -#define ET_RX_NDESC 512 -#define ET_RX_NRING 2 -#define ET_RX_NSTAT (ET_RX_NRING * ET_RX_NDESC) - -#define ET_TX_RING_SIZE (ET_TX_NDESC * sizeof(struct et_txdesc)) -#define ET_RX_RING_SIZE (ET_RX_NDESC * sizeof(struct et_rxdesc)) -#define ET_RXSTAT_RING_SIZE (ET_RX_NSTAT * sizeof(struct et_rxstat)) +#define ET_RING_ALIGN 4096 +#define ET_STATUS_ALIGN 8 +#define ET_NSEG_MAX 32 /* XXX no limit actually */ +#define ET_NSEG_SPARE 4 + +#define ET_TX_NDESC 512 +#define ET_RX_NDESC 512 +#define ET_RX_NRING 2 +#define ET_RX_NSTAT (ET_RX_NRING * ET_RX_NDESC) + +#define ET_TX_RING_SIZE (ET_TX_NDESC * sizeof(struct et_txdesc)) +#define ET_RX_RING_SIZE (ET_RX_NDESC * sizeof(struct et_rxdesc)) +#define ET_RXSTAT_RING_SIZE (ET_RX_NSTAT * sizeof(struct et_rxstat)) -#define ET_JUMBO_FRAMELEN (ET_MEM_SIZE - ET_MEM_RXSIZE_MIN - \ +#define ET_JUMBO_FRAMELEN (ET_MEM_SIZE - ET_MEM_RXSIZE_MIN - \ ET_MEM_TXSIZE_EX) -#define ET_JUMBO_MTU (ET_JUMBO_FRAMELEN - ETHER_HDR_LEN - \ +#define ET_JUMBO_MTU (ET_JUMBO_FRAMELEN - ETHER_HDR_LEN - \ EVL_ENCAPLEN - ETHER_CRC_LEN) -#define ET_FRAMELEN(mtu) (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + \ +#define ET_FRAMELEN(mtu) (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + \ (mtu) + ETHER_CRC_LEN) -#define ET_JSLOTS (ET_RX_NDESC + 128) -#define ET_JLEN (ET_JUMBO_FRAMELEN + ETHER_ALIGN) -#define ET_JUMBO_MEM_SIZE (ET_JSLOTS * ET_JLEN) +#define ET_JSLOTS (ET_RX_NDESC + 128) +#define ET_JLEN (ET_JUMBO_FRAMELEN + ETHER_ALIGN) +#define ET_JUMBO_MEM_SIZE (ET_JSLOTS * ET_JLEN) -#define CSR_WRITE_4(sc, reg, val) \ +#define CSR_WRITE_4(sc, reg, val) \ bus_write_4((sc)->sc_mem_res, (reg), (val)) -#define CSR_READ_4(sc, reg) \ +#define CSR_READ_4(sc, reg) \ bus_read_4((sc)->sc_mem_res, (reg)) -#define ET_ADDR_HI(addr) ((uint64_t) (addr) >> 32) -#define ET_ADDR_LO(addr) ((uint64_t) (addr) & 0xffffffff) +#define ET_ADDR_HI(addr) ((uint64_t) (addr) >> 32) +#define ET_ADDR_LO(addr) ((uint64_t) (addr) & 0xffffffff) struct et_txdesc { uint32_t td_addr_hi; @@ -79,23 +79,23 @@ struct et_txdesc { uint32_t td_ctrl2; /* ET_TDCTRL2_ */ }; -#define ET_TDCTRL1_LEN_MASK 0x0000FFFF +#define ET_TDCTRL1_LEN_MASK 0x0000FFFF -#define ET_TDCTRL2_LAST_FRAG 0x00000001 -#define ET_TDCTRL2_FIRST_FRAG 0x00000002 -#define ET_TDCTRL2_INTR 0x00000004 -#define ET_TDCTRL2_CTRL_WORD 0x00000008 -#define ET_TDCTRL2_HDX_BACKP 0x00000010 -#define ET_TDCTRL2_XMIT_PAUSE 0x00000020 -#define ET_TDCTRL2_FRAME_ERR 0x00000040 -#define ET_TDCTRL2_NO_CRC 0x00000080 -#define ET_TDCTRL2_MAC_OVRRD 0x00000100 -#define ET_TDCTRL2_PAD_PACKET 0x00000200 -#define ET_TDCTRL2_JUMBO_PACKET 0x00000400 -#define ET_TDCTRL2_INS_VLAN 0x00000800 -#define ET_TDCTRL2_CSUM_IP 0x00001000 -#define ET_TDCTRL2_CSUM_TCP 0x00002000 -#define ET_TDCTRL2_CSUM_UDP 0x00004000 +#define ET_TDCTRL2_LAST_FRAG 0x00000001 +#define ET_TDCTRL2_FIRST_FRAG 0x00000002 +#define ET_TDCTRL2_INTR 0x00000004 +#define ET_TDCTRL2_CTRL_WORD 0x00000008 +#define ET_TDCTRL2_HDX_BACKP 0x00000010 +#define ET_TDCTRL2_XMIT_PAUSE 0x00000020 +#define ET_TDCTRL2_FRAME_ERR 0x00000040 +#define ET_TDCTRL2_NO_CRC 0x00000080 +#define ET_TDCTRL2_MAC_OVRRD 0x00000100 +#define ET_TDCTRL2_PAD_PACKET 0x00000200 +#define ET_TDCTRL2_JUMBO_PACKET 0x00000400 +#define ET_TDCTRL2_INS_VLAN 0x00000800 +#define ET_TDCTRL2_CSUM_IP 0x00001000 +#define ET_TDCTRL2_CSUM_TCP 0x00002000 +#define ET_TDCTRL2_CSUM_UDP 0x00004000 struct et_rxdesc { uint32_t rd_addr_lo; @@ -103,56 +103,56 @@ struct et_rxdesc { uint32_t rd_ctrl; /* ET_RDCTRL_ */ }; -#define ET_RDCTRL_BUFIDX_MASK 0x000003FF +#define ET_RDCTRL_BUFIDX_MASK 0x000003FF struct et_rxstat { uint32_t rxst_info1; uint32_t rxst_info2; /* ET_RXST_INFO2_ */ }; -#define ET_RXST_INFO1_HASH_PASS 0x00000001 -#define ET_RXST_INFO1_IPCSUM 0x00000002 -#define ET_RXST_INFO1_IPCSUM_OK 0x00000004 -#define ET_RXST_INFO1_TCPCSUM 0x00000008 -#define ET_RXST_INFO1_TCPCSUM_OK 0x00000010 -#define ET_RXST_INFO1_WOL 0x00000020 -#define ET_RXST_INFO1_RXMAC_ERR 0x00000040 -#define ET_RXST_INFO1_DROP 0x00000080 -#define ET_RXST_INFO1_FRAME_TRUNC 0x00000100 -#define ET_RXST_INFO1_JUMBO 0x00000200 -#define ET_RXST_INFO1_VLAN 0x00000400 -#define ET_RXST_INFO1_PREV_FRMAE_DROP 0x00010000 -#define ET_RXST_INFO1_SHORT 0x00020000 -#define ET_RXST_INFO1_BAD_CARRIER 0x00040000 -#define ET_RXST_INFO1_CODE_ERR 0x00080000 -#define ET_RXST_INFO1_CRC_ERR 0x00100000 -#define ET_RXST_INFO1_LEN_MISMATCH 0x00200000 -#define ET_RXST_INFO1_TOO_LONG 0x00400000 -#define ET_RXST_INFO1_OK 0x00800000 -#define ET_RXST_INFO1_MULTICAST 0x01000000 -#define ET_RXST_INFO1_BROADCAST 0x02000000 -#define ET_RXST_INFO1_DRIBBLE 0x04000000 -#define ET_RXST_INFO1_CTL_FRAME 0x08000000 -#define ET_RXST_INFO1_PAUSE_FRAME 0x10000000 -#define ET_RXST_INFO1_UNKWN_CTL_FRAME 0x20000000 -#define ET_RXST_INFO1_VLAN_TAG 0x40000000 -#define ET_RXST_INFO1_LONG_EVENT 0x80000000 - -#define ET_RXST_INFO2_LEN_MASK 0x0000FFFF -#define ET_RXST_INFO2_LEN_SHIFT 0 -#define ET_RXST_INFO2_BUFIDX_MASK 0x03FF0000 -#define ET_RXST_INFO2_BUFIDX_SHIFT 16 -#define ET_RXST_INFO2_RINGIDX_MASK 0x0C000000 -#define ET_RXST_INFO2_RINGIDX_SHIFT 26 +#define ET_RXST_INFO1_HASH_PASS 0x00000001 +#define ET_RXST_INFO1_IPCSUM 0x00000002 +#define ET_RXST_INFO1_IPCSUM_OK 0x00000004 +#define ET_RXST_INFO1_TCPCSUM 0x00000008 +#define ET_RXST_INFO1_TCPCSUM_OK 0x00000010 +#define ET_RXST_INFO1_WOL 0x00000020 +#define ET_RXST_INFO1_RXMAC_ERR 0x00000040 +#define ET_RXST_INFO1_DROP 0x00000080 +#define ET_RXST_INFO1_FRAME_TRUNC 0x00000100 +#define ET_RXST_INFO1_JUMBO 0x00000200 +#define ET_RXST_INFO1_VLAN 0x00000400 +#define ET_RXST_INFO1_PREV_FRMAE_DROP 0x00010000 +#define ET_RXST_INFO1_SHORT 0x00020000 +#define ET_RXST_INFO1_BAD_CARRIER 0x00040000 +#define ET_RXST_INFO1_CODE_ERR 0x00080000 +#define ET_RXST_INFO1_CRC_ERR 0x00100000 +#define ET_RXST_INFO1_LEN_MISMATCH 0x00200000 +#define ET_RXST_INFO1_TOO_LONG 0x00400000 +#define ET_RXST_INFO1_OK 0x00800000 +#define ET_RXST_INFO1_MULTICAST 0x01000000 +#define ET_RXST_INFO1_BROADCAST 0x02000000 +#define ET_RXST_INFO1_DRIBBLE 0x04000000 +#define ET_RXST_INFO1_CTL_FRAME 0x08000000 +#define ET_RXST_INFO1_PAUSE_FRAME 0x10000000 +#define ET_RXST_INFO1_UNKWN_CTL_FRAME 0x20000000 +#define ET_RXST_INFO1_VLAN_TAG 0x40000000 +#define ET_RXST_INFO1_LONG_EVENT 0x80000000 + +#define ET_RXST_INFO2_LEN_MASK 0x0000FFFF +#define ET_RXST_INFO2_LEN_SHIFT 0 +#define ET_RXST_INFO2_BUFIDX_MASK 0x03FF0000 +#define ET_RXST_INFO2_BUFIDX_SHIFT 16 +#define ET_RXST_INFO2_RINGIDX_MASK 0x0C000000 +#define ET_RXST_INFO2_RINGIDX_SHIFT 26 struct et_rxstatus { uint32_t rxs_ring; uint32_t rxs_stat_ring; /* ET_RXS_STATRING_ */ }; -#define ET_RXS_STATRING_INDEX_MASK 0x0FFF0000 -#define ET_RXS_STATRING_INDEX_SHIFT 16 -#define ET_RXS_STATRING_WRAP 0x10000000 +#define ET_RXS_STATRING_INDEX_MASK 0x0FFF0000 +#define ET_RXS_STATRING_INDEX_SHIFT 16 +#define ET_RXS_STATRING_WRAP 0x10000000 struct et_txbuf { struct mbuf *tb_mbuf; @@ -334,15 +334,15 @@ struct et_softc { uint32_t sc_timer; }; -#define ET_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) -#define ET_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) -#define ET_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) - -#define ET_FLAG_PCIE 0x0001 -#define ET_FLAG_MSI 0x0002 -#define ET_FLAG_FASTETHER 0x0004 -#define ET_FLAG_TXRX_ENABLED 0x0100 -#define ET_FLAG_JUMBO 0x0200 -#define ET_FLAG_LINK 0x8000 +#define ET_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define ET_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) +#define ET_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) + +#define ET_FLAG_PCIE 0x0001 +#define ET_FLAG_MSI 0x0002 +#define ET_FLAG_FASTETHER 0x0004 +#define ET_FLAG_TXRX_ENABLED 0x0100 +#define ET_FLAG_JUMBO 0x0200 +#define ET_FLAG_LINK 0x8000 #endif /* !_IF_ETVAR_H */ From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 23:16:22 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id A35731065672; Wed, 7 Dec 2011 23:16:22 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id D966C14E5D2; Wed, 7 Dec 2011 23:16:21 +0000 (UTC) Message-ID: <4EDFF3C5.80501@FreeBSD.org> Date: Wed, 07 Dec 2011 15:16:21 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:8.0) Gecko/20111110 Thunderbird/8.0 MIME-Version: 1.0 To: Ed Schouten References: <201111261420.pAQEKYKu094828@svn.freebsd.org> <20111206230746.GE83814@acme.spoerlein.net> <20111207120048.GK59489@hoeg.nl> In-Reply-To: <20111207120048.GK59489@hoeg.nl> X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Cc: =?ISO-8859-1?Q?Ulrich_Sp=F6rlein?= , src-committers@FreeBSD.org, David Chisnall , svn-src-all@FreeBSD.org, svn-src-vendor@FreeBSD.org Subject: Re: svn commit: r227997 - vendor/libcxxrt/8931d9e5180830a5433d16ae6b3ad8dd9e629512 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 23:16:22 -0000 On 12/07/2011 04:00, Ed Schouten wrote: > Uli, > > * Ulrich Spörlein , 20111207 00:07: >> Please consider using dated snapshots instead, e.g. YYYY-MM-DD, etc. > > Maybe a combination of both? YYYY-MM-DD-shortrev Personally I'd do the yyyy-mm-dd thing in the path, and include the git version in a text file, along with any other relevant information. -- [^L] Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ From owner-svn-src-all@FreeBSD.ORG Wed Dec 7 23:20:14 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2965106566B; Wed, 7 Dec 2011 23:20:14 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B94A78FC08; Wed, 7 Dec 2011 23:20:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB7NKEAI060256; Wed, 7 Dec 2011 23:20:14 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB7NKEIM060253; Wed, 7 Dec 2011 23:20:14 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112072320.pB7NKEIM060253@svn.freebsd.org> From: Pyun YongHyeon Date: Wed, 7 Dec 2011 23:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228336 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2011 23:20:15 -0000 Author: yongari Date: Wed Dec 7 23:20:14 2011 New Revision: 228336 URL: http://svn.freebsd.org/changeset/base/228336 Log: Disable all clocks and put PHY into COMA before entering into suspend state. This will save more power. On resume, make sure to enable all clocks. While I'm here, if controller is not fast ethernet, enable gigabit PHY. Modified: head/sys/dev/et/if_et.c head/sys/dev/et/if_etreg.h Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Wed Dec 7 22:04:57 2011 (r228335) +++ head/sys/dev/et/if_et.c Wed Dec 7 23:20:14 2011 (r228336) @@ -220,6 +220,7 @@ et_attach(device_t dev) struct et_softc *sc; struct ifnet *ifp; uint8_t eaddr[ETHER_ADDR_LEN]; + uint32_t pmcfg; int cap, error, msic; sc = device_get_softc(dev); @@ -304,8 +305,11 @@ et_attach(device_t dev) et_get_eaddr(dev, eaddr); - CSR_WRITE_4(sc, ET_PM, - ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE); + /* Take PHY out of COMA and enable clocks. */ + pmcfg = ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE; + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + pmcfg |= EM_PM_GIGEPHY_ENB; + CSR_WRITE_4(sc, ET_PM, pmcfg); et_reset(sc); @@ -2636,11 +2640,18 @@ static int et_suspend(device_t dev) { struct et_softc *sc; + uint32_t pmcfg; sc = device_get_softc(dev); ET_LOCK(sc); if ((sc->ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) et_stop(sc); + /* Diable all clocks and put PHY into COMA. */ + pmcfg = CSR_READ_4(sc, ET_PM); + pmcfg &= ~(EM_PM_GIGEPHY_ENB | ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | + ET_PM_RXCLK_GATE); + pmcfg |= ET_PM_PHY_SW_COMA; + CSR_WRITE_4(sc, ET_PM, pmcfg); ET_UNLOCK(sc); return (0); } @@ -2649,9 +2660,15 @@ static int et_resume(device_t dev) { struct et_softc *sc; + uint32_t pmcfg; sc = device_get_softc(dev); ET_LOCK(sc); + /* Take PHY out of COMA and enable clocks. */ + pmcfg = ET_PM_SYSCLK_GATE | ET_PM_TXCLK_GATE | ET_PM_RXCLK_GATE; + if ((sc->sc_flags & ET_FLAG_FASTETHER) == 0) + pmcfg |= EM_PM_GIGEPHY_ENB; + CSR_WRITE_4(sc, ET_PM, pmcfg); if ((sc->ifp->if_flags & IFF_UP) != 0) et_init_locked(sc); ET_UNLOCK(sc); Modified: head/sys/dev/et/if_etreg.h ============================================================================== --- head/sys/dev/et/if_etreg.h Wed Dec 7 22:04:57 2011 (r228335) +++ head/sys/dev/et/if_etreg.h Wed Dec 7 23:20:14 2011 (r228336) @@ -93,9 +93,11 @@ #define ET_QUEUE_ADDR_END ET_QUEUE_ADDR(ET_MEM_SIZE) #define ET_PM 0x0010 +#define EM_PM_GIGEPHY_ENB 0x00000001 #define ET_PM_SYSCLK_GATE 0x00000008 #define ET_PM_TXCLK_GATE 0x00000010 #define ET_PM_RXCLK_GATE 0x00000020 +#define ET_PM_PHY_SW_COMA 0x00000040 #define ET_INTR_STATUS 0x0018 #define ET_INTR_MASK 0x001C From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 00:47:23 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 628D41065670; Thu, 8 Dec 2011 00:47:23 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4CB108FC16; Thu, 8 Dec 2011 00:47:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB80lNwW063037; Thu, 8 Dec 2011 00:47:23 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB80lMpY063030; Thu, 8 Dec 2011 00:47:22 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201112080047.pB80lMpY063030@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Thu, 8 Dec 2011 00:47:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228337 - in stable/8: contrib/binutils/bfd contrib/binutils/gas/config contrib/binutils/include/elf contrib/binutils/include/opcode contrib/binutils/opcodes contrib/gcc/config contrib/... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 00:47:23 -0000 Author: gonzo Date: Thu Dec 8 00:47:22 2011 New Revision: 228337 URL: http://svn.freebsd.org/changeset/base/228337 Log: MFC r208737 (required by OCTEON* kernels): Add/improve mips64r2, Octeon, n32 and n64 support in the toolchain. o) Add TARGET_ABI to the MIPS toolchain build process. This sets the default ABI to one of o32, n32 or n64. If it is not set, o32 is assumed as that is the current default. o) Set the default GCC cpu type to any specified TARGET_CPUTYPE. This is necessary to have a working "cc" if e.g. mips64 is specified, as binutils will refuse to link objects using different ISAs in some cases. o) Add support for n32 and n64 ABIs to binutils and GCC. o) Add additional required libgcc2 stubs for n32 and n64. o) Add support for the "mips64r2" architecture to GCC. Add the "octeon" o) When static linking, wrap default libraries in --start-group and --end-group. This is required for static linking to work on n64 with the interdependencies between libraries there. This is what other OSes that support n64 seem to do, as well. o) Fix our GCC spec to define __mips64 for 64-bit targets, not __mips64__, the former being what libgcc, etc., check and the latter seemingly being a misspelling of a hand merge from a Linux spec. o) When no TARGET_CPUTYPE is specified at build time, make GCC take the default ISA from the ABI. Our old defaults were too liberal and assumed that 64-bit ABIs should default to the MIPS64 ISA and that 32-bit ABIs should default to the MIPS32 ISA, when we are supporting or will support some systems based on earlier 32-bit and 64-bit ISAs, most notably MIPS-III. o) Merge a new opcode file (and support code) from a later version of binutils and add flags and code necessary to support Octeon-specific instructions. This should also make merging opcodes for other modern architectures easier. No objections from: imp, jmallet, jchandra MFC after: 18 months Added: stable/8/contrib/gcc/config/fixdfdi.c - copied unchanged from r208737, head/contrib/gcc/config/fixdfdi.c stable/8/contrib/gcc/config/fixsfdi.c - copied unchanged from r208737, head/contrib/gcc/config/fixsfdi.c stable/8/contrib/gcc/config/fixunsdfsi.c - copied unchanged from r208737, head/contrib/gcc/config/fixunsdfsi.c stable/8/contrib/gcc/config/fixunssfsi.c - copied unchanged from r208737, head/contrib/gcc/config/fixunssfsi.c stable/8/contrib/gcc/config/floatdidf.c - copied unchanged from r208737, head/contrib/gcc/config/floatdidf.c stable/8/contrib/gcc/config/floatdisf.c - copied unchanged from r208737, head/contrib/gcc/config/floatdisf.c stable/8/contrib/gcc/config/floatundidf.c - copied unchanged from r208737, head/contrib/gcc/config/floatundidf.c stable/8/contrib/gcc/config/floatundisf.c - copied unchanged from r208737, head/contrib/gcc/config/floatundisf.c Modified: stable/8/contrib/binutils/bfd/archures.c stable/8/contrib/binutils/bfd/bfd-in2.h stable/8/contrib/binutils/bfd/cpu-mips.c stable/8/contrib/binutils/bfd/elfxx-mips.c stable/8/contrib/binutils/gas/config/tc-mips.c stable/8/contrib/binutils/gas/config/tc-mips.h stable/8/contrib/binutils/include/elf/mips.h stable/8/contrib/binutils/include/opcode/mips.h stable/8/contrib/binutils/opcodes/mips-dis.c stable/8/contrib/binutils/opcodes/mips-opc.c stable/8/contrib/binutils/opcodes/mips16-opc.c stable/8/contrib/gcc/config/mips/freebsd.h stable/8/contrib/gcc/config/mips/mips.c stable/8/contrib/gcc/config/mips/mips.h stable/8/contrib/gcc/config/mips/mips.md stable/8/gnu/lib/libgcc/Makefile stable/8/gnu/lib/libgomp/Makefile stable/8/gnu/usr.bin/binutils/Makefile.inc0 stable/8/gnu/usr.bin/binutils/ld/Makefile.mips stable/8/gnu/usr.bin/binutils/libbfd/Makefile.mips stable/8/gnu/usr.bin/binutils/libbfd/bfd.h Directory Properties: stable/8/contrib/ (props changed) stable/8/contrib/binutils/ (props changed) stable/8/contrib/gcc/ (props changed) stable/8/gnu/ (props changed) stable/8/gnu/lib/libgcc/ (props changed) stable/8/gnu/usr.bin/ (props changed) stable/8/gnu/usr.bin/binutils/ld/ (props changed) Modified: stable/8/contrib/binutils/bfd/archures.c ============================================================================== --- stable/8/contrib/binutils/bfd/archures.c Wed Dec 7 23:20:14 2011 (r228336) +++ stable/8/contrib/binutils/bfd/archures.c Thu Dec 8 00:47:22 2011 (r228337) @@ -1,6 +1,6 @@ /* BFD library support routines for architectures. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Hacked by John Gilmore and Steve Chamberlain of Cygnus Support. @@ -18,7 +18,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -141,10 +141,12 @@ DESCRIPTION .#define bfd_mach_mips6000 6000 .#define bfd_mach_mips7000 7000 .#define bfd_mach_mips8000 8000 +.#define bfd_mach_mips9000 9000 .#define bfd_mach_mips10000 10000 .#define bfd_mach_mips12000 12000 .#define bfd_mach_mips16 16 .#define bfd_mach_mips5 5 +.#define bfd_mach_mips_octeon 6502 .#define bfd_mach_mips_sb1 12310201 {* octal 'SB', 01 *} .#define bfd_mach_mipsisa32 32 .#define bfd_mach_mipsisa32r2 33 Modified: stable/8/contrib/binutils/bfd/bfd-in2.h ============================================================================== --- stable/8/contrib/binutils/bfd/bfd-in2.h Wed Dec 7 23:20:14 2011 (r228336) +++ stable/8/contrib/binutils/bfd/bfd-in2.h Thu Dec 8 00:47:22 2011 (r228337) @@ -8,7 +8,8 @@ /* Main header file for the bfd library -- portable access to object files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -26,7 +27,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __BFD_H_SEEN__ #define __BFD_H_SEEN__ Modified: stable/8/contrib/binutils/bfd/cpu-mips.c ============================================================================== --- stable/8/contrib/binutils/bfd/cpu-mips.c Wed Dec 7 23:20:14 2011 (r228336) +++ stable/8/contrib/binutils/bfd/cpu-mips.c Thu Dec 8 00:47:22 2011 (r228337) @@ -1,6 +1,6 @@ /* bfd back-end for mips support Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, - 2002, 2003 Free Software Foundation, Inc. + 2002, 2003, 2004 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -17,7 +17,7 @@ GNU General Public License for more deta You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "bfd.h" #include "sysdep.h" @@ -76,6 +76,7 @@ enum I_mips6000, I_mips7000, I_mips8000, + I_mips9000, I_mips10000, I_mips12000, I_mips16, @@ -84,6 +85,7 @@ enum I_mipsisa32r2, I_mipsisa64, I_mipsisa64r2, + I_mipsocteon, I_sb1, }; @@ -108,6 +110,7 @@ static const bfd_arch_info_type arch_inf N (32, 32, bfd_mach_mips6000, "mips:6000", FALSE, NN(I_mips6000)), N (64, 64, bfd_mach_mips7000, "mips:7000", FALSE, NN(I_mips7000)), N (64, 64, bfd_mach_mips8000, "mips:8000", FALSE, NN(I_mips8000)), + N (64, 64, bfd_mach_mips9000, "mips:9000", FALSE, NN(I_mips9000)), N (64, 64, bfd_mach_mips10000,"mips:10000", FALSE, NN(I_mips10000)), N (64, 64, bfd_mach_mips12000,"mips:12000", FALSE, NN(I_mips12000)), N (64, 64, bfd_mach_mips16, "mips:16", FALSE, NN(I_mips16)), @@ -116,6 +119,7 @@ static const bfd_arch_info_type arch_inf N (32, 32, bfd_mach_mipsisa32r2,"mips:isa32r2", FALSE, NN(I_mipsisa32r2)), N (64, 64, bfd_mach_mipsisa64, "mips:isa64", FALSE, NN(I_mipsisa64)), N (64, 64, bfd_mach_mipsisa64r2,"mips:isa64r2", FALSE, NN(I_mipsisa64r2)), + N (64, 64, bfd_mach_mips_octeon,"mips:octeon", FALSE, NN(I_mipsocteon)), N (64, 64, bfd_mach_mips_sb1, "mips:sb1", FALSE, 0), }; Modified: stable/8/contrib/binutils/bfd/elfxx-mips.c ============================================================================== --- stable/8/contrib/binutils/bfd/elfxx-mips.c Wed Dec 7 23:20:14 2011 (r228336) +++ stable/8/contrib/binutils/bfd/elfxx-mips.c Thu Dec 8 00:47:22 2011 (r228337) @@ -1,6 +1,6 @@ /* MIPS-specific support for ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Most of the information added by Ian Lance Taylor, Cygnus Support, . @@ -23,7 +23,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file handles functionality common to the different MIPS ABI's. */ @@ -4088,6 +4088,12 @@ _bfd_elf_mips_mach (flagword flags) case E_MIPS_MACH_5500: return bfd_mach_mips5500; + case E_MIPS_MACH_9000: + return bfd_mach_mips9000; + + case E_MIPS_MACH_OCTEON: + return bfd_mach_mips_octeon; + case E_MIPS_MACH_SB1: return bfd_mach_mips_sb1; @@ -7159,6 +7165,10 @@ mips_set_isa_flags (bfd *abfd) val = E_MIPS_ARCH_4 | E_MIPS_MACH_5500; break; + case bfd_mach_mips9000: + val = E_MIPS_ARCH_4 | E_MIPS_MACH_9000; + break; + case bfd_mach_mips5000: case bfd_mach_mips7000: case bfd_mach_mips8000: @@ -7171,6 +7181,10 @@ mips_set_isa_flags (bfd *abfd) val = E_MIPS_ARCH_5; break; + case bfd_mach_mips_octeon: + val = E_MIPS_ARCH_64R2 | E_MIPS_MACH_OCTEON; + break; + case bfd_mach_mips_sb1: val = E_MIPS_ARCH_64 | E_MIPS_MACH_SB1; break; @@ -8873,6 +8887,9 @@ struct mips_mach_extension { are ordered topologically with MIPS I extensions listed last. */ static const struct mips_mach_extension mips_mach_extensions[] = { + /* MIPS64r2 extensions. */ + { bfd_mach_mips_octeon, bfd_mach_mipsisa64r2 }, + /* MIPS64 extensions. */ { bfd_mach_mipsisa64r2, bfd_mach_mipsisa64 }, { bfd_mach_mips_sb1, bfd_mach_mipsisa64 }, @@ -8896,6 +8913,7 @@ static const struct mips_mach_extension { bfd_mach_mips10000, bfd_mach_mips8000 }, { bfd_mach_mips5000, bfd_mach_mips8000 }, { bfd_mach_mips7000, bfd_mach_mips8000 }, + { bfd_mach_mips9000, bfd_mach_mips8000 }, /* VR4100 extensions. */ { bfd_mach_mips4120, bfd_mach_mips4100 }, @@ -8930,11 +8948,26 @@ mips_mach_extends_p (unsigned long base, { size_t i; - for (i = 0; extension != base && i < ARRAY_SIZE (mips_mach_extensions); i++) + if (extension == base) + return TRUE; + + if (base == bfd_mach_mipsisa32 + && mips_mach_extends_p (bfd_mach_mipsisa64, extension)) + return TRUE; + + if (base == bfd_mach_mipsisa32r2 + && mips_mach_extends_p (bfd_mach_mipsisa64r2, extension)) + return TRUE; + + for (i = 0; i < ARRAY_SIZE (mips_mach_extensions); i++) if (extension == mips_mach_extensions[i].extension) - extension = mips_mach_extensions[i].base; + { + extension = mips_mach_extensions[i].base; + if (extension == base) + return TRUE; + } - return extension == base; + return FALSE; } Modified: stable/8/contrib/binutils/gas/config/tc-mips.c ============================================================================== --- stable/8/contrib/binutils/gas/config/tc-mips.c Wed Dec 7 23:20:14 2011 (r228336) +++ stable/8/contrib/binutils/gas/config/tc-mips.c Thu Dec 8 00:47:22 2011 (r228337) @@ -1,6 +1,6 @@ /* tc-mips.c -- assemble code for a MIPS chip. Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004 Free Software Foundation, Inc. + 2003, 2004, 2005 Free Software Foundation, Inc. Contributed by the OSF and Ralph Campbell. Written by Keith Knowles and Ralph Campbell, working independently. Modified for ECOFF and R4000 support by Ian Lance Taylor of Cygnus @@ -20,8 +20,8 @@ You should have received a copy of the GNU General Public License along with GAS; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA + 02110-1301, USA. */ #include "as.h" #include "config.h" @@ -33,6 +33,7 @@ #include "opcode/mips.h" #include "itbl-ops.h" #include "dwarf2dbg.h" +#include "dw2gencfi.h" #ifdef DEBUG #define DBG(x) printf x @@ -83,6 +84,25 @@ int mips_flag_pdr = FALSE; int mips_flag_pdr = TRUE; #endif +/* Control generation of error message for unsupported instructions in + Octeon. Octeon does not have floating point, and all the instructions + that use floating point registers are not allowed in Elf targets but + are allowed in Linux targets by default. */ +#ifdef OCTEON_ERROR_ON_UNSUPPORTED +static int octeon_error_on_unsupported = 1; +#else +static int octeon_error_on_unsupported = 0; +#endif + +/* Control generation of Octeon/MIPS unaligned load/store instructions. + For ELF target, default to Octeon load/store instructions. + For Linux target, default to MIPS load/store instructions. */ +#ifdef OCTEON_USE_UNALIGN +static int octeon_use_unalign = 1; +#else +static int octeon_use_unalign = 0; +#endif + #include "ecoff.h" #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) @@ -111,9 +131,7 @@ static char *mips_regmask_frag; extern int target_big_endian; /* The name of the readonly data section. */ -#define RDATA_SECTION_NAME (OUTPUT_FLAVOR == bfd_target_aout_flavour \ - ? ".data" \ - : OUTPUT_FLAVOR == bfd_target_ecoff_flavour \ +#define RDATA_SECTION_NAME (OUTPUT_FLAVOR == bfd_target_ecoff_flavour \ ? ".rdata" \ : OUTPUT_FLAVOR == bfd_target_coff_flavour \ ? ".rdata" \ @@ -121,6 +139,43 @@ extern int target_big_endian; ? ".rodata" \ : (abort (), "")) +/* Information about an instruction, including its format, operands + and fixups. */ +struct mips_cl_insn +{ + /* The opcode's entry in mips_opcodes or mips16_opcodes. */ + const struct mips_opcode *insn_mo; + + /* True if this is a mips16 instruction and if we want the extended + form of INSN_MO. */ + bfd_boolean use_extend; + + /* The 16-bit extension instruction to use when USE_EXTEND is true. */ + unsigned short extend; + + /* The 16-bit or 32-bit bitstring of the instruction itself. This is + a copy of INSN_MO->match with the operands filled in. */ + unsigned long insn_opcode; + + /* The frag that contains the instruction. */ + struct frag *frag; + + /* The offset into FRAG of the first instruction byte. */ + long where; + + /* The relocs associated with the instruction, if any. */ + fixS *fixp[3]; + + /* True if this entry cannot be moved from its current position. */ + unsigned int fixed_p : 1; + + /* True if this instruction occured in a .set noreorder block. */ + unsigned int noreorder_p : 1; + + /* True for mips16 instructions that jump to an absolute address. */ + unsigned int mips16_absolute_jump_p : 1; +}; + /* The ABI to use. */ enum mips_abi_level { @@ -138,6 +193,10 @@ static enum mips_abi_level mips_abi = NO /* Whether or not we have code that can call pic code. */ int mips_abicalls = FALSE; +/* Whether or not we have code which can be put into a shared + library. */ +static bfd_boolean mips_in_shared = TRUE; + /* This is the set of options which may be modified by the .set pseudo-op. We use a struct so that .set push and .set pop are more reliable. */ @@ -153,6 +212,8 @@ struct mips_set_options command line options, and based on the default architecture. */ int ase_mips3d; int ase_mdmx; + int ase_dsp; + int ase_mt; /* Whether we are assembling for the mips16 processor. 0 if we are not, 1 if we are, and -1 if the value has not been initialized. Changed by `.set mips16' and `.set nomips16', and the -mips16 and @@ -187,6 +248,8 @@ struct mips_set_options /* MIPS architecture (CPU) type. Changed by .set arch=FOO, the -march command line option, and the default CPU. */ int arch; + /* True if ".set sym32" is in effect. */ + bfd_boolean sym32; }; /* True if -mgp32 was passed. */ @@ -201,7 +264,7 @@ static int file_mips_fp32 = -1; static struct mips_set_options mips_opts = { - ISA_UNKNOWN, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, CPU_UNKNOWN + ISA_UNKNOWN, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, CPU_UNKNOWN, FALSE }; /* These variables are filled in with the masks of registers used. @@ -225,6 +288,14 @@ static int file_ase_mips3d; command line (e.g., by -march). */ static int file_ase_mdmx; +/* True if -mdsp was passed or implied by arguments passed on the + command line (e.g., by -march). */ +static int file_ase_dsp; + +/* True if -mmt was passed or implied by arguments passed on the + command line (e.g., by -march). */ +static int file_ase_mt; + /* The argument of the -march= flag. The architecture we are assembling. */ static int file_mips_arch = CPU_UNKNOWN; static const char *mips_arch_string; @@ -268,6 +339,12 @@ static int mips_32bitmode = 0; || (ISA) == ISA_MIPS64R2 \ ) +/* Return true if ISA supports ins instructions. */ +#define ISA_HAS_INS(ISA) ( \ + (ISA) == ISA_MIPS32R2 \ + || (ISA) == ISA_MIPS64R2 \ + ) + #define HAVE_32BIT_GPRS \ (mips_opts.gp32 || ! ISA_HAS_64BIT_REGS (mips_opts.isa)) @@ -284,15 +361,16 @@ static int mips_32bitmode = 0; /* True if relocations are stored in-place. */ #define HAVE_IN_PLACE_ADDENDS (!HAVE_NEWABI) -/* We can only have 64bit addresses if the object file format - supports it. */ -#define HAVE_32BIT_ADDRESSES \ - (HAVE_32BIT_GPRS \ - || ((bfd_arch_bits_per_address (stdoutput) == 32 \ - || ! HAVE_64BIT_OBJECTS) \ - && mips_pic != EMBEDDED_PIC)) - -#define HAVE_64BIT_ADDRESSES (! HAVE_32BIT_ADDRESSES) +/* The ABI-derived address size. */ +#define HAVE_64BIT_ADDRESSES \ + (HAVE_64BIT_GPRS && (mips_abi == EABI_ABI || mips_abi == N64_ABI)) +#define HAVE_32BIT_ADDRESSES (!HAVE_64BIT_ADDRESSES) + +/* The size of symbolic constants (i.e., expressions of the form + "SYMBOL" or "SYMBOL + OFFSET"). */ +#define HAVE_32BIT_SYMBOLS \ + (HAVE_32BIT_ADDRESSES || !HAVE_64BIT_OBJECTS || mips_opts.sym32) +#define HAVE_64BIT_SYMBOLS (!HAVE_32BIT_SYMBOLS) /* Addresses are loaded in different ways, depending on the address size in use. The n32 ABI Documentation also mandates the use of additions @@ -322,6 +400,14 @@ static int mips_32bitmode = 0; #define CPU_HAS_MDMX(cpu) (FALSE \ ) +/* Return true if the given CPU supports the DSP ASE. */ +#define CPU_HAS_DSP(cpu) (FALSE \ + ) + +/* Return true if the given CPU supports the MT ASE. */ +#define CPU_HAS_MT(cpu) (FALSE \ + ) + /* True if CPU has a dror instruction. */ #define CPU_HAS_DROR(CPU) ((CPU) == CPU_VR5400 || (CPU) == CPU_VR5500) @@ -349,7 +435,6 @@ static int mips_32bitmode = 0; || mips_opts.arch == CPU_R10000 \ || mips_opts.arch == CPU_R12000 \ || mips_opts.arch == CPU_RM7000 \ - || mips_opts.arch == CPU_SB1 \ || mips_opts.arch == CPU_VR5500 \ ) @@ -360,8 +445,6 @@ static int mips_32bitmode = 0; level I. */ #define gpr_interlocks \ (mips_opts.isa != ISA_MIPS1 \ - || mips_opts.arch == CPU_VR5400 \ - || mips_opts.arch == CPU_VR5500 \ || mips_opts.arch == CPU_R3900) /* Whether the processor uses hardware interlocks to avoid delays @@ -377,9 +460,6 @@ static int mips_32bitmode = 0; && mips_opts.isa != ISA_MIPS2 \ && mips_opts.isa != ISA_MIPS3) \ || mips_opts.arch == CPU_R4300 \ - || mips_opts.arch == CPU_VR5400 \ - || mips_opts.arch == CPU_VR5500 \ - || mips_opts.arch == CPU_SB1 \ ) /* Whether the processor uses hardware interlocks to protect reads @@ -521,44 +601,27 @@ static int mips_optimize = 2; equivalent to seeing no -g option at all. */ static int mips_debug = 0; -/* The previous instruction. */ -static struct mips_cl_insn prev_insn; - -/* The instruction before prev_insn. */ -static struct mips_cl_insn prev_prev_insn; +/* The maximum number of NOPs needed to avoid the VR4130 mflo/mfhi errata. */ +#define MAX_VR4130_NOPS 4 -/* If we don't want information for prev_insn or prev_prev_insn, we - point the insn_mo field at this dummy integer. */ -static const struct mips_opcode dummy_opcode = { NULL, NULL, 0, 0, 0, 0 }; +/* The maximum number of NOPs needed to fill delay slots. */ +#define MAX_DELAY_NOPS 2 -/* Non-zero if prev_insn is valid. */ -static int prev_insn_valid; +/* The maximum number of NOPs needed for any purpose. */ +#define MAX_NOPS 4 -/* The frag for the previous instruction. */ -static struct frag *prev_insn_frag; +/* A list of previous instructions, with index 0 being the most recent. + We need to look back MAX_NOPS instructions when filling delay slots + or working around processor errata. We need to look back one + instruction further if we're thinking about using history[0] to + fill a branch delay slot. */ +static struct mips_cl_insn history[1 + MAX_NOPS]; -/* The offset into prev_insn_frag for the previous instruction. */ -static long prev_insn_where; +/* Nop instructions used by emit_nop. */ +static struct mips_cl_insn nop_insn, mips16_nop_insn; -/* The reloc type for the previous instruction, if any. */ -static bfd_reloc_code_real_type prev_insn_reloc_type[3]; - -/* The reloc for the previous instruction, if any. */ -static fixS *prev_insn_fixp[3]; - -/* Non-zero if the previous instruction was in a delay slot. */ -static int prev_insn_is_delay_slot; - -/* Non-zero if the previous instruction was in a .set noreorder. */ -static int prev_insn_unreordered; - -/* Non-zero if the previous instruction uses an extend opcode (if - mips16). */ -static int prev_insn_extended; - -/* Non-zero if the previous previous instruction was in a .set - noreorder. */ -static int prev_prev_insn_unreordered; +/* The appropriate nop for the current mode. */ +#define NOP_INSN (mips_opts.mips16 ? &mips16_nop_insn : &nop_insn) /* If this is set, it points to a frag holding nop instructions which were inserted before the start of a noreorder section. If those @@ -625,8 +688,29 @@ static const unsigned int mips16_to_32_r 16, 17, 2, 3, 4, 5, 6, 7 }; +/* Classifies the kind of instructions we're interested in when + implementing -mfix-vr4120. */ +enum fix_vr4120_class { + FIX_VR4120_MACC, + FIX_VR4120_DMACC, + FIX_VR4120_MULT, + FIX_VR4120_DMULT, + FIX_VR4120_DIV, + FIX_VR4120_MTHILO, + NUM_FIX_VR4120_CLASSES +}; + +/* Given two FIX_VR4120_* values X and Y, bit Y of element X is set if + there must be at least one other instruction between an instruction + of type X and an instruction of type Y. */ +static unsigned int vr4120_conflicts[NUM_FIX_VR4120_CLASSES]; + +/* True if -mfix-vr4120 is in force. */ static int mips_fix_vr4120; +/* ...likewise -mfix-vr4130. */ +static int mips_fix_vr4130; + /* We don't relax branches by default, since this causes us to expand `la .l2 - .l1' if there's a branch between .l1 and .l2, because we fail to compute the offset before expanding the macro to the most @@ -820,6 +904,41 @@ static int mips_relax_branch; (((x) &~ (offsetT) 0x7fff) == 0 \ || (((x) &~ (offsetT) 0x7fff) == ~ (offsetT) 0x7fff)) +/* Is the given value a zero-extended 32-bit value? Or a negated one? */ +#define IS_ZEXT_32BIT_NUM(x) \ + (((x) &~ (offsetT) 0xffffffff) == 0 \ + || (((x) &~ (offsetT) 0xffffffff) == ~ (offsetT) 0xffffffff)) + +/* Replace bits MASK << SHIFT of STRUCT with the equivalent bits in + VALUE << SHIFT. VALUE is evaluated exactly once. */ +#define INSERT_BITS(STRUCT, VALUE, MASK, SHIFT) \ + (STRUCT) = (((STRUCT) & ~((MASK) << (SHIFT))) \ + | (((VALUE) & (MASK)) << (SHIFT))) + +/* Extract bits MASK << SHIFT from STRUCT and shift them right + SHIFT places. */ +#define EXTRACT_BITS(STRUCT, MASK, SHIFT) \ + (((STRUCT) >> (SHIFT)) & (MASK)) + +/* Change INSN's opcode so that the operand given by FIELD has value VALUE. + INSN is a mips_cl_insn structure and VALUE is evaluated exactly once. + + include/opcode/mips.h specifies operand fields using the macros + OP_MASK_ and OP_SH_. The MIPS16 equivalents start + with "MIPS16OP" instead of "OP". */ +#define INSERT_OPERAND(FIELD, INSN, VALUE) \ + INSERT_BITS ((INSN).insn_opcode, VALUE, OP_MASK_##FIELD, OP_SH_##FIELD) +#define MIPS16_INSERT_OPERAND(FIELD, INSN, VALUE) \ + INSERT_BITS ((INSN).insn_opcode, VALUE, \ + MIPS16OP_MASK_##FIELD, MIPS16OP_SH_##FIELD) + +/* Extract the operand given by FIELD from mips_cl_insn INSN. */ +#define EXTRACT_OPERAND(FIELD, INSN) \ + EXTRACT_BITS ((INSN).insn_opcode, OP_MASK_##FIELD, OP_SH_##FIELD) +#define MIPS16_EXTRACT_OPERAND(FIELD, INSN) \ + EXTRACT_BITS ((INSN).insn_opcode, \ + MIPS16OP_MASK_##FIELD, \ + MIPS16OP_SH_##FIELD) /* Global variables used when generating relaxable macros. See the comment above RELAX_ENCODE for more details about how relaxation @@ -866,7 +985,7 @@ enum mips_regclass { MIPS_GR_REG, MIPS_F static void append_insn (struct mips_cl_insn *ip, expressionS *p, bfd_reloc_code_real_type *r); -static void mips_no_prev_insn (int); +static void mips_no_prev_insn (void); static void mips16_macro_build (expressionS *, const char *, const char *, va_list); static void load_register (int, expressionS *, int); @@ -1092,8 +1211,6 @@ mips_target_format (void) { switch (OUTPUT_FLAVOR) { - case bfd_target_aout_flavour: - return target_big_endian ? "a.out-mips-big" : "a.out-mips-little"; case bfd_target_ecoff_flavour: return target_big_endian ? "ecoff-bigmips" : ECOFF_LITTLE_FORMAT; case bfd_target_coff_flavour: @@ -1127,6 +1244,174 @@ mips_target_format (void) } } +/* Return the length of instruction INSN. */ + +static inline unsigned int +insn_length (const struct mips_cl_insn *insn) +{ + if (!mips_opts.mips16) + return 4; + return insn->mips16_absolute_jump_p || insn->use_extend ? 4 : 2; +} + +/* Initialise INSN from opcode entry MO. Leave its position unspecified. */ + +static void +create_insn (struct mips_cl_insn *insn, const struct mips_opcode *mo) +{ + size_t i; + + insn->insn_mo = mo; + insn->use_extend = FALSE; + insn->extend = 0; + insn->insn_opcode = mo->match; + insn->frag = NULL; + insn->where = 0; + for (i = 0; i < ARRAY_SIZE (insn->fixp); i++) + insn->fixp[i] = NULL; + insn->fixed_p = (mips_opts.noreorder > 0); + insn->noreorder_p = (mips_opts.noreorder > 0); + insn->mips16_absolute_jump_p = 0; +} + +/* Install INSN at the location specified by its "frag" and "where" fields. */ + +static void +install_insn (const struct mips_cl_insn *insn) +{ + char *f = insn->frag->fr_literal + insn->where; + if (!mips_opts.mips16) + md_number_to_chars (f, insn->insn_opcode, 4); + else if (insn->mips16_absolute_jump_p) + { + md_number_to_chars (f, insn->insn_opcode >> 16, 2); + md_number_to_chars (f + 2, insn->insn_opcode & 0xffff, 2); + } + else + { + if (insn->use_extend) + { + md_number_to_chars (f, 0xf000 | insn->extend, 2); + f += 2; + } + md_number_to_chars (f, insn->insn_opcode, 2); + } +} + +/* Move INSN to offset WHERE in FRAG. Adjust the fixups accordingly + and install the opcode in the new location. */ + +static void +move_insn (struct mips_cl_insn *insn, fragS *frag, long where) +{ + size_t i; + + insn->frag = frag; + insn->where = where; + for (i = 0; i < ARRAY_SIZE (insn->fixp); i++) + if (insn->fixp[i] != NULL) + { + insn->fixp[i]->fx_frag = frag; + insn->fixp[i]->fx_where = where; + } + install_insn (insn); +} + +/* Add INSN to the end of the output. */ + +static void +add_fixed_insn (struct mips_cl_insn *insn) +{ + char *f = frag_more (insn_length (insn)); + move_insn (insn, frag_now, f - frag_now->fr_literal); +} + +/* Start a variant frag and move INSN to the start of the variant part, + marking it as fixed. The other arguments are as for frag_var. */ + +static void +add_relaxed_insn (struct mips_cl_insn *insn, int max_chars, int var, + relax_substateT subtype, symbolS *symbol, offsetT offset) +{ + frag_grow (max_chars); + move_insn (insn, frag_now, frag_more (0) - frag_now->fr_literal); + insn->fixed_p = 1; + frag_var (rs_machine_dependent, max_chars, var, + subtype, symbol, offset, NULL); +} + +/* Insert N copies of INSN into the history buffer, starting at + position FIRST. Neither FIRST nor N need to be clipped. */ + +static void +insert_into_history (unsigned int first, unsigned int n, + const struct mips_cl_insn *insn) +{ + if (mips_relax.sequence != 2) + { + unsigned int i; + + for (i = ARRAY_SIZE (history); i-- > first;) + if (i >= first + n) + history[i] = history[i - n]; + else + history[i] = *insn; + } +} + +/* Emit a nop instruction, recording it in the history buffer. */ + +static void +emit_nop (void) +{ + add_fixed_insn (NOP_INSN); + insert_into_history (0, 1, NOP_INSN); +} + +/* Initialize vr4120_conflicts. There is a bit of duplication here: + the idea is to make it obvious at a glance that each errata is + included. */ + +static void +init_vr4120_conflicts (void) +{ +#define CONFLICT(FIRST, SECOND) \ + vr4120_conflicts[FIX_VR4120_##FIRST] |= 1 << FIX_VR4120_##SECOND + + /* Errata 21 - [D]DIV[U] after [D]MACC */ + CONFLICT (MACC, DIV); + CONFLICT (DMACC, DIV); + + /* Errata 23 - Continuous DMULT[U]/DMACC instructions. */ + CONFLICT (DMULT, DMULT); + CONFLICT (DMULT, DMACC); + CONFLICT (DMACC, DMULT); + CONFLICT (DMACC, DMACC); + + /* Errata 24 - MT{LO,HI} after [D]MACC */ + CONFLICT (MACC, MTHILO); + CONFLICT (DMACC, MTHILO); + + /* VR4181A errata MD(1): "If a MULT, MULTU, DMULT or DMULTU + instruction is executed immediately after a MACC or DMACC + instruction, the result of [either instruction] is incorrect." */ + CONFLICT (MACC, MULT); + CONFLICT (MACC, DMULT); + CONFLICT (DMACC, MULT); + CONFLICT (DMACC, DMULT); + + /* VR4181A errata MD(4): "If a MACC or DMACC instruction is + executed immediately after a DMULT, DMULTU, DIV, DIVU, + DDIV or DDIVU instruction, the result of the MACC or + DMACC instruction is incorrect.". */ + CONFLICT (DMULT, MACC); + CONFLICT (DMULT, DMACC); + CONFLICT (DIV, MACC); + CONFLICT (DIV, DMACC); + +#undef CONFLICT +} + /* This function is called once, at assembler startup time. It should set up all the tables, etc. that the MD part of the assembler will need. */ @@ -1137,6 +1422,13 @@ md_begin (void) int i = 0; int broken = 0; + if (mips_pic != NO_PIC) + { + if (g_switch_seen && g_switch_value != 0) + as_bad (_("-G may not be used in position-independent code")); + g_switch_value = 0; + } + if (! bfd_set_arch_mach (stdoutput, bfd_arch_mips, file_mips_arch)) as_warn (_("Could not set architecture and machine")); @@ -1160,6 +1452,11 @@ md_begin (void) { if (!validate_mips_insn (&mips_opcodes[i])) broken = 1; + if (nop_insn.insn_mo == NULL && strcmp (name, "nop") == 0) + { + create_insn (&nop_insn, mips_opcodes + i); + nop_insn.fixed_p = 1; + } } ++i; } @@ -1187,6 +1484,11 @@ md_begin (void) mips16_opcodes[i].name, mips16_opcodes[i].args); broken = 1; } + if (mips16_nop_insn.insn_mo == NULL && strcmp (name, "nop") == 0) + { + create_insn (&mips16_nop_insn, mips16_opcodes + i); + mips16_nop_insn.fixed_p = 1; + } ++i; } while (i < bfd_mips16_num_opcodes @@ -1239,7 +1541,7 @@ md_begin (void) &zero_address_frag)); } - mips_no_prev_insn (FALSE); + mips_no_prev_insn (); mips_gprmask = 0; mips_cprmask[0] = 0; @@ -1250,15 +1552,15 @@ md_begin (void) /* set the default alignment for the text section (2**2) */ record_alignment (text_section, 2); - if (USE_GLOBAL_POINTER_OPT) - bfd_set_gp_size (stdoutput, g_switch_value); + bfd_set_gp_size (stdoutput, g_switch_value); if (OUTPUT_FLAVOR == bfd_target_elf_flavour) { /* On a native system, sections must be aligned to 16 byte - boundaries. When configured for an embedded ELF target, we + boundaries. When configured for an embedded ELF target, we don't bother. */ - if (strcmp (TARGET_OS, "elf") != 0) + if (strcmp (TARGET_OS, "elf") != 0 + && strcmp (TARGET_OS, "vxworks") != 0) { (void) bfd_set_section_alignment (stdoutput, text_section, 4); (void) bfd_set_section_alignment (stdoutput, data_section, 4); @@ -1346,6 +1648,9 @@ md_begin (void) if (! ECOFF_DEBUGGING) md_obj_begin (); + + if (mips_fix_vr4120) + init_vr4120_conflicts (); } void @@ -1408,8 +1713,8 @@ md_assemble (char *str) } /* Return true if the given relocation might need a matching %lo(). - Note that R_MIPS_GOT16 relocations only need a matching %lo() when - applied to local symbols. */ + This is only "might" because SVR4 R_MIPS_GOT16 relocations only + need a matching %lo() when applied to local symbols. */ static inline bfd_boolean reloc_needs_lo_p (bfd_reloc_code_real_type reloc) @@ -1434,7 +1739,7 @@ fixup_has_matching_lo_p (fixS *fixp) of register. */ static int -insn_uses_reg (struct mips_cl_insn *ip, unsigned int reg, +insn_uses_reg (const struct mips_cl_insn *ip, unsigned int reg, enum mips_regclass class) { if (class == MIPS16_REG) @@ -1459,38 +1764,33 @@ insn_uses_reg (struct mips_cl_insn *ip, because there is no instruction that sets both $f0 and $f1 and requires a delay. */ if ((ip->insn_mo->pinfo & INSN_READ_FPR_S) - && ((((ip->insn_opcode >> OP_SH_FS) & OP_MASK_FS) &~(unsigned)1) + && ((EXTRACT_OPERAND (FS, *ip) & ~(unsigned) 1) == (reg &~ (unsigned) 1))) return 1; if ((ip->insn_mo->pinfo & INSN_READ_FPR_T) - && ((((ip->insn_opcode >> OP_SH_FT) & OP_MASK_FT) &~(unsigned)1) + && ((EXTRACT_OPERAND (FT, *ip) & ~(unsigned) 1) == (reg &~ (unsigned) 1))) return 1; } else if (! mips_opts.mips16) { if ((ip->insn_mo->pinfo & INSN_READ_GPR_S) - && ((ip->insn_opcode >> OP_SH_RS) & OP_MASK_RS) == reg) + && EXTRACT_OPERAND (RS, *ip) == reg) return 1; if ((ip->insn_mo->pinfo & INSN_READ_GPR_T) - && ((ip->insn_opcode >> OP_SH_RT) & OP_MASK_RT) == reg) + && EXTRACT_OPERAND (RT, *ip) == reg) return 1; } else { if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_X) - && (mips16_to_32_reg_map[((ip->insn_opcode >> MIPS16OP_SH_RX) - & MIPS16OP_MASK_RX)] - == reg)) + && mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (RX, *ip)] == reg) return 1; if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_Y) - && (mips16_to_32_reg_map[((ip->insn_opcode >> MIPS16OP_SH_RY) - & MIPS16OP_MASK_RY)] - == reg)) + && mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (RY, *ip)] == reg) return 1; if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_Z) - && (mips16_to_32_reg_map[((ip->insn_opcode >> MIPS16OP_SH_MOVE32Z) - & MIPS16OP_MASK_MOVE32Z)] + && (mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (MOVE32Z, *ip)] == reg)) return 1; if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_T) && reg == TREG) @@ -1500,8 +1800,7 @@ insn_uses_reg (struct mips_cl_insn *ip, if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_31) && reg == RA) return 1; if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_GPR_X) - && ((ip->insn_opcode >> MIPS16OP_SH_REGR32) - & MIPS16OP_MASK_REGR32) == reg) + && MIPS16_EXTRACT_OPERAND (REGR32, *ip) == reg) return 1; } @@ -1516,7 +1815,7 @@ reg_needs_delay (unsigned int reg) { unsigned long prev_pinfo; - prev_pinfo = prev_insn.insn_mo->pinfo; + prev_pinfo = history[0].insn_mo->pinfo; if (! mips_opts.noreorder && (((prev_pinfo & INSN_LOAD_MEMORY_DELAY) && ! gpr_interlocks) @@ -1527,13 +1826,33 @@ reg_needs_delay (unsigned int reg) delay the use of general register rt for one instruction. */ /* Itbl support may require additional care here. */ know (prev_pinfo & INSN_WRITE_GPR_T); - if (reg == ((prev_insn.insn_opcode >> OP_SH_RT) & OP_MASK_RT)) + if (reg == EXTRACT_OPERAND (RT, history[0])) return 1; } return 0; } +/* Move all labels in insn_labels to the current insertion point. */ + +static void +mips_move_labels (void) +{ + struct insn_label_list *l; + valueT val; + + for (l = insn_labels; l != NULL; l = l->next) + { + assert (S_GET_SEGMENT (l->label) == now_seg); + symbol_set_frag (l->label, frag_now); + val = (valueT) frag_now_fix (); + /* mips16 text labels are stored as odd. */ + if (mips_opts.mips16) + ++val; + S_SET_VALUE (l->label, val); + } +} + /* Mark instruction labels in mips16 mode. This permits the linker to handle them specially, such as generating jalx instructions when needed. We also make them odd for the duration of the assembly, in @@ -1609,6 +1928,273 @@ relax_end (void) mips_relax.sequence = 0; } +/* Classify an instruction according to the FIX_VR4120_* enumeration. + Return NUM_FIX_VR4120_CLASSES if the instruction isn't affected + by VR4120 errata. */ + +static unsigned int +classify_vr4120_insn (const char *name) +{ + if (strncmp (name, "macc", 4) == 0) + return FIX_VR4120_MACC; + if (strncmp (name, "dmacc", 5) == 0) + return FIX_VR4120_DMACC; + if (strncmp (name, "mult", 4) == 0) + return FIX_VR4120_MULT; + if (strncmp (name, "dmult", 5) == 0) + return FIX_VR4120_DMULT; + if (strstr (name, "div")) + return FIX_VR4120_DIV; + if (strcmp (name, "mtlo") == 0 || strcmp (name, "mthi") == 0) + return FIX_VR4120_MTHILO; + return NUM_FIX_VR4120_CLASSES; +} + +/* Return the number of instructions that must separate INSN1 and INSN2, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 00:48:06 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A14141065675; Thu, 8 Dec 2011 00:48:06 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9057F8FC1D; Thu, 8 Dec 2011 00:48:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB80m6xc063097; Thu, 8 Dec 2011 00:48:06 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB80m6OQ063095; Thu, 8 Dec 2011 00:48:06 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201112080048.pB80m6OQ063095@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Thu, 8 Dec 2011 00:48:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228338 - stable/8/sys/mips/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 00:48:06 -0000 Author: gonzo Date: Thu Dec 8 00:48:06 2011 New Revision: 228338 URL: http://svn.freebsd.org/changeset/base/228338 Log: Unbreak MALTA64 build by providing proper ldscript name Modified: stable/8/sys/mips/conf/MALTA64 Modified: stable/8/sys/mips/conf/MALTA64 ============================================================================== --- stable/8/sys/mips/conf/MALTA64 Thu Dec 8 00:47:22 2011 (r228337) +++ stable/8/sys/mips/conf/MALTA64 Thu Dec 8 00:48:06 2011 (r228338) @@ -21,7 +21,7 @@ ident MALTA makeoptions ARCH_FLAGS="-march=mips64 -mabi=64" makeoptions MIPS_LITTLE_ENDIAN=defined -makeoptions LDSCRIPT_NAME= ldscript.mips.mips64 +makeoptions LDSCRIPT_NAME= ldscript.mips.64 options YAMON From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 00:48:47 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 988581065673; Thu, 8 Dec 2011 00:48:47 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 879EC8FC12; Thu, 8 Dec 2011 00:48:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB80mlL4063152; Thu, 8 Dec 2011 00:48:47 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB80mlia063150; Thu, 8 Dec 2011 00:48:47 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201112080048.pB80mlia063150@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Thu, 8 Dec 2011 00:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228339 - stable/8/sys/mips/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 00:48:47 -0000 Author: gonzo Date: Thu Dec 8 00:48:47 2011 New Revision: 228339 URL: http://svn.freebsd.org/changeset/base/228339 Log: Add -march=octeon optoin for building OCTEON1-32 kernel Modified: stable/8/sys/mips/conf/OCTEON1-32 Modified: stable/8/sys/mips/conf/OCTEON1-32 ============================================================================== --- stable/8/sys/mips/conf/OCTEON1-32 Thu Dec 8 00:48:06 2011 (r228338) +++ stable/8/sys/mips/conf/OCTEON1-32 Thu Dec 8 00:48:47 2011 (r228339) @@ -24,7 +24,7 @@ ident OCTEON1 # Don't build any modules yet. makeoptions MODULES_OVERRIDE="" makeoptions TARGET_BIG_ENDIAN=defined -#makeoptions ARCH_FLAGS="-march=octeon" +makeoptions ARCH_FLAGS="-march=octeon" makeoptions LDSCRIPT_NAME=ldscript.mips.octeon1.32 makeoptions KERNLOADADDR=0x81000000 From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 00:50:15 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06EFE106564A; Thu, 8 Dec 2011 00:50:15 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E13568FC12; Thu, 8 Dec 2011 00:50:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB80oEqi063238; Thu, 8 Dec 2011 00:50:14 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB80oEQ4063236; Thu, 8 Dec 2011 00:50:14 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201112080050.pB80oEQ4063236@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Thu, 8 Dec 2011 00:50:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228340 - stable/8/sys/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 00:50:15 -0000 Author: gonzo Date: Thu Dec 8 00:50:14 2011 New Revision: 228340 URL: http://svn.freebsd.org/changeset/base/228340 Log: Add ldscripts for OCTEON1 and OCTEON1-32 Added: - copied unchanged from r215938, head/sys/conf/ldscript.mips.octeon1.32 - copied unchanged from r215938, head/sys/conf/ldscript.mips.octeon1.64 Directory Properties: stable/8/sys/conf/ldscript.mips.octeon1.32 (props changed) stable/8/sys/conf/ldscript.mips.octeon1.64 (props changed) Copied: stable/8/sys/conf/ldscript.mips.octeon1.32 (from r215938, head/sys/conf/ldscript.mips.octeon1.32) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/conf/ldscript.mips.octeon1.32 Thu Dec 8 00:50:14 2011 (r228340, copy of r215938, head/sys/conf/ldscript.mips.octeon1.32) @@ -0,0 +1,60 @@ +/* $FreeBSD$ */ + +TARGET(elf32-tradbigmips) +OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", "elf32-tradlittlemips") +OUTPUT_ARCH(mips) +ENTRY(_start) + __DYNAMIC = 0; +PROVIDE (_DYNAMIC = 0); + +SECTIONS { + . = KERNLOADADDR + SIZEOF_HEADERS; + + .text . : { + *(.text) + *(.dynamic) + etext = .; + _etext = .; + . = ALIGN(0x2000); + } + + .rodata ALIGN(0x2000) : { + _fdata = .; + *(.rodata) + . = ALIGN(32); + } + + .data . : { + _rwdata = .; + *(.data) + . = ALIGN(32); + CONSTRUCTORS; + } + + _gp = (. + 0x8000); + + .sdata . : { + _small_start = .; + *(.sdata) + . = ALIGN(32); + edata = .; + _edata = .; + } + + .sbss . : { + __bss_start = .; + _fbss = .; + *(.sbss) *(.scommon) + _small_end = .; + . = ALIGN(32); + } + + .bss . : { + *(.bss) + *(COMMON) + . = ALIGN(32); + _end = .; + end = .; + } + +} Copied: stable/8/sys/conf/ldscript.mips.octeon1.64 (from r215938, head/sys/conf/ldscript.mips.octeon1.64) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/conf/ldscript.mips.octeon1.64 Thu Dec 8 00:50:14 2011 (r228340, copy of r215938, head/sys/conf/ldscript.mips.octeon1.64) @@ -0,0 +1,65 @@ +/* $FreeBSD$ */ + +TARGET(elf64-tradbigmips) +OUTPUT_FORMAT("elf64-tradbigmips", "elf64-tradbigmips", "elf64-tradlittlemips") +OUTPUT_ARCH(mips) +ENTRY(_start) + __DYNAMIC = 0; +PROVIDE (_DYNAMIC = 0); + +PHDRS { + text PT_LOAD FLAGS(0x7); +} + +SECTIONS { + . = KERNLOADADDR + SIZEOF_HEADERS; + + .text : { + *(.text) + *(.dynamic) + etext = .; + _etext = .; + . = ALIGN(0x2000); + } : text + + . = ALIGN(0x2000); + .rodata : { + _fdata = .; + *(.rodata) + . = ALIGN(32); + } + + .data : { + _rwdata = .; + *(.data) + . = ALIGN(32); + CONSTRUCTORS; + } + + _gp = (. + 0x8000); + + .sdata : { + _small_start = .; + *(.sdata) + . = ALIGN(32); + edata = .; + _edata = .; + } : text + + .sbss : { + __bss_start = .; + _fbss = .; + *(.sbss) *(.scommon) + _small_end = .; + . = ALIGN(32); + } + + .bss : { + *(.bss) + *(COMMON) + . = ALIGN(32); + _end = .; + end = .; + } + +} From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 00:56:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F42A106564A; Thu, 8 Dec 2011 00:56:24 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3E63F8FC0C; Thu, 8 Dec 2011 00:56:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB80uOhw063466; Thu, 8 Dec 2011 00:56:24 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB80uOb1063464; Thu, 8 Dec 2011 00:56:24 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201112080056.pB80uOb1063464@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Thu, 8 Dec 2011 00:56:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228341 - stable/8/sys/dev/ic X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 00:56:24 -0000 Author: gonzo Date: Thu Dec 8 00:56:23 2011 New Revision: 228341 URL: http://svn.freebsd.org/changeset/base/228341 Log: MFS r202062: Defintions for cavium uart MFC after: 23 months Modified: stable/8/sys/dev/ic/ns16550.h Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/ic/ns16550.h ============================================================================== --- stable/8/sys/dev/ic/ns16550.h Thu Dec 8 00:50:14 2011 (r228340) +++ stable/8/sys/dev/ic/ns16550.h Thu Dec 8 00:56:23 2011 (r228341) @@ -52,6 +52,7 @@ #define REG_IIR com_iir #define IIR_IMASK 0xf #define IIR_RXTOUT 0xc +#define IIR_BUSY 0x7 #define IIR_RLS 0x6 #define IIR_RXRDY 0x4 #define IIR_TXRDY 0x2 @@ -181,6 +182,10 @@ #define com_xoff1 6 /* XOFF 1 character (R/W) */ #define com_xoff2 7 /* XOFF 2 character (R/W) */ +#define com_usr 39 /* Octeon 16750/16550 Uart Status Reg */ +#define REG_USR com_usr +#define USR_TXFIFO_NOTFULL 2 /* Uart TX FIFO Not full */ + /* 16950 register #1. Access enabled by ACR[7]. Also requires !LCR[7]. */ #define com_asr 1 /* additional status register (R[0-7]/W[0-1]) */ From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 02:40:46 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66DEB106564A; Thu, 8 Dec 2011 02:40:46 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 565878FC0C; Thu, 8 Dec 2011 02:40:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB82ekIL066641; Thu, 8 Dec 2011 02:40:46 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB82ek4Q066638; Thu, 8 Dec 2011 02:40:46 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201112080240.pB82ek4Q066638@svn.freebsd.org> From: Eitan Adler Date: Thu, 8 Dec 2011 02:40:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228342 - head/contrib/tzcode/zic X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 02:40:46 -0000 Author: eadler (ports committer) Date: Thu Dec 8 02:40:46 2011 New Revision: 228342 URL: http://svn.freebsd.org/changeset/base/228342 Log: - set progname for use in usage() PR: bin/162908 Submitted by: Oleg Ginzburg Approved by: sbruno@ MFC after: 3 days Modified: head/contrib/tzcode/zic/zdump.c Modified: head/contrib/tzcode/zic/zdump.c ============================================================================== --- head/contrib/tzcode/zic/zdump.c Thu Dec 8 00:56:23 2011 (r228341) +++ head/contrib/tzcode/zic/zdump.c Thu Dec 8 02:40:46 2011 (r228342) @@ -260,6 +260,7 @@ char * argv[]; register struct tm * tmp; register struct tm * newtmp; + progname=argv[0]; INITIALIZE(cutlotime); INITIALIZE(cuthitime); #if HAVE_GETTEXT From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 03:20:39 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56ABA1065672; Thu, 8 Dec 2011 03:20:39 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 468058FC0C; Thu, 8 Dec 2011 03:20:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB83KdeA068177; Thu, 8 Dec 2011 03:20:39 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB83KdkV068175; Thu, 8 Dec 2011 03:20:39 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201112080320.pB83KdkV068175@svn.freebsd.org> From: Eitan Adler Date: Thu, 8 Dec 2011 03:20:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228343 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 03:20:39 -0000 Author: eadler (ports committer) Date: Thu Dec 8 03:20:38 2011 New Revision: 228343 URL: http://svn.freebsd.org/changeset/base/228343 Log: - Fix ktrace leakage if error is set PR: kern/163098 Submitted by: Loganaden Velvindron Approved by: sbruno@ MFC after: 1 month Modified: head/sys/kern/kern_ktrace.c Modified: head/sys/kern/kern_ktrace.c ============================================================================== --- head/sys/kern/kern_ktrace.c Thu Dec 8 02:40:46 2011 (r228342) +++ head/sys/kern/kern_ktrace.c Thu Dec 8 03:20:38 2011 (r228343) @@ -478,7 +478,7 @@ ktrsysret(code, error, retval) ktp = &req->ktr_data.ktr_sysret; ktp->ktr_code = code; ktp->ktr_error = error; - ktp->ktr_retval = retval; /* what about val2 ? */ + ktp->ktr_retval = ((error == 0) ? retval: 0); /* what about val2 ? */ ktr_submitrequest(curthread, req); } From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 03:20:48 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6896A106564A; Thu, 8 Dec 2011 03:20:48 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5859A8FC15; Thu, 8 Dec 2011 03:20:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB83Kmsw068220; Thu, 8 Dec 2011 03:20:48 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB83KmCO068218; Thu, 8 Dec 2011 03:20:48 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201112080320.pB83KmCO068218@svn.freebsd.org> From: Eitan Adler Date: Thu, 8 Dec 2011 03:20:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228344 - head/sys/cam/scsi X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 03:20:48 -0000 Author: eadler (ports committer) Date: Thu Dec 8 03:20:48 2011 New Revision: 228344 URL: http://svn.freebsd.org/changeset/base/228344 Log: - Add support for Support SEAGATE DAT Scopion 130 PR: kern/141934 Submitted by: HASHI Hiroaki Approved by: sbruno@ MFC after: 1 week Modified: head/sys/cam/scsi/scsi_sa.c Modified: head/sys/cam/scsi/scsi_sa.c ============================================================================== --- head/sys/cam/scsi/scsi_sa.c Thu Dec 8 03:20:38 2011 (r228343) +++ head/sys/cam/scsi/scsi_sa.c Thu Dec 8 03:20:48 2011 (r228344) @@ -334,6 +334,10 @@ static struct sa_quirk_entry sa_quirk_ta "STT20000*", "*"}, SA_QUIRK_1FM, 0 }, { + { T_SEQUENTIAL, SIP_MEDIA_REMOVABLE, "SEAGATE", + "DAT 06241-XXX", "*"}, SA_QUIRK_VARIABLE|SA_QUIRK_2FM, 0 + }, + { { T_SEQUENTIAL, SIP_MEDIA_REMOVABLE, "TANDBERG", " TDC 3600", "U07:"}, SA_QUIRK_NOCOMP|SA_QUIRK_1FM, 512 }, From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 07:33:10 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE9571065672; Thu, 8 Dec 2011 07:33:10 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id 91CAA8FC0A; Thu, 8 Dec 2011 07:33:10 +0000 (UTC) Received: from localhost (58.wheelsystems.com [83.12.187.58]) by mail.dawidek.net (Postfix) with ESMTPSA id 5841C74C; Thu, 8 Dec 2011 08:33:09 +0100 (CET) Date: Thu, 8 Dec 2011 08:32:10 +0100 From: Pawel Jakub Dawidek To: Eitan Adler Message-ID: <20111208073210.GC1678@garage.freebsd.pl> References: <201112080240.pB82ek4Q066638@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WplhKdTI2c8ulnbP" Content-Disposition: inline In-Reply-To: <201112080240.pB82ek4Q066638@svn.freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r228342 - head/contrib/tzcode/zic X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 07:33:11 -0000 --WplhKdTI2c8ulnbP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 08, 2011 at 02:40:46AM +0000, Eitan Adler wrote: > Author: eadler (ports committer) > Date: Thu Dec 8 02:40:46 2011 > New Revision: 228342 > URL: http://svn.freebsd.org/changeset/base/228342 >=20 > Log: > - set progname for use in usage() > =20 > PR: bin/162908 > Submitted by: Oleg Ginzburg > Approved by: sbruno@ > MFC after: 3 days >=20 > Modified: > head/contrib/tzcode/zic/zdump.c >=20 > Modified: head/contrib/tzcode/zic/zdump.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/contrib/tzcode/zic/zdump.c Thu Dec 8 00:56:23 2011 (r228341) > +++ head/contrib/tzcode/zic/zdump.c Thu Dec 8 02:40:46 2011 (r228342) > @@ -260,6 +260,7 @@ char * argv[]; > register struct tm * tmp; > register struct tm * newtmp; > =20 > + progname=3Dargv[0]; > INITIALIZE(cutlotime); > INITIALIZE(cuthitime); > #if HAVE_GETTEXT It will good to to try to upstream it as this is contributed code. This change doesn't seem to be consistent with the style of this file. They use spaces around =3D. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --WplhKdTI2c8ulnbP Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk7gZ/oACgkQForvXbEpPzRjswCeOZA0Gpw/p36FXaY0MV7aLz58 X8cAoO/iWsc+o5QPAchS4V0b2figXRy7 =Bh37 -----END PGP SIGNATURE----- --WplhKdTI2c8ulnbP-- From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 09:21:31 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A364E106566B; Thu, 8 Dec 2011 09:21:31 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7AC178FC14; Thu, 8 Dec 2011 09:21:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB89LV0K079124; Thu, 8 Dec 2011 09:21:31 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB89LV6I079123; Thu, 8 Dec 2011 09:21:31 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201112080921.pB89LV6I079123@svn.freebsd.org> From: Ruslan Ermilov Date: Thu, 8 Dec 2011 09:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228347 - vendor/one-true-awk/20110810 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 09:21:31 -0000 Author: ru Date: Thu Dec 8 09:21:30 2011 New Revision: 228347 URL: http://svn.freebsd.org/changeset/base/228347 Log: Belatedly tag a 20110810 release. Added: vendor/one-true-awk/20110810/ - copied from r228346, vendor/one-true-awk/dist/ From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 10:42:38 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 970771065670; Thu, 8 Dec 2011 10:42:38 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 854EC8FC12; Thu, 8 Dec 2011 10:42:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB8AgcOZ081797; Thu, 8 Dec 2011 10:42:38 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB8Agcfg081785; Thu, 8 Dec 2011 10:42:38 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201112081042.pB8Agcfg081785@svn.freebsd.org> From: Ruslan Ermilov Date: Thu, 8 Dec 2011 10:42:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228348 - stable/8/contrib/one-true-awk X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 10:42:38 -0000 Author: ru Date: Thu Dec 8 10:42:38 2011 New Revision: 228348 URL: http://svn.freebsd.org/changeset/base/228348 Log: Update to a 10-Aug-2011 release. Deleted: stable/8/contrib/one-true-awk/proctab.c Modified: stable/8/contrib/one-true-awk/FIXES stable/8/contrib/one-true-awk/README stable/8/contrib/one-true-awk/awkgram.y stable/8/contrib/one-true-awk/b.c stable/8/contrib/one-true-awk/lex.c stable/8/contrib/one-true-awk/lib.c stable/8/contrib/one-true-awk/main.c stable/8/contrib/one-true-awk/makefile stable/8/contrib/one-true-awk/proto.h stable/8/contrib/one-true-awk/run.c stable/8/contrib/one-true-awk/tran.c Directory Properties: stable/8/contrib/one-true-awk/ (props changed) Modified: stable/8/contrib/one-true-awk/FIXES ============================================================================== --- stable/8/contrib/one-true-awk/FIXES Thu Dec 8 09:21:30 2011 (r228347) +++ stable/8/contrib/one-true-awk/FIXES Thu Dec 8 10:42:38 2011 (r228348) @@ -25,6 +25,59 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +Aug 10, 2011: + another fix to avoid core dump with delete(ARGV); again, many thanks + to ruslan ermilov. + +Aug 7, 2011: + split(s, a, //) now behaves the same as split(s, a, "") + +Jun 12, 2011: + /pat/, \n /pat/ {...} is now legal, though bad style to use. + + added checks to new -v code that permits -vnospace; thanks to + ruslan ermilov for spotting this and providing the patch. + + removed fixed limit on number of open files; thanks to aleksey + cheusov and christos zoulos. + + fixed day 1 bug that resurrected deleted elements of ARGV when + used as filenames (in lib.c). + + minor type fiddles to make gcc -Wall -pedantic happier (but not + totally so); turned on -fno-strict-aliasing in makefile. + +May 6, 2011: + added #ifdef for isblank. + now allows -ffoo as well as -f foo arguments. + (thanks, ruslan) + +May 1, 2011: + after advice from todd miller, kevin lo, ruslan ermilov, + and arnold robbins, changed srand() to return the previous + seed (which is 1 on the first call of srand). the seed is + an Awkfloat internally though converted to unsigned int to + pass to the library srand(). thanks, everyone. + + fixed a subtle (and i hope low-probability) overflow error + in fldbld, by adding space for one extra \0. thanks to + robert bassett for spotting this one and providing a fix. + + removed the files related to compilation on windows. i no + longer have anything like a current windows environment, so + i can't test any of it. + +May 23, 2010: + fixed long-standing overflow bug in run.c; many thanks to + nelson beebe for spotting it and providing the fix. + + fixed bug that didn't parse -vd=1 properly; thanks to santiago + vila for spotting it. + +Feb 8, 2010: + i give up. replaced isblank with isspace in b.c; there are + no consistent header files. + Nov 26, 2009: fixed a long-standing issue with when FS takes effect. a change to FS is now noticed immediately for subsequent splits. Modified: stable/8/contrib/one-true-awk/README ============================================================================== --- stable/8/contrib/one-true-awk/README Thu Dec 8 09:21:30 2011 (r228347) +++ stable/8/contrib/one-true-awk/README Thu Dec 8 10:42:38 2011 (r228348) @@ -29,7 +29,7 @@ by Al Aho, Brian Kernighan, and Peter We Changes, mostly bug fixes and occasional enhancements, are listed in FIXES. If you distribute this code further, please please please distribute FIXES with it. If you find errors, please report them -to bwk@bell-labs.com. Thanks. +to bwk@cs.princeton.edu. Thanks. The program itself is created by make Modified: stable/8/contrib/one-true-awk/awkgram.y ============================================================================== --- stable/8/contrib/one-true-awk/awkgram.y Thu Dec 8 09:21:30 2011 (r228347) +++ stable/8/contrib/one-true-awk/awkgram.y Thu Dec 8 10:42:38 2011 (r228348) @@ -174,8 +174,8 @@ pa_pat: pa_stat: pa_pat { $$ = stat2(PASTAT, $1, stat2(PRINT, rectonode(), NIL)); } | pa_pat lbrace stmtlist '}' { $$ = stat2(PASTAT, $1, $3); } - | pa_pat ',' pa_pat { $$ = pa2stat($1, $3, stat2(PRINT, rectonode(), NIL)); } - | pa_pat ',' pa_pat lbrace stmtlist '}' { $$ = pa2stat($1, $3, $5); } + | pa_pat ',' opt_nl pa_pat { $$ = pa2stat($1, $4, stat2(PRINT, rectonode(), NIL)); } + | pa_pat ',' opt_nl pa_pat lbrace stmtlist '}' { $$ = pa2stat($1, $4, $6); } | lbrace stmtlist '}' { $$ = stat2(PASTAT, NIL, $2); } | XBEGIN lbrace stmtlist '}' { beginloc = linkum(beginloc, $3); $$ = 0; } Modified: stable/8/contrib/one-true-awk/b.c ============================================================================== --- stable/8/contrib/one-true-awk/b.c Thu Dec 8 09:21:30 2011 (r228347) +++ stable/8/contrib/one-true-awk/b.c Thu Dec 8 10:42:38 2011 (r228348) @@ -234,7 +234,7 @@ void freetr(Node *p) /* free parse tree /* in the parsing of regular expressions, metacharacters like . have */ /* to be seen literally; \056 is not a metacharacter. */ -int hexstr(char **pp) /* find and eval hex string at pp, return new p */ +int hexstr(uschar **pp) /* find and eval hex string at pp, return new p */ { /* only pick up one 8-bit byte (2 chars) */ uschar *p; int n = 0; @@ -248,16 +248,16 @@ int hexstr(char **pp) /* find and eval h else if (*p >= 'A' && *p <= 'F') n = 16 * n + *p - 'A' + 10; } - *pp = (char *) p; + *pp = (uschar *) p; return n; } #define isoctdigit(c) ((c) >= '0' && (c) <= '7') /* multiple use of arg */ -int quoted(char **pp) /* pick up next thing after a \\ */ +int quoted(uschar **pp) /* pick up next thing after a \\ */ /* and increment *pp */ { - char *p = *pp; + uschar *p = *pp; int c; if ((c = *p++) == 't') @@ -314,13 +314,13 @@ char *cclenter(const char *argp) /* add bp = buf; for (i = 0; (c = *p++) != 0; ) { if (c == '\\') { - c = quoted((char **) &p); + c = quoted(&p); } else if (c == '-' && i > 0 && bp[-1] != 0) { if (*p != 0) { c = bp[-1]; c2 = *p++; if (c2 == '\\') - c2 = quoted((char **) &p); + c2 = quoted(&p); if (collate_range_cmp(c, c2) > 0) { bp--; i--; @@ -752,7 +752,7 @@ Node *unary(Node *np) /* #define HAS_ISBLANK */ #ifndef HAS_ISBLANK -int (isblank)(int c) +int (xisblank)(int c) { return c==' ' || c=='\t'; } @@ -766,7 +766,11 @@ struct charclass { } charclasses[] = { { "alnum", 5, isalnum }, { "alpha", 5, isalpha }, +#ifndef HAS_ISBLANK + { "blank", 5, isspace }, /* was isblank */ +#else { "blank", 5, isblank }, +#endif { "cntrl", 5, iscntrl }, { "digit", 5, isdigit }, { "graph", 5, isgraph }, @@ -803,7 +807,7 @@ int relex(void) /* lexical analyzer for case ')': return c; case '\\': - rlxval = quoted((char **) &prestr); + rlxval = quoted(&prestr); return CHAR; default: rlxval = c; Modified: stable/8/contrib/one-true-awk/lex.c ============================================================================== --- stable/8/contrib/one-true-awk/lex.c Thu Dec 8 09:21:30 2011 (r228347) +++ stable/8/contrib/one-true-awk/lex.c Thu Dec 8 10:42:38 2011 (r228348) @@ -411,7 +411,7 @@ int string(void) } *px = 0; unput(c); - sscanf(xbuf, "%x", &n); + sscanf(xbuf, "%x", (unsigned int *) &n); *bp++ = n; break; } Modified: stable/8/contrib/one-true-awk/lib.c ============================================================================== --- stable/8/contrib/one-true-awk/lib.c Thu Dec 8 09:21:30 2011 (r228347) +++ stable/8/contrib/one-true-awk/lib.c Thu Dec 8 10:42:38 2011 (r228348) @@ -89,8 +89,13 @@ void initgetrec(void) char *p; for (i = 1; i < *ARGC; i++) { - if (!isclvar(p = getargv(i))) { /* find 1st real filename */ - setsval(lookup("FILENAME", symtab), getargv(i)); + p = getargv(i); /* find 1st real filename */ + if (p == NULL || *p == '\0') { /* deleted or zapped */ + argno++; + continue; + } + if (!isclvar(p)) { + setsval(lookup("FILENAME", symtab), p); return; } setclvar(p); /* a commandline assignment before filename */ @@ -124,7 +129,7 @@ int getrec(char **pbuf, int *pbufsize, i dprintf( ("argno=%d, file=|%s|\n", argno, file) ); if (infile == NULL) { /* have to open a new file */ file = getargv(argno); - if (*file == '\0') { /* it's been zapped */ + if (file == NULL || *file == '\0') { /* deleted or zapped */ argno++; continue; } @@ -187,6 +192,7 @@ int readrec(char **pbuf, int *pbufsize, if (strlen(*FS) >= sizeof(inputFS)) FATAL("field separator %.10s... is too long", *FS); + /*fflush(stdout); avoids some buffering problem but makes it 25% slower*/ strcpy(inputFS, *FS); /* for subsequent field splitting */ if ((sep = **RS) == 0) { sep = '\n'; @@ -227,6 +233,8 @@ char *getargv(int n) /* get ARGV[n] */ extern Array *ARGVtab; sprintf(temp, "%d", n); + if (lookup(temp, ARGVtab) == NULL) + return NULL; x = setsymtab(temp, "", 0.0, STR, ARGVtab); s = getsval(x); dprintf( ("getargv(%d) returns |%s|\n", n, s) ); @@ -256,6 +264,7 @@ void fldbld(void) /* create fields from { /* this relies on having fields[] the same length as $0 */ /* the fields are all stored in this one array with \0's */ + /* possibly with a final trailing \0 not associated with any field */ char *r, *fr, sep; Cell *p; int i, j, n; @@ -268,7 +277,7 @@ void fldbld(void) /* create fields from n = strlen(r); if (n > fieldssize) { xfree(fields); - if ((fields = (char *) malloc(n+1)) == NULL) + if ((fields = (char *) malloc(n+2)) == NULL) /* possibly 2 final \0s */ FATAL("out of space for fields in fldbld %d", n); fieldssize = n; } @@ -476,14 +485,14 @@ void recbld(void) /* create $0 from $1.. if (!adjbuf(&record, &recsize, 2+r-record, recsize, &r, "recbld 3")) FATAL("built giant record `%.30s...'", record); *r = '\0'; - dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, fldtab[0]) ); + dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, (void*)fldtab[0]) ); if (freeable(fldtab[0])) xfree(fldtab[0]->sval); fldtab[0]->tval = REC | STR | DONTFREE; fldtab[0]->sval = record; - dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, fldtab[0]) ); + dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, (void*)fldtab[0]) ); dprintf( ("recbld = |%s|\n", record) ); donerec = 1; } Modified: stable/8/contrib/one-true-awk/main.c ============================================================================== --- stable/8/contrib/one-true-awk/main.c Thu Dec 8 09:21:30 2011 (r228347) +++ stable/8/contrib/one-true-awk/main.c Thu Dec 8 10:42:38 2011 (r228348) @@ -25,7 +25,7 @@ THIS SOFTWARE. #include __FBSDID("$FreeBSD$"); -const char *version = "version 20091126 (FreeBSD)"; +const char *version = "version 20110810 (FreeBSD)"; #define DEBUG #include @@ -41,6 +41,7 @@ extern char **environ; extern int nfields; int dbg = 0; +Awkfloat srand_seed = 1; char *cmdname; /* gets argv[0] for error messages */ extern FILE *yyin; /* lex input file */ char *lexprog; /* points to program argument if it exists */ @@ -71,6 +72,10 @@ int main(int argc, char *argv[]) exit(1); } signal(SIGFPE, fpecatch); + + srand_seed = 1; + srand(srand_seed); + yyin = NULL; symtab = makesymtab(NSYMTAB/NSYMTAB); while (argc > 1 && argv[1][0] == '-' && argv[1][1] != '\0') { @@ -90,7 +95,7 @@ int main(int argc, char *argv[]) safe = 1; break; case 'f': /* next argument is program filename */ - if (argv[1][2] != 0) { /* arg is -fsomething */ + if (argv[1][2] != 0) { /* arg is -fsomething */ if (npfile >= MAX_PFILE - 1) FATAL("too many -f options"); pfile[npfile++] = &argv[1][2]; @@ -120,13 +125,19 @@ int main(int argc, char *argv[]) WARNING("field separator FS is empty"); break; case 'v': /* -v a=1 to be done NOW. one -v for each */ - if (argv[1][2] != 0) { /* arg is -vsomething */ - if (argv[1][2] != 0) + if (argv[1][2] != 0) { /* arg is -vsomething */ + if (isclvar(&argv[1][2])) setclvar(&argv[1][2]); + else + FATAL("invalid -v option argument: %s", &argv[1][2]); } else { /* arg is -v something */ argc--; argv++; - if (argc > 1 && isclvar(argv[1])) + if (argc <= 1) + FATAL("no variable name"); + if (isclvar(argv[1])) setclvar(argv[1]); + else + FATAL("invalid -v option argument: %s", argv[1]); } break; case 'd': Modified: stable/8/contrib/one-true-awk/makefile ============================================================================== --- stable/8/contrib/one-true-awk/makefile Thu Dec 8 09:21:30 2011 (r228347) +++ stable/8/contrib/one-true-awk/makefile Thu Dec 8 10:42:38 2011 (r228348) @@ -26,12 +26,11 @@ CFLAGS = -g CFLAGS = -O2 CFLAGS = -CC = gcc -Wall -g -Wwrite-strings -CC = gcc -fprofile-arcs -ftest-coverage # then gcov f1.c; cat f1.c.gcov CC = gcc -Wall -g CC = cc -CC = gcc -O4 - +CC = gcc -Wall -g -Wwrite-strings +CC = gcc -fprofile-arcs -ftest-coverage # then gcov f1.c; cat f1.c.gcov +CC = gcc -O4 -Wall -pedantic -fno-strict-aliasing YACC = bison -y YACC = yacc @@ -40,13 +39,13 @@ YFLAGS = -d OFILES = b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o SOURCE = awk.h ytab.c ytab.h proto.h awkgram.y lex.c b.c main.c \ - maketab.c parse.c lib.c run.c tran.c proctab.c missing95.c + maketab.c parse.c lib.c run.c tran.c proctab.c LISTING = awk.h proto.h awkgram.y lex.c b.c main.c maketab.c parse.c \ - lib.c run.c tran.c missing95.c + lib.c run.c tran.c -SHIP = README FIXES $(SOURCE) ytab[ch].bak makefile makefile.win \ - vcvars32.bat buildwin.bat awk.1 +SHIP = README FIXES $(SOURCE) ytab[ch].bak makefile \ + awk.1 a.out: ytab.o $(OFILES) $(CC) $(CFLAGS) ytab.o $(OFILES) $(ALLOC) -lm Modified: stable/8/contrib/one-true-awk/proto.h ============================================================================== --- stable/8/contrib/one-true-awk/proto.h Thu Dec 8 09:21:30 2011 (r228347) +++ stable/8/contrib/one-true-awk/proto.h Thu Dec 8 10:42:38 2011 (r228348) @@ -43,8 +43,8 @@ extern fa *mkdfa(const char *, int); extern int makeinit(fa *, int); extern void penter(Node *); extern void freetr(Node *); -extern int hexstr(char **); -extern int quoted(char **); +extern int hexstr(uschar **); +extern int quoted(uschar **); extern char *cclenter(const char *); extern void overflo(const char *); extern void cfoll(fa *, Node *); Modified: stable/8/contrib/one-true-awk/run.c ============================================================================== --- stable/8/contrib/one-true-awk/run.c Thu Dec 8 09:21:30 2011 (r228347) +++ stable/8/contrib/one-true-awk/run.c Thu Dec 8 10:42:38 2011 (r228348) @@ -69,6 +69,7 @@ void tempfree(Cell *p) { jmp_buf env; extern int pairstack[]; +extern Awkfloat srand_seed; Node *winner = NULL; /* root of parse tree */ Cell *tmps; /* free temporary cells for execution */ @@ -1238,6 +1239,12 @@ Cell *split(Node **a, int nnn) /* split( ap->sval = (char *) makesymtab(NSYMTAB); n = 0; + if (arg3type == REGEXPR && strlen((char*)((fa*)a[2])->restr) == 0) { + /* split(s, a, //); have to arrange that it looks like empty sep */ + arg3type = 0; + fs = ""; + sep = 0; + } if (*s != '\0' && (strlen(fs) > 1 || arg3type == REGEXPR)) { /* reg expr */ fa *pfa; if (arg3type == REGEXPR) { /* it's ready already */ @@ -1469,6 +1476,7 @@ Cell *bltin(Node **a, int n) /* builtin Cell *x, *y; Awkfloat u; int t; + Awkfloat tmp; char *p, *buf; Node *nextarg; FILE *fp; @@ -1520,7 +1528,10 @@ Cell *bltin(Node **a, int n) /* builtin u = time((time_t *)0); else u = getfval(x); + tmp = u; srand((unsigned int) u); + u = srand_seed; + srand_seed = tmp; break; case FTOUPPER: case FTOLOWER: @@ -1616,17 +1627,25 @@ struct files { FILE *fp; const char *fname; int mode; /* '|', 'a', 'w' => LE/LT, GT */ -} files[FOPEN_MAX] ={ - { NULL, "/dev/stdin", LT }, /* watch out: don't free this! */ - { NULL, "/dev/stdout", GT }, - { NULL, "/dev/stderr", GT } -}; +} *files; + +int nfiles; void stdinit(void) /* in case stdin, etc., are not constants */ { - files[0].fp = stdin; - files[1].fp = stdout; - files[2].fp = stderr; + nfiles = FOPEN_MAX; + files = calloc(nfiles, sizeof(*files)); + if (files == NULL) + FATAL("can't allocate file memory for %u files", nfiles); + files[0].fp = stdin; + files[0].fname = "/dev/stdin"; + files[0].mode = LT; + files[1].fp = stdout; + files[1].fname = "/dev/stdout"; + files[1].mode = GT; + files[2].fp = stderr; + files[2].fname = "/dev/stderr"; + files[2].mode = GT; } FILE *openfile(int a, const char *us) @@ -1637,7 +1656,7 @@ FILE *openfile(int a, const char *us) if (*s == '\0') FATAL("null file name in print or getline"); - for (i=0; i < FOPEN_MAX; i++) + for (i=0; i < nfiles; i++) if (files[i].fname && strcmp(s, files[i].fname) == 0) { if (a == files[i].mode || (a==APPEND && files[i].mode==GT)) return files[i].fp; @@ -1647,11 +1666,19 @@ FILE *openfile(int a, const char *us) if (a == FFLUSH) /* didn't find it, so don't create it! */ return NULL; - for (i=0; i < FOPEN_MAX; i++) + for (i=0; i < nfiles; i++) if (files[i].fp == 0) break; - if (i >= FOPEN_MAX) - FATAL("%s makes too many open files", s); + if (i >= nfiles) { + struct files *nf; + int nnf = nfiles + FOPEN_MAX; + nf = realloc(files, nnf * sizeof(*nf)); + if (nf == NULL) + FATAL("cannot grow files for %s and %d files", s, nnf); + memset(&nf[nfiles], 0, FOPEN_MAX * sizeof(*nf)); + nfiles = nnf; + files = nf; + } fflush(stdout); /* force a semblance of order */ m = a; if (a == GT) { @@ -1679,7 +1706,7 @@ const char *filename(FILE *fp) { int i; - for (i = 0; i < FOPEN_MAX; i++) + for (i = 0; i < nfiles; i++) if (fp == files[i].fp) return files[i].fname; return "???"; @@ -1694,7 +1721,7 @@ Cell *closefile(Node **a, int n) x = execute(a[0]); getsval(x); stat = -1; - for (i = 0; i < FOPEN_MAX; i++) { + for (i = 0; i < nfiles; i++) { if (files[i].fname && strcmp(x->sval, files[i].fname) == 0) { if (ferror(files[i].fp)) WARNING( "i/o error occurred on %s", files[i].fname ); @@ -1738,7 +1765,7 @@ void flush_all(void) { int i; - for (i = 0; i < FOPEN_MAX; i++) + for (i = 0; i < nfiles; i++) if (files[i].fp) fflush(files[i].fp); } @@ -1890,9 +1917,10 @@ Cell *gsub(Node **a, int nnn) /* global adjbuf(&buf, &bufsz, 1+strlen(sptr)+pb-buf, 0, &pb, "gsub"); while ((*pb++ = *sptr++) != 0) ; - done: if (pb > buf + bufsz) - FATAL("gsub result2 %.30s too big; can't happen", buf); - *pb = '\0'; + done: if (pb < buf + bufsz) + *pb = '\0'; + else if (*(pb-1) != '\0') + FATAL("gsub result2 %.30s truncated; can't happen", buf); setsval(x, buf); /* BUG: should be able to avoid copy + free */ pfa->initstat = tempstat; } Modified: stable/8/contrib/one-true-awk/tran.c ============================================================================== --- stable/8/contrib/one-true-awk/tran.c Thu Dec 8 09:21:30 2011 (r228347) +++ stable/8/contrib/one-true-awk/tran.c Thu Dec 8 10:42:38 2011 (r228348) @@ -212,7 +212,7 @@ Cell *setsymtab(const char *n, const cha if (n != NULL && (p = lookup(n, tp)) != NULL) { dprintf( ("setsymtab found %p: n=%s s=\"%s\" f=%g t=%o\n", - p, NN(p->nval), NN(p->sval), p->fval, p->tval) ); + (void*)p, NN(p->nval), NN(p->sval), p->fval, p->tval) ); return(p); } p = (Cell *) malloc(sizeof(Cell)); @@ -231,7 +231,7 @@ Cell *setsymtab(const char *n, const cha p->cnext = tp->tab[h]; tp->tab[h] = p; dprintf( ("setsymtab set %p: n=%s s=\"%s\" f=%g t=%o\n", - p, p->nval, p->sval, p->fval, p->tval) ); + (void*)p, p->nval, p->sval, p->fval, p->tval) ); return(p); } @@ -298,7 +298,7 @@ Awkfloat setfval(Cell *vp, Awkfloat f) / xfree(vp->sval); /* free any previous string */ vp->tval &= ~STR; /* mark string invalid */ vp->tval |= NUM; /* mark number ok */ - dprintf( ("setfval %p: %s = %g, t=%o\n", vp, NN(vp->nval), f, vp->tval) ); + dprintf( ("setfval %p: %s = %g, t=%o\n", (void*)vp, NN(vp->nval), f, vp->tval) ); return vp->fval = f; } @@ -318,7 +318,7 @@ char *setsval(Cell *vp, const char *s) / int fldno; dprintf( ("starting setsval %p: %s = \"%s\", t=%o, r,f=%d,%d\n", - vp, NN(vp->nval), s, vp->tval, donerec, donefld) ); + (void*)vp, NN(vp->nval), s, vp->tval, donerec, donefld) ); if ((vp->tval & (NUM | STR)) == 0) funnyvar(vp, "assign to"); if (isfld(vp)) { @@ -338,7 +338,7 @@ char *setsval(Cell *vp, const char *s) / vp->tval |= STR; vp->tval &= ~DONTFREE; dprintf( ("setsval %p: %s = \"%s (%p) \", t=%o r,f=%d,%d\n", - vp, NN(vp->nval), t,t, vp->tval, donerec, donefld) ); + (void*)vp, NN(vp->nval), t,t, vp->tval, donerec, donefld) ); return(vp->sval = t); } @@ -355,7 +355,8 @@ Awkfloat getfval(Cell *vp) /* get float if (is_number(vp->sval) && !(vp->tval&CON)) vp->tval |= NUM; /* make NUM only sparingly */ } - dprintf( ("getfval %p: %s = %g, t=%o\n", vp, NN(vp->nval), vp->fval, vp->tval) ); + dprintf( ("getfval %p: %s = %g, t=%o\n", + (void*)vp, NN(vp->nval), vp->fval, vp->tval) ); return(vp->fval); } @@ -381,7 +382,8 @@ static char *get_str_val(Cell *vp, char vp->tval &= ~DONTFREE; vp->tval |= STR; } - dprintf( ("getsval %p: %s = \"%s (%p)\", t=%o\n", vp, NN(vp->nval), vp->sval, vp->sval, vp->tval) ); + dprintf( ("getsval %p: %s = \"%s (%p)\", t=%o\n", + (void*)vp, NN(vp->nval), vp->sval, vp->sval, vp->tval) ); return(vp->sval); } From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 11:13:10 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7E0D106564A; Thu, 8 Dec 2011 11:13:10 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by mx1.freebsd.org (Postfix) with ESMTP id 12EC68FC0A; Thu, 8 Dec 2011 11:13:09 +0000 (UTC) Received: from c211-28-227-231.carlnfd1.nsw.optusnet.com.au (c211-28-227-231.carlnfd1.nsw.optusnet.com.au [211.28.227.231]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id pB8BD4KR027877 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 8 Dec 2011 22:13:06 +1100 Date: Thu, 8 Dec 2011 22:13:04 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pawel Jakub Dawidek In-Reply-To: <20111208073210.GC1678@garage.freebsd.pl> Message-ID: <20111208200957.F1091@besplex.bde.org> References: <201112080240.pB82ek4Q066638@svn.freebsd.org> <20111208073210.GC1678@garage.freebsd.pl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Eitan Adler Subject: Re: svn commit: r228342 - head/contrib/tzcode/zic X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 11:13:10 -0000 On Thu, 8 Dec 2011, Pawel Jakub Dawidek wrote: > On Thu, Dec 08, 2011 at 02:40:46AM +0000, Eitan Adler wrote: >> Log: >> - set progname for use in usage() >> >> Modified: head/contrib/tzcode/zic/zdump.c >> ============================================================================== >> --- head/contrib/tzcode/zic/zdump.c Thu Dec 8 00:56:23 2011 (r228341) >> +++ head/contrib/tzcode/zic/zdump.c Thu Dec 8 02:40:46 2011 (r228342) >> @@ -260,6 +260,7 @@ char * argv[]; >> register struct tm * tmp; >> register struct tm * newtmp; >> >> + progname=argv[0]; >> INITIALIZE(cutlotime); >> INITIALIZE(cuthitime); >> #if HAVE_GETTEXT > > It will good to to try to upstream it as this is contributed code. > This change doesn't seem to be consistent with the style of this file. > They use spaces around =. Also, if this were not contrib'ed code, then using progname in it would involve 2 layers of style bugs: - user-visible layer: in FreeBSD, the program name printed by usage() is literal and doesn't depend on the pathname with which the program was invoked. In old versions of zdump in FreeBSD, one of the main changes was to convert it to FreeBSD style. Old versions were also missing the uninitialization of progrname, even in the vendor version: % Index: zdump.c % =================================================================== % RCS file: /home/ncvs/src/usr.sbin/zic/zdump.c,v % retrieving revision 1.1.1.4 % retrieving revision 1.9 % diff -r1.1.1.4 -r1.9 % ... % 130d132 % < static char * progname; % 131a134 % > static void usage(void); % 160d162 % < progname = argv[0]; % 163,164c165 % < (void) printf("%s\n", elsieid); % < (void) exit(EXIT_SUCCESS); % --- % > errx(EXIT_SUCCESS, "%s", elsieid); % 174,177c175 % < (void) fprintf(stderr, % < _("%s: usage is %s [ --version ] [ -v ] [ -c cutoff ] zonename ...\n"), % < argv[0], argv[0]); % < (void) exit(EXIT_FAILURE); % --- % > usage(); % 204,207c202,205 % < (fakeenv[0] = (char *) malloc(longest + 4)) == NULL) { % < (void) perror(progname); % < (void) exit(EXIT_FAILURE); % < } % --- % > (fakeenv[0] = (char *) malloc((size_t) (longest + % > 4))) == NULL) % > errx(EXIT_FAILURE, % > _("malloc() failed")); % 266,270c264,265 % < if (fflush(stdout) || ferror(stdout)) { % < (void) fprintf(stderr, "%s: ", argv[0]); % < (void) perror(_("Error writing standard output")); % < (void) exit(EXIT_FAILURE); % < } % --- % > if (fflush(stdout) || ferror(stdout)) % > errx(EXIT_FAILURE, _("error writing standard output")); % 277a273,280 % > static void % > usage(void) % > { % > fprintf(stderr, % > _("usage: zdump [--version] [-v] [-c cutoff] zonename ...\n")); % > exit(EXIT_FAILURE); % > } This change also breaks the vendor style, since it doesn't use an excessive (void) cast on the fprintf() in usage(). The other changes mostly involve changing perror() and [f]printf() to errx(). This is a user-visible change if the [f]printf() was to stdout instead of stderr, and perhaps if errx() gives better formatting than perror(). The current version uses the unportable errx() instead of perror() plus exit(), but still uses [f]printf() instead of warnx() when not exiting. I can't see any vendor version of it using cvs. - FreeBSD and NetBSD programs never use progname = argv[0] or use progname explicitly. They use getprogname(3). This is implemented by setting a variable __progname to argv[0] in crt. The setting may be changed by setprogname(3). This gives minor inconsistencies which may be considered features: usage() always prints the literal program name, while the errx() family uses getprogname() and this prints argv[0] or whatever setprogname() changed __progname too. Grepping for progname in /usr/src/*bin shows only a few violations of the above rules: % bin/chio/chio.c: " [inv]\n", getprogname(), cname); % bin/chio/chio.c: getprogname(), cname); % bin/chio/chio.c: getprogname(), cname); % bin/chio/chio.c: (void) fprintf(stderr, "usage: %s %s\n", getprogname(), cname); % bin/chio/chio.c: (void) fprintf(stderr, "usage: %s %s\n", getprogname(), cname); % bin/chio/chio.c: (void) fprintf(stderr, "usage: %s %s \n", getprogname(), cname); % bin/chio/chio.c: getprogname(), cname); % bin/chio/chio.c: getprogname(), cname); % bin/chio/chio.c: getprogname(), cname); % bin/chio/chio.c: " \n", getprogname(), cname); % bin/chio/chio.c: "arg1 arg2 [arg3 [...]]\n", getprogname()); chio doesn't look like FreeBSD sources. It came from NetBSD. % bin/ps/ps.c: getprogname(), *argv); Someone broke ps. It is internally inconsistent: it prints getprogname() here, and then immediately calls usage() which prints a literal "ps". % bin/pkill/pkill.c: if (strcmp(getprogname(), "pgrep") == 0) { % bin/pkill/pkill.c: " [-t tty] [-u euid] pattern ...\n", getprogname(), pkill can be a link to pgrep. This is the only excuse for using getprograme() in usage(). __progname is actually initialized to an edited version of argv[0], with the path prefix stripped. Thus if pkill is copied to ./cat, and run from any path leading to ./cat, the above bogusly prints that its name is `cat'. When pkill is invoked under any other name that pgrep, it defaults to acting as pkill, but it doesn't change its name to pkill so what it is acting as is hard to tell from its error messages if its name is not pkill. Before getprogname() existed, usage() would probably have printed a name that matched its action using a flag set when its action was determined (acting_as_pgrep ? "pgrep" : "pkill"). Using getprogname(), the logic should probably be that if the action is defaulted then the name should be changed to match the defaulted action. But it would be clearer to default to an error, with a special usage message. This the existence of getprogname() doesn't simplify printing of the active program name in usage() for programs whose action depends on their name. % bin/echo/echo.c: char *progname = argv[0]; % bin/echo/echo.c: errexit(progname, "malloc"); % bin/echo/echo.c: errexit(progname, "write"); echo has contortions to avoid using err() since that might break sh when echo is sh's builtin. It should use getprogname() here. IIRC, this was implemented before gteprogname() existed. % sbin/newfs/newfs.c: getprogname(), SOmeone broken newfs. Fixed in my version. % sbin/fsck_ffs/main.c: getprogname()); % sbin/fsck/fsutil.c: dev, getprogname()); % sbin/fsck/fsck.c: getprogname(), common); This is probably from NetBSD> % sbin/dhclient/dhclient.c: extern char *__progname; % sbin/dhclient/dhclient.c: openlog(__progname, LOG_PID | LOG_NDELAY, DHCPD_LOG_FACILITY); % sbin/dhclient/dhclient.c: extern char *__progname; % sbin/dhclient/dhclient.c: fprintf(stderr, "usage: %s [-bdqu] ", __progname); Chumminess with the implementation. % sbin/mdmfs/mdmfs.c: if (strcmp(getprogname(), "mount_mfs") == 0 || % sbin/mdmfs/mdmfs.c: strcmp(getprogname(), "mfs") == 0) { % sbin/mdmfs/mdmfs.c:"\tmd-device mount-point\n", getprogname()); Because it is sometimes named mount_mfs, and this is supported (like pkill/pgrep). % sbin/hastctl/hastctl.c: getprogname()); % sbin/hastctl/hastctl.c: getprogname()); % sbin/hastctl/hastctl.c: getprogname()); % sbin/hastctl/hastctl.c: getprogname()); Apparently just style bugs. % sbin/swapon/swapon.c: getprogname(), % sbin/swapon/swapon.c: getprogname(), which_prog == SWAPOFF ? "remov" : "add", % sbin/swapon/swapon.c: fprintf(stderr, "usage: %s ", getprogname()); Because it is sometimes named swapoff or swapctl. % sbin/devfs/rule.c: setprogname("devfs rule"); % sbin/devfs/rule.c: setprogname("devfs ruleset"); Change to a strange program name with spaces in it. This name would be hard to parse if it is actually used. % sbin/md5/md5.c: const char *progname; % sbin/md5/md5.c: const char* progname; % sbin/md5/md5.c: if ((progname = strrchr(argv[0], '/')) == NULL) % sbin/md5/md5.c: progname = argv[0]; % sbin/md5/md5.c: progname++; Home made version of getprogname(). Probably written before the latter existed. % sbin/md5/md5.c: if (strcasecmp(Algorithm[digest].progname, progname) == 0) % sbin/md5/md5.c: fprintf(stderr, "usage: %s [-pqrtx] [-s string] [files ...]\n", alg->progname); Because it can have various names. [... 249 more lines] Got bored here. The above examples are enough to show that the FreeBSD style is to use getprogname() in usage() if and only if the program can have various _supported_ names (not unsupported names like a copy of /bin/rm to ./cat would have). Oops. I chose rm for maximal danger when it is renamed to a harmless command. But rm is linked to unlink. Its logic for determining its action and name are slightly broken, as for pkill/pgrep but more: - to determine whether it should act like unlink, it uses a home made getprogname(). - when its name is neither rm nor unlink, it acts like rm - when its name is unlink, it normally doesn't call usage(), so if there is an error then its name is reported as being unlink. However, it calls usage() if it has any option or no args. usage() doesn't use getprogname(), so it then prints the usage message for rm, including rm's literal name. But usage() prints the message for unlink too. usage() always prints both messages. This gives noise more for the case where the program is just rm. Related bug: the program name returned by getprogname() is initialized as if by setprogname(argv[0]). pkill.c depends on this, but this is not documented in getprogname(3). It is documented that setprogname() sets the program name to the last component of its arg, but not that initialization uses either argv[0] or setprogname() on it. The man page also says that getprogname() manipulates the program name. These bugs are fixed or moot in NetBSD's man page, but the semantics of setprogname() are very different in NetBSD (at least in 2005). In NetBSD, setprogname() is always called from crt (as in FreeBSD), but subsequent calls have no effect. It is recommended that all programs start with a call to setprogname() in main(), just for portability to systems that don't call it automatically. For systems that don't have it at all, these calls can be implemented in a special library or annulled by a macro. It's amazing how complicated keeping track of your own name is when you use a library/bureauocracy that might not exist to do it :-). Bruce From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 12:31:47 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B1E47106566B; Thu, 8 Dec 2011 12:31:47 +0000 (UTC) (envelope-from rmh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1FB68FC19; Thu, 8 Dec 2011 12:31:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB8CVlU9086769; Thu, 8 Dec 2011 12:31:47 GMT (envelope-from rmh@svn.freebsd.org) Received: (from rmh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB8CVlKf086767; Thu, 8 Dec 2011 12:31:47 GMT (envelope-from rmh@svn.freebsd.org) Message-Id: <201112081231.pB8CVlKf086767@svn.freebsd.org> From: Robert Millan Date: Thu, 8 Dec 2011 12:31:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228349 - head/lib/libufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 12:31:47 -0000 Author: rmh Date: Thu Dec 8 12:31:47 2011 New Revision: 228349 URL: http://svn.freebsd.org/changeset/base/228349 Log: Make berase() work on platforms whose kernel lacks DIOCGDELETE ioctl. Approved by: kib (mentor) Modified: head/lib/libufs/block.c Modified: head/lib/libufs/block.c ============================================================================== --- head/lib/libufs/block.c Thu Dec 8 10:42:38 2011 (r228348) +++ head/lib/libufs/block.c Thu Dec 8 12:31:47 2011 (r228349) @@ -139,10 +139,56 @@ bwrite(struct uufsd *disk, ufs2_daddr_t return (cnt); } +#ifdef __FreeBSD_kernel__ + +static int +berase_helper(struct uufsd *disk, ufs2_daddr_t blockno, ufs2_daddr_t size) +{ + off_t ioarg[2]; + + ioarg[0] = blockno * disk->d_bsize; + ioarg[1] = size; + return (ioctl(disk->d_fd, DIOCGDELETE, ioarg)); +} + +#else + +static int +berase_helper(struct uufsd *disk, ufs2_daddr_t blockno, ufs2_daddr_t size) +{ + char *zero_chunk; + off_t offset, zero_chunk_size, pwrite_size; + int rv; + + offset = blockno * disk->d_bsize; + zero_chunk_size = 65536 * disk->d_bsize; + zero_chunk = calloc(1, zero_chunk_size); + if (zero_chunk == NULL) { + ERROR(disk, "failed to allocate memory"); + return (-1); + } + while (size > 0) { + pwrite_size = size; + if (pwrite_size > zero_chunk_size) + pwrite_size = zero_chunk_size; + rv = pwrite(disk->d_fd, zero_chunk, pwrite_size, offset); + if (rv == -1) { + ERROR(disk, "failed writing to disk"); + break; + } + size -= rv; + offset += rv; + rv = 0; + } + free(zero_chunk); + return (rv); +} + +#endif + int berase(struct uufsd *disk, ufs2_daddr_t blockno, ufs2_daddr_t size) { - off_t ioarg[2]; int rv; ERROR(disk, NULL); @@ -151,8 +197,5 @@ berase(struct uufsd *disk, ufs2_daddr_t ERROR(disk, "failed to open disk for writing"); return(rv); } - ioarg[0] = blockno * disk->d_bsize; - ioarg[1] = size; - rv = ioctl(disk->d_fd, DIOCGDELETE, ioarg); - return (rv); + return (berase_helper(disk, blockno, size)); } From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 13:45:33 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4225810656D2; Thu, 8 Dec 2011 13:45:33 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2F8098FC15; Thu, 8 Dec 2011 13:45:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB8DjXZ8089158; Thu, 8 Dec 2011 13:45:33 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB8DjXMR089153; Thu, 8 Dec 2011 13:45:33 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201112081345.pB8DjXMR089153@svn.freebsd.org> From: Ruslan Ermilov Date: Thu, 8 Dec 2011 13:45:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228350 - vendor/groff/dist/tmac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 13:45:33 -0000 Author: ru Date: Thu Dec 8 13:45:32 2011 New Revision: 228350 URL: http://svn.freebsd.org/changeset/base/228350 Log: Cherry-pick vendor changes to mdoc: : 2011-10-23 Ingo Schwarze : : [mdoc] Synchronize string tables with the mandoc(1) utility. : : * tmac/doc-common: Add many architecture names used in NetBSD and : OpenBSD (and "arm" from FreeBSD) and remove the duplicate OS version : entry for Darwin-10.6.0. : : * tmac/doc-syms: Add many library names used in NetBSD and FreeBSD. : : * tmac/groff_mdoc.man: Document all supported architecture names, OS : versions, and library names. : : 2011-09-11 Joseph Koshy : : [mdoc] Add some library strings. : : * tmac/doc-syms: Add `libdwarf' and `libelf'. : * tmac/groff_mdoc.man: Document them. : : 2011-07-03 Guillem Jover : : mdoc: Update more OS versions strings. : : * tmac/doc-common: Add versions strings for NetBSD, OpenBSD, : FreeBSD, and DragonFly. Modified: vendor/groff/dist/tmac/doc-common vendor/groff/dist/tmac/doc-syms vendor/groff/dist/tmac/doc.tmac vendor/groff/dist/tmac/groff_mdoc.man Modified: vendor/groff/dist/tmac/doc-common ============================================================================== --- vendor/groff/dist/tmac/doc-common Thu Dec 8 12:31:47 2011 (r228349) +++ vendor/groff/dist/tmac/doc-common Thu Dec 8 13:45:32 2011 (r228350) @@ -264,50 +264,72 @@ .ds doc-volume-as-algor algor .ds doc-volume-as-amd64 amd64 .ds doc-volume-as-amiga amiga +.ds doc-volume-as-amigappc amigappc .ds doc-volume-as-arc arc +.ds doc-volume-as-arm arm .ds doc-volume-as-arm26 arm26 .ds doc-volume-as-arm32 arm32 +.ds doc-volume-as-armish armish .ds doc-volume-as-atari atari +.ds doc-volume-as-aviion aviion +.ds doc-volume-as-beagle beagle .ds doc-volume-as-bebox bebox .ds doc-volume-as-cats cats .ds doc-volume-as-cesfic cesfic .ds doc-volume-as-cobalt cobalt .ds doc-volume-as-dreamcast dreamcast +.ds doc-volume-as-emips emips .ds doc-volume-as-evbarm evbarm .ds doc-volume-as-evbmips evbmips .ds doc-volume-as-evbppc evbppc .ds doc-volume-as-evbsh3 evbsh3 +.ds doc-volume-as-ews4800mips ews4800mips .ds doc-volume-as-hp300 hp300 .ds doc-volume-as-hp700 hp700 .ds doc-volume-as-hpcarm hpcarm .ds doc-volume-as-hpcmips hpcmips .ds doc-volume-as-hpcsh hpcsh +.ds doc-volume-as-hppa hppa +.ds doc-volume-as-hppa64 hppa64 .ds doc-volume-as-i386 i386 +.ds doc-volume-as-ia64 ia64 +.ds doc-volume-as-ibmnws ibmnws +.ds doc-volume-as-iyonix iyonix +.ds doc-volume-as-landisk landisk +.ds doc-volume-as-loongson loongson .ds doc-volume-as-luna68k luna68k +.ds doc-volume-as-luna88k luna88k .ds doc-volume-as-m68k m68k .ds doc-volume-as-mac68k mac68k .ds doc-volume-as-macppc macppc .ds doc-volume-as-mips mips +.ds doc-volume-as-mips64 mips64 .ds doc-volume-as-mipsco mipsco .ds doc-volume-as-mmeye mmeye .ds doc-volume-as-mvme68k mvme68k +.ds doc-volume-as-mvme88k mvme88k .ds doc-volume-as-mvmeppc mvmeppc .ds doc-volume-as-netwinder netwinder .ds doc-volume-as-news68k news68k .ds doc-volume-as-newsmips newsmips .ds doc-volume-as-next68k next68k .ds doc-volume-as-ofppc ofppc +.ds doc-volume-as-palm palm .ds doc-volume-as-pc532 pc532 .ds doc-volume-as-playstation2 playstation2 .ds doc-volume-as-pmax pmax .ds doc-volume-as-pmppc pmppc .ds doc-volume-as-powerpc powerpc .ds doc-volume-as-prep prep +.ds doc-volume-as-rs6000 rs6000 .ds doc-volume-as-sandpoint sandpoint .ds doc-volume-as-sbmips sbmips +.ds doc-volume-as-sgi sgi .ds doc-volume-as-sgimips sgimips .ds doc-volume-as-sh3 sh3 .ds doc-volume-as-shark shark +.ds doc-volume-as-socppc socppc +.ds doc-volume-as-solbourne solbourne .ds doc-volume-as-sparc sparc .ds doc-volume-as-sparc64 sparc64 .ds doc-volume-as-sun2 sun2 @@ -316,6 +338,8 @@ .ds doc-volume-as-vax vax .ds doc-volume-as-x68k x68k .ds doc-volume-as-x86_64 x86_64 +.ds doc-volume-as-xen xen +.ds doc-volume-as-zaurus zaurus . .de Dt . \" reset default arguments @@ -451,12 +475,16 @@ .ds doc-operating-system-NetBSD-3.0 3.0 .ds doc-operating-system-NetBSD-3.0.1 3.0.1 .ds doc-operating-system-NetBSD-3.0.2 3.0.2 +.ds doc-operating-system-NetBSD-3.0.3 3.0.3 .ds doc-operating-system-NetBSD-3.1 3.1 +.ds doc-operating-system-NetBSD-3.1.1 3.1.1 .ds doc-operating-system-NetBSD-4.0 4.0 .ds doc-operating-system-NetBSD-4.0.1 4.0.1 .ds doc-operating-system-NetBSD-5.0 5.0 .ds doc-operating-system-NetBSD-5.0.1 5.0.1 .ds doc-operating-system-NetBSD-5.0.2 5.0.2 +.ds doc-operating-system-NetBSD-5.1 5.1 +.ds doc-operating-system-NetBSD-6.0 6.0 . .ds doc-operating-system-OpenBSD-2.0 2.0 .ds doc-operating-system-OpenBSD-2.1 2.1 @@ -487,6 +515,8 @@ .ds doc-operating-system-OpenBSD-4.6 4.6 .ds doc-operating-system-OpenBSD-4.7 4.7 .ds doc-operating-system-OpenBSD-4.8 4.8 +.ds doc-operating-system-OpenBSD-4.9 4.9 +.ds doc-operating-system-OpenBSD-5.0 5.0 . .ds doc-operating-system-FreeBSD-1.0 1.0 .ds doc-operating-system-FreeBSD-1.1 1.1 @@ -544,6 +574,7 @@ .ds doc-operating-system-FreeBSD-8.0 8.0 .ds doc-operating-system-FreeBSD-8.1 8.1 .ds doc-operating-system-FreeBSD-8.2 8.2 +.ds doc-operating-system-FreeBSD-9.0 9.0 . .ds doc-operating-system-Darwin-8.0.0 8.0.0 .ds doc-operating-system-Darwin-8.1.0 8.1.0 @@ -566,7 +597,6 @@ .ds doc-operating-system-Darwin-9.6.0 9.6.0 .ds doc-operating-system-Darwin-9.7.0 9.7.0 .ds doc-operating-system-Darwin-9.8.0 9.8.0 -.ds doc-operating-system-Darwin-10.6.0 10.6.0 .ds doc-operating-system-Darwin-10.1.0 10.1.0 .ds doc-operating-system-Darwin-10.2.0 10.2.0 .ds doc-operating-system-Darwin-10.3.0 10.3.0 @@ -593,6 +623,11 @@ .ds doc-operating-system-DragonFly-2.4 2.4 .ds doc-operating-system-DragonFly-2.6 2.6 .ds doc-operating-system-DragonFly-2.8 2.8 +.ds doc-operating-system-DragonFly-2.9 2.9 +.ds doc-operating-system-DragonFly-2.9.1 2.9.1 +.ds doc-operating-system-DragonFly-2.10 2.10 +.ds doc-operating-system-DragonFly-2.10.1 2.10.1 +.ds doc-operating-system-DragonFly-2.11 2.11 . .de Os . ds doc-command-name Modified: vendor/groff/dist/tmac/doc-syms ============================================================================== --- vendor/groff/dist/tmac/doc-syms Thu Dec 8 12:31:47 2011 (r228349) +++ vendor/groff/dist/tmac/doc-syms Thu Dec 8 13:45:32 2011 (r228350) @@ -754,38 +754,74 @@ .\" NS .\" NS width register `Lb' defined in doc-common . +.ds doc-str-Lb-libarchive Reading and Writing Streaming Archives Library (libarchive, \-larchive) .ds doc-str-Lb-libarm ARM Architecture Library (libarm, \-larm) .ds doc-str-Lb-libarm32 ARM32 Architecture Library (libarm32, \-larm32) +.ds doc-str-Lb-libbluetooth Bluetooth Library (libbluetooth, \-lbluetooth) .ds doc-str-Lb-libbsm Basic Security Module Library (libbsm, \-lbsm) .ds doc-str-Lb-libc Standard C\~Library (libc, \-lc) +.ds doc-str-Lb-libc_r Reentrant C\~Library (libc_r, \-lc_r) +.ds doc-str-Lb-libcalendar Calendar Arithmetic Library (libcalendar, \-lcalendar) +.ds doc-str-Lb-libcam Common Access Method User Library (libcam, \-lcam) .ds doc-str-Lb-libcdk Curses Development Kit Library (libcdk, \-lcdk) +.ds doc-str-Lb-libcipher FreeSec Crypt Library (libcipher, \-lcipher) .ds doc-str-Lb-libcompat Compatibility Library (libcompat, \-lcompat) .ds doc-str-Lb-libcrypt Crypt Library (libcrypt, \-lcrypt) .ds doc-str-Lb-libcurses Curses Library (libcurses, \-lcurses) +.ds doc-str-Lb-libdevinfo Device and Resource Information Utility Library (libdevinfo, \-ldevinfo) +.ds doc-str-Lb-libdevstat Device Statistics Library (libdevstat, \-ldevstat) +.ds doc-str-Lb-libdisk Interface to Slice and Partition Labels Library (libdisk, \-ldisk) +.ds doc-str-Lb-libdwarf DWARF Access Library (libdwarf, \-ldwarf) .ds doc-str-Lb-libedit Command Line Editor Library (libedit, \-ledit) +.ds doc-str-Lb-libelf ELF Access Library (libelf, \-lelf) .ds doc-str-Lb-libevent Event Notification Library (libevent, \-levent) +.ds doc-str-Lb-libfetch File Transfer Library for URLs (libfetch, \-lfetch) .ds doc-str-Lb-libform Curses Form Library (libform, \-lform) +.ds doc-str-Lb-libgeom Userland API Library for kernel GEOM subsystem (libgeom, \-lgeom) +.ds doc-str-Lb-libgpib General-Purpose Instrument Bus (GPIB) library (libgpib, \-lgpib) .ds doc-str-Lb-libi386 i386 Architecture Library (libi386, \-li386) .ds doc-str-Lb-libintl Internationalized Message Handling Library (libintl, \-lintl) .ds doc-str-Lb-libipsec IPsec Policy Control Library (libipsec, \-lipsec) +.ds doc-str-Lb-libipx IPX Address Conversion Support Library (libipx, \-lipx) +.ds doc-str-Lb-libiscsi iSCSI protocol library (libiscsi, \-liscsi) +.ds doc-str-Lb-libjail Jail Library (libjail, \-ljail) +.ds doc-str-Lb-libkiconv Kernel side iconv library (libkiconv, \-lkiconv) +.ds doc-str-Lb-libkse N:M Threading Library (libkse, \-lkse) .ds doc-str-Lb-libkvm Kernel Data Access Library (libkvm, \-lkvm) .ds doc-str-Lb-libm Math Library (libm, \-lm) .ds doc-str-Lb-libm68k m68k Architecture Library (libm68k, \-lm68k) .ds doc-str-Lb-libmagic Magic Number Recognition Library (libmagic, \-lmagic) +.ds doc-str-Lb-libmd Message Digest (MD4, MD5, etc.) Support Library (libmd, \-lmd) +.ds doc-str-Lb-libmemstat Kernel Memory Allocator Statistics Library (libmemstat, \-lmemstat) .ds doc-str-Lb-libmenu Curses Menu Library (libmenu, \-lmenu) +.ds doc-str-Lb-libnetgraph Netgraph User Library (libnetgraph, \-lnetgraph) +.ds doc-str-Lb-libnetpgp Netpgp signing, verification, encryption and decryption (libnetpgp, \-lnetpgp) .ds doc-str-Lb-libossaudio OSS Audio Emulation Library (libossaudio, \-lossaudio) .ds doc-str-Lb-libpam Pluggable Authentication Module Library (libpam, \-lpam) .ds doc-str-Lb-libpcap Packet Capture Library (libpcap, \-lpcap) .ds doc-str-Lb-libpci PCI Bus Access Library (libpci, \-lpci) .ds doc-str-Lb-libpmc Performance Counters Library (libpmc, \-lpmc) .ds doc-str-Lb-libposix \*[Px] \*[doc-str-Lb]Compatibility Library (libposix, \-lposix) +.ds doc-str-Lb-libprop Property Container Object Library (libprop, \-lprop) .ds doc-str-Lb-libpthread \*[Px] \*[doc-str-Lb]Threads Library (libpthread, \-lpthread) +.ds doc-str-Lb-libpuffs puffs Convenience Library (libpuffs, \-lpuffs) +.ds doc-str-Lb-librefuse File System in Userspace Convenience Library (librefuse, \-lrefuse) .ds doc-str-Lb-libresolv DNS Resolver Library (libresolv, \-lresolv) +.ds doc-str-Lb-librpcsec_gss RPC GSS-API Authentication Library (librpcsec_gss, \-lrpcsec_gss) +.ds doc-str-Lb-librpcsvc RPC Service Library (librpcsvc, \-lrpcsvc) .ds doc-str-Lb-librt \*[Px] \*[doc-str-Lb]Real-time Library (librt, \-lrt) +.ds doc-str-Lb-libsdp Bluetooth Service Discovery Protocol User Library (libsdp, \-lsdp) +.ds doc-str-Lb-libssp Buffer Overflow Protection Library (libssp, \-lssp) .ds doc-str-Lb-libSystem System Library (libSystem, \-lSystem) .ds doc-str-Lb-libtermcap Termcap Access Library (libtermcap, \-ltermcap) +.ds doc-str-Lb-libterminfo Terminal Information Library (libterminfo, \-lterminfo) +.ds doc-str-Lb-libthr 1:1 Threading Library (libthr, \-lthr) +.ds doc-str-Lb-libufs UFS File System Access Library (libufs, \-lufs) +.ds doc-str-Lb-libugidfw File System Firewall Interface Library (libugidfw, \-lugidfw) +.ds doc-str-Lb-libulog User Login Record Library (libulog, \-lulog) .ds doc-str-Lb-libusbhid USB Human Interface Devices Library (libusbhid, \-lusbhid) .ds doc-str-Lb-libutil System Utilities Library (libutil, \-lutil) +.ds doc-str-Lb-libvgl Video Graphics Library (libvgl, \-lvgl) .ds doc-str-Lb-libx86_64 x86_64 Architecture Library (libx86_64, \-lx86_64) .ds doc-str-Lb-libz Compression Library (libz, \-lz) . Modified: vendor/groff/dist/tmac/doc.tmac ============================================================================== --- vendor/groff/dist/tmac/doc.tmac Thu Dec 8 12:31:47 2011 (r228349) +++ vendor/groff/dist/tmac/doc.tmac Thu Dec 8 13:45:32 2011 (r228350) @@ -4268,7 +4268,7 @@ . if (\n[doc-arg-limit] > \n[doc-arg-ptr]) \{\ . nr doc-reg-Xr (\n[doc-arg-ptr] + 1) . \" modify second argument if it is a string and -. \" remove space inbetween +. \" remove space in between . if (\n[doc-type\n[doc-reg-Xr]] == 2) \{\ . ds doc-arg\n[doc-reg-Xr] \*[lp]\*[doc-arg\n[doc-reg-Xr]]\*[rp] . ds doc-space\n[doc-arg-ptr] @@ -5091,7 +5091,7 @@ . . .\" NS doc-build-func-string macro -.\" NS collect function arguments and set hard spaces inbetween +.\" NS collect function arguments and set hard spaces in between .\" NS .\" NS modifies: .\" NS doc-func-arg Modified: vendor/groff/dist/tmac/groff_mdoc.man ============================================================================== --- vendor/groff/dist/tmac/groff_mdoc.man Thu Dec 8 12:31:47 2011 (r228349) +++ vendor/groff/dist/tmac/groff_mdoc.man Thu Dec 8 13:45:32 2011 (r228350) @@ -769,13 +769,18 @@ By default, the following architecture k . \# we use `No' to avoid hyphenation .Bd -ragged -offset indent -.No alpha , acorn26 , acorn32 , algor , amd64 , amiga , arc , arm26 , -.No arm32 , atari , bebox , cats , cesfic , cobalt , dreamcast , evbarm , -.No evbmips , evbppc , evbsh3 , hp300 , hp700 , hpcmips , i386 , luna68k , -.No m68k , mac68k , macppc , mips , mmeye , mvme68k , mvmeppc , netwinder , -.No news68k , newsmips , next68k , ofppc , pc532 , pmax , pmppc , powerpc , -.No prep , sandpoint , sgimips , sh3 , shark , sparc , sparc64 , sun3 , -.No tahoe , vax , x68k , x86_64 +.No acorn26 , acorn32 , algor , alpha , amd64 , amiga , amigappc , +.No arc , arm , arm26 , arm32 , armish , atari , aviion , +.No beagle , bebox , cats , cesfic , cobalt , dreamcast , +.No emips , evbarm , evbmips , evbppc , evbsh3 , ews4800mips , +.No hp300 , hp700 , hpcarm , hpcmips , hpcsh , hppa , hppa64 , +.No i386 , ia64 , ibmnws , iyonix , landisk , loongson , luna68k , luna88k , +.No m68k , mac68k , macppc , mips , mips64 , mipsco , mmeye , +.No mvme68k , mvme88k , mvmeppc , netwinder , news68k , newsmips , next68k , +.No ofppc , palm , pc532 , playstation2 , pmax , pmppc , powerpc , prep , +.No rs6000 , sandpoint , sbmips , sgi , sgimips , sh3 , shark , +.No socppc , solbourne , sparc , sparc64 , sun2 , sun3 , +.No tahoe , vax , x68k , x86_64 , xen , zaurus .Ed .Pp . @@ -864,23 +869,25 @@ the release ID. .It NetBSD 0.8, 0.8a, 0.9, 0.9a, 1.0, 1.0a, 1.1, 1.2, 1.2a, 1.2b, 1.2c, 1.2d, 1.2e, 1.3, 1.3a, 1.4, 1.4.1, 1.4.2, 1.4.3, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.6, 1.6.1, -1.6.2, 1.6.3, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.1, 3.0, 3.0.1, 3.0.2, 3.1, 4.0, -4.0.1, 5.0, 5.0.1, 5.0.2 +1.6.2, 1.6.3, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.1, 3.0, 3.0.1, 3.0.2, 3.0.3, +3.1, 3.1.1, 4.0, 4.0.1, 5.0, 5.0.1, 5.0.2, 5.1, 6.0 .It FreeBSD 1.0, 1.1, 1.1.5, 1.1.5.1, 2.0, 2.0.5, 2.1, 2.1.5, 2.1.6, 2.1.7, 2.2, 2.2.1, 2.2.2, 2.2.5, 2.2.6, 2.2.7, 2.2.8, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 4.0, 4.1, 4.1.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.6.2, 4.7, 4.8, 4.9, 4.10, 4.11, 5.0, 5.1, 5.2, 5.2.1, 5.3, 5.4, 5.5, 6.0, 6.1, 6.2, 6.3, 6.4, 7.0, 7.1, 7.2, 7.3, 8.0, -8.1 +8.1, 8.2, 9.0 .It OpenBSD 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, -3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8 +3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, +5.0 .It DragonFly 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 1.8.1, 1.10, 1.12, 1.12.2, 2.0, 2.2, -2.4, 2.6, 2.8 +2.4, 2.6, 2.8, 2.9, 2.9.1, 2.10, 2.10.1, 2.11 .It Darwin 8.0.0, 8.1.0, 8.2.0, 8.3.0, 8.4.0, 8.5.0, 8.6.0, 8.7.0, 8.8.0, 8.9.0, -8.10.0, 8.11.0, 9.0.0, 9.1.0, 9.2.0, 9.3.0, 9.4.0, 9.5.0, 9.6.0 +8.10.0, 8.11.0, 9.0.0, 9.1.0, 9.2.0, 9.3.0, 9.4.0, 9.5.0, 9.6.0, 9.7.0, +9.8.0, 10.1.0, 10.2.0, 10.3.0, 10.4.0, 10.5.0, 10.6.0, 10.7.0, 11.0.0 .El .Ed .Pp @@ -1673,33 +1680,73 @@ Available arguments to and their results are: . .Pp -.Bl -tag -width ".Li libossaudio" -compact -offset indent +.Bl -tag -width ".Li librpcsec_gss" -compact -offset indent +.It Li libarchive +.Lb libarchive .It Li libarm .Lb libarm .It Li libarm32 .Lb libarm32 +.It Li libbluetooth +.Lb libbluetooth +.It Li libbsm +.Lb libbsm .It Li libc .Lb libc +.It Li libc_r +.Lb libc_r +.It Li libcalendar +.Lb libcalendar +.It Li libcam +.Lb libcam .It Li libcdk .Lb libcdk +.It Li libcipher +.Lb libcipher .It Li libcompat .Lb libcompat .It Li libcrypt .Lb libcrypt .It Li libcurses .Lb libcurses +.It Li libdevinfo +.Lb libdevinfo +.It Li libdevstat +.Lb libdevstat +.It Li libdisk +.Lb libdisk +.It Li libdwarf +.Lb libdwarf .It Li libedit .Lb libedit +.It Li libelf +.Lb libelf .It Li libevent .Lb libevent +.It Li libfetch +.Lb libfetch .It Li libform .Lb libform +.It Li libgeom +.Lb libgeom +.It Li libgpib +.Lb libgpib .It Li libi386 .Lb libi386 .It Li libintl .Lb libintl .It Li libipsec .Lb libipsec +.It Li libipx +.Lb libipx +.It Li libiscsi +.Lb libiscsi +.It Li libjail +.Lb libjail +.It Li libkiconv +.Lb libkiconv +.It Li libkse +.Lb libkse .It Li libkvm .Lb libkvm .It Li libm @@ -1708,8 +1755,16 @@ and their results are: .Lb libm68k .It Li libmagic .Lb libmagic +.It Li libmd +.Lb libmd +.It Li libmemstat +.Lb libmemstat .It Li libmenu .Lb libmenu +.It Li libnetgraph +.Lb libnetgraph +.It Li libnetpgp +.Lb libnetpgp .It Li libossaudio .Lb libossaudio .It Li libpam @@ -1722,18 +1777,46 @@ and their results are: .Lb libpmc .It Li libposix .Lb libposix +.It Li libprop +.Lb libprop .It Li libpthread .Lb libpthread +.It Li libpuffs +.Lb libpuffs +.It Li librefuse +.Lb librefuse .It Li libresolv .Lb libresolv +.It Li librpcsec_gss +.Lb librpcsec_gss +.It Li librpcsvc +.Lb librpcsvc .It Li librt .Lb librt +.It Li libsdp +.Lb libsdp +.It Li libssp +.Lb libssp +.It Li libSystem +.Lb libSystem .It Li libtermcap .Lb libtermcap +.It Li libterminfo +.Lb libterminfo +.It Li libthr +.Lb libthr +.It Li libufs +.Lb libufs +.It Li libugidfw +.Lb libugidfw +.It Li libulog +.Lb libulog .It Li libusbhid .Lb libusbhid .It Li libutil .Lb libutil +.It Li libvgl +.Lb libvgl .It Li libx86_64 .Lb libx86_64 .It Li libz From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 13:54:07 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 288FB1065670; Thu, 8 Dec 2011 13:54:07 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15E238FC12; Thu, 8 Dec 2011 13:54:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB8Ds7Y1089481; Thu, 8 Dec 2011 13:54:07 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB8Ds6P2089475; Thu, 8 Dec 2011 13:54:06 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201112081354.pB8Ds6P2089475@svn.freebsd.org> From: Ruslan Ermilov Date: Thu, 8 Dec 2011 13:54:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228351 - in head: contrib/groff/tmac gnu/usr.bin/groff/tmac X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 13:54:07 -0000 Author: ru Date: Thu Dec 8 13:54:06 2011 New Revision: 228351 URL: http://svn.freebsd.org/changeset/base/228351 Log: Pull up vendor changes to mdoc(7). Modified: head/contrib/groff/tmac/doc-common head/contrib/groff/tmac/doc-syms head/contrib/groff/tmac/doc.tmac head/contrib/groff/tmac/groff_mdoc.man head/gnu/usr.bin/groff/tmac/mdoc.local Directory Properties: head/contrib/groff/ (props changed) Modified: head/contrib/groff/tmac/doc-common ============================================================================== --- head/contrib/groff/tmac/doc-common Thu Dec 8 13:45:32 2011 (r228350) +++ head/contrib/groff/tmac/doc-common Thu Dec 8 13:54:06 2011 (r228351) @@ -264,50 +264,72 @@ .ds doc-volume-as-algor algor .ds doc-volume-as-amd64 amd64 .ds doc-volume-as-amiga amiga +.ds doc-volume-as-amigappc amigappc .ds doc-volume-as-arc arc +.ds doc-volume-as-arm arm .ds doc-volume-as-arm26 arm26 .ds doc-volume-as-arm32 arm32 +.ds doc-volume-as-armish armish .ds doc-volume-as-atari atari +.ds doc-volume-as-aviion aviion +.ds doc-volume-as-beagle beagle .ds doc-volume-as-bebox bebox .ds doc-volume-as-cats cats .ds doc-volume-as-cesfic cesfic .ds doc-volume-as-cobalt cobalt .ds doc-volume-as-dreamcast dreamcast +.ds doc-volume-as-emips emips .ds doc-volume-as-evbarm evbarm .ds doc-volume-as-evbmips evbmips .ds doc-volume-as-evbppc evbppc .ds doc-volume-as-evbsh3 evbsh3 +.ds doc-volume-as-ews4800mips ews4800mips .ds doc-volume-as-hp300 hp300 .ds doc-volume-as-hp700 hp700 .ds doc-volume-as-hpcarm hpcarm .ds doc-volume-as-hpcmips hpcmips .ds doc-volume-as-hpcsh hpcsh +.ds doc-volume-as-hppa hppa +.ds doc-volume-as-hppa64 hppa64 .ds doc-volume-as-i386 i386 +.ds doc-volume-as-ia64 ia64 +.ds doc-volume-as-ibmnws ibmnws +.ds doc-volume-as-iyonix iyonix +.ds doc-volume-as-landisk landisk +.ds doc-volume-as-loongson loongson .ds doc-volume-as-luna68k luna68k +.ds doc-volume-as-luna88k luna88k .ds doc-volume-as-m68k m68k .ds doc-volume-as-mac68k mac68k .ds doc-volume-as-macppc macppc .ds doc-volume-as-mips mips +.ds doc-volume-as-mips64 mips64 .ds doc-volume-as-mipsco mipsco .ds doc-volume-as-mmeye mmeye .ds doc-volume-as-mvme68k mvme68k +.ds doc-volume-as-mvme88k mvme88k .ds doc-volume-as-mvmeppc mvmeppc .ds doc-volume-as-netwinder netwinder .ds doc-volume-as-news68k news68k .ds doc-volume-as-newsmips newsmips .ds doc-volume-as-next68k next68k .ds doc-volume-as-ofppc ofppc +.ds doc-volume-as-palm palm .ds doc-volume-as-pc532 pc532 .ds doc-volume-as-playstation2 playstation2 .ds doc-volume-as-pmax pmax .ds doc-volume-as-pmppc pmppc .ds doc-volume-as-powerpc powerpc .ds doc-volume-as-prep prep +.ds doc-volume-as-rs6000 rs6000 .ds doc-volume-as-sandpoint sandpoint .ds doc-volume-as-sbmips sbmips +.ds doc-volume-as-sgi sgi .ds doc-volume-as-sgimips sgimips .ds doc-volume-as-sh3 sh3 .ds doc-volume-as-shark shark +.ds doc-volume-as-socppc socppc +.ds doc-volume-as-solbourne solbourne .ds doc-volume-as-sparc sparc .ds doc-volume-as-sparc64 sparc64 .ds doc-volume-as-sun2 sun2 @@ -316,6 +338,8 @@ .ds doc-volume-as-vax vax .ds doc-volume-as-x68k x68k .ds doc-volume-as-x86_64 x86_64 +.ds doc-volume-as-xen xen +.ds doc-volume-as-zaurus zaurus . .de Dt . \" reset default arguments @@ -451,12 +475,16 @@ .ds doc-operating-system-NetBSD-3.0 3.0 .ds doc-operating-system-NetBSD-3.0.1 3.0.1 .ds doc-operating-system-NetBSD-3.0.2 3.0.2 +.ds doc-operating-system-NetBSD-3.0.3 3.0.3 .ds doc-operating-system-NetBSD-3.1 3.1 +.ds doc-operating-system-NetBSD-3.1.1 3.1.1 .ds doc-operating-system-NetBSD-4.0 4.0 .ds doc-operating-system-NetBSD-4.0.1 4.0.1 .ds doc-operating-system-NetBSD-5.0 5.0 .ds doc-operating-system-NetBSD-5.0.1 5.0.1 .ds doc-operating-system-NetBSD-5.0.2 5.0.2 +.ds doc-operating-system-NetBSD-5.1 5.1 +.ds doc-operating-system-NetBSD-6.0 6.0 . .ds doc-operating-system-OpenBSD-2.0 2.0 .ds doc-operating-system-OpenBSD-2.1 2.1 @@ -487,6 +515,8 @@ .ds doc-operating-system-OpenBSD-4.6 4.6 .ds doc-operating-system-OpenBSD-4.7 4.7 .ds doc-operating-system-OpenBSD-4.8 4.8 +.ds doc-operating-system-OpenBSD-4.9 4.9 +.ds doc-operating-system-OpenBSD-5.0 5.0 . .ds doc-operating-system-FreeBSD-1.0 1.0 .ds doc-operating-system-FreeBSD-1.1 1.1 @@ -544,6 +574,7 @@ .ds doc-operating-system-FreeBSD-8.0 8.0 .ds doc-operating-system-FreeBSD-8.1 8.1 .ds doc-operating-system-FreeBSD-8.2 8.2 +.ds doc-operating-system-FreeBSD-9.0 9.0 . .ds doc-operating-system-Darwin-8.0.0 8.0.0 .ds doc-operating-system-Darwin-8.1.0 8.1.0 @@ -566,7 +597,6 @@ .ds doc-operating-system-Darwin-9.6.0 9.6.0 .ds doc-operating-system-Darwin-9.7.0 9.7.0 .ds doc-operating-system-Darwin-9.8.0 9.8.0 -.ds doc-operating-system-Darwin-10.6.0 10.6.0 .ds doc-operating-system-Darwin-10.1.0 10.1.0 .ds doc-operating-system-Darwin-10.2.0 10.2.0 .ds doc-operating-system-Darwin-10.3.0 10.3.0 @@ -593,6 +623,11 @@ .ds doc-operating-system-DragonFly-2.4 2.4 .ds doc-operating-system-DragonFly-2.6 2.6 .ds doc-operating-system-DragonFly-2.8 2.8 +.ds doc-operating-system-DragonFly-2.9 2.9 +.ds doc-operating-system-DragonFly-2.9.1 2.9.1 +.ds doc-operating-system-DragonFly-2.10 2.10 +.ds doc-operating-system-DragonFly-2.10.1 2.10.1 +.ds doc-operating-system-DragonFly-2.11 2.11 . .de Os . ds doc-command-name Modified: head/contrib/groff/tmac/doc-syms ============================================================================== --- head/contrib/groff/tmac/doc-syms Thu Dec 8 13:45:32 2011 (r228350) +++ head/contrib/groff/tmac/doc-syms Thu Dec 8 13:54:06 2011 (r228351) @@ -754,38 +754,74 @@ .\" NS .\" NS width register `Lb' defined in doc-common . +.ds doc-str-Lb-libarchive Reading and Writing Streaming Archives Library (libarchive, \-larchive) .ds doc-str-Lb-libarm ARM Architecture Library (libarm, \-larm) .ds doc-str-Lb-libarm32 ARM32 Architecture Library (libarm32, \-larm32) +.ds doc-str-Lb-libbluetooth Bluetooth Library (libbluetooth, \-lbluetooth) .ds doc-str-Lb-libbsm Basic Security Module Library (libbsm, \-lbsm) .ds doc-str-Lb-libc Standard C\~Library (libc, \-lc) +.ds doc-str-Lb-libc_r Reentrant C\~Library (libc_r, \-lc_r) +.ds doc-str-Lb-libcalendar Calendar Arithmetic Library (libcalendar, \-lcalendar) +.ds doc-str-Lb-libcam Common Access Method User Library (libcam, \-lcam) .ds doc-str-Lb-libcdk Curses Development Kit Library (libcdk, \-lcdk) +.ds doc-str-Lb-libcipher FreeSec Crypt Library (libcipher, \-lcipher) .ds doc-str-Lb-libcompat Compatibility Library (libcompat, \-lcompat) .ds doc-str-Lb-libcrypt Crypt Library (libcrypt, \-lcrypt) .ds doc-str-Lb-libcurses Curses Library (libcurses, \-lcurses) +.ds doc-str-Lb-libdevinfo Device and Resource Information Utility Library (libdevinfo, \-ldevinfo) +.ds doc-str-Lb-libdevstat Device Statistics Library (libdevstat, \-ldevstat) +.ds doc-str-Lb-libdisk Interface to Slice and Partition Labels Library (libdisk, \-ldisk) +.ds doc-str-Lb-libdwarf DWARF Access Library (libdwarf, \-ldwarf) .ds doc-str-Lb-libedit Command Line Editor Library (libedit, \-ledit) +.ds doc-str-Lb-libelf ELF Access Library (libelf, \-lelf) .ds doc-str-Lb-libevent Event Notification Library (libevent, \-levent) +.ds doc-str-Lb-libfetch File Transfer Library for URLs (libfetch, \-lfetch) .ds doc-str-Lb-libform Curses Form Library (libform, \-lform) +.ds doc-str-Lb-libgeom Userland API Library for kernel GEOM subsystem (libgeom, \-lgeom) +.ds doc-str-Lb-libgpib General-Purpose Instrument Bus (GPIB) library (libgpib, \-lgpib) .ds doc-str-Lb-libi386 i386 Architecture Library (libi386, \-li386) .ds doc-str-Lb-libintl Internationalized Message Handling Library (libintl, \-lintl) .ds doc-str-Lb-libipsec IPsec Policy Control Library (libipsec, \-lipsec) +.ds doc-str-Lb-libipx IPX Address Conversion Support Library (libipx, \-lipx) +.ds doc-str-Lb-libiscsi iSCSI protocol library (libiscsi, \-liscsi) +.ds doc-str-Lb-libjail Jail Library (libjail, \-ljail) +.ds doc-str-Lb-libkiconv Kernel side iconv library (libkiconv, \-lkiconv) +.ds doc-str-Lb-libkse N:M Threading Library (libkse, \-lkse) .ds doc-str-Lb-libkvm Kernel Data Access Library (libkvm, \-lkvm) .ds doc-str-Lb-libm Math Library (libm, \-lm) .ds doc-str-Lb-libm68k m68k Architecture Library (libm68k, \-lm68k) .ds doc-str-Lb-libmagic Magic Number Recognition Library (libmagic, \-lmagic) +.ds doc-str-Lb-libmd Message Digest (MD4, MD5, etc.) Support Library (libmd, \-lmd) +.ds doc-str-Lb-libmemstat Kernel Memory Allocator Statistics Library (libmemstat, \-lmemstat) .ds doc-str-Lb-libmenu Curses Menu Library (libmenu, \-lmenu) +.ds doc-str-Lb-libnetgraph Netgraph User Library (libnetgraph, \-lnetgraph) +.ds doc-str-Lb-libnetpgp Netpgp signing, verification, encryption and decryption (libnetpgp, \-lnetpgp) .ds doc-str-Lb-libossaudio OSS Audio Emulation Library (libossaudio, \-lossaudio) .ds doc-str-Lb-libpam Pluggable Authentication Module Library (libpam, \-lpam) .ds doc-str-Lb-libpcap Packet Capture Library (libpcap, \-lpcap) .ds doc-str-Lb-libpci PCI Bus Access Library (libpci, \-lpci) .ds doc-str-Lb-libpmc Performance Counters Library (libpmc, \-lpmc) .ds doc-str-Lb-libposix \*[Px] \*[doc-str-Lb]Compatibility Library (libposix, \-lposix) +.ds doc-str-Lb-libprop Property Container Object Library (libprop, \-lprop) .ds doc-str-Lb-libpthread \*[Px] \*[doc-str-Lb]Threads Library (libpthread, \-lpthread) +.ds doc-str-Lb-libpuffs puffs Convenience Library (libpuffs, \-lpuffs) +.ds doc-str-Lb-librefuse File System in Userspace Convenience Library (librefuse, \-lrefuse) .ds doc-str-Lb-libresolv DNS Resolver Library (libresolv, \-lresolv) +.ds doc-str-Lb-librpcsec_gss RPC GSS-API Authentication Library (librpcsec_gss, \-lrpcsec_gss) +.ds doc-str-Lb-librpcsvc RPC Service Library (librpcsvc, \-lrpcsvc) .ds doc-str-Lb-librt \*[Px] \*[doc-str-Lb]Real-time Library (librt, \-lrt) +.ds doc-str-Lb-libsdp Bluetooth Service Discovery Protocol User Library (libsdp, \-lsdp) +.ds doc-str-Lb-libssp Buffer Overflow Protection Library (libssp, \-lssp) .ds doc-str-Lb-libSystem System Library (libSystem, \-lSystem) .ds doc-str-Lb-libtermcap Termcap Access Library (libtermcap, \-ltermcap) +.ds doc-str-Lb-libterminfo Terminal Information Library (libterminfo, \-lterminfo) +.ds doc-str-Lb-libthr 1:1 Threading Library (libthr, \-lthr) +.ds doc-str-Lb-libufs UFS File System Access Library (libufs, \-lufs) +.ds doc-str-Lb-libugidfw File System Firewall Interface Library (libugidfw, \-lugidfw) +.ds doc-str-Lb-libulog User Login Record Library (libulog, \-lulog) .ds doc-str-Lb-libusbhid USB Human Interface Devices Library (libusbhid, \-lusbhid) .ds doc-str-Lb-libutil System Utilities Library (libutil, \-lutil) +.ds doc-str-Lb-libvgl Video Graphics Library (libvgl, \-lvgl) .ds doc-str-Lb-libx86_64 x86_64 Architecture Library (libx86_64, \-lx86_64) .ds doc-str-Lb-libz Compression Library (libz, \-lz) . Modified: head/contrib/groff/tmac/doc.tmac ============================================================================== --- head/contrib/groff/tmac/doc.tmac Thu Dec 8 13:45:32 2011 (r228350) +++ head/contrib/groff/tmac/doc.tmac Thu Dec 8 13:54:06 2011 (r228351) @@ -4268,7 +4268,7 @@ . if (\n[doc-arg-limit] > \n[doc-arg-ptr]) \{\ . nr doc-reg-Xr (\n[doc-arg-ptr] + 1) . \" modify second argument if it is a string and -. \" remove space inbetween +. \" remove space in between . if (\n[doc-type\n[doc-reg-Xr]] == 2) \{\ . ds doc-arg\n[doc-reg-Xr] \*[lp]\*[doc-arg\n[doc-reg-Xr]]\*[rp] . ds doc-space\n[doc-arg-ptr] @@ -5091,7 +5091,7 @@ . . .\" NS doc-build-func-string macro -.\" NS collect function arguments and set hard spaces inbetween +.\" NS collect function arguments and set hard spaces in between .\" NS .\" NS modifies: .\" NS doc-func-arg Modified: head/contrib/groff/tmac/groff_mdoc.man ============================================================================== --- head/contrib/groff/tmac/groff_mdoc.man Thu Dec 8 13:45:32 2011 (r228350) +++ head/contrib/groff/tmac/groff_mdoc.man Thu Dec 8 13:54:06 2011 (r228351) @@ -769,13 +769,18 @@ By default, the following architecture k . \# we use `No' to avoid hyphenation .Bd -ragged -offset indent -.No alpha , acorn26 , acorn32 , algor , amd64 , amiga , arc , arm26 , -.No arm32 , atari , bebox , cats , cesfic , cobalt , dreamcast , evbarm , -.No evbmips , evbppc , evbsh3 , hp300 , hp700 , hpcmips , i386 , luna68k , -.No m68k , mac68k , macppc , mips , mmeye , mvme68k , mvmeppc , netwinder , -.No news68k , newsmips , next68k , ofppc , pc532 , pmax , pmppc , powerpc , -.No prep , sandpoint , sgimips , sh3 , shark , sparc , sparc64 , sun3 , -.No tahoe , vax , x68k , x86_64 +.No acorn26 , acorn32 , algor , alpha , amd64 , amiga , amigappc , +.No arc , arm , arm26 , arm32 , armish , atari , aviion , +.No beagle , bebox , cats , cesfic , cobalt , dreamcast , +.No emips , evbarm , evbmips , evbppc , evbsh3 , ews4800mips , +.No hp300 , hp700 , hpcarm , hpcmips , hpcsh , hppa , hppa64 , +.No i386 , ia64 , ibmnws , iyonix , landisk , loongson , luna68k , luna88k , +.No m68k , mac68k , macppc , mips , mips64 , mipsco , mmeye , +.No mvme68k , mvme88k , mvmeppc , netwinder , news68k , newsmips , next68k , +.No ofppc , palm , pc532 , playstation2 , pmax , pmppc , powerpc , prep , +.No rs6000 , sandpoint , sbmips , sgi , sgimips , sh3 , shark , +.No socppc , solbourne , sparc , sparc64 , sun2 , sun3 , +.No tahoe , vax , x68k , x86_64 , xen , zaurus .Ed .Pp . @@ -864,23 +869,25 @@ the release ID. .It NetBSD 0.8, 0.8a, 0.9, 0.9a, 1.0, 1.0a, 1.1, 1.2, 1.2a, 1.2b, 1.2c, 1.2d, 1.2e, 1.3, 1.3a, 1.4, 1.4.1, 1.4.2, 1.4.3, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.6, 1.6.1, -1.6.2, 1.6.3, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.1, 3.0, 3.0.1, 3.0.2, 3.1, 4.0, -4.0.1, 5.0, 5.0.1, 5.0.2 +1.6.2, 1.6.3, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.1, 3.0, 3.0.1, 3.0.2, 3.0.3, +3.1, 3.1.1, 4.0, 4.0.1, 5.0, 5.0.1, 5.0.2, 5.1, 6.0 .It FreeBSD 1.0, 1.1, 1.1.5, 1.1.5.1, 2.0, 2.0.5, 2.1, 2.1.5, 2.1.6, 2.1.7, 2.2, 2.2.1, 2.2.2, 2.2.5, 2.2.6, 2.2.7, 2.2.8, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 4.0, 4.1, 4.1.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.6.2, 4.7, 4.8, 4.9, 4.10, 4.11, 5.0, 5.1, 5.2, 5.2.1, 5.3, 5.4, 5.5, 6.0, 6.1, 6.2, 6.3, 6.4, 7.0, 7.1, 7.2, 7.3, 8.0, -8.1 +8.1, 8.2, 9.0 .It OpenBSD 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, -3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8 +3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9, +5.0 .It DragonFly 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.8, 1.8.1, 1.10, 1.12, 1.12.2, 2.0, 2.2, -2.4, 2.6, 2.8 +2.4, 2.6, 2.8, 2.9, 2.9.1, 2.10, 2.10.1, 2.11 .It Darwin 8.0.0, 8.1.0, 8.2.0, 8.3.0, 8.4.0, 8.5.0, 8.6.0, 8.7.0, 8.8.0, 8.9.0, -8.10.0, 8.11.0, 9.0.0, 9.1.0, 9.2.0, 9.3.0, 9.4.0, 9.5.0, 9.6.0 +8.10.0, 8.11.0, 9.0.0, 9.1.0, 9.2.0, 9.3.0, 9.4.0, 9.5.0, 9.6.0, 9.7.0, +9.8.0, 10.1.0, 10.2.0, 10.3.0, 10.4.0, 10.5.0, 10.6.0, 10.7.0, 11.0.0 .El .Ed .Pp @@ -1673,33 +1680,73 @@ Available arguments to and their results are: . .Pp -.Bl -tag -width ".Li libossaudio" -compact -offset indent +.Bl -tag -width ".Li librpcsec_gss" -compact -offset indent +.It Li libarchive +.Lb libarchive .It Li libarm .Lb libarm .It Li libarm32 .Lb libarm32 +.It Li libbluetooth +.Lb libbluetooth +.It Li libbsm +.Lb libbsm .It Li libc .Lb libc +.It Li libc_r +.Lb libc_r +.It Li libcalendar +.Lb libcalendar +.It Li libcam +.Lb libcam .It Li libcdk .Lb libcdk +.It Li libcipher +.Lb libcipher .It Li libcompat .Lb libcompat .It Li libcrypt .Lb libcrypt .It Li libcurses .Lb libcurses +.It Li libdevinfo +.Lb libdevinfo +.It Li libdevstat +.Lb libdevstat +.It Li libdisk +.Lb libdisk +.It Li libdwarf +.Lb libdwarf .It Li libedit .Lb libedit +.It Li libelf +.Lb libelf .It Li libevent .Lb libevent +.It Li libfetch +.Lb libfetch .It Li libform .Lb libform +.It Li libgeom +.Lb libgeom +.It Li libgpib +.Lb libgpib .It Li libi386 .Lb libi386 .It Li libintl .Lb libintl .It Li libipsec .Lb libipsec +.It Li libipx +.Lb libipx +.It Li libiscsi +.Lb libiscsi +.It Li libjail +.Lb libjail +.It Li libkiconv +.Lb libkiconv +.It Li libkse +.Lb libkse .It Li libkvm .Lb libkvm .It Li libm @@ -1708,8 +1755,16 @@ and their results are: .Lb libm68k .It Li libmagic .Lb libmagic +.It Li libmd +.Lb libmd +.It Li libmemstat +.Lb libmemstat .It Li libmenu .Lb libmenu +.It Li libnetgraph +.Lb libnetgraph +.It Li libnetpgp +.Lb libnetpgp .It Li libossaudio .Lb libossaudio .It Li libpam @@ -1722,18 +1777,46 @@ and their results are: .Lb libpmc .It Li libposix .Lb libposix +.It Li libprop +.Lb libprop .It Li libpthread .Lb libpthread +.It Li libpuffs +.Lb libpuffs +.It Li librefuse +.Lb librefuse .It Li libresolv .Lb libresolv +.It Li librpcsec_gss +.Lb librpcsec_gss +.It Li librpcsvc +.Lb librpcsvc .It Li librt .Lb librt +.It Li libsdp +.Lb libsdp +.It Li libssp +.Lb libssp +.It Li libSystem +.Lb libSystem .It Li libtermcap .Lb libtermcap +.It Li libterminfo +.Lb libterminfo +.It Li libthr +.Lb libthr +.It Li libufs +.Lb libufs +.It Li libugidfw +.Lb libugidfw +.It Li libulog +.Lb libulog .It Li libusbhid .Lb libusbhid .It Li libutil .Lb libutil +.It Li libvgl +.Lb libvgl .It Li libx86_64 .Lb libx86_64 .It Li libz Modified: head/gnu/usr.bin/groff/tmac/mdoc.local ============================================================================== --- head/gnu/usr.bin/groff/tmac/mdoc.local Thu Dec 8 13:45:32 2011 (r228350) +++ head/gnu/usr.bin/groff/tmac/mdoc.local Thu Dec 8 13:54:06 2011 (r228351) @@ -34,41 +34,14 @@ .\" FreeBSD .Lb values .ds doc-str-Lb-libarchive Streaming Archive Library (libarchive, \-larchive) .ds doc-str-Lb-libbluetooth Bluetooth User Library (libbluetooth, \-lbluetooth) -.ds doc-str-Lb-libc_r Reentrant C\~Library (libc_r, \-lc_r) -.ds doc-str-Lb-libcalendar Calendar Arithmetic Library (libcalendar, \-lcalendar) -.ds doc-str-Lb-libcam Common Access Method User Library (libcam, \-lcam) -.ds doc-str-Lb-libcipher FreeSec Crypt Library (libcipher, \-lcipher) -.ds doc-str-Lb-libdevinfo Device and Resource Information Utility Library (libdevinfo, \-ldevinfo) -.ds doc-str-Lb-libdevstat Device Statistics Library (libdevstat, \-ldevstat) -.ds doc-str-Lb-libdisk Interface to Slice and Partition Labels Library (libdisk, \-ldisk) .ds doc-str-Lb-libedit Line Editor and History Library (libedit, \-ledit) .ds doc-str-Lb-libefi EFI Runtime Services Library (libefi, \-lefi) .ds doc-str-Lb-libelf ELF Parsing Library (libelf, \-lelf) .ds doc-str-Lb-libfetch File Transfer Library (libfetch, \-lfetch) -.ds doc-str-Lb-libgeom Userland API Library for kernel GEOM subsystem (libgeom, \-lgeom) -.ds doc-str-Lb-libgpib General-Purpose Instrument Bus (GPIB) library (libgpib, \-lgpib) -.ds doc-str-Lb-libipx IPX Address Conversion Support Library (libipx, \-lipx) -.ds doc-str-Lb-libjail Jail Library (libjail, \-ljail) -.ds doc-str-Lb-libkiconv Kernel side iconv library (libkiconv, \-lkiconv) -.ds doc-str-Lb-libkse N:M Threading Library (libkse, \-lkse) -.ds doc-str-Lb-libmd Message Digest (MD4, MD5, etc.) Support Library (libmd, \-lmd) -.ds doc-str-Lb-libmemstat Kernel Memory Allocator Statistics Library (libmemstat, \-lmemstat) -.ds doc-str-Lb-libnetgraph Netgraph User Library (libnetgraph, \-lnetgraph) .ds doc-str-Lb-libpmc Performance Monitoring Counters Interface Library (libpmc, \-lpmc) .ds doc-str-Lb-libproc Processor Monitoring and Analysis Library (libproc, \-lproc) .ds doc-str-Lb-libprocstat Process and Files Information Retrieval (libprocstat, \-lprocstat) -.ds doc-str-Lb-librpcsec_gss RPC GSS-API Authentication Library (librpcsec_gss, \-lrpcsec_gss) -.ds doc-str-Lb-librpcsvc RPC Service Library (librpcsvc, \-lrpcsvc) .ds doc-str-Lb-librtld_db Run-time Linker Debugging Library (librtld_db, \-lrtld_db) -.ds doc-str-Lb-libsdp Bluetooth Service Discovery Protocol User Library (libsdp, \-lsdp) -.ds doc-str-Lb-libthr 1:1 Threading Library (libthr, \-lthr) -.ds doc-str-Lb-libufs UFS File System Access Library (libufs, \-lufs) -.ds doc-str-Lb-libugidfw File System Firewall Interface Library (libugidfw, \-lugidfw) -.ds doc-str-Lb-libulog User Login Record Library (libulog, \-lulog) -.ds doc-str-Lb-libvgl Video Graphics Library (libvgl, \-lvgl) -. -.\" FreeBSD architectures not found in doc-common -.ds doc-volume-as-arm arm . .\" Default .Os value .ds doc-default-operating-system FreeBSD\~10.0 @@ -76,7 +49,6 @@ .\" FreeBSD releases not found in doc-common .ds doc-operating-system-FreeBSD-7.4 7.4 .ds doc-operating-system-FreeBSD-8.3 8.3 -.ds doc-operating-system-FreeBSD-9.0 9.0 .ds doc-operating-system-FreeBSD-10.0 10.0 . .\" Definitions not (yet) in doc-syms From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 17:49:20 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 569B21065675; Thu, 8 Dec 2011 17:49:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 02CD38FC08; Thu, 8 Dec 2011 17:49:20 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id AAB1946B0D; Thu, 8 Dec 2011 12:49:19 -0500 (EST) Received: from John-Baldwins-MacBook-Air.local (c-68-36-150-83.hsd1.nj.comcast.net [68.36.150.83]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 18139B93A; Thu, 8 Dec 2011 12:49:19 -0500 (EST) Message-ID: <4EE0F89E.1070107@FreeBSD.org> Date: Thu, 08 Dec 2011 12:49:18 -0500 From: John Baldwin User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Luigi Rizzo References: <201112051533.pB5FXEuh043063@svn.freebsd.org> <20111205183854.GC54475@alchemy.franken.de> <20111205193150.GB49118@onelab2.iet.unipi.it> In-Reply-To: <20111205193150.GB49118@onelab2.iet.unipi.it> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 08 Dec 2011 12:49:19 -0500 (EST) Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org, Marius Strobl Subject: Re: svn commit: r228281 - in head/sys/dev: e1000 re X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 17:49:20 -0000 On 12/5/11 2:31 PM, Luigi Rizzo wrote: > On Mon, Dec 05, 2011 at 07:38:54PM +0100, Marius Strobl wrote: >> On Mon, Dec 05, 2011 at 03:33:14PM +0000, Luigi Rizzo wrote: > ... >>> +#ifdef DEV_NETMAP >>> + if (slot) { >>> + int si = i + na->tx_rings[txr->me].nkr_hwofs; >>> + void *addr; >>> + >>> + if (si>= na->num_tx_desc) >>> + si -= na->num_tx_desc; >>> + addr = NMB(slot + si); >>> + txr->tx_base[i].buffer_addr = >>> + htole64(vtophys(addr)); >>> + /* reload the map for netmap mode */ >>> + netmap_load_map(txr->txtag, >>> + txbuf->map, addr, na->buff_size); >>> + } >>> +#endif /* DEV_NETMAP */ >> >> Can these vtophys(9) usages be fixed to use bus_dma(9) instead so netmap >> works with bounce buffers, IOMMUs etc? > > maybe. Can you suggest how to change it ? > > Consider that (not here but in other places) vtophys() is called > in a time-critical loop so performance matters a lot. As long as i > can compute the physical address in advance and cache it in my own > array, i suppose that should be fine (in which case the calls to > vtophys(addr) would become NMPB(slot + si) where the NMPB() macro > would hide translations and checks. For your use case, you probably don't want to be coping with bounce buffers at all. That is, if you are preallocating long-lived buffers that keep getting reused while netmap is active that are allocated at startup and free'd at teardown, you probably want to allocate buffers that won't require bounce buffers. That means you have to let the drivers allocate the buffers (or give you a suitable bus_dma tag since different devices have different addressing requirements, etc.). You could then use bus_dmamem_alloc() to allocate your buffers. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 18:13:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D79B106566B; Thu, 8 Dec 2011 18:13:24 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id 0BCE78FC14; Thu, 8 Dec 2011 18:13:22 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 7EF597300A; Thu, 8 Dec 2011 19:29:32 +0100 (CET) Date: Thu, 8 Dec 2011 19:29:32 +0100 From: Luigi Rizzo To: John Baldwin Message-ID: <20111208182932.GA82488@onelab2.iet.unipi.it> References: <201112051533.pB5FXEuh043063@svn.freebsd.org> <20111205183854.GC54475@alchemy.franken.de> <20111205193150.GB49118@onelab2.iet.unipi.it> <4EE0F89E.1070107@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4EE0F89E.1070107@FreeBSD.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org, Marius Strobl Subject: Re: svn commit: r228281 - in head/sys/dev: e1000 re X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 18:13:24 -0000 On Thu, Dec 08, 2011 at 12:49:18PM -0500, John Baldwin wrote: > On 12/5/11 2:31 PM, Luigi Rizzo wrote: > >On Mon, Dec 05, 2011 at 07:38:54PM +0100, Marius Strobl wrote: > >>On Mon, Dec 05, 2011 at 03:33:14PM +0000, Luigi Rizzo wrote: > >... > >>>+#ifdef DEV_NETMAP > >>>+ if (slot) { > >>>+ int si = i + na->tx_rings[txr->me].nkr_hwofs; > >>>+ void *addr; > >>>+ > >>>+ if (si>= na->num_tx_desc) > >>>+ si -= na->num_tx_desc; > >>>+ addr = NMB(slot + si); > >>>+ txr->tx_base[i].buffer_addr = > >>>+ htole64(vtophys(addr)); > >>>+ /* reload the map for netmap mode */ > >>>+ netmap_load_map(txr->txtag, > >>>+ txbuf->map, addr, na->buff_size); > >>>+ } > >>>+#endif /* DEV_NETMAP */ > >> > >>Can these vtophys(9) usages be fixed to use bus_dma(9) instead so netmap > >>works with bounce buffers, IOMMUs etc? > > > >maybe. Can you suggest how to change it ? > > > >Consider that (not here but in other places) vtophys() is called > >in a time-critical loop so performance matters a lot. As long as i > >can compute the physical address in advance and cache it in my own > >array, i suppose that should be fine (in which case the calls to > >vtophys(addr) would become NMPB(slot + si) where the NMPB() macro > >would hide translations and checks. > > For your use case, you probably don't want to be coping with bounce > buffers at all. That is, if you are preallocating long-lived buffers > that keep getting reused while netmap is active that are allocated at > startup and free'd at teardown, you probably want to allocate buffers > that won't require bounce buffers. That means you have to let the > drivers allocate the buffers (or give you a suitable bus_dma tag since > different devices have different addressing requirements, etc.). You > could then use bus_dmamem_alloc() to allocate your buffers. certainly i don't want to use netmap with bounce buffers. I am not sure about IOMMU (I basically don't need it but maybe using a compatible API is always nice). Right now i am allocating a huge chunk of memory with contigmalloc. Ryan Stone suggested that a plain malloc may work as well (as long as i make sure that each buffer is within a single page). Eventually I may want to play with cache alignment (also suggested by Ryan) so allocate smaller chunks of contigmalloc'ed memory (say each buffer is 2K - 64 bytes, then a contiguous block of 64K fits exactly 33 buffers). cheers luigi may also work as long as i make sure th > > -- > John Baldwin From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 18:25:27 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 250581065672; Thu, 8 Dec 2011 18:25:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id D96898FC0A; Thu, 8 Dec 2011 18:25:26 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 7386046B3B; Thu, 8 Dec 2011 13:25:26 -0500 (EST) Received: from John-Baldwins-MacBook-Air.local (c-68-36-150-83.hsd1.nj.comcast.net [68.36.150.83]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D20B5B93E; Thu, 8 Dec 2011 13:25:25 -0500 (EST) Message-ID: <4EE10115.3050309@FreeBSD.org> Date: Thu, 08 Dec 2011 13:25:25 -0500 From: John Baldwin User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Luigi Rizzo References: <201112051533.pB5FXEuh043063@svn.freebsd.org> <20111205183854.GC54475@alchemy.franken.de> <20111205193150.GB49118@onelab2.iet.unipi.it> <4EE0F89E.1070107@FreeBSD.org> <20111208182932.GA82488@onelab2.iet.unipi.it> In-Reply-To: <20111208182932.GA82488@onelab2.iet.unipi.it> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 08 Dec 2011 13:25:26 -0500 (EST) Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org, Marius Strobl Subject: Re: svn commit: r228281 - in head/sys/dev: e1000 re X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 18:25:27 -0000 On 12/8/11 1:29 PM, Luigi Rizzo wrote: > On Thu, Dec 08, 2011 at 12:49:18PM -0500, John Baldwin wrote: >> On 12/5/11 2:31 PM, Luigi Rizzo wrote: >>> On Mon, Dec 05, 2011 at 07:38:54PM +0100, Marius Strobl wrote: >>>> On Mon, Dec 05, 2011 at 03:33:14PM +0000, Luigi Rizzo wrote: >>> ... >>>>> +#ifdef DEV_NETMAP >>>>> + if (slot) { >>>>> + int si = i + na->tx_rings[txr->me].nkr_hwofs; >>>>> + void *addr; >>>>> + >>>>> + if (si>= na->num_tx_desc) >>>>> + si -= na->num_tx_desc; >>>>> + addr = NMB(slot + si); >>>>> + txr->tx_base[i].buffer_addr = >>>>> + htole64(vtophys(addr)); >>>>> + /* reload the map for netmap mode */ >>>>> + netmap_load_map(txr->txtag, >>>>> + txbuf->map, addr, na->buff_size); >>>>> + } >>>>> +#endif /* DEV_NETMAP */ >>>> >>>> Can these vtophys(9) usages be fixed to use bus_dma(9) instead so netmap >>>> works with bounce buffers, IOMMUs etc? >>> >>> maybe. Can you suggest how to change it ? >>> >>> Consider that (not here but in other places) vtophys() is called >>> in a time-critical loop so performance matters a lot. As long as i >>> can compute the physical address in advance and cache it in my own >>> array, i suppose that should be fine (in which case the calls to >>> vtophys(addr) would become NMPB(slot + si) where the NMPB() macro >>> would hide translations and checks. >> >> For your use case, you probably don't want to be coping with bounce >> buffers at all. That is, if you are preallocating long-lived buffers >> that keep getting reused while netmap is active that are allocated at >> startup and free'd at teardown, you probably want to allocate buffers >> that won't require bounce buffers. That means you have to let the >> drivers allocate the buffers (or give you a suitable bus_dma tag since >> different devices have different addressing requirements, etc.). You >> could then use bus_dmamem_alloc() to allocate your buffers. > > certainly i don't want to use netmap with bounce buffers. > I am not sure about IOMMU (I basically don't need it but maybe > using a compatible API is always nice). Right now i am allocating > a huge chunk of memory with contigmalloc. > Ryan Stone suggested that a plain malloc may work as well (as long > as i make sure that each buffer is within a single page). > Eventually I may want to play with cache alignment (also suggested by Ryan) > so allocate smaller chunks of contigmalloc'ed memory (say each buffer > is 2K - 64 bytes, then a contiguous block of 64K fits exactly 33 buffers). Right, you should use bus_dmamem_alloc() instead. Internally it calls contigmalloc(). However, it will only allocate memory that your device can safely use (so if you are using a NIC that can only do 32-bit DMA addresses, it will allocate pages below 4GB avoiding bounce buffering). For the IOMMU case it will usually allocate memory from the region that is statically mapped into the IOMMU (at least some IOMMU's split the DVMA address space into two types: a mostly static region for things like descriptor rings, etc. and a dynamic region for transient I/O buffers like mbufs). If you want to design an interface that will work with a wide variety of hardware and not just ixgbe on Intel, then using bus_dma to manage DMA buffers is the correct approach. Also, back to IOMMU, if the device is doing DMA into this buffer, then you _must_ use the IOMMU on certain platforms (e.g. sparc64, probably some embedded platforms where netmap might be very nice to have). -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 18:30:37 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDD47106564A; Thu, 8 Dec 2011 18:30:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 836EB8FC15; Thu, 8 Dec 2011 18:30:37 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 34EE346B23; Thu, 8 Dec 2011 13:30:37 -0500 (EST) Received: from John-Baldwins-MacBook-Air.local (c-68-36-150-83.hsd1.nj.comcast.net [68.36.150.83]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 99A0AB93E; Thu, 8 Dec 2011 13:30:36 -0500 (EST) Message-ID: <4EE1024C.6040800@FreeBSD.org> Date: Thu, 08 Dec 2011 13:30:36 -0500 From: John Baldwin User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Mikolaj Golub References: <201111242054.pAOKs6vj012296@svn.freebsd.org> <201111281330.11720.jhb@freebsd.org> <86liqt1ier.fsf@kopusha.home.net> In-Reply-To: <86liqt1ier.fsf@kopusha.home.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 08 Dec 2011 13:30:36 -0500 (EST) Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Kostik Belousov Subject: Re: svn commit: r227956 - head/usr.bin/procstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 18:30:37 -0000 On 12/3/11 3:58 PM, Mikolaj Golub wrote: > > On Mon, 28 Nov 2011 13:30:11 -0500 John Baldwin wrote: > > JB> On Thursday, November 24, 2011 3:54:06 pm Mikolaj Golub wrote: > >> Author: trociny > >> Date: Thu Nov 24 20:54:06 2011 > >> New Revision: 227956 > >> URL: http://svn.freebsd.org/changeset/base/227956 > >> > >> Log: > >> usr.bin/procstat > >> > >> Add -l flag to display resource limits. > >> > >> PR: bin/161257 > >> Reviewed by: kib > >> MFC after: 2 weeks > > JB> Thanks for doing this! Did you consider making the procstat -l output use > JB> "pretty" output similar to the output of /usr/bin/limits? For example, > JB> using "infinity" instead of -1 and using humanize_number() for finite limits > JB> that are in units of bytes? > > I tried several variants, from one where for rlimit names rlimit_ident > constants from sys/resource.h are used and units are printed as suffixes: > > PID COMM RLIMIT SOFT HARD > 46150 zsh cpu 100000S infinity > 46150 zsh fsize infinity infinity > 46150 zsh data 524288kB 524288kB > 46150 zsh stack 65536kB 65536kB > 46150 zsh core 9765625kB 9765625kB > 46150 zsh rss infinity infinity > 46150 zsh memlock infinity infinity > 46150 zsh nproc 5547 5547 > 46150 zsh nofile 11095 11095 > 46150 zsh sbsize infinity infinity > 46150 zsh vmem infinity infinity > 46150 zsh npts infinity infinity > 46150 zsh swap infinity infinity > > to one where rlimit names are the same as in limits(1) and units are printed > in separate column: > > PID COMM RLIMIT SOFT HARD UNIT > 48885 zsh cputime 100000 infinity secs > 48885 zsh filesize infinity infinity bytes > 48885 zsh datasize 524288k 524288k bytes > 48885 zsh stacksize 65536k 65536k bytes > 48885 zsh coredumpsize 95367M 95367M bytes > 48885 zsh memoryuse infinity infinity bytes > 48885 zsh memorylocked infinity infinity bytes > 48885 zsh maxprocesses 5547 5547 > 48885 zsh openfiles 11095 11095 > 48885 zsh sbsize infinity infinity bytes > 48885 zsh vmemoryuse infinity infinity bytes > 48885 zsh pseudo-terminals infinity infinity > 48885 zsh swapuse infinity infinity bytes > > Personally I like the first variant as the most compact and the easiest to > maintain but would be glad to learn what other think about this or may be have > other suggestions. > > A couple other variations: > > PID COMM RLIMIT SOFT HARD UNIT > 47062 zsh cpu 100000 infinity secs > 47062 zsh fsize infinity infinity bytes > 47062 zsh data 524288k 524288k bytes > 47062 zsh stack 67108864 67108864 bytes > 47062 zsh core 9765625k 9765625k bytes > 47062 zsh rss infinity infinity bytes > 47062 zsh memlock infinity infinity bytes > 47062 zsh nproc 5547 5547 > 47062 zsh nofile 11095 11095 > 47062 zsh sbsize infinity infinity bytes > 47062 zsh vmem infinity infinity bytes > 47062 zsh npts infinity infinity > 47062 zsh swap infinity infinity bytes > > PID COMM RLIMIT SOFT HARD UNIT > 48798 zsh cputime 100000 infinity secs > 48798 zsh filesize infinity infinity bytes > 48798 zsh datasize 524288k 524288k bytes > 48798 zsh stacksize 65536k 65536k bytes > 48798 zsh coredumpsize 95367M 95367M bytes > 48798 zsh memoryuse infinity infinity bytes > 48798 zsh memorylocked infinity infinity bytes > 48798 zsh maxprocesses 5547 5547 > 48798 zsh openfiles 11095 11095 > 48798 zsh sbsize infinity infinity bytes > 48798 zsh vmemoryuse infinity infinity bytes > 48798 zsh pseudo-terminals infinity infinity > 48798 zsh swapuse infinity infinity bytes Hmm, I would stick as close to limits output as possible. I would consider duplicating the unit field in each of soft and hard, so you end up with something like this: PID COMM RLIMIT SOFT HARD 48798 zsh cputime 100000 secs infinity secs 48798 zsh filesize infinity kb infinity kb 48798 zsh datasize 524288 kb 524288 kb etc. (Things like 'openfiles' is simply more intuitive than 'nofile' (no file?, huh? oh, num open files.. (except not all users will make the last step there). -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 19:38:43 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 524FD106564A; Thu, 8 Dec 2011 19:38:43 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 40BB08FC08; Thu, 8 Dec 2011 19:38:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB8JchIX099992; Thu, 8 Dec 2011 19:38:43 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB8Jch1l099990; Thu, 8 Dec 2011 19:38:43 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201112081938.pB8Jch1l099990@svn.freebsd.org> From: Martin Matuska Date: Thu, 8 Dec 2011 19:38:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228353 - head/cddl/contrib/opensolaris/cmd/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 19:38:43 -0000 Author: mm Date: Thu Dec 8 19:38:42 2011 New Revision: 228353 URL: http://svn.freebsd.org/changeset/base/228353 Log: Some mdoc(7) style and typo fixes to zfs(8). Submitted by: Nobuyuki Koganemaru MFC after: 3 days Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Dec 8 15:28:36 2011 (r228352) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Dec 8 19:38:42 2011 (r228353) @@ -377,7 +377,7 @@ property. This directory is created as n automatically mounts the file system when the .Qq Nm Cm mount Fl a command is invoked (without editing -.Pa /etc/fstab Ns ). +.Pa /etc/fstab ) . The .Sy mountpoint property can be inherited, so if @@ -409,7 +409,7 @@ responsible for mounting and unmounting dataset can be attached to a jail by using the .Qq Nm Cm jail subcommand. You cannot attach a dataset to one jail and the children of the -same dataset to another jails. To allow managment of the dataset from within +same dataset to another jails. To allow management of the dataset from within a jail, the .Sy jailed property has to be set. The @@ -624,10 +624,10 @@ symbol, using one of the following forms .Bl -bullet -offset 2n .It POSIX name (for example, -.Em joe Ns ) +.Em joe ) .It POSIX numeric ID (for example, -.Em 1001 Ns ) +.Em 1001 ) .El .It Sy userrefs This property is set to the number of user holds on this snapshot. User holds @@ -673,7 +673,7 @@ snapshot. The .Ar snapshot may be specified as a short snapshot name (just the part after the -.Sy @ Ns ), +.Sy @ ) , in which case it will be interpreted as a snapshot in the same filesystem as this dataset. The .Ar snapshot @@ -847,7 +847,7 @@ is an integer from 1 (fastest) to 9 (bes is equivalent to .Cm gzip-6 (which is also the default for -.Xr gzip 1 Ns ). +.Xr gzip 1 ) . The .Cm zle compression algorithm compresses runs of zeros. @@ -952,7 +952,7 @@ space calculation does not include space such as snapshots and clones. User space consumption is identified by the .Sy userspace@ Ns Ar user property. -.sp +.Pp Enforcement of user quotas may be delayed by several seconds. This delay means that a user might exceed their quota before the system notices that they are over quota and begins to refuse additional writes with the @@ -960,14 +960,14 @@ over quota and begins to refuse addition error message. See the .Cm userspace subcommand for more information. -.sp +.Pp Unprivileged users can only access their own groups' space usage. The root user, or a user who has been granted the .Sy userquota privilege with .Qq Nm Cm allow , can get and set everyone's quota. -.sp +.Pp This property is not available on volumes, on file systems before version 4, or on pools before version 15. The .Sy userquota@ Ns ... @@ -979,17 +979,17 @@ symbol, using one of the following forms .Bl -bullet -offset 2n .It POSIX name (for example, -.Em joe Ns ) +.Em joe ) .It POSIX numeric ID (for example, -.Em 1001 Ns ) +.Em 1001 ) .El .It Sy groupquota@ Ns Ar group Ns = Ns Ar size | Cm none Limits the amount of space consumed by the specified group. Group space consumption is identified by the .Sy userquota@ Ns Ar user property. -.sp +.Pp Unprivileged users can access only their own groups' space usage. The root user, or a user who has been granted the .Sy groupquota @@ -1020,7 +1020,7 @@ than or equal to 128 Kbytes. Changing the file system's .Sy recordsize affects only files created afterward; existing files are unaffected. -.sp +.Pp This property can also be referred to by its shortened column name, .Sy recsize . .It Sy refquota Ns = Ns Ar size | Cm none @@ -1036,13 +1036,13 @@ The .Sy refreservation reservation is accounted for in the parent datasets' space used, and counts against the parent datasets' quotas and reservations. -.sp +.Pp If .Sy refreservation is set, a snapshot is only allowed if there is enough free pool space outside of this reservation to accommodate the current number of "referenced" bytes in the dataset. -.sp +.Pp This property can also be referred to by its shortened column name, .Sy refreserv . .It Sy reservation Ns = Ns Ar size | Cm none @@ -1161,7 +1161,7 @@ version number of 9 or higher, a is set instead. Any changes to .Sy volsize are reflected in an equivalent change to the reservation (or -.Sy refreservation Ns ). +.Sy refreservation ) . The .Sy volsize can only be set to a multiple of @@ -1174,7 +1174,7 @@ run out of space, resulting in undefined on how the volume is used. These effects can also occur when the volume size is changed while it is in use (particularly when shrinking the size). Extreme care should be used when adjusting the volume size. -.sp +.Pp Though not recommended, a "sparse volume" (also known as "thin provisioning") can be created by specifying the .Fl s @@ -1708,7 +1708,7 @@ Snapshots are displayed if the property is .Cm on (the default is -.Cm off Ns ). +.Cm off ) . The following fields are displayed, .Sy name , used , available , referenced , mountpoint . .Bl -tag -width indent @@ -2168,10 +2168,10 @@ Creates a stream representation of the l argument (not part of .Fl i or -.Fl I Ns ) +.Fl I ) which is written to standard output. The output can be redirected to a file or to a different system (for example, using -.Xr ssh 1 Ns ). +.Xr ssh 1 ) . By default, a full stream is generated. .Bl -tag -width indent .It Fl i Ar snapshot @@ -2180,10 +2180,10 @@ Generate an incremental stream from the to the last .Ar snapshot . The incremental source (the -.Fl i Ar snapshot Ns ) +.Fl i Ar snapshot ) can be specified as the last component of the snapshot name (for example, the part after the -.Sy @ Ns ), +.Sy @ ) , and it is assumed to be from the same file system as the last .Ar snapshot . .Pp @@ -2191,11 +2191,13 @@ If the destination is a clone, the sourc must be fully specified (for example, .Cm pool/fs@origin , not just -.Cm @origin Ns ). +.Cm @origin ) . .It Fl I Ar snapshot Generate a stream package that sends all intermediary snapshots from the -.Fl I Ar snapshot to the last -.Ar snapshot . For example, +.Fl I Ar snapshot +to the last +.Ar snapshot . +For example, .Ic -I @a fs@d is similar to .Ic -i @a fs@b; -i @b fs@c; -i @c fs@d . @@ -2223,12 +2225,12 @@ flag is specified when this stream is re .It Fl D Generate a deduplicated stream. Blocks which would have been sent multiple times in the send stream will only be sent once. The receiving system must -also support this feature to recieve a deduplicated stream. This flag can +also support this feature to receive a deduplicated stream. This flag can be used regardless of the dataset's .Sy dedup property, but performance will be much better if the filesystem uses a dedup-capable checksum (eg. -.Sy sha256 Ns ). +.Sy sha256 ) . .It Fl r Recursively send all descendant snapshots. This is similar to the .Fl R @@ -2323,14 +2325,14 @@ option is specified, all but the pool na appended (for example, .Sy b/c@1 appended from sent snapshot -.Sy a/b/c@1 Ns ), +.Sy a/b/c@1 ) , and if the .Fl e option is specified, only the tail of the sent snapshot path is appended (for example, .Sy c@1 appended from sent snapshot -.Sy a/b/c@1 Ns ). +.Sy a/b/c@1 ) . In the case of .Fl d , any file systems needed to replicate the path of the sent snapshot are created @@ -2349,13 +2351,13 @@ Print verbose information about the stre receive operation. .It Fl n Do not actually receive the stream. This can be useful in conjunction with the -.It Fl v +.Fl v option to verify the name the receive operation would use. .It Fl F Force a rollback of the file system to the most recent snapshot before performing the receive operation. If receiving an incremental replication stream (for example, one generated by -.Qq Nm Cm send Fl R Fi iI Ns ) , +.Qq Nm Cm send Fl R Fi iI ) , destroy snapshots and file systems that do not exist on the sending side. .El .It Xo @@ -2409,7 +2411,8 @@ option. .Op Fl e .Ar perm Ns | Ns Ar @setname Ns Op , Ns Ar ... .Xc -Specifies that the permissions be delegated to "everyone." Multiple permissions +Specifies that the permissions be delegated to "everyone". +Multiple permissions may be specified as a comma-separated list. Permission names are the same as .Tn ZFS subcommand and property names. See the property list below. Property set names, @@ -2655,7 +2658,7 @@ Describes differences between a snapshot successor dataset can be a later snapshot or the current filesystem. .Pp The changed files are displayed including the change type. The change type -is displayed ussing a single character. If a file or directory was renamed, +is displayed useing a single character. If a file or directory was renamed, the old and the new names are displayed. .Pp The following change types can be displayed: @@ -2680,9 +2683,9 @@ The following file types can be displaye .It \&B Ta block device .It \&@ Ta symbolic link .It \&= Ta socket -.It \&> Ta door (not supported on Fx Ns ) -.It \&| Ta FIFO (not supported on Fx Ns ) -.It \&P Ta event portal (not supported on Fx Ns ) +.It \&> Ta door (not supported on Fx ) +.It \&| Ta FIFO (not supported on Fx ) +.It \&P Ta event portal (not supported on Fx ) .El .It Fl H Machine-parseable output, fields separated a tab character. From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 20:53:51 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE3A61065677; Thu, 8 Dec 2011 20:53:51 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 4B6038FC18; Thu, 8 Dec 2011 20:53:49 +0000 (UTC) Received: by bkbzv15 with SMTP id zv15so2665600bkb.13 for ; Thu, 08 Dec 2011 12:53:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:x-comment-to:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=NUhXvg0m57yhQlA1POZxvMzKEnOpq8D/TtN927xwBwo=; b=Jjn/Vwwd19MJMnECY6r2CFtpqpHkx/+C9B7qL3a0ifSk2UyNB3UCltneeAmUgFyvSK ImVWFFJZPAm0dovJDA20eHfmvKkwCImctCv62P0L3huD/MgCw8hKUiheg4P5RojXquAA bK2NF19e9xD+5hPh67OmKsQeKK0szslXkARIA= Received: by 10.205.130.146 with SMTP id hm18mr1934662bkc.19.1323377629047; Thu, 08 Dec 2011 12:53:49 -0800 (PST) Received: from localhost ([95.69.173.122]) by mx.google.com with ESMTPS id e18sm5042095bkr.15.2011.12.08.12.53.45 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 08 Dec 2011 12:53:46 -0800 (PST) From: Mikolaj Golub To: John Baldwin References: <201111242054.pAOKs6vj012296@svn.freebsd.org> <201111281330.11720.jhb@freebsd.org> <86liqt1ier.fsf@kopusha.home.net> <4EE1024C.6040800@FreeBSD.org> X-Comment-To: John Baldwin Sender: Mikolaj Golub Date: Thu, 08 Dec 2011 22:53:44 +0200 In-Reply-To: <4EE1024C.6040800@FreeBSD.org> (John Baldwin's message of "Thu, 08 Dec 2011 13:30:36 -0500") Message-ID: <86k466aip3.fsf@kopusha.home.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Kostik Belousov Subject: Re: svn commit: r227956 - head/usr.bin/procstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 20:53:51 -0000 On Thu, 08 Dec 2011 13:30:36 -0500 John Baldwin wrote: JB> On 12/3/11 3:58 PM, Mikolaj Golub wrote: >> >> On Mon, 28 Nov 2011 13:30:11 -0500 John Baldwin wrote: >> >> JB> On Thursday, November 24, 2011 3:54:06 pm Mikolaj Golub wrote: >> >> Author: trociny >> >> Date: Thu Nov 24 20:54:06 2011 >> >> New Revision: 227956 >> >> URL: http://svn.freebsd.org/changeset/base/227956 >> >> >> >> Log: >> >> usr.bin/procstat >> >> >> >> Add -l flag to display resource limits. >> >> >> >> PR: bin/161257 >> >> Reviewed by: kib >> >> MFC after: 2 weeks >> >> JB> Thanks for doing this! Did you consider making the procstat -l output use >> JB> "pretty" output similar to the output of /usr/bin/limits? For example, >> JB> using "infinity" instead of -1 and using humanize_number() for finite limits >> JB> that are in units of bytes? >> >> I tried several variants, from one where for rlimit names rlimit_ident >> constants from sys/resource.h are used and units are printed as suffixes: >> >> PID COMM RLIMIT SOFT HARD >> 46150 zsh cpu 100000S infinity >> 46150 zsh fsize infinity infinity >> 46150 zsh data 524288kB 524288kB >> 46150 zsh stack 65536kB 65536kB >> 46150 zsh core 9765625kB 9765625kB >> 46150 zsh rss infinity infinity >> 46150 zsh memlock infinity infinity >> 46150 zsh nproc 5547 5547 >> 46150 zsh nofile 11095 11095 >> 46150 zsh sbsize infinity infinity >> 46150 zsh vmem infinity infinity >> 46150 zsh npts infinity infinity >> 46150 zsh swap infinity infinity >> >> to one where rlimit names are the same as in limits(1) and units are printed >> in separate column: >> >> PID COMM RLIMIT SOFT HARD UNIT >> 48885 zsh cputime 100000 infinity secs >> 48885 zsh filesize infinity infinity bytes >> 48885 zsh datasize 524288k 524288k bytes >> 48885 zsh stacksize 65536k 65536k bytes >> 48885 zsh coredumpsize 95367M 95367M bytes >> 48885 zsh memoryuse infinity infinity bytes >> 48885 zsh memorylocked infinity infinity bytes >> 48885 zsh maxprocesses 5547 5547 >> 48885 zsh openfiles 11095 11095 >> 48885 zsh sbsize infinity infinity bytes >> 48885 zsh vmemoryuse infinity infinity bytes >> 48885 zsh pseudo-terminals infinity infinity >> 48885 zsh swapuse infinity infinity bytes >> >> Personally I like the first variant as the most compact and the easiest to >> maintain but would be glad to learn what other think about this or may be have >> other suggestions. >> >> A couple other variations: >> >> PID COMM RLIMIT SOFT HARD UNIT >> 47062 zsh cpu 100000 infinity secs >> 47062 zsh fsize infinity infinity bytes >> 47062 zsh data 524288k 524288k bytes >> 47062 zsh stack 67108864 67108864 bytes >> 47062 zsh core 9765625k 9765625k bytes >> 47062 zsh rss infinity infinity bytes >> 47062 zsh memlock infinity infinity bytes >> 47062 zsh nproc 5547 5547 >> 47062 zsh nofile 11095 11095 >> 47062 zsh sbsize infinity infinity bytes >> 47062 zsh vmem infinity infinity bytes >> 47062 zsh npts infinity infinity >> 47062 zsh swap infinity infinity bytes >> >> PID COMM RLIMIT SOFT HARD UNIT >> 48798 zsh cputime 100000 infinity secs >> 48798 zsh filesize infinity infinity bytes >> 48798 zsh datasize 524288k 524288k bytes >> 48798 zsh stacksize 65536k 65536k bytes >> 48798 zsh coredumpsize 95367M 95367M bytes >> 48798 zsh memoryuse infinity infinity bytes >> 48798 zsh memorylocked infinity infinity bytes >> 48798 zsh maxprocesses 5547 5547 >> 48798 zsh openfiles 11095 11095 >> 48798 zsh sbsize infinity infinity bytes >> 48798 zsh vmemoryuse infinity infinity bytes >> 48798 zsh pseudo-terminals infinity infinity >> 48798 zsh swapuse infinity infinity bytes JB> Hmm, I would stick as close to limits output as possible. I would JB> consider duplicating the unit field in each of soft and hard, so you JB> end up with something like this: JB> PID COMM RLIMIT SOFT HARD JB> 48798 zsh cputime 100000 secs infinity secs JB> 48798 zsh filesize infinity kb infinity kb JB> 48798 zsh datasize 524288 kb 524288 kb JB> etc. Ok. JB> (Things like 'openfiles' is simply more intuitive than 'nofile' (no JB> file?, huh? oh, num open files.. (except not all users will make the JB> last step there). Then why do we have so non-intuitive rlimit_ident names? It looks like they are used only in procfs_rlimit.c. Do procfs(5) users always make that last step with 'nofile'? :-) Is it possible to change rlimit_ident names? Just to ones that are used by limit(1) or (if they look too long) to something like below: cputime filesize datasize stacksize coresize rmemuse memlocked maxproc openfiles sbsize vmemuse openpts swapuse or any other names, just so I wouldn't need to hardcode the names in procstat? -- Mikolaj Golub From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 20:55:36 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E012106564A; Thu, 8 Dec 2011 20:55:36 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from smtp.fgznet.ch (mail.fgznet.ch [81.92.96.47]) by mx1.freebsd.org (Postfix) with ESMTP id C688D8FC14; Thu, 8 Dec 2011 20:55:35 +0000 (UTC) Received: from deuterium.andreas.nets (dhclient-91-190-14-19.flashcable.ch [91.190.14.19]) by smtp.fgznet.ch (8.13.8/8.13.8/Submit_SMTPAUTH) with ESMTP id pB8Kd764095164; Thu, 8 Dec 2011 21:39:08 +0100 (CET) (envelope-from andreast@FreeBSD.org) Message-ID: <4EE120D7.10903@FreeBSD.org> Date: Thu, 08 Dec 2011 21:40:55 +0100 From: Andreas Tobler User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: David Chisnall References: <201112072117.pB7LHoaL055972@svn.freebsd.org> In-Reply-To: <201112072117.pB7LHoaL055972@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 81.92.96.47 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r228330 - in head: include sys/sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 20:55:36 -0000 On 07.12.11 22:17, David Chisnall wrote: > Author: theraven > Date: Wed Dec 7 21:17:50 2011 > New Revision: 228330 > URL: http://svn.freebsd.org/changeset/base/228330 > > Log: > As per das@'s suggestion, s/__noreturn/_Noreturn/, since the latter is an > identifier reserved for the implementation in C99 and earlier so there is > no sensible reason for introducing yet another reserved identifier when we > could just use the one C1x uses. > > Approved by: brooks (mentor) > Modified: head/sys/sys/cdefs.h > ============================================================================== > --- head/sys/sys/cdefs.h Wed Dec 7 21:02:35 2011 (r228329) > +++ head/sys/sys/cdefs.h Wed Dec 7 21:17:50 2011 (r228330) > @@ -220,13 +220,13 @@ > > > #if defined(__cplusplus)&& __cplusplus>= 201103L > -#define __noreturn [[noreturn]] > +#define _Noreturn [[noreturn]] > #elif defined(__STDC_VERSION__)&& __STDC_VERSION__> 201000L > -#define __noreturn _Noreturn > +/* Do nothing - _Noreturn is a keyword */ > #elif defined(__GNUC__) > -#define __noreturn __attribute__((__noreturn__)) > +#define _Noreturn __attribute__((__noreturn__)) This and the previous commit broke bootstrapping gcc. The problem is this: /export/devel/build/gcc/head/objdir/./gcc/include-fixed/stdlib.h:96:1: error: expected unqualified-id before '[' token Line in question is: _Noreturn void abort(void); Where _Noreturn gets expanded to [[noreturn]] I helped myself with adding the below. Well. No clue if it is correct. But at least I can continue building gcc trunk. Thanks, Andreas Index: cdefs.h =================================================================== --- cdefs.h (revision 228352) +++ cdefs.h (working copy) @@ -219,7 +219,7 @@ #endif -#if defined(__cplusplus) && __cplusplus >= 201103L +#if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__GNUC__) #define _Noreturn [[noreturn]] #elif defined(__STDC_VERSION__) && __STDC_VERSION__ > 201000L /* Do nothing - _Noreturn is a keyword */ From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 21:32:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A649106566B; Thu, 8 Dec 2011 21:32:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id AB10D8FC08; Thu, 8 Dec 2011 21:32:17 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 5845146B0A; Thu, 8 Dec 2011 16:32:17 -0500 (EST) Received: from John-Baldwins-MacBook-Air.local (c-68-36-150-83.hsd1.nj.comcast.net [68.36.150.83]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id AE89CB91E; Thu, 8 Dec 2011 16:32:16 -0500 (EST) Message-ID: <4EE12CE0.5070803@FreeBSD.org> Date: Thu, 08 Dec 2011 16:32:16 -0500 From: John Baldwin User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Mikolaj Golub References: <201111242054.pAOKs6vj012296@svn.freebsd.org> <201111281330.11720.jhb@freebsd.org> <86liqt1ier.fsf@kopusha.home.net> <4EE1024C.6040800@FreeBSD.org> <86k466aip3.fsf@kopusha.home.net> In-Reply-To: <86k466aip3.fsf@kopusha.home.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 08 Dec 2011 16:32:16 -0500 (EST) Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Kostik Belousov Subject: Re: svn commit: r227956 - head/usr.bin/procstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 21:32:18 -0000 On 12/8/11 3:53 PM, Mikolaj Golub wrote: > > On Thu, 08 Dec 2011 13:30:36 -0500 John Baldwin wrote: > > JB> On 12/3/11 3:58 PM, Mikolaj Golub wrote: > >> > >> On Mon, 28 Nov 2011 13:30:11 -0500 John Baldwin wrote: > >> > >> JB> On Thursday, November 24, 2011 3:54:06 pm Mikolaj Golub wrote: > >> >> Author: trociny > >> >> Date: Thu Nov 24 20:54:06 2011 > >> >> New Revision: 227956 > >> >> URL: http://svn.freebsd.org/changeset/base/227956 > >> >> > >> >> Log: > >> >> usr.bin/procstat > >> >> > >> >> Add -l flag to display resource limits. > >> >> > >> >> PR: bin/161257 > >> >> Reviewed by: kib > >> >> MFC after: 2 weeks > >> > >> JB> Thanks for doing this! Did you consider making the procstat -l output use > >> JB> "pretty" output similar to the output of /usr/bin/limits? For example, > >> JB> using "infinity" instead of -1 and using humanize_number() for finite limits > >> JB> that are in units of bytes? > >> > >> I tried several variants, from one where for rlimit names rlimit_ident > >> constants from sys/resource.h are used and units are printed as suffixes: > >> > >> PID COMM RLIMIT SOFT HARD > >> 46150 zsh cpu 100000S infinity > >> 46150 zsh fsize infinity infinity > >> 46150 zsh data 524288kB 524288kB > >> 46150 zsh stack 65536kB 65536kB > >> 46150 zsh core 9765625kB 9765625kB > >> 46150 zsh rss infinity infinity > >> 46150 zsh memlock infinity infinity > >> 46150 zsh nproc 5547 5547 > >> 46150 zsh nofile 11095 11095 > >> 46150 zsh sbsize infinity infinity > >> 46150 zsh vmem infinity infinity > >> 46150 zsh npts infinity infinity > >> 46150 zsh swap infinity infinity > >> > >> to one where rlimit names are the same as in limits(1) and units are printed > >> in separate column: > >> > >> PID COMM RLIMIT SOFT HARD UNIT > >> 48885 zsh cputime 100000 infinity secs > >> 48885 zsh filesize infinity infinity bytes > >> 48885 zsh datasize 524288k 524288k bytes > >> 48885 zsh stacksize 65536k 65536k bytes > >> 48885 zsh coredumpsize 95367M 95367M bytes > >> 48885 zsh memoryuse infinity infinity bytes > >> 48885 zsh memorylocked infinity infinity bytes > >> 48885 zsh maxprocesses 5547 5547 > >> 48885 zsh openfiles 11095 11095 > >> 48885 zsh sbsize infinity infinity bytes > >> 48885 zsh vmemoryuse infinity infinity bytes > >> 48885 zsh pseudo-terminals infinity infinity > >> 48885 zsh swapuse infinity infinity bytes > >> > >> Personally I like the first variant as the most compact and the easiest to > >> maintain but would be glad to learn what other think about this or may be have > >> other suggestions. > >> > >> A couple other variations: > >> > >> PID COMM RLIMIT SOFT HARD UNIT > >> 47062 zsh cpu 100000 infinity secs > >> 47062 zsh fsize infinity infinity bytes > >> 47062 zsh data 524288k 524288k bytes > >> 47062 zsh stack 67108864 67108864 bytes > >> 47062 zsh core 9765625k 9765625k bytes > >> 47062 zsh rss infinity infinity bytes > >> 47062 zsh memlock infinity infinity bytes > >> 47062 zsh nproc 5547 5547 > >> 47062 zsh nofile 11095 11095 > >> 47062 zsh sbsize infinity infinity bytes > >> 47062 zsh vmem infinity infinity bytes > >> 47062 zsh npts infinity infinity > >> 47062 zsh swap infinity infinity bytes > >> > >> PID COMM RLIMIT SOFT HARD UNIT > >> 48798 zsh cputime 100000 infinity secs > >> 48798 zsh filesize infinity infinity bytes > >> 48798 zsh datasize 524288k 524288k bytes > >> 48798 zsh stacksize 65536k 65536k bytes > >> 48798 zsh coredumpsize 95367M 95367M bytes > >> 48798 zsh memoryuse infinity infinity bytes > >> 48798 zsh memorylocked infinity infinity bytes > >> 48798 zsh maxprocesses 5547 5547 > >> 48798 zsh openfiles 11095 11095 > >> 48798 zsh sbsize infinity infinity bytes > >> 48798 zsh vmemoryuse infinity infinity bytes > >> 48798 zsh pseudo-terminals infinity infinity > >> 48798 zsh swapuse infinity infinity bytes > > JB> Hmm, I would stick as close to limits output as possible. I would > JB> consider duplicating the unit field in each of soft and hard, so you > JB> end up with something like this: > > JB> PID COMM RLIMIT SOFT HARD > JB> 48798 zsh cputime 100000 secs infinity secs > JB> 48798 zsh filesize infinity kb infinity kb > JB> 48798 zsh datasize 524288 kb 524288 kb > > JB> etc. > > Ok. > > JB> (Things like 'openfiles' is simply more intuitive than 'nofile' (no > JB> file?, huh? oh, num open files.. (except not all users will make the > JB> last step there). > > Then why do we have so non-intuitive rlimit_ident names? > > It looks like they are used only in procfs_rlimit.c. Do procfs(5) users always > make that last step with 'nofile'? :-) Well, I suspect it's best not to change the names in procfs in case there are existing binaries that parse the output of that file (unfortunately). > Is it possible to change rlimit_ident names? Just to ones that are used by > limit(1) or (if they look too long) to something like below: Hmm, I have no idea what other things might use rlimit_ident. Probably not many. (Also, for fun, note that the 'ulimit' and 'limit' built-in commands in sh and csh also have their own sets of names, fun!) I would maybe add a rlimit_names[] (just leave rlimit_ident alone), and give that the names from limits(1), and change both procstat and sh's 'ulimit' command to use those. -- John Baldwin From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 22:33:37 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7046F1065670; Thu, 8 Dec 2011 22:33:37 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 606598FC08; Thu, 8 Dec 2011 22:33:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB8MXb4r005461; Thu, 8 Dec 2011 22:33:37 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB8MXbvi005459; Thu, 8 Dec 2011 22:33:37 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201112082233.pB8MXbvi005459@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Thu, 8 Dec 2011 22:33:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228354 - head/share/misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 22:33:37 -0000 Author: pfg Date: Thu Dec 8 22:33:37 2011 New Revision: 228354 URL: http://svn.freebsd.org/changeset/base/228354 Log: Add myself as new committer: add PGP key and announce.. Approved by: jhb (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Thu Dec 8 19:38:42 2011 (r228353) +++ head/share/misc/committers-src.dot Thu Dec 8 22:33:37 2011 (r228354) @@ -203,6 +203,7 @@ obrien [label="David E. O'Brien\nobrien@ olli [label="Oliver Fromme\nolli@FreeBSD.org\n2008/02/14"] peadar [label="Peter Edwards\npeadar@FreeBSD.org\n2004/03/08"] peter [label="Peter Wemm\npeter@FreeBSD.org\n????/??/??"] +pfg [label="Pedro Giffuni\npfg@FreeBSD.org\n2011/12/01"] philip [label="Philip Paeps\nphilip@FreBSD.org\n2004/01/21"] phk [label="Poul-Henning Kamp\nphk@FreeBSD.org\n1994/02/21"] pho [label="Peter Holm\npho@FreeBSD.org\n2008/11/16"] From owner-svn-src-all@FreeBSD.ORG Thu Dec 8 23:58:26 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED05B1065672; Thu, 8 Dec 2011 23:58:26 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD3748FC16; Thu, 8 Dec 2011 23:58:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB8NwQhQ008123; Thu, 8 Dec 2011 23:58:26 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB8NwQ3I008121; Thu, 8 Dec 2011 23:58:26 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201112082358.pB8NwQ3I008121@svn.freebsd.org> From: Glen Barber Date: Thu, 8 Dec 2011 23:58:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228355 - head/share/man/man5 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Dec 2011 23:58:27 -0000 Author: gjb (doc committer) Date: Thu Dec 8 23:58:26 2011 New Revision: 228355 URL: http://svn.freebsd.org/changeset/base/228355 Log: As of r226865, daily_scrub_zfs_default_threshold is 35 days; document accordingly. PR: 162890 Submitted by: Oliver Hartmann (ohartman ! mail.zedat.fu-berlin.de) Patch by: Niclas Zeising (niclas.zeising ! gmail.com) MFC after: 1 week X-Need-MFC: r226865 Modified: head/share/man/man5/periodic.conf.5 Modified: head/share/man/man5/periodic.conf.5 ============================================================================== --- head/share/man/man5/periodic.conf.5 Thu Dec 8 22:33:37 2011 (r228354) +++ head/share/man/man5/periodic.conf.5 Thu Dec 8 23:58:26 2011 (r228355) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 15, 2010 +.Dd December 8, 2011 .Dt PERIODIC.CONF 5 .Os .Sh NAME @@ -631,7 +631,7 @@ If the list is empty or not set, all zfs .It Va daily_scrub_zfs_default_threshold .Pq Vt int Number of days between a scrub if no pool-specific threshold is set. -The default value if no value is set is 30. +If not set, the default value is 35, corresponding to 5 weeks. .It Va daily_scrub_zfs_ Ns Ao Ar poolname Ac Ns Va _threshold .Pq Vt int The same as From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 02:30:56 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F03C9106564A; Fri, 9 Dec 2011 02:30:56 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D60128FC13; Fri, 9 Dec 2011 02:30:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB92Uulw012804; Fri, 9 Dec 2011 02:30:56 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB92Uuug012801; Fri, 9 Dec 2011 02:30:56 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201112090230.pB92Uuug012801@svn.freebsd.org> From: Glen Barber Date: Fri, 9 Dec 2011 02:30:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228356 - head/usr.bin/du X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 02:30:57 -0000 Author: gjb (doc committer) Date: Fri Dec 9 02:30:56 2011 New Revision: 228356 URL: http://svn.freebsd.org/changeset/base/228356 Log: Update du(1): - Sort arguments alphabetically where appropriate - '-B blocksize' is not mutually exclusive of '-h|-k|-m' - Mention '-t' in synopsis - Other wording improvements - Update usage() output to reflect the new synopsis [1] - Other miscellaneous improvements PR: 162438 Submitted by: arundel Reviewed by: Benjamin Kaduk (kaduk ! mit.edu), jhb[1] (original version) MFC after: 1 week Modified: head/usr.bin/du/du.1 head/usr.bin/du/du.c Modified: head/usr.bin/du/du.1 ============================================================================== --- head/usr.bin/du/du.1 Thu Dec 8 23:58:26 2011 (r228355) +++ head/usr.bin/du/du.1 Fri Dec 9 02:30:56 2011 (r228356) @@ -28,7 +28,7 @@ .\" @(#)du.1 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd November 6, 2008 +.Dd December 8, 2011 .Dt DU 1 .Os .Sh NAME @@ -36,15 +36,13 @@ .Nd display disk usage statistics .Sh SYNOPSIS .Nm -.Op Fl A +.Op Fl Aclnx .Op Fl H | L | P -.Op Fl a | s | d Ar depth | Fl t Ar threshold -.Op Fl c -.Op Fl l -.Op Fl h | k | m | B Ar blocksize -.Op Fl n -.Op Fl x +.Op Fl h | k | m +.Op Fl a | s | d Ar depth +.Op Fl B Ar blocksize .Op Fl I Ar mask +.Op Fl t Ar threshold .Op Ar .Sh DESCRIPTION The @@ -65,7 +63,9 @@ Calculate block counts in .Ar blocksize byte blocks. This is different from the -.Fl k, m +.Fl h, k +and +.Fl m options or setting .Ev BLOCKSIZE and gives an estimate of how much space the examined file hierarchy would @@ -79,48 +79,31 @@ is rounded up to the next multiple of 51 .It Fl H Symbolic links on the command line are followed, symbolic links in file hierarchies are not followed. -.It Fl L -Symbolic links on the command line and in file hierarchies are followed. .It Fl I Ar mask Ignore files and directories matching the specified .Ar mask . +.It Fl L +Symbolic links on the command line and in file hierarchies are followed. .It Fl P No symbolic links are followed. This is the default. .It Fl a Display an entry for each file in a file hierarchy. -.It Fl h -"Human-readable" output. -Use unit suffixes: Byte, Kilobyte, Megabyte, -Gigabyte, Terabyte and Petabyte. -.It Fl r -Generate messages about directories that cannot be read, files -that cannot be opened, and so on. -This is the default case. -This option exists solely for conformance with -.St -xpg4 . -.It Fl s -Display an entry for each specified file. -(Equivalent to -.Fl d Li 0 ) -.It Fl t Ar threshold -Display only entries for which size exceeds -.Ar threshold . -If -.Ar threshold -is negative, display only entries for which size is less than the absolute -value of -.Ar threshold . +.It Fl c +Display a grand total. .It Fl d Ar depth Display an entry for all files and directories .Ar depth directories deep. -.It Fl c -Display a grand total. +.It Fl h +.Dq Human-readable +output. +Use unit suffixes: Byte, Kilobyte, Megabyte, +Gigabyte, Terabyte and Petabyte. .It Fl k Display block counts in 1024-byte (1-Kbyte) blocks. .It Fl l -If a file has multiple hard links, count its size many times. +If a file has multiple hard links, count its size multiple times. The default behavior of .Nm is to count files with multiple hard links only once. @@ -136,6 +119,24 @@ Ignore files and directories with user flag .Pq Dv UF_NODUMP set. +.It Fl r +Generate messages about directories that cannot be read, files +that cannot be opened, and so on. +This is the default case. +This option exists solely for conformance with +.St -xpg4 . +.It Fl s +Display an entry for each specified file. +(Equivalent to +.Fl d Li 0 ) +.It Fl t Ar threshold +Display only entries for which size exceeds +.Ar threshold . +If +.Ar threshold +is negative, display only entries for which size is less than the absolute +value of +.Ar threshold . .It Fl x File system mount points are not traversed. .El @@ -152,25 +153,32 @@ If either the .Fl H or .Fl L -options are specified, storage used by any symbolic links which are -followed is not counted or displayed. +option is specified, storage used by any symbolic links which are +followed is not counted (or displayed). +.Pp +The +.Fl h, k +and +.Fl m +options all override each other; the last one specified determines +the block counts used. .Sh ENVIRONMENT .Bl -tag -width BLOCKSIZE .It Ev BLOCKSIZE If the environment variable .Ev BLOCKSIZE is set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in units of that block size. If .Ev BLOCKSIZE is not set, and the -.Fl k, m +.Fl h, k or -.Fl h +.Fl m options are not specified, the block counts will be displayed in 512-byte blocks. .El Modified: head/usr.bin/du/du.c ============================================================================== --- head/usr.bin/du/du.c Thu Dec 8 23:58:26 2011 (r228355) +++ head/usr.bin/du/du.c Fri Dec 9 02:30:56 2011 (r228356) @@ -499,9 +499,9 @@ static void usage(void) { (void)fprintf(stderr, - "usage: du [-A] [-H | -L | -P] [-a | -s | -d depth] [-c] " - "[-l] [-h | -k | -m | -B bsize] [-n] [-x] [-I mask] " - "[file ...]\n"); + "usage: du [-Aclnx] [-H | -L | -P] [-h | -k | -m ] " + "[-a | -s | -d depth] [-B blocksize] [-I mask] " + "[-t threshold] [file ...]\n"); exit(EX_USAGE); } From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 13:15:19 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A54551065677; Fri, 9 Dec 2011 13:15:19 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 954CF8FC1A; Fri, 9 Dec 2011 13:15:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9DFJmD034396; Fri, 9 Dec 2011 13:15:19 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9DFJKl034394; Fri, 9 Dec 2011 13:15:19 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201112091315.pB9DFJKl034394@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 9 Dec 2011 13:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228358 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 13:15:19 -0000 Author: jh Date: Fri Dec 9 13:15:19 2011 New Revision: 228358 URL: http://svn.freebsd.org/changeset/base/228358 Log: - Fix markup. - Remove trailing whitespace. Modified: head/share/man/man9/sbuf.9 Modified: head/share/man/man9/sbuf.9 ============================================================================== --- head/share/man/man9/sbuf.9 Fri Dec 9 04:51:40 2011 (r228357) +++ head/share/man/man9/sbuf.9 Fri Dec 9 13:15:19 2011 (r228358) @@ -117,7 +117,7 @@ defined in .Pp Any errors encountered during the allocation or composition of the string will be latched in the data structure, -making a single error test at the end of the composition +making a single error test at the end of the composition sufficient to determine success or failure of the entire process. .Pp The @@ -391,7 +391,8 @@ function returns the actual string; only works on a finished .Fa sbuf . The -.Fn sbuf_len function returns the length of the string. +.Fn sbuf_len +function returns the length of the string. For an .Fa sbuf with an attached drain, @@ -482,7 +483,7 @@ being finished, or returns the error code from the drain if one is attached. .Pp The -.Fn sbuf_finish 3 +.Fn sbuf_finish 3 function (the userland version) will return zero for success and \-1 and set errno on error. .Sh EXAMPLES From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 13:28:41 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A3D21065672; Fri, 9 Dec 2011 13:28:41 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89ED48FC12; Fri, 9 Dec 2011 13:28:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9DSfTi034878; Fri, 9 Dec 2011 13:28:41 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9DSfYh034876; Fri, 9 Dec 2011 13:28:41 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201112091328.pB9DSfYh034876@svn.freebsd.org> From: Jaakko Heinonen Date: Fri, 9 Dec 2011 13:28:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228359 - head/share/man/man9 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 13:28:41 -0000 Author: jh Date: Fri Dec 9 13:28:41 2011 New Revision: 228359 URL: http://svn.freebsd.org/changeset/base/228359 Log: sbuf_data() hasn't returned NULL for overflowed buffers since r71721. Modified: head/share/man/man9/sbuf.9 Modified: head/share/man/man9/sbuf.9 ============================================================================== --- head/share/man/man9/sbuf.9 Fri Dec 9 13:15:19 2011 (r228358) +++ head/share/man/man9/sbuf.9 Fri Dec 9 13:28:41 2011 (r228359) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 25, 2011 +.Dd December 9, 2011 .Dt SBUF 9 .Os .Sh NAME @@ -463,12 +463,8 @@ function returns a non-zero value if the drain error, and zero otherwise. .Pp The -.Fn sbuf_data -and .Fn sbuf_len -functions return -.Dv NULL -and \-1, respectively, if the buffer overflowed. +function returns \-1 if the buffer overflowed. .Pp The .Fn sbuf_copyin From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 17:19:42 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 20E7D106564A; Fri, 9 Dec 2011 17:19:42 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 10ED48FC16; Fri, 9 Dec 2011 17:19:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9HJfdm042115; Fri, 9 Dec 2011 17:19:41 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9HJflN042113; Fri, 9 Dec 2011 17:19:41 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201112091719.pB9HJflN042113@svn.freebsd.org> From: Peter Holm Date: Fri, 9 Dec 2011 17:19:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228360 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 17:19:42 -0000 Author: pho Date: Fri Dec 9 17:19:41 2011 New Revision: 228360 URL: http://svn.freebsd.org/changeset/base/228360 Log: Move cpu_set_upcall(newtd, td) up before the first call of thread_free(newtd). This to avoid a possible page fault in cpu_thread_clean() as seen on amd64 with syscall fuzzing. Reviewed by: kib MFC after: 1 week Modified: head/sys/kern/kern_thr.c Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Fri Dec 9 13:28:41 2011 (r228359) +++ head/sys/kern/kern_thr.c Fri Dec 9 17:19:41 2011 (r228360) @@ -201,6 +201,8 @@ create_thread(struct thread *td, mcontex goto fail; } + cpu_set_upcall(newtd, td); + /* * Try the copyout as soon as we allocate the td so we don't * have to tear things down in a failure case below. @@ -226,8 +228,6 @@ create_thread(struct thread *td, mcontex newtd->td_proc = td->td_proc; newtd->td_ucred = crhold(td->td_ucred); - cpu_set_upcall(newtd, td); - if (ctx != NULL) { /* old way to set user context */ error = set_mcontext(newtd, ctx); if (error != 0) { From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 17:49:35 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F4161065672; Fri, 9 Dec 2011 17:49:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3F4A28FC17; Fri, 9 Dec 2011 17:49:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9HnZiN043070; Fri, 9 Dec 2011 17:49:35 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9HnZvL043068; Fri, 9 Dec 2011 17:49:35 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201112091749.pB9HnZvL043068@svn.freebsd.org> From: John Baldwin Date: Fri, 9 Dec 2011 17:49:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228361 - head/sys/fs/devfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 17:49:35 -0000 Author: jhb Date: Fri Dec 9 17:49:34 2011 New Revision: 228361 URL: http://svn.freebsd.org/changeset/base/228361 Log: Explicitly use curthread while manipulating td_fpop during last close of a devfs file descriptor in devfs_close_f(). The passed in td argument may be NULL if the close was invoked by garbage collection of open file descriptors in pending control messages in the socket buffer of a UNIX domain socket after it was closed. PR: kern/151758 Submitted by: Andrey Shidakov andrey shidakov ru Submitted by: Ruben van Staveren ruben verweg com Reviewed by: kib MFC after: 2 weeks Modified: head/sys/fs/devfs/devfs_vnops.c Modified: head/sys/fs/devfs/devfs_vnops.c ============================================================================== --- head/sys/fs/devfs/devfs_vnops.c Fri Dec 9 17:19:41 2011 (r228360) +++ head/sys/fs/devfs/devfs_vnops.c Fri Dec 9 17:49:34 2011 (r228361) @@ -602,10 +602,14 @@ devfs_close_f(struct file *fp, struct th int error; struct file *fpop; - fpop = td->td_fpop; - td->td_fpop = fp; + /* + * NB: td may be NULL if this descriptor is closed due to + * garbage collection from a closed UNIX domain socket. + */ + fpop = curthread->td_fpop; + curthread->td_fpop = fp; error = vnops.fo_close(fp, td); - td->td_fpop = fpop; + curthread->td_fpop = fpop; /* * The f_cdevpriv cannot be assigned non-NULL value while we From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 18:17:02 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78CF3106564A; Fri, 9 Dec 2011 18:17:02 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6867B8FC15; Fri, 9 Dec 2011 18:17:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9IH2SG044028; Fri, 9 Dec 2011 18:17:02 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9IH2wV044025; Fri, 9 Dec 2011 18:17:02 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112091817.pB9IH2wV044025@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 9 Dec 2011 18:17:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228362 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 18:17:02 -0000 Author: yongari Date: Fri Dec 9 18:17:02 2011 New Revision: 228362 URL: http://svn.freebsd.org/changeset/base/228362 Log: Do not disable interrupt without knowing whether the raised interrupt is ours. Note, interrupts are automatically ACKed when the status register is read. Add RX/TX DMA error to interrupt handler and do full controller reset if driver happen to encounter these errors. There is no way to recover from these DMA errors without controller reset. Rename local variable name intrs with status to enhance readability. While I'm here, rename ET_INTR_TXEOF and ET_INTR_RXEOF to ET_INTR_TXDMA and ET_INTR_RXDMA respectively. These interrupts indicate that a frame is successfully DMAed to controller's internal FIFO and they have nothing to do with EOF(end of frame). Driver does not need to wait actual end of TX/RX of a frame(e.g. no need to wait the end signal of TX which is generated when a frame in TX FIFO is emptied by MAC). Previous names were somewhat confusing. Modified: head/sys/dev/et/if_et.c head/sys/dev/et/if_etreg.h Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Fri Dec 9 17:49:34 2011 (r228361) +++ head/sys/dev/et/if_et.c Fri Dec 9 18:17:02 2011 (r228362) @@ -1158,34 +1158,40 @@ et_intr(void *xsc) { struct et_softc *sc = xsc; struct ifnet *ifp; - uint32_t intrs; + uint32_t status; ET_LOCK(sc); ifp = sc->ifp; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { - ET_UNLOCK(sc); - return; - } + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + goto done; + + status = CSR_READ_4(sc, ET_INTR_STATUS); + if ((status & ET_INTRS) == 0) + goto done; /* Disable further interrupts. */ CSR_WRITE_4(sc, ET_INTR_MASK, 0xffffffff); - intrs = CSR_READ_4(sc, ET_INTR_STATUS); - if ((intrs & ET_INTRS) == 0) - goto done; - - if (intrs & ET_INTR_RXEOF) + if (status & (ET_INTR_RXDMA_ERROR | ET_INTR_TXDMA_ERROR)) { + device_printf(sc->dev, "DMA error(0x%08x) -- resetting\n", + status); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + et_init_locked(sc); + ET_UNLOCK(sc); + return; + } + if (status & ET_INTR_RXDMA) et_rxeof(sc); - if (intrs & (ET_INTR_TXEOF | ET_INTR_TIMER)) + if (status & (ET_INTR_TXDMA | ET_INTR_TIMER)) et_txeof(sc); - if (intrs & ET_INTR_TIMER) + if (status & ET_INTR_TIMER) CSR_WRITE_4(sc, ET_TIMER, sc->sc_timer); -done: if (ifp->if_drv_flags & IFF_DRV_RUNNING) { CSR_WRITE_4(sc, ET_INTR_MASK, ~ET_INTRS); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) et_start_locked(ifp); } +done: ET_UNLOCK(sc); } Modified: head/sys/dev/et/if_etreg.h ============================================================================== --- head/sys/dev/et/if_etreg.h Fri Dec 9 17:49:34 2011 (r228361) +++ head/sys/dev/et/if_etreg.h Fri Dec 9 18:17:02 2011 (r228362) @@ -378,9 +378,9 @@ /* * Interrupts */ -#define ET_INTR_TXEOF 0x00000008 +#define ET_INTR_TXDMA 0x00000008 #define ET_INTR_TXDMA_ERROR 0x00000010 -#define ET_INTR_RXEOF 0x00000020 +#define ET_INTR_RXDMA 0x00000020 #define ET_INTR_RXRING0_LOW 0x00000040 #define ET_INTR_RXRING1_LOW 0x00000080 #define ET_INTR_RXSTAT_LOW 0x00000100 @@ -393,9 +393,9 @@ #define ET_INTR_MAC_STATS 0x00080000 #define ET_INTR_SLAVE_TO 0x00100000 -#define ET_INTRS (ET_INTR_TXEOF | \ - ET_INTR_RXEOF | \ - ET_INTR_TIMER) +#define ET_INTRS \ + (ET_INTR_TXDMA | ET_INTR_RXDMA | ET_INTR_TIMER | \ + ET_INTR_TXDMA_ERROR | ET_INTR_RXDMA_ERROR) /* * RX ring position uses same layout From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 18:22:57 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B349A1065672; Fri, 9 Dec 2011 18:22:57 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A29ED8FC0C; Fri, 9 Dec 2011 18:22:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9IMvdQ044266; Fri, 9 Dec 2011 18:22:57 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9IMv0g044264; Fri, 9 Dec 2011 18:22:57 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201112091822.pB9IMv0g044264@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 9 Dec 2011 18:22:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228363 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 18:22:57 -0000 Author: pjd Date: Fri Dec 9 18:22:57 2011 New Revision: 228363 URL: http://svn.freebsd.org/changeset/base/228363 Log: The vfs.zfs.txg.timeout sysctl can be safely modified at run time. MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Fri Dec 9 18:17:02 2011 (r228362) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c Fri Dec 9 18:22:57 2011 (r228363) @@ -43,7 +43,7 @@ int zfs_txg_timeout = 5; /* max seconds SYSCTL_DECL(_vfs_zfs); SYSCTL_NODE(_vfs_zfs, OID_AUTO, txg, CTLFLAG_RW, 0, "ZFS TXG"); TUNABLE_INT("vfs.zfs.txg.timeout", &zfs_txg_timeout); -SYSCTL_INT(_vfs_zfs_txg, OID_AUTO, timeout, CTLFLAG_RDTUN, &zfs_txg_timeout, 0, +SYSCTL_INT(_vfs_zfs_txg, OID_AUTO, timeout, CTLFLAG_RW, &zfs_txg_timeout, 0, "Maximum seconds worth of delta per txg"); /* From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 18:27:23 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE2A11065672; Fri, 9 Dec 2011 18:27:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A94DC8FC0A; Fri, 9 Dec 2011 18:27:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9IRN5R044457; Fri, 9 Dec 2011 18:27:23 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9IRNt5044435; Fri, 9 Dec 2011 18:27:23 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112091827.pB9IRNt5044435@svn.freebsd.org> From: Dimitry Andric Date: Fri, 9 Dec 2011 18:27:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228364 - in vendor/llvm/dist: docs lib/CodeGen lib/CodeGen/AsmPrinter lib/CodeGen/SelectionDAG lib/Target/ARM lib/Target/CppBackend lib/Target/Mips lib/Target/PowerPC lib/Target/X86 li... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 18:27:23 -0000 Author: dim Date: Fri Dec 9 18:27:22 2011 New Revision: 228364 URL: http://svn.freebsd.org/changeset/base/228364 Log: Vendor import of llvm 3.0 final release: http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_30/final@145349 Added: vendor/llvm/dist/test/CodeGen/ARM/gv-stubs-crash.ll Modified: vendor/llvm/dist/docs/AliasAnalysis.html vendor/llvm/dist/docs/BranchWeightMetadata.html vendor/llvm/dist/docs/Bugpoint.html vendor/llvm/dist/docs/CMake.html vendor/llvm/dist/docs/CodeGenerator.html vendor/llvm/dist/docs/CodingStandards.html vendor/llvm/dist/docs/DebuggingJITedCode.html vendor/llvm/dist/docs/ExtendingLLVM.html vendor/llvm/dist/docs/GetElementPtr.html vendor/llvm/dist/docs/GoldPlugin.html vendor/llvm/dist/docs/HowToReleaseLLVM.html vendor/llvm/dist/docs/HowToSubmitABug.html vendor/llvm/dist/docs/LangRef.html vendor/llvm/dist/docs/LinkTimeOptimization.html vendor/llvm/dist/docs/Packaging.html vendor/llvm/dist/docs/Passes.html vendor/llvm/dist/docs/ProgrammersManual.html vendor/llvm/dist/docs/Projects.html vendor/llvm/dist/docs/ReleaseNotes.html vendor/llvm/dist/docs/SystemLibrary.html vendor/llvm/dist/docs/TableGenFundamentals.html vendor/llvm/dist/docs/TestingGuide.html vendor/llvm/dist/docs/UsingLibraries.html vendor/llvm/dist/docs/index.html vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp vendor/llvm/dist/lib/CodeGen/LLVMTargetMachine.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp vendor/llvm/dist/lib/CodeGen/TargetLoweringObjectFileImpl.cpp vendor/llvm/dist/lib/Target/ARM/ARMBaseRegisterInfo.cpp vendor/llvm/dist/lib/Target/ARM/ARMCallingConv.td vendor/llvm/dist/lib/Target/ARM/ARMFastISel.cpp vendor/llvm/dist/lib/Target/ARM/ARMFrameLowering.cpp vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp vendor/llvm/dist/lib/Target/ARM/ARMInstrThumb2.td vendor/llvm/dist/lib/Target/CppBackend/CPPBackend.cpp vendor/llvm/dist/lib/Target/Mips/CMakeLists.txt vendor/llvm/dist/lib/Target/Mips/Makefile vendor/llvm/dist/lib/Target/Mips/Mips64InstrInfo.td vendor/llvm/dist/lib/Target/Mips/MipsCodeEmitter.cpp vendor/llvm/dist/lib/Target/Mips/MipsInstrFPU.td vendor/llvm/dist/lib/Target/Mips/MipsInstrFormats.td vendor/llvm/dist/lib/Target/Mips/MipsInstrInfo.td vendor/llvm/dist/lib/Target/Mips/MipsJITInfo.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCFrameLowering.cpp vendor/llvm/dist/lib/Target/X86/X86CodeEmitter.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstructionCombining.cpp vendor/llvm/dist/test/CodeGen/PowerPC/2008-10-17-AsmMatchingOperands.ll vendor/llvm/dist/test/CodeGen/X86/dbg-i128-const.ll vendor/llvm/dist/test/MC/ARM/elf-thumbfunc-reloc.ll vendor/llvm/dist/test/MC/AsmParser/2011-09-06-NoNewline.s vendor/llvm/dist/test/Transforms/InstCombine/crash.ll vendor/llvm/dist/tools/llvm-nm/llvm-nm.cpp vendor/llvm/dist/tools/llvm-objdump/llvm-objdump.cpp vendor/llvm/dist/utils/release/test-release.sh Modified: vendor/llvm/dist/docs/AliasAnalysis.html ============================================================================== --- vendor/llvm/dist/docs/AliasAnalysis.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/AliasAnalysis.html Fri Dec 9 18:27:22 2011 (r228364) @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + LLVM Alias Analysis Infrastructure @@ -1060,7 +1061,7 @@ analysis directly.

Chris Lattner
LLVM Compiler Infrastructure
- Last modified: $Date: 2011-05-25 00:01:32 +0200 (Wed, 25 May 2011) $ + Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $ Modified: vendor/llvm/dist/docs/BranchWeightMetadata.html ============================================================================== --- vendor/llvm/dist/docs/BranchWeightMetadata.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/BranchWeightMetadata.html Fri Dec 9 18:27:22 2011 (r228364) @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + LLVM Branch Weight Metadata Modified: vendor/llvm/dist/docs/Bugpoint.html ============================================================================== --- vendor/llvm/dist/docs/Bugpoint.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/Bugpoint.html Fri Dec 9 18:27:22 2011 (r228364) @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + LLVM bugpoint tool: design and usage @@ -231,7 +232,7 @@ non-obvious ways. Here are some hints a Chris Lattner
LLVM Compiler Infrastructure
- Last modified: $Date: 2011-08-30 20:26:11 +0200 (Tue, 30 Aug 2011) $ + Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $ Modified: vendor/llvm/dist/docs/CMake.html ============================================================================== --- vendor/llvm/dist/docs/CMake.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/CMake.html Fri Dec 9 18:27:22 2011 (r228364) @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + Building LLVM with CMake Modified: vendor/llvm/dist/docs/CodeGenerator.html ============================================================================== --- vendor/llvm/dist/docs/CodeGenerator.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/CodeGenerator.html Fri Dec 9 18:27:22 2011 (r228364) @@ -1813,6 +1813,8 @@ $ llc -regalloc=pbqp file.bc -o pbqp.s; Prolog/Epilog Code Insertion +
+

Compact Unwind @@ -1927,6 +1929,8 @@ $ llc -regalloc=pbqp file.bc -o pbqp.s;

+ +

Late Machine Code Optimizations @@ -2988,7 +2992,7 @@ MOVSX32rm16 -> movsx, 32-bit register Chris Lattner
The LLVM Compiler Infrastructure
- Last modified: $Date: 2011-09-19 20:15:46 +0200 (Mon, 19 Sep 2011) $ + Last modified: $Date: 2011-11-03 07:43:54 +0100 (Thu, 03 Nov 2011) $ Modified: vendor/llvm/dist/docs/CodingStandards.html ============================================================================== --- vendor/llvm/dist/docs/CodingStandards.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/CodingStandards.html Fri Dec 9 18:27:22 2011 (r228364) @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + LLVM Coding Standards @@ -1526,7 +1527,7 @@ something.

Chris Lattner
LLVM Compiler Infrastructure
- Last modified: $Date: 2011-08-12 21:49:16 +0200 (Fri, 12 Aug 2011) $ + Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $ Modified: vendor/llvm/dist/docs/DebuggingJITedCode.html ============================================================================== --- vendor/llvm/dist/docs/DebuggingJITedCode.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/DebuggingJITedCode.html Fri Dec 9 18:27:22 2011 (r228364) @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + Debugging JITed Code With GDB @@ -146,7 +147,7 @@ coordinate with GDB to get better debug src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"> Reid Kleckner
The LLVM Compiler Infrastructure
- Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $ + Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $ Modified: vendor/llvm/dist/docs/ExtendingLLVM.html ============================================================================== --- vendor/llvm/dist/docs/ExtendingLLVM.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/ExtendingLLVM.html Fri Dec 9 18:27:22 2011 (r228364) @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + Extending LLVM: Adding instructions, intrinsics, types, etc. @@ -384,7 +385,7 @@ void calcTypeName(const Type *Ty, The LLVM Compiler Infrastructure
- Last modified: $Date: 2011-06-30 08:37:07 +0200 (Thu, 30 Jun 2011) $ + Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $ Modified: vendor/llvm/dist/docs/GetElementPtr.html ============================================================================== --- vendor/llvm/dist/docs/GetElementPtr.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/GetElementPtr.html Fri Dec 9 18:27:22 2011 (r228364) @@ -746,8 +746,8 @@ idx3 = (char*) &MyVar + 8 src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"> Valid HTML 4.01 - The LLVM Compiler Infrastructure
- Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $ + The LLVM Compiler Infrastructure
+ Last modified: $Date: 2011-11-03 07:43:54 +0100 (Thu, 03 Nov 2011) $ Modified: vendor/llvm/dist/docs/GoldPlugin.html ============================================================================== --- vendor/llvm/dist/docs/GoldPlugin.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/GoldPlugin.html Fri Dec 9 18:27:22 2011 (r228364) @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + LLVM gold plugin Modified: vendor/llvm/dist/docs/HowToReleaseLLVM.html ============================================================================== --- vendor/llvm/dist/docs/HowToReleaseLLVM.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/HowToReleaseLLVM.html Fri Dec 9 18:27:22 2011 (r228364) @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + How To Release LLVM To The Public @@ -574,7 +575,7 @@ $ svn copy https://llvm.org/svn/llvm-pro src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"> The LLVM Compiler Infrastructure
- Last modified: $Date: 2011-10-17 22:32:14 +0200 (Mon, 17 Oct 2011) $ + Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $ Modified: vendor/llvm/dist/docs/HowToSubmitABug.html ============================================================================== --- vendor/llvm/dist/docs/HowToSubmitABug.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/HowToSubmitABug.html Fri Dec 9 18:27:22 2011 (r228364) @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + How to submit an LLVM bug report @@ -340,7 +341,7 @@ the following:

Chris Lattner
The LLVM Compiler Infrastructure
- Last modified: $Date: 2011-06-07 22:03:13 +0200 (Tue, 07 Jun 2011) $ + Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $ Modified: vendor/llvm/dist/docs/LangRef.html ============================================================================== --- vendor/llvm/dist/docs/LangRef.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/LangRef.html Fri Dec 9 18:27:22 2011 (r228364) @@ -281,23 +281,6 @@
  • 'llvm.adjust.trampoline' Intrinsic
  • -
  • Atomic intrinsics -
      -
    1. llvm.memory_barrier
    2. -
    3. llvm.atomic.cmp.swap
    4. -
    5. llvm.atomic.swap
    6. -
    7. llvm.atomic.load.add
    8. -
    9. llvm.atomic.load.sub
    10. -
    11. llvm.atomic.load.and
    12. -
    13. llvm.atomic.load.nand
    14. -
    15. llvm.atomic.load.or
    16. -
    17. llvm.atomic.load.xor
    18. -
    19. llvm.atomic.load.max
    20. -
    21. llvm.atomic.load.min
    22. -
    23. llvm.atomic.load.umax
    24. -
    25. llvm.atomic.load.umin
    26. -
    -
  • Memory Use Markers
    1. llvm.lifetime.start
    2. @@ -1915,9 +1898,6 @@ in signal handlers).

      possible to have a two dimensional array, using an array as the element type of another array.

      - - -

      Aggregate Types @@ -2225,6 +2205,8 @@ in signal handlers).

      + +

      Constants

      @@ -6321,8 +6303,6 @@ declare void @llvm.va_end(i8*) - -

      Accurate Garbage Collection Intrinsics @@ -7018,8 +6998,6 @@ LLVM.

      - -

      'llvm.exp.*' Intrinsic @@ -7084,6 +7062,9 @@ LLVM.

      This function returns the same values as the libm log functions would, and handles error conditions in the same way.

      + + +

      'llvm.fma.*' Intrinsic

      @@ -7117,6 +7098,8 @@ LLVM.

      + +

      Bit Manipulation Intrinsics @@ -7812,503 +7795,6 @@ LLVM.

      - Atomic Operations and Synchronization Intrinsics -

      - -
      - -

      These intrinsic functions expand the "universal IR" of LLVM to represent - hardware constructs for atomic operations and memory synchronization. This - provides an interface to the hardware, not an interface to the programmer. It - is aimed at a low enough level to allow any programming models or APIs - (Application Programming Interfaces) which need atomic behaviors to map - cleanly onto it. It is also modeled primarily on hardware behavior. Just as - hardware provides a "universal IR" for source languages, it also provides a - starting point for developing a "universal" atomic operation and - synchronization IR.

      - -

      These do not form an API such as high-level threading libraries, - software transaction memory systems, atomic primitives, and intrinsic - functions as found in BSD, GNU libc, atomic_ops, APR, and other system and - application libraries. The hardware interface provided by LLVM should allow - a clean implementation of all of these APIs and parallel programming models. - No one model or paradigm should be selected above others unless the hardware - itself ubiquitously does so.

      - - -

      - 'llvm.memory.barrier' Intrinsic -

      - -
      -
      Syntax:
      -
      -  declare void @llvm.memory.barrier(i1 <ll>, i1 <ls>, i1 <sl>, i1 <ss>, i1 <device>)
      -
      - -
      Overview:
      -

      The llvm.memory.barrier intrinsic guarantees ordering between - specific pairs of memory access types.

      - -
      Arguments:
      -

      The llvm.memory.barrier intrinsic requires five boolean arguments. - The first four arguments enables a specific barrier as listed below. The - fifth argument specifies that the barrier applies to io or device or uncached - memory.

      - -
        -
      • ll: load-load barrier
      • -
      • ls: load-store barrier
      • -
      • sl: store-load barrier
      • -
      • ss: store-store barrier
      • -
      • device: barrier applies to device and uncached memory also.
      • -
      - -
      Semantics:
      -

      This intrinsic causes the system to enforce some ordering constraints upon - the loads and stores of the program. This barrier does not - indicate when any events will occur, it only enforces - an order in which they occur. For any of the specified pairs of load - and store operations (f.ex. load-load, or store-load), all of the first - operations preceding the barrier will complete before any of the second - operations succeeding the barrier begin. Specifically the semantics for each - pairing is as follows:

      - -
        -
      • ll: All loads before the barrier must complete before any load - after the barrier begins.
      • -
      • ls: All loads before the barrier must complete before any - store after the barrier begins.
      • -
      • ss: All stores before the barrier must complete before any - store after the barrier begins.
      • -
      • sl: All stores before the barrier must complete before any - load after the barrier begins.
      • -
      - -

      These semantics are applied with a logical "and" behavior when more than one - is enabled in a single memory barrier intrinsic.

      - -

      Backends may implement stronger barriers than those requested when they do - not support as fine grained a barrier as requested. Some architectures do - not need all types of barriers and on such architectures, these become - noops.

      - -
      Example:
      -
      -%mallocP  = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32))
      -%ptr      = bitcast i8* %mallocP to i32*
      -            store i32 4, %ptr
      -
      -%result1  = load i32* %ptr      ; yields {i32}:result1 = 4
      -            call void @llvm.memory.barrier(i1 false, i1 true, i1 false, i1 false, i1 true)
      -                                ; guarantee the above finishes
      -            store i32 8, %ptr   ; before this begins
      -
      - -
      - - -

      - 'llvm.atomic.cmp.swap.*' Intrinsic -

      - -
      - -
      Syntax:
      -

      This is an overloaded intrinsic. You can use llvm.atomic.cmp.swap on - any integer bit width and for different address spaces. Not all targets - support all bit widths however.

      - -
      -  declare i8 @llvm.atomic.cmp.swap.i8.p0i8(i8* <ptr>, i8 <cmp>, i8 <val>)
      -  declare i16 @llvm.atomic.cmp.swap.i16.p0i16(i16* <ptr>, i16 <cmp>, i16 <val>)
      -  declare i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* <ptr>, i32 <cmp>, i32 <val>)
      -  declare i64 @llvm.atomic.cmp.swap.i64.p0i64(i64* <ptr>, i64 <cmp>, i64 <val>)
      -
      - -
      Overview:
      -

      This loads a value in memory and compares it to a given value. If they are - equal, it stores a new value into the memory.

      - -
      Arguments:
      -

      The llvm.atomic.cmp.swap intrinsic takes three arguments. The result - as well as both cmp and val must be integer values with the - same bit width. The ptr argument must be a pointer to a value of - this integer type. While any bit width integer may be used, targets may only - lower representations they support in hardware.

      - -
      Semantics:
      -

      This entire intrinsic must be executed atomically. It first loads the value - in memory pointed to by ptr and compares it with the - value cmp. If they are equal, val is stored into the - memory. The loaded value is yielded in all cases. This provides the - equivalent of an atomic compare-and-swap operation within the SSA - framework.

      - -
      Examples:
      -
      -%mallocP  = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32))
      -%ptr      = bitcast i8* %mallocP to i32*
      -            store i32 4, %ptr
      -
      -%val1     = add i32 4, 4
      -%result1  = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %ptr, i32 4, %val1)
      -                                          ; yields {i32}:result1 = 4
      -%stored1  = icmp eq i32 %result1, 4       ; yields {i1}:stored1 = true
      -%memval1  = load i32* %ptr                ; yields {i32}:memval1 = 8
      -
      -%val2     = add i32 1, 1
      -%result2  = call i32 @llvm.atomic.cmp.swap.i32.p0i32(i32* %ptr, i32 5, %val2)
      -                                          ; yields {i32}:result2 = 8
      -%stored2  = icmp eq i32 %result2, 5       ; yields {i1}:stored2 = false
      -
      -%memval2  = load i32* %ptr                ; yields {i32}:memval2 = 8
      -
      - -
      - - -

      - 'llvm.atomic.swap.*' Intrinsic -

      - -
      -
      Syntax:
      - -

      This is an overloaded intrinsic. You can use llvm.atomic.swap on any - integer bit width. Not all targets support all bit widths however.

      - -
      -  declare i8 @llvm.atomic.swap.i8.p0i8(i8* <ptr>, i8 <val>)
      -  declare i16 @llvm.atomic.swap.i16.p0i16(i16* <ptr>, i16 <val>)
      -  declare i32 @llvm.atomic.swap.i32.p0i32(i32* <ptr>, i32 <val>)
      -  declare i64 @llvm.atomic.swap.i64.p0i64(i64* <ptr>, i64 <val>)
      -
      - -
      Overview:
      -

      This intrinsic loads the value stored in memory at ptr and yields - the value from memory. It then stores the value in val in the memory - at ptr.

      - -
      Arguments:
      -

      The llvm.atomic.swap intrinsic takes two arguments. Both - the val argument and the result must be integers of the same bit - width. The first argument, ptr, must be a pointer to a value of this - integer type. The targets may only lower integer representations they - support.

      - -
      Semantics:
      -

      This intrinsic loads the value pointed to by ptr, yields it, and - stores val back into ptr atomically. This provides the - equivalent of an atomic swap operation within the SSA framework.

      - -
      Examples:
      -
      -%mallocP  = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32))
      -%ptr      = bitcast i8* %mallocP to i32*
      -            store i32 4, %ptr
      -
      -%val1     = add i32 4, 4
      -%result1  = call i32 @llvm.atomic.swap.i32.p0i32(i32* %ptr, i32 %val1)
      -                                        ; yields {i32}:result1 = 4
      -%stored1  = icmp eq i32 %result1, 4     ; yields {i1}:stored1 = true
      -%memval1  = load i32* %ptr              ; yields {i32}:memval1 = 8
      -
      -%val2     = add i32 1, 1
      -%result2  = call i32 @llvm.atomic.swap.i32.p0i32(i32* %ptr, i32 %val2)
      -                                        ; yields {i32}:result2 = 8
      -
      -%stored2  = icmp eq i32 %result2, 8     ; yields {i1}:stored2 = true
      -%memval2  = load i32* %ptr              ; yields {i32}:memval2 = 2
      -
      - -
      - - -

      - 'llvm.atomic.load.add.*' Intrinsic -

      - -
      - -
      Syntax:
      -

      This is an overloaded intrinsic. You can use llvm.atomic.load.add on - any integer bit width. Not all targets support all bit widths however.

      - -
      -  declare i8 @llvm.atomic.load.add.i8.p0i8(i8* <ptr>, i8 <delta>)
      -  declare i16 @llvm.atomic.load.add.i16.p0i16(i16* <ptr>, i16 <delta>)
      -  declare i32 @llvm.atomic.load.add.i32.p0i32(i32* <ptr>, i32 <delta>)
      -  declare i64 @llvm.atomic.load.add.i64.p0i64(i64* <ptr>, i64 <delta>)
      -
      - -
      Overview:
      -

      This intrinsic adds delta to the value stored in memory - at ptr. It yields the original value at ptr.

      - -
      Arguments:
      -

      The intrinsic takes two arguments, the first a pointer to an integer value - and the second an integer value. The result is also an integer value. These - integer types can have any bit width, but they must all have the same bit - width. The targets may only lower integer representations they support.

      - -
      Semantics:
      -

      This intrinsic does a series of operations atomically. It first loads the - value stored at ptr. It then adds delta, stores the result - to ptr. It yields the original value stored at ptr.

      - -
      Examples:
      -
      -%mallocP  = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32))
      -%ptr      = bitcast i8* %mallocP to i32*
      -            store i32 4, %ptr
      -%result1  = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %ptr, i32 4)
      -                                ; yields {i32}:result1 = 4
      -%result2  = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %ptr, i32 2)
      -                                ; yields {i32}:result2 = 8
      -%result3  = call i32 @llvm.atomic.load.add.i32.p0i32(i32* %ptr, i32 5)
      -                                ; yields {i32}:result3 = 10
      -%memval1  = load i32* %ptr      ; yields {i32}:memval1 = 15
      -
      - -
      - - -

      - 'llvm.atomic.load.sub.*' Intrinsic -

      - -
      - -
      Syntax:
      -

      This is an overloaded intrinsic. You can use llvm.atomic.load.sub on - any integer bit width and for different address spaces. Not all targets - support all bit widths however.

      - -
      -  declare i8 @llvm.atomic.load.sub.i8.p0i32(i8* <ptr>, i8 <delta>)
      -  declare i16 @llvm.atomic.load.sub.i16.p0i32(i16* <ptr>, i16 <delta>)
      -  declare i32 @llvm.atomic.load.sub.i32.p0i32(i32* <ptr>, i32 <delta>)
      -  declare i64 @llvm.atomic.load.sub.i64.p0i32(i64* <ptr>, i64 <delta>)
      -
      - -
      Overview:
      -

      This intrinsic subtracts delta to the value stored in memory at - ptr. It yields the original value at ptr.

      - -
      Arguments:
      -

      The intrinsic takes two arguments, the first a pointer to an integer value - and the second an integer value. The result is also an integer value. These - integer types can have any bit width, but they must all have the same bit - width. The targets may only lower integer representations they support.

      - -
      Semantics:
      -

      This intrinsic does a series of operations atomically. It first loads the - value stored at ptr. It then subtracts delta, stores the - result to ptr. It yields the original value stored - at ptr.

      - -
      Examples:
      -
      -%mallocP  = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32))
      -%ptr      = bitcast i8* %mallocP to i32*
      -            store i32 8, %ptr
      -%result1  = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %ptr, i32 4)
      -                                ; yields {i32}:result1 = 8
      -%result2  = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %ptr, i32 2)
      -                                ; yields {i32}:result2 = 4
      -%result3  = call i32 @llvm.atomic.load.sub.i32.p0i32(i32* %ptr, i32 5)
      -                                ; yields {i32}:result3 = 2
      -%memval1  = load i32* %ptr      ; yields {i32}:memval1 = -3
      -
      - -
      - - -

      - - 'llvm.atomic.load.and.*' Intrinsic - -
      - - 'llvm.atomic.load.nand.*' Intrinsic - -
      - - 'llvm.atomic.load.or.*' Intrinsic - -
      - - 'llvm.atomic.load.xor.*' Intrinsic - -

      - -
      - -
      Syntax:
      -

      These are overloaded intrinsics. You can - use llvm.atomic.load_and, llvm.atomic.load_nand, - llvm.atomic.load_or, and llvm.atomic.load_xor on any integer - bit width and for different address spaces. Not all targets support all bit - widths however.

      - -
      -  declare i8 @llvm.atomic.load.and.i8.p0i8(i8* <ptr>, i8 <delta>)
      -  declare i16 @llvm.atomic.load.and.i16.p0i16(i16* <ptr>, i16 <delta>)
      -  declare i32 @llvm.atomic.load.and.i32.p0i32(i32* <ptr>, i32 <delta>)
      -  declare i64 @llvm.atomic.load.and.i64.p0i64(i64* <ptr>, i64 <delta>)
      -
      - -
      -  declare i8 @llvm.atomic.load.or.i8.p0i8(i8* <ptr>, i8 <delta>)
      -  declare i16 @llvm.atomic.load.or.i16.p0i16(i16* <ptr>, i16 <delta>)
      -  declare i32 @llvm.atomic.load.or.i32.p0i32(i32* <ptr>, i32 <delta>)
      -  declare i64 @llvm.atomic.load.or.i64.p0i64(i64* <ptr>, i64 <delta>)
      -
      - -
      -  declare i8 @llvm.atomic.load.nand.i8.p0i32(i8* <ptr>, i8 <delta>)
      -  declare i16 @llvm.atomic.load.nand.i16.p0i32(i16* <ptr>, i16 <delta>)
      -  declare i32 @llvm.atomic.load.nand.i32.p0i32(i32* <ptr>, i32 <delta>)
      -  declare i64 @llvm.atomic.load.nand.i64.p0i32(i64* <ptr>, i64 <delta>)
      -
      - -
      -  declare i8 @llvm.atomic.load.xor.i8.p0i32(i8* <ptr>, i8 <delta>)
      -  declare i16 @llvm.atomic.load.xor.i16.p0i32(i16* <ptr>, i16 <delta>)
      -  declare i32 @llvm.atomic.load.xor.i32.p0i32(i32* <ptr>, i32 <delta>)
      -  declare i64 @llvm.atomic.load.xor.i64.p0i32(i64* <ptr>, i64 <delta>)
      -
      - -
      Overview:
      -

      These intrinsics bitwise the operation (and, nand, or, xor) delta to - the value stored in memory at ptr. It yields the original value - at ptr.

      - -
      Arguments:
      -

      These intrinsics take two arguments, the first a pointer to an integer value - and the second an integer value. The result is also an integer value. These - integer types can have any bit width, but they must all have the same bit - width. The targets may only lower integer representations they support.

      - -
      Semantics:
      -

      These intrinsics does a series of operations atomically. They first load the - value stored at ptr. They then do the bitwise - operation delta, store the result to ptr. They yield the - original value stored at ptr.

      - -
      Examples:
      -
      -%mallocP  = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32))
      -%ptr      = bitcast i8* %mallocP to i32*
      -            store i32 0x0F0F, %ptr
      -%result0  = call i32 @llvm.atomic.load.nand.i32.p0i32(i32* %ptr, i32 0xFF)
      -                                ; yields {i32}:result0 = 0x0F0F
      -%result1  = call i32 @llvm.atomic.load.and.i32.p0i32(i32* %ptr, i32 0xFF)
      -                                ; yields {i32}:result1 = 0xFFFFFFF0
      -%result2  = call i32 @llvm.atomic.load.or.i32.p0i32(i32* %ptr, i32 0F)
      -                                ; yields {i32}:result2 = 0xF0
      -%result3  = call i32 @llvm.atomic.load.xor.i32.p0i32(i32* %ptr, i32 0F)
      -                                ; yields {i32}:result3 = FF
      -%memval1  = load i32* %ptr      ; yields {i32}:memval1 = F0
      -
      - -
      - - -

      - - 'llvm.atomic.load.max.*' Intrinsic - -
      - - 'llvm.atomic.load.min.*' Intrinsic - -
      - - 'llvm.atomic.load.umax.*' Intrinsic - -
      - - 'llvm.atomic.load.umin.*' Intrinsic - -

      - -
      - -
      Syntax:
      -

      These are overloaded intrinsics. You can use llvm.atomic.load_max, - llvm.atomic.load_min, llvm.atomic.load_umax, and - llvm.atomic.load_umin on any integer bit width and for different - address spaces. Not all targets support all bit widths however.

      - -
      -  declare i8 @llvm.atomic.load.max.i8.p0i8(i8* <ptr>, i8 <delta>)
      -  declare i16 @llvm.atomic.load.max.i16.p0i16(i16* <ptr>, i16 <delta>)
      -  declare i32 @llvm.atomic.load.max.i32.p0i32(i32* <ptr>, i32 <delta>)
      -  declare i64 @llvm.atomic.load.max.i64.p0i64(i64* <ptr>, i64 <delta>)
      -
      - -
      -  declare i8 @llvm.atomic.load.min.i8.p0i8(i8* <ptr>, i8 <delta>)
      -  declare i16 @llvm.atomic.load.min.i16.p0i16(i16* <ptr>, i16 <delta>)
      -  declare i32 @llvm.atomic.load.min.i32.p0i32(i32* <ptr>, i32 <delta>)
      -  declare i64 @llvm.atomic.load.min.i64.p0i64(i64* <ptr>, i64 <delta>)
      -
      - -
      -  declare i8 @llvm.atomic.load.umax.i8.p0i8(i8* <ptr>, i8 <delta>)
      -  declare i16 @llvm.atomic.load.umax.i16.p0i16(i16* <ptr>, i16 <delta>)
      -  declare i32 @llvm.atomic.load.umax.i32.p0i32(i32* <ptr>, i32 <delta>)
      -  declare i64 @llvm.atomic.load.umax.i64.p0i64(i64* <ptr>, i64 <delta>)
      -
      - -
      -  declare i8 @llvm.atomic.load.umin.i8.p0i8(i8* <ptr>, i8 <delta>)
      -  declare i16 @llvm.atomic.load.umin.i16.p0i16(i16* <ptr>, i16 <delta>)
      -  declare i32 @llvm.atomic.load.umin.i32.p0i32(i32* <ptr>, i32 <delta>)
      -  declare i64 @llvm.atomic.load.umin.i64.p0i64(i64* <ptr>, i64 <delta>)
      -
      - -
      Overview:
      -

      These intrinsics takes the signed or unsigned minimum or maximum of - delta and the value stored in memory at ptr. It yields the - original value at ptr.

      - -
      Arguments:
      -

      These intrinsics take two arguments, the first a pointer to an integer value - and the second an integer value. The result is also an integer value. These - integer types can have any bit width, but they must all have the same bit - width. The targets may only lower integer representations they support.

      - -
      Semantics:
      -

      These intrinsics does a series of operations atomically. They first load the - value stored at ptr. They then do the signed or unsigned min or - max delta and the value, store the result to ptr. They - yield the original value stored at ptr.

      - -
      Examples:
      -
      -%mallocP  = tail call i8* @malloc(i32 ptrtoint (i32* getelementptr (i32* null, i32 1) to i32))
      -%ptr      = bitcast i8* %mallocP to i32*
      -            store i32 7, %ptr
      -%result0  = call i32 @llvm.atomic.load.min.i32.p0i32(i32* %ptr, i32 -2)
      -                                ; yields {i32}:result0 = 7
      -%result1  = call i32 @llvm.atomic.load.max.i32.p0i32(i32* %ptr, i32 8)
      -                                ; yields {i32}:result1 = -2
      -%result2  = call i32 @llvm.atomic.load.umin.i32.p0i32(i32* %ptr, i32 10)
      -                                ; yields {i32}:result2 = 8
      -%result3  = call i32 @llvm.atomic.load.umax.i32.p0i32(i32* %ptr, i32 30)
      -                                ; yields {i32}:result3 = 8
      -%memval1  = load i32* %ptr      ; yields {i32}:memval1 = 30
      -
      - -
      - -
      - - -

      Memory Use Markers

      @@ -8615,7 +8101,7 @@ LLVM.

      Chris Lattner
      The LLVM Compiler Infrastructure
      - Last modified: $Date: 2011-10-14 01:04:49 +0200 (Fri, 14 Oct 2011) $ + Last modified: $Date: 2011-11-03 07:43:54 +0100 (Thu, 03 Nov 2011) $ Modified: vendor/llvm/dist/docs/LinkTimeOptimization.html ============================================================================== --- vendor/llvm/dist/docs/LinkTimeOptimization.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/LinkTimeOptimization.html Fri Dec 9 18:27:22 2011 (r228364) @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + LLVM Link Time Optimization: Design and Implementation @@ -392,7 +393,7 @@ of the native object files.

      Devang Patel and Nick Kledzik
      LLVM Compiler Infrastructure
      - Last modified: $Date: 2011-09-18 14:51:05 +0200 (Sun, 18 Sep 2011) $ + Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $ Modified: vendor/llvm/dist/docs/Packaging.html ============================================================================== --- vendor/llvm/dist/docs/Packaging.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/Packaging.html Fri Dec 9 18:27:22 2011 (r228364) @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + Advice on Packaging LLVM @@ -112,7 +113,7 @@ line numbers. Valid HTML 4.01 The LLVM Compiler Infrastructure
      - Last modified: $Date: 2011-04-23 02:30:22 +0200 (Sat, 23 Apr 2011) $ + Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $ Modified: vendor/llvm/dist/docs/Passes.html ============================================================================== --- vendor/llvm/dist/docs/Passes.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/Passes.html Fri Dec 9 18:27:22 2011 (r228364) @@ -226,11 +226,8 @@ perl -e '$/ = undef; for (split(/\n/, <> -basicaa: Basic Alias Analysis (stateless AA impl)
  • -

    - This is the default implementation of the Alias Analysis interface - that simply implements a few identities (two different globals cannot alias, - etc), but otherwise does no analysis. -

    +

    A basic alias analysis pass that implements identities (two different + globals cannot alias, etc), but does no stateful analysis.

    @@ -527,9 +524,10 @@ perl -e '$/ = undef; for (split(/\n/, <>

    - Always returns "I don't know" for alias queries. NoAA is unlike other alias - analysis implementations, in that it does not chain to a previous analysis. As - such it doesn't follow many of the rules that other alias analyses must. + This is the default implementation of the Alias Analysis interface. It always + returns "I don't know" for alias queries. NoAA is unlike other alias analysis + implementations, in that it does not chain to a previous analysis. As such it + doesn't follow many of the rules that other alias analyses must.

    @@ -2041,7 +2039,7 @@ if (X < 3) { Reid Spencer
    LLVM Compiler Infrastructure
    - Last modified: $Date: 2011-08-04 00:18:20 +0200 (Thu, 04 Aug 2011) $ + Last modified: $Date: 2011-11-04 07:30:50 +0100 (Fri, 04 Nov 2011) $ Modified: vendor/llvm/dist/docs/ProgrammersManual.html ============================================================================== --- vendor/llvm/dist/docs/ProgrammersManual.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/ProgrammersManual.html Fri Dec 9 18:27:22 2011 (r228364) @@ -879,9 +879,6 @@ elements (but could contain many), for e . Doing so avoids (relatively) expensive malloc/free calls, which dwarf the cost of adding the elements to the container.

    - - -

    Sequential Containers (std::vector, std::list, etc) @@ -4055,7 +4052,7 @@ arguments. An argument has a pointer to Dinakar Dhurjati and Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2011-10-11 08:33:56 +0200 (Tue, 11 Oct 2011) $ + Last modified: $Date: 2011-11-03 07:43:54 +0100 (Thu, 03 Nov 2011) $ Modified: vendor/llvm/dist/docs/Projects.html ============================================================================== --- vendor/llvm/dist/docs/Projects.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/Projects.html Fri Dec 9 18:27:22 2011 (r228364) @@ -2,6 +2,7 @@ "http://www.w3.org/TR/html4/strict.dtd"> + Creating an LLVM Project @@ -481,7 +482,7 @@ Mailing List.

    John Criswell
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2011-06-03 04:20:48 +0200 (Fri, 03 Jun 2011) $ + Last modified: $Date: 2011-11-03 07:43:23 +0100 (Thu, 03 Nov 2011) $ Modified: vendor/llvm/dist/docs/ReleaseNotes.html ============================================================================== --- vendor/llvm/dist/docs/ReleaseNotes.html Fri Dec 9 18:22:57 2011 (r228363) +++ vendor/llvm/dist/docs/ReleaseNotes.html Fri Dec 9 18:27:22 2011 (r228364) @@ -189,13 +189,7 @@ Release Notes.

    -

    LLDB is a brand new member of the LLVM - umbrella of projects. LLDB is a next generation, high-performance - debugger. It is built as a set of reusable components which highly leverage - existing libraries in the larger LLVM Project, such as the Clang expression - parser, the LLVM disassembler and the LLVM JIT.

    - -

    LLDB is has advanced by leaps and bounds in the 3.0 timeframe. It is +

    LLDB has advanced by leaps and bounds in the 3.0 timeframe. It is dramatically more stable and useful, and includes both a new tutorial and a side-by-side comparison with @@ -210,13 +204,6 @@ Release Notes.

    -

    libc++ is another new member of the - LLVM family. It is an implementation of the C++ standard library, written - from the ground up to specifically target the forthcoming C++'0X standard and - focus on delivering great performance.

    - -

    In the LLVM 3.0 timeframe,

    -

    Like compiler_rt, libc++ is now dual licensed under the MIT and UIUC license, allowing it to be used more permissively.

    @@ -290,23 +277,257 @@ be used to verify some algorithms. projects that have already been updated to work with LLVM 3.0.

    -

    Crack Programming Language

    +

    AddressSanitizer

    + +
    +

    AddressSanitizer + uses compiler instrumentation and a specialized malloc library to find C/C++ + bugs such as use-after-free and out-of-bound accesses to heap, stack, and + globals. The key feature of the tool is speed: the average slowdown + introduced by AddressSanitizer is less than 2x.

    + +
    + + +

    ClamAV

    +
    -

    Crack aims to provide - the ease of development of a scripting language with the performance of a - compiled language. The language derives concepts from C++, Java and Python, - incorporating object-oriented programming, operator overloading and strong - typing.

    +

    Clam AntiVirus is an open source (GPL) + anti-virus toolkit for UNIX, designed especially for e-mail scanning on mail + gateways.

    + +

    Since version 0.96 it + has bytecode + signatures that allow writing detections for complex malware.

    + +

    It uses LLVM's JIT to speed up the execution of bytecode on X86, X86-64, + PPC32/64, falling back to its own interpreter otherwise. The git version was + updated to work with LLVM 3.0.

    + +
    + + +

    clReflect

    + +
    + +

    clReflect is a C++ + parser that uses clang/LLVM to derive a light-weight reflection database + suitable for use in game development. It comes with a very simple runtime + library for loading and querying the database, requiring no external + dependencies (including CRT), and an additional utility library for object + management and serialisation.

    *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 18:30:07 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 223031065670; Fri, 9 Dec 2011 18:30:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E444A8FC08; Fri, 9 Dec 2011 18:30:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9IU6L1044582; Fri, 9 Dec 2011 18:30:06 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9IU6WW044581; Fri, 9 Dec 2011 18:30:06 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112091830.pB9IU6WW044581@svn.freebsd.org> From: Dimitry Andric Date: Fri, 9 Dec 2011 18:30:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228365 - vendor/llvm/llvm-r145349 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 18:30:07 -0000 Author: dim Date: Fri Dec 9 18:30:06 2011 New Revision: 228365 URL: http://svn.freebsd.org/changeset/base/228365 Log: Tag llvm 3.0 final release. Added: vendor/llvm/llvm-r145349/ - copied from r228364, vendor/llvm/dist/ From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 18:30:43 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8429D106564A; Fri, 9 Dec 2011 18:30:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6FB848FC15; Fri, 9 Dec 2011 18:30:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9IUh9H044650; Fri, 9 Dec 2011 18:30:43 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9IUhbm044635; Fri, 9 Dec 2011 18:30:43 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112091830.pB9IUhbm044635@svn.freebsd.org> From: Dimitry Andric Date: Fri, 9 Dec 2011 18:30:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228366 - in vendor/clang/dist: bindings/python/clang bindings/python/tests/cindex include/clang/Basic include/clang/Driver include/clang/Frontend lib/Basic lib/CodeGen lib/Driver lib/F... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 18:30:43 -0000 Author: dim Date: Fri Dec 9 18:30:42 2011 New Revision: 228366 URL: http://svn.freebsd.org/changeset/base/228366 Log: Vendor import of clang 3.0 final release: http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_30/final@145349 Added: vendor/clang/dist/test/CodeGen/pr9614.c vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.6/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.6.99/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.6.99/crtbegin.o vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.6/crtbegin.o vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7.0/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7.1/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing1/lib/gcc/i386-unknown-linux/4.7.1/crtbegin.o vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.99/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.99/crtbegin.o vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.x/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.6.x/crtbegin.o vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.0/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.0/crtbegin.o vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.1/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing2/lib/gcc/i386-unknown-linux/4.7.1/crtbegin.o vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing3/lib/gcc/i386-unknown-linux/4.7.98/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing3/lib/gcc/i386-unknown-linux/4.7.98/crtbegin.o vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing4/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing4/bin/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing4/bin/.keep vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing4/lib/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.98/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.98/crtbegin.o vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.99/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.99-rc5/ vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.99-rc5/crtbegin.o vendor/clang/dist/test/Driver/Inputs/gcc_version_parsing4/lib/gcc/i386-unknown-linux/4.7.99/crtbegin.o Modified: vendor/clang/dist/bindings/python/clang/cindex.py vendor/clang/dist/bindings/python/tests/cindex/test_type.py vendor/clang/dist/include/clang/Basic/Builtins.def vendor/clang/dist/include/clang/Driver/CC1Options.td vendor/clang/dist/include/clang/Driver/ToolChain.h vendor/clang/dist/include/clang/Frontend/HeaderSearchOptions.h vendor/clang/dist/lib/Basic/Version.cpp vendor/clang/dist/lib/CodeGen/CGObjCGNU.cpp vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp vendor/clang/dist/lib/CodeGen/CodeGenModule.h vendor/clang/dist/lib/Driver/CMakeLists.txt vendor/clang/dist/lib/Driver/ToolChain.cpp vendor/clang/dist/lib/Driver/ToolChains.cpp vendor/clang/dist/lib/Driver/ToolChains.h vendor/clang/dist/lib/Driver/Tools.cpp vendor/clang/dist/lib/Frontend/CompilerInvocation.cpp vendor/clang/dist/lib/Frontend/InitHeaderSearch.cpp vendor/clang/dist/test/Analysis/iterators.cpp vendor/clang/dist/test/Analysis/security-syntax-checks.m vendor/clang/dist/test/Driver/linux-ld.c vendor/clang/dist/test/PCH/reloc.c vendor/clang/dist/test/Preprocessor/header_lookup1.c vendor/clang/dist/test/lit.cfg Modified: vendor/clang/dist/bindings/python/clang/cindex.py ============================================================================== --- vendor/clang/dist/bindings/python/clang/cindex.py Fri Dec 9 18:30:06 2011 (r228365) +++ vendor/clang/dist/bindings/python/clang/cindex.py Fri Dec 9 18:30:42 2011 (r228366) @@ -815,7 +815,7 @@ class Cursor(Structure): The Cursor class represents a reference to an element within the AST. It acts as a kind of iterator. """ - _fields_ = [("_kind_id", c_int), ("data", c_void_p * 3)] + _fields_ = [("_kind_id", c_int), ("xdata", c_int), ("data", c_void_p * 3)] def __eq__(self, other): return Cursor_eq(self, other) @@ -1019,7 +1019,7 @@ TypeKind.OBJCINTERFACE = TypeKind(108) TypeKind.OBJCOBJECTPOINTER = TypeKind(109) TypeKind.FUNCTIONNOPROTO = TypeKind(110) TypeKind.FUNCTIONPROTO = TypeKind(111) - +TypeKind.CONSTANTARRAY = TypeKind(112) class Type(Structure): """ Modified: vendor/clang/dist/bindings/python/tests/cindex/test_type.py ============================================================================== --- vendor/clang/dist/bindings/python/tests/cindex/test_type.py Fri Dec 9 18:30:06 2011 (r228365) +++ vendor/clang/dist/bindings/python/tests/cindex/test_type.py Fri Dec 9 18:30:42 2011 (r228366) @@ -74,3 +74,22 @@ def test_a_struct(): else: assert False, "Didn't find teststruct??" + + +constarrayInput=""" +struct teststruct { + void *A[2]; +}; +""" +def testConstantArray(): + index = Index.create() + tu = index.parse('t.c', unsaved_files = [('t.c',constarrayInput)]) + + for n in tu.cursor.get_children(): + if n.spelling == 'teststruct': + fields = list(n.get_children()) + assert fields[0].spelling == 'A' + assert fields[0].type.kind == TypeKind.CONSTANTARRAY + break + else: + assert False, "Didn't find teststruct??" Modified: vendor/clang/dist/include/clang/Basic/Builtins.def ============================================================================== --- vendor/clang/dist/include/clang/Basic/Builtins.def Fri Dec 9 18:30:06 2011 (r228365) +++ vendor/clang/dist/include/clang/Basic/Builtins.def Fri Dec 9 18:30:42 2011 (r228366) @@ -672,16 +672,16 @@ LIBBUILTIN(rindex, "c*cC*i", "f", LIBBUILTIN(bzero, "vv*z", "f", "strings.h", ALL_LANGUAGES) // POSIX unistd.h LIBBUILTIN(_exit, "vi", "fr", "unistd.h", ALL_LANGUAGES) -LIBBUILTIN(vfork, "iJ", "fj", "unistd.h", ALL_LANGUAGES) +LIBBUILTIN(vfork, "i", "fj", "unistd.h", ALL_LANGUAGES) // POSIX setjmp.h // In some systems setjmp is a macro that expands to _setjmp. We undefine // it here to avoid having two identical LIBBUILTIN entries. #undef setjmp LIBBUILTIN(_setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) -LIBBUILTIN(__sigsetjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) +LIBBUILTIN(__sigsetjmp, "iJi", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(setjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) -LIBBUILTIN(sigsetjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) +LIBBUILTIN(sigsetjmp, "iJi", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(setjmp_syscall, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(savectx, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) LIBBUILTIN(qsetjmp, "iJ", "fj", "setjmp.h", ALL_LANGUAGES) Modified: vendor/clang/dist/include/clang/Driver/CC1Options.td ============================================================================== --- vendor/clang/dist/include/clang/Driver/CC1Options.td Fri Dec 9 18:30:06 2011 (r228365) +++ vendor/clang/dist/include/clang/Driver/CC1Options.td Fri Dec 9 18:30:42 2011 (r228366) @@ -642,6 +642,17 @@ def isystem : JoinedOrSeparate<"-isystem def iwithsysroot : JoinedOrSeparate<"-iwithsysroot">,MetaVarName<"">, HelpText<"Add directory to SYSTEM include search path, " "absolute paths are relative to -isysroot">; +def internal_isystem : JoinedOrSeparate<"-internal-isystem">, + MetaVarName<"">, + HelpText<"Add directory to the internal system include search path; these " + "are assumed to not be user-provided and are used to model system " + "and standard headers' paths.">; +def internal_externc_isystem : JoinedOrSeparate<"-internal-externc-isystem">, + MetaVarName<"">, + HelpText<"Add directory to the internal system include search path with " + "implicit extern \"C\" semantics; these are assumed to not be " + "user-provided and are used to model system and standard headers' " + "paths.">; def iprefix : JoinedOrSeparate<"-iprefix">, MetaVarName<"">, HelpText<"Set the -iwithprefix/-iwithprefixbefore prefix">; def iwithprefix : JoinedOrSeparate<"-iwithprefix">, MetaVarName<"">, Modified: vendor/clang/dist/include/clang/Driver/ToolChain.h ============================================================================== --- vendor/clang/dist/include/clang/Driver/ToolChain.h Fri Dec 9 18:30:06 2011 (r228365) +++ vendor/clang/dist/include/clang/Driver/ToolChain.h Fri Dec 9 18:30:42 2011 (r228366) @@ -195,15 +195,21 @@ public: /// FIXME: this really belongs on some sort of DeploymentTarget abstraction virtual bool hasBlocksRuntime() const { return true; } + /// \brief Add the clang cc1 arguments for system include paths. + /// + /// This routine is responsible for adding the necessary cc1 arguments to + /// include headers from standard system header directories. + virtual void AddClangSystemIncludeArgs(const ArgList &DriverArgs, + ArgStringList &CC1Args) const; + // GetCXXStdlibType - Determine the C++ standard library type to use with the // given compilation arguments. virtual CXXStdlibType GetCXXStdlibType(const ArgList &Args) const; /// AddClangCXXStdlibIncludeArgs - Add the clang -cc1 level arguments to set /// the include paths to use for the given C++ standard library type. - virtual void AddClangCXXStdlibIncludeArgs(const ArgList &Args, - ArgStringList &CmdArgs, - bool ObjCXXAutoRefCount) const; + virtual void AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, + ArgStringList &CC1Args) const; /// AddCXXStdlibLibArgs - Add the system specific linker arguments to use /// for the given C++ standard library type. Modified: vendor/clang/dist/include/clang/Frontend/HeaderSearchOptions.h ============================================================================== --- vendor/clang/dist/include/clang/Frontend/HeaderSearchOptions.h Fri Dec 9 18:30:06 2011 (r228365) +++ vendor/clang/dist/include/clang/Frontend/HeaderSearchOptions.h Fri Dec 9 18:30:42 2011 (r228366) @@ -49,10 +49,24 @@ public: /// path. unsigned IgnoreSysRoot : 1; + /// \brief True if this entry is an internal search path. + /// + /// This typically indicates that users didn't directly provide it, but + /// instead it was provided by a compatibility layer for a particular + /// system. This isn't redundant with IsUserSupplied (even though perhaps + /// it should be) because that is false for user provided '-iwithprefix' + /// header search entries. + unsigned IsInternal : 1; + + /// \brief True if this entry's headers should be wrapped in extern "C". + unsigned ImplicitExternC : 1; + Entry(StringRef path, frontend::IncludeDirGroup group, - bool isUserSupplied, bool isFramework, bool ignoreSysRoot) + bool isUserSupplied, bool isFramework, bool ignoreSysRoot, + bool isInternal, bool implicitExternC) : Path(path), Group(group), IsUserSupplied(isUserSupplied), - IsFramework(isFramework), IgnoreSysRoot(ignoreSysRoot) {} + IsFramework(isFramework), IgnoreSysRoot(ignoreSysRoot), + IsInternal(isInternal), ImplicitExternC(implicitExternC) {} }; /// If non-empty, the directory to use as a "virtual system root" for include @@ -98,9 +112,10 @@ public: /// AddPath - Add the \arg Path path to the specified \arg Group list. void AddPath(StringRef Path, frontend::IncludeDirGroup Group, - bool IsUserSupplied, bool IsFramework, bool IgnoreSysRoot) { + bool IsUserSupplied, bool IsFramework, bool IgnoreSysRoot, + bool IsInternal = false, bool ImplicitExternC = false) { UserEntries.push_back(Entry(Path, Group, IsUserSupplied, IsFramework, - IgnoreSysRoot)); + IgnoreSysRoot, IsInternal, ImplicitExternC)); } }; Modified: vendor/clang/dist/lib/Basic/Version.cpp ============================================================================== --- vendor/clang/dist/lib/Basic/Version.cpp Fri Dec 9 18:30:06 2011 (r228365) +++ vendor/clang/dist/lib/Basic/Version.cpp Fri Dec 9 18:30:42 2011 (r228366) @@ -32,7 +32,7 @@ std::string getClangRepositoryPath() { // If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us // pick up a tag in an SVN export, for example. - static StringRef SVNRepository("$URL: http://llvm.org/svn/llvm-project/cfe/branches/release_30/lib/Basic/Version.cpp $"); + static StringRef SVNRepository("$URL: http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_30/final/lib/Basic/Version.cpp $"); if (URL.empty()) { URL = SVNRepository.slice(SVNRepository.find(':'), SVNRepository.find("/lib/Basic")); Modified: vendor/clang/dist/lib/CodeGen/CGObjCGNU.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGObjCGNU.cpp Fri Dec 9 18:30:06 2011 (r228365) +++ vendor/clang/dist/lib/CodeGen/CGObjCGNU.cpp Fri Dec 9 18:30:42 2011 (r228366) @@ -538,11 +538,12 @@ protected: llvm::Value *cmd, llvm::MDNode *node) { CGBuilderTy &Builder = CGF.Builder; - llvm::Value *imp = Builder.CreateCall2(MsgLookupFn, - EnforceType(Builder, Receiver, IdTy), - EnforceType(Builder, cmd, SelectorTy)); - cast(imp)->setMetadata(msgSendMDKind, node); - return imp; + llvm::Value *args[] = { + EnforceType(Builder, Receiver, IdTy), + EnforceType(Builder, cmd, SelectorTy) }; + llvm::CallSite imp = CGF.EmitCallOrInvoke(MsgLookupFn, args); + imp->setMetadata(msgSendMDKind, node); + return imp.getInstruction(); } virtual llvm::Value *LookupIMPSuper(CodeGenFunction &CGF, llvm::Value *ObjCSuper, @@ -597,16 +598,17 @@ class CGObjCGNUstep : public CGObjCGNU { // The lookup function is guaranteed not to capture the receiver pointer. LookupFn->setDoesNotCapture(1); - llvm::CallInst *slot = - Builder.CreateCall3(LookupFn, - EnforceType(Builder, ReceiverPtr, PtrToIdTy), - EnforceType(Builder, cmd, SelectorTy), - EnforceType(Builder, self, IdTy)); - slot->setOnlyReadsMemory(); + llvm::Value *args[] = { + EnforceType(Builder, ReceiverPtr, PtrToIdTy), + EnforceType(Builder, cmd, SelectorTy), + EnforceType(Builder, self, IdTy) }; + llvm::CallSite slot = CGF.EmitCallOrInvoke(LookupFn, args); + slot.setOnlyReadsMemory(); slot->setMetadata(msgSendMDKind, node); // Load the imp from the slot - llvm::Value *imp = Builder.CreateLoad(Builder.CreateStructGEP(slot, 4)); + llvm::Value *imp = + Builder.CreateLoad(Builder.CreateStructGEP(slot.getInstruction(), 4)); // The lookup function may have changed the receiver, so make sure we use // the new one. @@ -1361,8 +1363,8 @@ llvm::Constant *CGObjCGNU::GenerateClass LongTy, // abi_version IvarOffsets->getType(), // ivar_offsets Properties->getType(), // properties - Int64Ty, // strong_pointers - Int64Ty, // weak_pointers + IntPtrTy, // strong_pointers + IntPtrTy, // weak_pointers NULL); llvm::Constant *Zero = llvm::ConstantInt::get(LongTy, 0); // Fill in the structure @@ -1723,12 +1725,14 @@ void CGObjCGNU::GenerateProtocolHolderCa /// bitfield / with the 63rd bit set will be 1<<64. llvm::Constant *CGObjCGNU::MakeBitField(llvm::SmallVectorImpl &bits) { int bitCount = bits.size(); - if (bitCount < 64) { + int ptrBits = + (TheModule.getPointerSize() == llvm::Module::Pointer32) ? 32 : 64; + if (bitCount < ptrBits) { uint64_t val = 1; for (int i=0 ; i values; int v=0; @@ -1748,8 +1752,6 @@ llvm::Constant *CGObjCGNU::MakeBitField( llvm::Constant *GS = MakeGlobal(llvm::StructType::get(Int32Ty, arrayTy, NULL), fields); llvm::Constant *ptr = llvm::ConstantExpr::getPtrToInt(GS, IntPtrTy); - if (IntPtrTy != Int64Ty) - ptr = llvm::ConstantExpr::getZExt(ptr, Int64Ty); return ptr; } @@ -2073,12 +2075,12 @@ void CGObjCGNU::GenerateClass(const ObjC } ++ivarIndex; } - llvm::Constant *Zero64 = llvm::ConstantInt::get(Int64Ty, 0); + llvm::Constant *ZeroPtr = llvm::ConstantInt::get(IntPtrTy, 0); //Generate metaclass for class methods llvm::Constant *MetaClassStruct = GenerateClassStructure(NULLPtr, NULLPtr, 0x12L, ClassName.c_str(), 0, Zeros[0], GenerateIvarList( empty, empty, empty), ClassMethodList, NULLPtr, - NULLPtr, NULLPtr, Zero64, Zero64, true); + NULLPtr, NULLPtr, ZeroPtr, ZeroPtr, true); // Generate the class structure llvm::Constant *ClassStruct = Modified: vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp Fri Dec 9 18:30:06 2011 (r228365) +++ vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp Fri Dec 9 18:30:42 2011 (r228366) @@ -29,6 +29,7 @@ #include "clang/AST/DeclTemplate.h" #include "clang/AST/Mangle.h" #include "clang/AST/RecordLayout.h" +#include "clang/AST/RecursiveASTVisitor.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/TargetInfo.h" @@ -858,6 +859,59 @@ void CodeGenModule::EmitGlobal(GlobalDec } } +namespace { + struct FunctionIsDirectlyRecursive : + public RecursiveASTVisitor { + const StringRef Name; + bool Result; + FunctionIsDirectlyRecursive(const FunctionDecl *F) : + Name(F->getName()), Result(false) { + } + typedef RecursiveASTVisitor Base; + + bool TraverseCallExpr(CallExpr *E) { + const Decl *D = E->getCalleeDecl(); + if (!D) + return true; + AsmLabelAttr *Attr = D->getAttr(); + if (!Attr) + return true; + if (Name == Attr->getLabel()) { + Result = true; + return false; + } + return true; + } + }; +} + +// isTriviallyRecursiveViaAsm - Check if this function calls another +// decl that, because of the asm attribute, ends up pointing to itself. +bool +CodeGenModule::isTriviallyRecursiveViaAsm(const FunctionDecl *F) { + if (getCXXABI().getMangleContext().shouldMangleDeclName(F)) + return false; + + FunctionIsDirectlyRecursive Walker(F); + Walker.TraverseFunctionDecl(const_cast(F)); + return Walker.Result; +} + +bool +CodeGenModule::shouldEmitFunction(const FunctionDecl *F) { + if (getFunctionLinkage(F) != llvm::Function::AvailableExternallyLinkage) + return true; + if (CodeGenOpts.OptimizationLevel == 0 && + !F->hasAttr()) + return false; + // PR9614. Avoid cases where the source code is lying to us. An available + // externally function should have an equivalent function somewhere else, + // but a function that calls itself is clearly not equivalent to the real + // implementation. + // This happens in glibc's btowc and in some configure checks. + return !isTriviallyRecursiveViaAsm(F); +} + void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD) { const ValueDecl *D = cast(GD.getDecl()); @@ -868,10 +922,7 @@ void CodeGenModule::EmitGlobalDefinition if (const FunctionDecl *Function = dyn_cast(D)) { // At -O0, don't generate IR for functions with available_externally // linkage. - if (CodeGenOpts.OptimizationLevel == 0 && - !Function->hasAttr() && - getFunctionLinkage(Function) - == llvm::Function::AvailableExternallyLinkage) + if (!shouldEmitFunction(Function)) return; if (const CXXMethodDecl *Method = dyn_cast(D)) { Modified: vendor/clang/dist/lib/CodeGen/CodeGenModule.h ============================================================================== --- vendor/clang/dist/lib/CodeGen/CodeGenModule.h Fri Dec 9 18:30:06 2011 (r228365) +++ vendor/clang/dist/lib/CodeGen/CodeGenModule.h Fri Dec 9 18:30:42 2011 (r228366) @@ -324,6 +324,8 @@ class CodeGenModule : public CodeGenType void createOpenCLRuntime(); void createCUDARuntime(); + bool isTriviallyRecursiveViaAsm(const FunctionDecl *F); + bool shouldEmitFunction(const FunctionDecl *F); llvm::LLVMContext &VMContext; /// @name Cache for Blocks Runtime Globals Modified: vendor/clang/dist/lib/Driver/CMakeLists.txt ============================================================================== --- vendor/clang/dist/lib/Driver/CMakeLists.txt Fri Dec 9 18:30:06 2011 (r228365) +++ vendor/clang/dist/lib/Driver/CMakeLists.txt Fri Dec 9 18:30:42 2011 (r228366) @@ -21,5 +21,13 @@ add_clang_library(clangDriver Types.cpp ) +IF(MSVC) + get_target_property(NON_ANSI_COMPILE_FLAGS clangDriver COMPILE_FLAGS) + string(REPLACE /Za + "" NON_ANSI_COMPILE_FLAGS + ${NON_ANSI_COMPILE_FLAGS}) + set_target_properties(clangDriver PROPERTIES COMPILE_FLAGS ${NON_ANSI_COMPILE_FLAGS}) +ENDIF(MSVC) + add_dependencies(clangDriver ClangAttrList ClangDiagnosticDriver ClangDriverOptions ClangCC1Options ClangCC1AsOptions) Modified: vendor/clang/dist/lib/Driver/ToolChain.cpp ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChain.cpp Fri Dec 9 18:30:06 2011 (r228365) +++ vendor/clang/dist/lib/Driver/ToolChain.cpp Fri Dec 9 18:30:42 2011 (r228366) @@ -211,6 +211,11 @@ std::string ToolChain::ComputeEffectiveC return ComputeLLVMTriple(Args, InputType); } +void ToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs, + ArgStringList &CC1Args) const { + // Each toolchain should provide the appropriate include flags. +} + ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{ if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) { StringRef Value = A->getValue(Args); @@ -225,24 +230,18 @@ ToolChain::CXXStdlibType ToolChain::GetC return ToolChain::CST_Libstdcxx; } -void ToolChain::AddClangCXXStdlibIncludeArgs(const ArgList &Args, - ArgStringList &CmdArgs, - bool ObjCXXAutoRefCount) const { - CXXStdlibType Type = GetCXXStdlibType(Args); - - // Header search paths are handled by the mass of goop in InitHeaderSearch. - - switch (Type) { - case ToolChain::CST_Libcxx: - if (ObjCXXAutoRefCount) - CmdArgs.push_back("-fobjc-arc-cxxlib=libc++"); - break; - - case ToolChain::CST_Libstdcxx: - if (ObjCXXAutoRefCount) - CmdArgs.push_back("-fobjc-arc-cxxlib=libstdc++"); - break; - } +void ToolChain::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, + ArgStringList &CC1Args) const { + // Header search paths should be handled by each of the subclasses. + // Historically, they have not been, and instead have been handled inside of + // the CC1-layer frontend. As the logic is hoisted out, this generic function + // will slowly stop being called. + // + // While it is being called, replicate a bit of a hack to propagate the + // '-stdlib=' flag down to CC1 so that it can in turn customize the C++ + // header search paths with it. Once all systems are overriding this + // function, the CC1 flag and this line can be removed. + DriverArgs.AddAllArgs(CC1Args, options::OPT_stdlib_EQ); } void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args, Modified: vendor/clang/dist/lib/Driver/ToolChains.cpp ============================================================================== --- vendor/clang/dist/lib/Driver/ToolChains.cpp Fri Dec 9 18:30:06 2011 (r228365) +++ vendor/clang/dist/lib/Driver/ToolChains.cpp Fri Dec 9 18:30:42 2011 (r228366) @@ -40,10 +40,51 @@ #include "llvm/Config/config.h" // for CXX_INCLUDE_ROOT +// Include the necessary headers to interface with the Windows registry and +// environment. +#ifdef _MSC_VER + #define WIN32_LEAN_AND_MEAN 1 + #include + #undef min + #undef max +#endif + using namespace clang::driver; using namespace clang::driver::toolchains; using namespace clang; +/// \brief Utility function to add a system include directory to CC1 arguments. +static void addSystemInclude(const ArgList &DriverArgs, ArgStringList &CC1Args, + const Twine &Path) { + CC1Args.push_back("-internal-isystem"); + CC1Args.push_back(DriverArgs.MakeArgString(Path)); +} + +/// \brief Utility function to add a system include directory with extern "C" +/// semantics to CC1 arguments. +/// +/// Note that this should be used rarely, and only for directories that +/// historically and for legacy reasons are treated as having implicit extern +/// "C" semantics. These semantics are *ignored* by and large today, but its +/// important to preserve the preprocessor changes resulting from the +/// classification. +static void addExternCSystemInclude(const ArgList &DriverArgs, + ArgStringList &CC1Args, const Twine &Path) { + CC1Args.push_back("-internal-externc-isystem"); + CC1Args.push_back(DriverArgs.MakeArgString(Path)); +} + +/// \brief Utility function to add a list of system include directories to CC1. +static void addSystemIncludes(const ArgList &DriverArgs, + ArgStringList &CC1Args, + ArrayRef Paths) { + for (ArrayRef::iterator I = Paths.begin(), E = Paths.end(); + I != E; ++I) { + CC1Args.push_back("-internal-isystem"); + CC1Args.push_back(DriverArgs.MakeArgString(*I)); + } +} + /// Darwin - Darwin tool chain for i386 and x86_64. Darwin::Darwin(const HostInfo &Host, const llvm::Triple& Triple) @@ -1385,19 +1426,6 @@ static bool IsUbuntu(enum LinuxDistro Di Distro == UbuntuNatty || Distro == UbuntuOneiric; } -// FIXME: This should be deleted. We should assume a multilib environment, and -// fallback gracefully if any parts of it are absent. -static bool HasMultilib(llvm::Triple::ArchType Arch, enum LinuxDistro Distro) { - if (Arch == llvm::Triple::x86_64) { - bool Exists; - if (Distro == Exherbo && - (llvm::sys::fs::exists("/usr/lib32/libc.so", Exists) || !Exists)) - return false; - } - - return true; -} - static LinuxDistro DetectLinuxDistro(llvm::Triple::ArchType Arch) { llvm::OwningPtr File; if (!llvm::MemoryBuffer::getFile("/etc/lsb-release", File)) { @@ -1482,280 +1510,293 @@ static LinuxDistro DetectLinuxDistro(llv return UnknownDistro; } -/// \brief Trivial helper function to simplify code checking path existence. -static bool PathExists(StringRef Path) { - bool Exists; - if (!llvm::sys::fs::exists(Path, Exists)) - return Exists; - return false; +/// \brief Parse a GCCVersion object out of a string of text. +/// +/// This is the primary means of forming GCCVersion objects. +/*static*/ Linux::GCCVersion Linux::GCCVersion::Parse(StringRef VersionText) { + const GCCVersion BadVersion = { VersionText.str(), -1, -1, -1, "" }; + std::pair First = VersionText.split('.'); + std::pair Second = First.second.split('.'); + + GCCVersion GoodVersion = { VersionText.str(), -1, -1, -1, "" }; + if (First.first.getAsInteger(10, GoodVersion.Major) || + GoodVersion.Major < 0) + return BadVersion; + if (Second.first.getAsInteger(10, GoodVersion.Minor) || + GoodVersion.Minor < 0) + return BadVersion; + + // First look for a number prefix and parse that if present. Otherwise just + // stash the entire patch string in the suffix, and leave the number + // unspecified. This covers versions strings such as: + // 4.4 + // 4.4.0 + // 4.4.x + // 4.4.2-rc4 + // 4.4.x-patched + // And retains any patch number it finds. + StringRef PatchText = GoodVersion.PatchSuffix = Second.second.str(); + if (!PatchText.empty()) { + if (unsigned EndNumber = PatchText.find_first_not_of("0123456789")) { + // Try to parse the number and any suffix. + if (PatchText.slice(0, EndNumber).getAsInteger(10, GoodVersion.Patch) || + GoodVersion.Patch < 0) + return BadVersion; + GoodVersion.PatchSuffix = PatchText.substr(EndNumber).str(); + } + } + + return GoodVersion; } -namespace { -/// \brief This is a class to find a viable GCC installation for Clang to use. -/// -/// This class tries to find a GCC installation on the system, and report -/// information about it. It starts from the host information provided to the -/// Driver, and has logic for fuzzing that where appropriate. -class GCCInstallationDetector { - /// \brief Struct to store and manipulate GCC versions. - /// - /// We rely on assumptions about the form and structure of GCC version - /// numbers: they consist of at most three '.'-separated components, and each - /// component is a non-negative integer. - struct GCCVersion { - unsigned Major, Minor, Patch; - - static GCCVersion Parse(StringRef VersionText) { - const GCCVersion BadVersion = {0, 0, 0}; - std::pair First = VersionText.split('.'); - std::pair Second = First.second.split('.'); +/// \brief Less-than for GCCVersion, implementing a Strict Weak Ordering. +bool Linux::GCCVersion::operator<(const GCCVersion &RHS) const { + if (Major < RHS.Major) return true; if (Major > RHS.Major) return false; + if (Minor < RHS.Minor) return true; if (Minor > RHS.Minor) return false; - GCCVersion GoodVersion = {0, 0, 0}; - if (First.first.getAsInteger(10, GoodVersion.Major)) - return BadVersion; - if (Second.first.getAsInteger(10, GoodVersion.Minor)) - return BadVersion; - // We accept a number, or a string for the patch version, in case there - // is a strang suffix, or other mangling: '4.1.x', '4.1.2-rc3'. When it - // isn't a number, we just use '0' as the number but accept it. - if (Second.first.getAsInteger(10, GoodVersion.Patch)) - GoodVersion.Patch = 0; - return GoodVersion; - } - - bool operator<(const GCCVersion &RHS) const { - if (Major < RHS.Major) return true; - if (Major > RHS.Major) return false; - if (Minor < RHS.Minor) return true; - if (Minor > RHS.Minor) return false; - return Patch < RHS.Patch; - } - bool operator>(const GCCVersion &RHS) const { return RHS < *this; } - bool operator<=(const GCCVersion &RHS) const { return !(*this > RHS); } - bool operator>=(const GCCVersion &RHS) const { return !(*this < RHS); } - }; + // Note that we rank versions with *no* patch specified is better than ones + // hard-coding a patch version. Thus if the RHS has no patch, it always + // wins, and the LHS only wins if it has no patch and the RHS does have + // a patch. + if (RHS.Patch == -1) return true; if (Patch == -1) return false; + if (Patch < RHS.Patch) return true; if (Patch > RHS.Patch) return false; - bool IsValid; - std::string GccTriple; + // Finally, between completely tied version numbers, the version with the + // suffix loses as we prefer full releases. + if (RHS.PatchSuffix.empty()) return true; + return false; +} - // FIXME: These might be better as path objects. - std::string GccInstallPath; - std::string GccParentLibPath; - - llvm::SmallString<128> CxxIncludeRoot; - -public: - /// \brief Construct a GCCInstallationDetector from the driver. - /// - /// This performs all of the autodetection and sets up the various paths. - /// Once constructed, a GCCInstallation is esentially immutable. - GCCInstallationDetector(const Driver &D) - : IsValid(false), - GccTriple(D.DefaultHostTriple), - CxxIncludeRoot(CXX_INCLUDE_ROOT) { - // FIXME: Using CXX_INCLUDE_ROOT is here is a bit of a hack, but - // avoids adding yet another option to configure/cmake. - // It would probably be cleaner to break it in two variables - // CXX_GCC_ROOT with just /foo/bar - // CXX_GCC_VER with 4.5.2 - // Then we would have - // CXX_INCLUDE_ROOT = CXX_GCC_ROOT/include/c++/CXX_GCC_VER - // and this function would return - // CXX_GCC_ROOT/lib/gcc/CXX_INCLUDE_ARCH/CXX_GCC_VER - if (CxxIncludeRoot != "") { - // This is of the form /foo/bar/include/c++/4.5.2/ - if (CxxIncludeRoot.back() == '/') - llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the / - StringRef Version = llvm::sys::path::filename(CxxIncludeRoot); - llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the version - llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the c++ - llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the include - GccInstallPath = CxxIncludeRoot.str(); - GccInstallPath.append("/lib/gcc/"); - GccInstallPath.append(CXX_INCLUDE_ARCH); - GccInstallPath.append("/"); - GccInstallPath.append(Version); - GccParentLibPath = GccInstallPath + "/../../.."; - IsValid = true; - return; - } +/// \brief Construct a GCCInstallationDetector from the driver. +/// +/// This performs all of the autodetection and sets up the various paths. +/// Once constructed, a GCCInstallation is esentially immutable. +Linux::GCCInstallationDetector::GCCInstallationDetector(const Driver &D) + : IsValid(false), + GccTriple(D.DefaultHostTriple) { + // FIXME: Using CXX_INCLUDE_ROOT is here is a bit of a hack, but + // avoids adding yet another option to configure/cmake. + // It would probably be cleaner to break it in two variables + // CXX_GCC_ROOT with just /foo/bar + // CXX_GCC_VER with 4.5.2 + // Then we would have + // CXX_INCLUDE_ROOT = CXX_GCC_ROOT/include/c++/CXX_GCC_VER + // and this function would return + // CXX_GCC_ROOT/lib/gcc/CXX_INCLUDE_ARCH/CXX_GCC_VER + llvm::SmallString<128> CxxIncludeRoot(CXX_INCLUDE_ROOT); + if (CxxIncludeRoot != "") { + // This is of the form /foo/bar/include/c++/4.5.2/ + if (CxxIncludeRoot.back() == '/') + llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the / + StringRef Version = llvm::sys::path::filename(CxxIncludeRoot); + llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the version + llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the c++ + llvm::sys::path::remove_filename(CxxIncludeRoot); // remove the include + GccInstallPath = CxxIncludeRoot.str(); + GccInstallPath.append("/lib/gcc/"); + GccInstallPath.append(CXX_INCLUDE_ARCH); + GccInstallPath.append("/"); + GccInstallPath.append(Version); + GccParentLibPath = GccInstallPath + "/../../.."; + IsValid = true; + return; + } - llvm::Triple::ArchType HostArch = llvm::Triple(GccTriple).getArch(); - // The library directories which may contain GCC installations. - SmallVector CandidateLibDirs; - // The compatible GCC triples for this particular architecture. - SmallVector CandidateTriples; - CollectLibDirsAndTriples(HostArch, CandidateLibDirs, CandidateTriples); - - // Always include the default host triple as the final fallback if no - // specific triple is detected. - CandidateTriples.push_back(D.DefaultHostTriple); - - // Compute the set of prefixes for our search. - SmallVector Prefixes(D.PrefixDirs.begin(), - D.PrefixDirs.end()); - Prefixes.push_back(D.SysRoot); - Prefixes.push_back(D.SysRoot + "/usr"); - Prefixes.push_back(D.InstalledDir + "/.."); - - // Loop over the various components which exist and select the best GCC - // installation available. GCC installs are ranked by version number. - GCCVersion BestVersion = {0, 0, 0}; - for (unsigned i = 0, ie = Prefixes.size(); i < ie; ++i) { - if (!PathExists(Prefixes[i])) + llvm::Triple::ArchType HostArch = llvm::Triple(GccTriple).getArch(); + // The library directories which may contain GCC installations. + SmallVector CandidateLibDirs; + // The compatible GCC triples for this particular architecture. + SmallVector CandidateTriples; + CollectLibDirsAndTriples(HostArch, CandidateLibDirs, CandidateTriples); + + // Always include the default host triple as the final fallback if no + // specific triple is detected. + CandidateTriples.push_back(D.DefaultHostTriple); + + // Compute the set of prefixes for our search. + SmallVector Prefixes(D.PrefixDirs.begin(), + D.PrefixDirs.end()); + Prefixes.push_back(D.SysRoot); + Prefixes.push_back(D.SysRoot + "/usr"); + Prefixes.push_back(D.InstalledDir + "/.."); + + // Loop over the various components which exist and select the best GCC + // installation available. GCC installs are ranked by version number. + Version = GCCVersion::Parse("0.0.0"); + for (unsigned i = 0, ie = Prefixes.size(); i < ie; ++i) { + if (!llvm::sys::fs::exists(Prefixes[i])) + continue; + for (unsigned j = 0, je = CandidateLibDirs.size(); j < je; ++j) { + const std::string LibDir = Prefixes[i] + CandidateLibDirs[j].str(); + if (!llvm::sys::fs::exists(LibDir)) continue; - for (unsigned j = 0, je = CandidateLibDirs.size(); j < je; ++j) { - const std::string LibDir = Prefixes[i] + CandidateLibDirs[j].str(); - if (!PathExists(LibDir)) - continue; - for (unsigned k = 0, ke = CandidateTriples.size(); k < ke; ++k) - ScanLibDirForGCCTriple(LibDir, CandidateTriples[k], BestVersion); - } + for (unsigned k = 0, ke = CandidateTriples.size(); k < ke; ++k) + ScanLibDirForGCCTriple(HostArch, LibDir, CandidateTriples[k]); } } +} - /// \brief Check whether we detected a valid GCC install. - bool isValid() const { return IsValid; } - - /// \brief Get the GCC triple for the detected install. - const std::string &getTriple() const { return GccTriple; } - - /// \brief Get the detected GCC installation path. - const std::string &getInstallPath() const { return GccInstallPath; } - - /// \brief Get the detected GCC parent lib path. - const std::string &getParentLibPath() const { return GccParentLibPath; } - -private: - static void CollectLibDirsAndTriples(llvm::Triple::ArchType HostArch, - SmallVectorImpl &LibDirs, - SmallVectorImpl &Triples) { - if (HostArch == llvm::Triple::arm || HostArch == llvm::Triple::thumb) { - static const char *const ARMLibDirs[] = { "/lib" }; - static const char *const ARMTriples[] = { "arm-linux-gnueabi" }; - LibDirs.append(ARMLibDirs, ARMLibDirs + llvm::array_lengthof(ARMLibDirs)); - Triples.append(ARMTriples, ARMTriples + llvm::array_lengthof(ARMTriples)); - } else if (HostArch == llvm::Triple::x86_64) { - static const char *const X86_64LibDirs[] = { "/lib64", "/lib" }; - static const char *const X86_64Triples[] = { - "x86_64-linux-gnu", - "x86_64-unknown-linux-gnu", - "x86_64-pc-linux-gnu", - "x86_64-redhat-linux6E", - "x86_64-redhat-linux", - "x86_64-suse-linux", - "x86_64-manbo-linux-gnu", - "x86_64-linux-gnu", - "x86_64-slackware-linux" - }; - LibDirs.append(X86_64LibDirs, - X86_64LibDirs + llvm::array_lengthof(X86_64LibDirs)); - Triples.append(X86_64Triples, - X86_64Triples + llvm::array_lengthof(X86_64Triples)); - } else if (HostArch == llvm::Triple::x86) { - static const char *const X86LibDirs[] = { "/lib32", "/lib" }; - static const char *const X86Triples[] = { - "i686-linux-gnu", - "i386-linux-gnu", - "i686-pc-linux-gnu", - "i486-linux-gnu", - "i686-redhat-linux", - "i386-redhat-linux", - "i586-suse-linux", - "i486-slackware-linux" - }; - LibDirs.append(X86LibDirs, X86LibDirs + llvm::array_lengthof(X86LibDirs)); - Triples.append(X86Triples, X86Triples + llvm::array_lengthof(X86Triples)); - } else if (HostArch == llvm::Triple::ppc) { - static const char *const PPCLibDirs[] = { "/lib32", "/lib" }; - static const char *const PPCTriples[] = { - "powerpc-linux-gnu", - "powerpc-unknown-linux-gnu" - }; - LibDirs.append(PPCLibDirs, PPCLibDirs + llvm::array_lengthof(PPCLibDirs)); - Triples.append(PPCTriples, PPCTriples + llvm::array_lengthof(PPCTriples)); - } else if (HostArch == llvm::Triple::ppc64) { - static const char *const PPC64LibDirs[] = { "/lib64", "/lib" }; - static const char *const PPC64Triples[] = { - "powerpc64-unknown-linux-gnu" - }; - LibDirs.append(PPC64LibDirs, - PPC64LibDirs + llvm::array_lengthof(PPC64LibDirs)); - Triples.append(PPC64Triples, - PPC64Triples + llvm::array_lengthof(PPC64Triples)); - } - } - - void ScanLibDirForGCCTriple(const std::string &LibDir, - StringRef CandidateTriple, - GCCVersion &BestVersion) { - // There are various different suffixes involving the triple we - // check for. We also record what is necessary to walk from each back - // up to the lib directory. - const std::string Suffixes[] = { - "/gcc/" + CandidateTriple.str(), - "/" + CandidateTriple.str() + "/gcc/" + CandidateTriple.str(), - - // Ubuntu has a strange mis-matched pair of triples that this happens to - // match. - // FIXME: It may be worthwhile to generalize this and look for a second - // triple. - "/" + CandidateTriple.str() + "/gcc/i686-linux-gnu" +/*static*/ void Linux::GCCInstallationDetector::CollectLibDirsAndTriples( + llvm::Triple::ArchType HostArch, SmallVectorImpl &LibDirs, + SmallVectorImpl &Triples) { + if (HostArch == llvm::Triple::arm || HostArch == llvm::Triple::thumb) { + static const char *const ARMLibDirs[] = { "/lib" }; + static const char *const ARMTriples[] = { "arm-linux-gnueabi" }; + LibDirs.append(ARMLibDirs, ARMLibDirs + llvm::array_lengthof(ARMLibDirs)); + Triples.append(ARMTriples, ARMTriples + llvm::array_lengthof(ARMTriples)); + } else if (HostArch == llvm::Triple::x86_64) { + static const char *const X86_64LibDirs[] = { "/lib64", "/lib" }; + static const char *const X86_64Triples[] = { + "x86_64-linux-gnu", + "x86_64-unknown-linux-gnu", + "x86_64-pc-linux-gnu", + "x86_64-redhat-linux6E", + "x86_64-redhat-linux", + "x86_64-suse-linux", + "x86_64-manbo-linux-gnu", + "x86_64-linux-gnu", + "x86_64-slackware-linux" }; - const std::string InstallSuffixes[] = { - "/../../..", - "/../../../..", - "/../../../.." + LibDirs.append(X86_64LibDirs, + X86_64LibDirs + llvm::array_lengthof(X86_64LibDirs)); + Triples.append(X86_64Triples, + X86_64Triples + llvm::array_lengthof(X86_64Triples)); + } else if (HostArch == llvm::Triple::x86) { + static const char *const X86LibDirs[] = { "/lib32", "/lib" }; + static const char *const X86Triples[] = { + "i686-linux-gnu", + "i686-pc-linux-gnu", + "i486-linux-gnu", + "i386-linux-gnu", + "i686-redhat-linux", + "i586-redhat-linux", + "i386-redhat-linux", + "i586-suse-linux", + "i486-slackware-linux" }; - // Only look at the final, weird Ubuntu suffix for i386-linux-gnu. - const unsigned NumSuffixes = (llvm::array_lengthof(Suffixes) - - (CandidateTriple != "i386-linux-gnu")); - for (unsigned i = 0; i < NumSuffixes; ++i) { - StringRef Suffix = Suffixes[i]; - llvm::error_code EC; - for (llvm::sys::fs::directory_iterator LI(LibDir + Suffix, EC), LE; - !EC && LI != LE; LI = LI.increment(EC)) { - StringRef VersionText = llvm::sys::path::filename(LI->path()); - GCCVersion CandidateVersion = GCCVersion::Parse(VersionText); - static const GCCVersion MinVersion = { 4, 1, 1 }; - if (CandidateVersion < MinVersion) - continue; - if (CandidateVersion <= BestVersion) - continue; - if (!PathExists(LI->path() + "/crtbegin.o")) - continue; + LibDirs.append(X86LibDirs, X86LibDirs + llvm::array_lengthof(X86LibDirs)); + Triples.append(X86Triples, X86Triples + llvm::array_lengthof(X86Triples)); + } else if (HostArch == llvm::Triple::ppc) { + static const char *const PPCLibDirs[] = { "/lib32", "/lib" }; + static const char *const PPCTriples[] = { + "powerpc-linux-gnu", + "powerpc-unknown-linux-gnu" + }; + LibDirs.append(PPCLibDirs, PPCLibDirs + llvm::array_lengthof(PPCLibDirs)); + Triples.append(PPCTriples, PPCTriples + llvm::array_lengthof(PPCTriples)); + } else if (HostArch == llvm::Triple::ppc64) { + static const char *const PPC64LibDirs[] = { "/lib64", "/lib" }; + static const char *const PPC64Triples[] = { + "powerpc64-unknown-linux-gnu" + }; + LibDirs.append(PPC64LibDirs, + PPC64LibDirs + llvm::array_lengthof(PPC64LibDirs)); + Triples.append(PPC64Triples, + PPC64Triples + llvm::array_lengthof(PPC64Triples)); + } +} - BestVersion = CandidateVersion; - GccTriple = CandidateTriple.str(); - // FIXME: We hack together the directory name here instead of - // using LI to ensure stable path separators across Windows and - // Linux. - GccInstallPath = LibDir + Suffixes[i] + "/" + VersionText.str(); - GccParentLibPath = GccInstallPath + InstallSuffixes[i]; - IsValid = true; - } +void Linux::GCCInstallationDetector::ScanLibDirForGCCTriple( + llvm::Triple::ArchType HostArch, const std::string &LibDir, + StringRef CandidateTriple) { + // There are various different suffixes involving the triple we + // check for. We also record what is necessary to walk from each back + // up to the lib directory. + const std::string Suffixes[] = { + "/gcc/" + CandidateTriple.str(), + "/" + CandidateTriple.str() + "/gcc/" + CandidateTriple.str(), + + // Ubuntu has a strange mis-matched pair of triples that this happens to + // match. + // FIXME: It may be worthwhile to generalize this and look for a second + // triple. + "/i386-linux-gnu/gcc/" + CandidateTriple.str() + }; + const std::string InstallSuffixes[] = { + "/../../..", + "/../../../..", + "/../../../.." + }; + // Only look at the final, weird Ubuntu suffix for i386-linux-gnu. + const unsigned NumSuffixes = (llvm::array_lengthof(Suffixes) - + (HostArch != llvm::Triple::x86)); + for (unsigned i = 0; i < NumSuffixes; ++i) { + StringRef Suffix = Suffixes[i]; + llvm::error_code EC; + for (llvm::sys::fs::directory_iterator LI(LibDir + Suffix, EC), LE; + !EC && LI != LE; LI = LI.increment(EC)) { + StringRef VersionText = llvm::sys::path::filename(LI->path()); + GCCVersion CandidateVersion = GCCVersion::Parse(VersionText); + static const GCCVersion MinVersion = { "4.1.1", 4, 1, 1, "" }; + if (CandidateVersion < MinVersion) + continue; + if (CandidateVersion <= Version) + continue; + if (!llvm::sys::fs::exists(LI->path() + "/crtbegin.o")) + continue; + + Version = CandidateVersion; + GccTriple = CandidateTriple.str(); + // FIXME: We hack together the directory name here instead of + // using LI to ensure stable path separators across Windows and + // Linux. + GccInstallPath = LibDir + Suffixes[i] + "/" + VersionText.str(); + GccParentLibPath = GccInstallPath + InstallSuffixes[i]; + IsValid = true; } } -}; } -static void addPathIfExists(const std::string &Path, - ToolChain::path_list &Paths) { - if (PathExists(Path)) Paths.push_back(Path); +static void addPathIfExists(Twine Path, ToolChain::path_list &Paths) { + if (llvm::sys::fs::exists(Path)) Paths.push_back(Path.str()); +} + +/// \brief Get our best guess at the multiarch triple for a target. +/// +/// Debian-based systems are starting to use a multiarch setup where they use +/// a target-triple directory in the library and header search paths. +/// Unfortunately, this triple does not align with the vanilla target triple, +/// so we provide a rough mapping here. +static std::string getMultiarchTriple(const llvm::Triple TargetTriple, + StringRef SysRoot) { + // For most architectures, just use whatever we have rather than trying to be + // clever. + switch (TargetTriple.getArch()) { + default: + return TargetTriple.str(); + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 18:31:22 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F24A51065670; Fri, 9 Dec 2011 18:31:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C90DA8FC21; Fri, 9 Dec 2011 18:31:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9IVMNn044706; Fri, 9 Dec 2011 18:31:22 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9IVMfi044705; Fri, 9 Dec 2011 18:31:22 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112091831.pB9IVMfi044705@svn.freebsd.org> From: Dimitry Andric Date: Fri, 9 Dec 2011 18:31:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228367 - vendor/clang/clang-r145349 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 18:31:23 -0000 Author: dim Date: Fri Dec 9 18:31:22 2011 New Revision: 228367 URL: http://svn.freebsd.org/changeset/base/228367 Log: Tag clang 3.0 final release. Added: vendor/clang/clang-r145349/ - copied from r228366, vendor/clang/dist/ From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 18:34:45 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7D931065670; Fri, 9 Dec 2011 18:34:45 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B78C28FC18; Fri, 9 Dec 2011 18:34:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9IYjQS044855; Fri, 9 Dec 2011 18:34:45 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9IYjua044852; Fri, 9 Dec 2011 18:34:45 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112091834.pB9IYjua044852@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 9 Dec 2011 18:34:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228368 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 18:34:45 -0000 Author: yongari Date: Fri Dec 9 18:34:45 2011 New Revision: 228368 URL: http://svn.freebsd.org/changeset/base/228368 Log: Remove unnecessary definition of ET_PCIR_BAR. Controller support I/O memory only. While here, use pci_set_max_read_req(9) rather than directly manipulating PCIe device control register. Modified: head/sys/dev/et/if_et.c head/sys/dev/et/if_etreg.h Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Fri Dec 9 18:31:22 2011 (r228367) +++ head/sys/dev/et/if_et.c Fri Dec 9 18:34:45 2011 (r228368) @@ -250,9 +250,9 @@ et_attach(device_t dev) /* * Allocate IO memory */ - sc->sc_mem_rid = ET_PCIR_BAR; + sc->sc_mem_rid = PCIR_BAR(0); sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &sc->sc_mem_rid, RF_ACTIVE); + &sc->sc_mem_rid, RF_ACTIVE); if (sc->sc_mem_res == NULL) { device_printf(dev, "can't allocate IO memory\n"); return (ENXIO); @@ -722,12 +722,7 @@ et_bus_config(struct et_softc *sc) /* * Set max read request size to 2048 bytes */ - val = pci_read_config(sc->dev, - sc->sc_expcap + PCIR_EXPRESS_DEVICE_CTL, 2); - val &= ~PCIM_EXP_CTL_MAX_READ_REQUEST; - val |= ET_PCIV_DEVICE_CTRL_RRSZ_2K; - pci_write_config(sc->dev, - sc->sc_expcap + PCIR_EXPRESS_DEVICE_CTL, val, 2); + pci_set_max_read_req(sc->dev, 2048); return (0); } Modified: head/sys/dev/et/if_etreg.h ============================================================================== --- head/sys/dev/et/if_etreg.h Fri Dec 9 18:31:22 2011 (r228367) +++ head/sys/dev/et/if_etreg.h Fri Dec 9 18:34:45 2011 (r228368) @@ -53,8 +53,6 @@ * ET_PCIV_REPLAY_TIMER_{128,256} are from * PCI EXPRESS BASE SPECIFICATION, REV. 1.0a, Table 3-4 */ -#define ET_PCIR_BAR PCIR_BAR(0) - #define ET_PCIR_DEVICE_CAPS 0x4C #define ET_PCIM_DEVICE_CAPS_MAX_PLSZ 0x7 /* Max playload size */ #define ET_PCIV_DEVICE_CAPS_PLSZ_128 0x0 From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 19:10:38 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A43C4106564A; Fri, 9 Dec 2011 19:10:38 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93C4D8FC0C; Fri, 9 Dec 2011 19:10:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9JAcG1045959; Fri, 9 Dec 2011 19:10:38 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9JAcHb045956; Fri, 9 Dec 2011 19:10:38 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112091910.pB9JAcHb045956@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 9 Dec 2011 19:10:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228369 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 19:10:38 -0000 Author: yongari Date: Fri Dec 9 19:10:38 2011 New Revision: 228369 URL: http://svn.freebsd.org/changeset/base/228369 Log: Announce flow control ability to PHY driver and enable RX flow control. Controller does not automatically generate pause frames based on number of available RX buffers so it's very hard to know when driver should generate XON frame in time. The only mechanism driver can detect low number of RX buffer condition is ET_INTR_RXRING0_LOW or ET_INTR_RXRING1_LOW interrupt. This interrupt is generated whenever controller notices the number of available RX buffers are lower than pre-programmed value( ET_RX_RING0_MINCNT and ET_RX_RING1_MINCNT register). This scheme does not provide a way to detect when controller sees enough number of RX buffers again such that efficient generation of XON/XOFF frame is not easy. While here, add more flow control related register definition. Modified: head/sys/dev/et/if_et.c head/sys/dev/et/if_etreg.h Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Fri Dec 9 18:34:45 2011 (r228368) +++ head/sys/dev/et/if_et.c Fri Dec 9 19:10:38 2011 (r228369) @@ -332,7 +332,8 @@ et_attach(device_t dev) et_chip_attach(sc); error = mii_attach(dev, &sc->sc_miibus, ifp, et_ifmedia_upd, - et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0); + et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, + MIIF_DOPAUSE); if (error) { device_printf(dev, "attaching PHYs failed\n"); goto fail; @@ -548,12 +549,23 @@ et_miibus_statchg(device_t dev) if (IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) { cfg2 |= ET_MAC_CFG2_FDX; + /* + * Controller lacks automatic TX pause frame + * generation so it should be handled by driver. + * Even though driver can send pause frame with + * arbitrary pause time, controller does not + * provide a way that tells how many free RX + * buffers are available in controller. This + * limitation makes it hard to generate XON frame + * in time on driver side so don't enable TX flow + * control. + */ #ifdef notyet if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_TXPAUSE) cfg1 |= ET_MAC_CFG1_TXFLOW; +#endif if (IFM_OPTIONS(mii->mii_media_active) & IFM_ETH_RXPAUSE) cfg1 |= ET_MAC_CFG1_RXFLOW; -#endif } else ctrl |= ET_MAC_CTRL_GHDX; @@ -1949,8 +1961,12 @@ et_init_txmac(struct et_softc *sc) /* Disable TX MAC and FC(?) */ CSR_WRITE_4(sc, ET_TXMAC_CTRL, ET_TXMAC_CTRL_FC_DISABLE); - /* No flow control yet */ - CSR_WRITE_4(sc, ET_TXMAC_FLOWCTRL, 0); + /* + * Initialize pause time. + * This register should be set before XON/XOFF frame is + * sent by driver. + */ + CSR_WRITE_4(sc, ET_TXMAC_FLOWCTRL, 0 << ET_TXMAC_FLOWCTRL_CFPT_SHIFT); /* Enable TX MAC but leave FC(?) diabled */ CSR_WRITE_4(sc, ET_TXMAC_CTRL, Modified: head/sys/dev/et/if_etreg.h ============================================================================== --- head/sys/dev/et/if_etreg.h Fri Dec 9 18:34:45 2011 (r228368) +++ head/sys/dev/et/if_etreg.h Fri Dec 9 19:10:38 2011 (r228369) @@ -193,6 +193,13 @@ #define ET_TXMAC_CTRL_FC_DISABLE 0x00000008 #define ET_TXMAC_FLOWCTRL 0x3010 +#define ET_TXMAC_FLOWCTRL_CFPT_MASK 0x0000FFFF +#define ET_TXMAC_FLOWCTRL_CFEP_MASK 0xFFFF0000 +#define ET_TXMAC_FLOWCTRL_CFPT_SHIFT 0 + +#define ET_TXMAC_BP_CTRL 0x3020 +#define ET_TXMAC_BP_CTRL_XONXOFF 0x00000001 +#define ET_TXMAC_BP_CTRL_REQ 0x00000002 #define ET_RXMAC_CTRL 0x4000 #define ET_RXMAC_CTRL_ENABLE 0x00000001 From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 19:17:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BC0B1065676; Fri, 9 Dec 2011 19:17:52 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B7688FC08; Fri, 9 Dec 2011 19:17:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9JHqnp046235; Fri, 9 Dec 2011 19:17:52 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9JHqNZ046232; Fri, 9 Dec 2011 19:17:52 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112091917.pB9JHqNZ046232@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 9 Dec 2011 19:17:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228370 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 19:17:52 -0000 Author: yongari Date: Fri Dec 9 19:17:51 2011 New Revision: 228370 URL: http://svn.freebsd.org/changeset/base/228370 Log: After r228293, et(4) supports altq(4). Modified: head/share/man/man4/altq.4 head/share/man/man4/et.4 Modified: head/share/man/man4/altq.4 ============================================================================== --- head/share/man/man4/altq.4 Fri Dec 9 19:10:38 2011 (r228369) +++ head/share/man/man4/altq.4 Fri Dec 9 19:17:51 2011 (r228370) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 8, 2011 +.Dd December 9, 2011 .Dt ALTQ 4 .Os .Sh NAME @@ -134,6 +134,7 @@ They have been applied to the following .Xr em 4 , .Xr ep 4 , .Xr epair 4 , +.Xr et 4 , .Xr fxp 4 , .Xr gem 4 , .Xr hme 4 , Modified: head/share/man/man4/et.4 ============================================================================== --- head/share/man/man4/et.4 Fri Dec 9 19:10:38 2011 (r228369) +++ head/share/man/man4/et.4 Fri Dec 9 19:17:51 2011 (r228370) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 25, 2010 +.Dd December 9, 2011 .Dt ET 4 .Os .Sh NAME @@ -156,6 +156,7 @@ to achieve TX interrupt moderation. The default value is 1000000000 (nanoseconds). .El .Sh SEE ALSO +.Xr altq 4 , .Xr arp 4 , .Xr miibus 4 , .Xr netintro 4 , From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 19:24:18 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E5FE106564A; Fri, 9 Dec 2011 19:24:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D7668FC08; Fri, 9 Dec 2011 19:24:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9JOI7J046469; Fri, 9 Dec 2011 19:24:18 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9JOI5x046467; Fri, 9 Dec 2011 19:24:18 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201112091924.pB9JOI5x046467@svn.freebsd.org> From: John Baldwin Date: Fri, 9 Dec 2011 19:24:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228371 - head/tools/regression/sockets/unix_passfd X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 19:24:18 -0000 Author: jhb Date: Fri Dec 9 19:24:17 2011 New Revision: 228371 URL: http://svn.freebsd.org/changeset/base/228371 Log: - Add a test for PR 151758. - While here, make this compile and work on non-i386: - Use CMSG_SPACE(), CMSG_LEN(), and CMSG_FIRSTHDR() instead of ignoring padding between 'struct cmsghdr' and control message payloads. - Don't initialize the control message before calling recvmsg(). Instead, check that we get a valid control message on return from recvmsg(). - Use errx() instead of err() for some errors that don't report failures that set errno. Requested by: kib (1) Modified: head/tools/regression/sockets/unix_passfd/unix_passfd.c Modified: head/tools/regression/sockets/unix_passfd/unix_passfd.c ============================================================================== --- head/tools/regression/sockets/unix_passfd/unix_passfd.c Fri Dec 9 19:17:51 2011 (r228370) +++ head/tools/regression/sockets/unix_passfd/unix_passfd.c Fri Dec 9 19:24:17 2011 (r228371) @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -62,6 +63,17 @@ closesocketpair(int *fdp) } static void +devnull(const char *test, int *fdp) +{ + int fd; + + fd = open("/dev/null", O_RDONLY); + if (fd < 0) + err(-1, "%s: open(/dev/null)", test); + *fdp = fd; +} + +static void tempfile(const char *test, int *fdp) { char path[PATH_MAX]; @@ -88,9 +100,9 @@ samefile(const char *test, struct stat * { if (sb1->st_dev != sb2->st_dev) - err(-1, "%s: samefile: different device", test); + errx(-1, "%s: samefile: different device", test); if (sb1->st_ino != sb2->st_ino) - err(-1, "%s: samefile: different inode", test); + errx(-1, "%s: samefile: different inode", test); } static void @@ -99,10 +111,8 @@ sendfd(const char *test, int sockfd, int struct iovec iovec; char ch; - struct { - struct cmsghdr cmsghdr; - int fd; - } message; + char message[CMSG_SPACE(sizeof(int))]; + struct cmsghdr *cmsghdr; struct msghdr msghdr; ssize_t len; @@ -110,7 +120,7 @@ sendfd(const char *test, int sockfd, int bzero(&message, sizeof(message)); ch = 0; - msghdr.msg_control = &message; + msghdr.msg_control = message; msghdr.msg_controllen = sizeof(message); iovec.iov_base = &ch; @@ -119,35 +129,33 @@ sendfd(const char *test, int sockfd, int msghdr.msg_iov = &iovec; msghdr.msg_iovlen = 1; - message.cmsghdr.cmsg_len = sizeof(message); - message.cmsghdr.cmsg_level = SOL_SOCKET; - message.cmsghdr.cmsg_type = SCM_RIGHTS; - message.fd = sendfd; + cmsghdr = (struct cmsghdr *)message; + cmsghdr->cmsg_len = CMSG_LEN(sizeof(int)); + cmsghdr->cmsg_level = SOL_SOCKET; + cmsghdr->cmsg_type = SCM_RIGHTS; + *(int *)CMSG_DATA(cmsghdr) = sendfd; len = sendmsg(sockfd, &msghdr, 0); if (len < 0) err(-1, "%s: sendmsg", test); if (len != sizeof(ch)) - errx(-1, "%s: sendmsg: %d bytes sent", test, len); + errx(-1, "%s: sendmsg: %zd bytes sent", test, len); } static void recvfd(const char *test, int sockfd, int *recvfd) { - struct { - struct cmsghdr cmsghdr; - int fd; - } message; + struct cmsghdr *cmsghdr; + char message[CMSG_SPACE(sizeof(int))]; struct msghdr msghdr; struct iovec iovec; ssize_t len; char ch; bzero(&msghdr, sizeof(msghdr)); - bzero(&message, sizeof(message)); ch = 0; - msghdr.msg_control = &message; + msghdr.msg_control = message; msghdr.msg_controllen = sizeof(message); iovec.iov_base = &ch; @@ -161,19 +169,22 @@ recvfd(const char *test, int sockfd, int msghdr.msg_iov = &iovec; msghdr.msg_iovlen = 1; - message.cmsghdr.cmsg_len = sizeof(message); - message.cmsghdr.cmsg_level = SOL_SOCKET; - message.cmsghdr.cmsg_type = SCM_RIGHTS; - message.fd = -1; - len = recvmsg(sockfd, &msghdr, 0); if (len < 0) err(-1, "%s: recvmsg", test); if (len != sizeof(ch)) - errx(-1, "%s: recvmsg: %d bytes received", test, len); - if (message.fd == -1) + errx(-1, "%s: recvmsg: %zd bytes received", test, len); + cmsghdr = CMSG_FIRSTHDR(&msghdr); + if (cmsghdr == NULL) + errx(-1, "%s: recvmsg: did not receive control message", test); + if (cmsghdr->cmsg_len != CMSG_LEN(sizeof(int)) || + cmsghdr->cmsg_level != SOL_SOCKET || + cmsghdr->cmsg_type != SCM_RIGHTS) + errx(-1, "%s: recvmsg: did not receive single-fd message", + test); + *recvfd = *(int *)CMSG_DATA(cmsghdr); + if (*recvfd == -1) errx(-1, "%s: recvmsg: received fd -1", test); - *recvfd = message.fd; } int @@ -303,5 +314,22 @@ main(int argc, char *argv[]) printf("%s passed\n", test); + /* + * Test for PR 151758: Send an character device over the UNIX + * domain socket and then close both sockets to orphan the + * device. + */ + + test = "test7-devfsorphan"; + printf("beginning %s\n", test); + + domainsocketpair(test, fd); + devnull(test, &putfd_1); + sendfd(test, fd[0], putfd_1); + close(putfd_1); + closesocketpair(fd); + + printf("%s passed\n", test); + return (0); } From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 20:09:37 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D8D6106564A; Fri, 9 Dec 2011 20:09:37 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D6A58FC17; Fri, 9 Dec 2011 20:09:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9K9bsn047897; Fri, 9 Dec 2011 20:09:37 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9K9bgd047894; Fri, 9 Dec 2011 20:09:37 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <201112092009.pB9K9bgd047894@svn.freebsd.org> From: Scott Long Date: Fri, 9 Dec 2011 20:09:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228372 - svnadmin/conf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 20:09:37 -0000 Author: scottl Date: Fri Dec 9 20:09:36 2011 New Revision: 228372 URL: http://svn.freebsd.org/changeset/base/228372 Log: Welcome Jim Harris to FreeBSD. He and his team at Intel will be working on storage and chipset drivers for various Intel products. Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Fri Dec 9 19:24:17 2011 (r228371) +++ svnadmin/conf/access Fri Dec 9 20:09:36 2011 (r228372) @@ -117,6 +117,7 @@ jhay jhb jhibbits jilles +jimharris jinmei jkim jkoshy Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Fri Dec 9 19:24:17 2011 (r228371) +++ svnadmin/conf/mentors Fri Dec 9 20:09:36 2011 (r228372) @@ -19,6 +19,7 @@ gber cognet gleb mdf jceel wkoszek Co-mentor: cognet jhibbits nwhitehorn +jimharris scottl Co-mentor: sbruno jinmei gnn jonathan rwatson jpaetzel kib From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 20:23:58 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9C2E106564A; Fri, 9 Dec 2011 20:23:58 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D97ED8FC08; Fri, 9 Dec 2011 20:23:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9KNwbP048398; Fri, 9 Dec 2011 20:23:58 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9KNwQA048396; Fri, 9 Dec 2011 20:23:58 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201112092023.pB9KNwQA048396@svn.freebsd.org> From: Jim Harris Date: Fri, 9 Dec 2011 20:23:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228373 - head/share/misc X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 20:23:59 -0000 Author: jimharris Date: Fri Dec 9 20:23:58 2011 New Revision: 228373 URL: http://svn.freebsd.org/changeset/base/228373 Log: Added jimharris. Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Fri Dec 9 20:09:36 2011 (r228372) +++ head/share/misc/committers-src.dot Fri Dec 9 20:23:58 2011 (r228373) @@ -161,6 +161,7 @@ jh [label="Jaakko Heinonen\njh@FreeBSD.o jhb [label="John Baldwin\njhb@FreeBSD.org\n1999/08/23"] jhibbits [label="Justin Hibbits\njhibbits@FreeBSD.org\n2011/11/30"] jilles [label="Jilles Tjoelker\njilles@FreeBSD.org\n2009/05/22"] +jimharris [label="Jim Harris\njimharris@FreeBSD.org\n2011/12/09"] jinmei [label="JINMEI Tatuya\njinmei@FreeBSD.org\n2007/03/17"] jkim [label="Jung-uk Kim\njkim@FreeBSD.org\n2005/07/06"] jkoshy [label="A. Joseph Koshy\njkoshy@FreeBSD.org\n1998/05/13"] From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 20:40:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA159106564A; Fri, 9 Dec 2011 20:40:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A15B8FC12; Fri, 9 Dec 2011 20:40:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9KeOJO049000; Fri, 9 Dec 2011 20:40:24 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9KeOY9048998; Fri, 9 Dec 2011 20:40:24 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112092040.pB9KeOY9048998@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 9 Dec 2011 20:40:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228375 - head/libexec/rtld-elf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 20:40:24 -0000 Author: kib Date: Fri Dec 9 20:40:24 2011 New Revision: 228375 URL: http://svn.freebsd.org/changeset/base/228375 Log: Typo. MFC after: 3 days Modified: head/libexec/rtld-elf/rtld.h Modified: head/libexec/rtld-elf/rtld.h ============================================================================== --- head/libexec/rtld-elf/rtld.h Fri Dec 9 20:36:10 2011 (r228374) +++ head/libexec/rtld-elf/rtld.h Fri Dec 9 20:40:24 2011 (r228375) @@ -246,7 +246,7 @@ typedef struct Struct_Obj_Entry { /* Flags to be passed into symlook_ family of functions. */ #define SYMLOOK_IN_PLT 0x01 /* Lookup for PLT symbol */ -#define SYMLOOK_DLSYM 0x02 /* Return newes versioned symbol. Used by +#define SYMLOOK_DLSYM 0x02 /* Return newest versioned symbol. Used by dlsym. */ /* Flags for load_object(). */ From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 20:41:55 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53621106564A; Fri, 9 Dec 2011 20:41:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4355A8FC12; Fri, 9 Dec 2011 20:41:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9KftJL049077; Fri, 9 Dec 2011 20:41:55 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9KftCm049075; Fri, 9 Dec 2011 20:41:55 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201112092041.pB9KftCm049075@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 9 Dec 2011 20:41:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228376 - head/sys/ddb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 20:41:55 -0000 Author: kib Date: Fri Dec 9 20:41:54 2011 New Revision: 228376 URL: http://svn.freebsd.org/changeset/base/228376 Log: Typo. MFC after: 3 days Modified: head/sys/ddb/db_thread.c Modified: head/sys/ddb/db_thread.c ============================================================================== --- head/sys/ddb/db_thread.c Fri Dec 9 20:40:24 2011 (r228375) +++ head/sys/ddb/db_thread.c Fri Dec 9 20:41:54 2011 (r228376) @@ -109,7 +109,7 @@ db_show_threads(db_expr_t addr, boolean_ * Lookup a thread based on a db expression address. We assume that the * address was parsed in hexadecimal. We reparse the address in decimal * first and try to treat it as a thread ID to find an associated thread. - * If that fails and check_pid is true, we terat the decimal value as a + * If that fails and check_pid is true, we treat the decimal value as a * PID. If that matches a process, we return the first thread in that * process. Otherwise, we treat the addr as a pointer to a thread. */ From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 22:23:46 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89D6B1065675; Fri, 9 Dec 2011 22:23:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 75F8F8FC13; Fri, 9 Dec 2011 22:23:46 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9MNkdE052418; Fri, 9 Dec 2011 22:23:46 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9MNkAr052400; Fri, 9 Dec 2011 22:23:46 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112092223.pB9MNkAr052400@svn.freebsd.org> From: Dimitry Andric Date: Fri, 9 Dec 2011 22:23:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228379 - in head: contrib/llvm/lib/CodeGen contrib/llvm/lib/CodeGen/AsmPrinter contrib/llvm/lib/CodeGen/SelectionDAG contrib/llvm/lib/Target/ARM contrib/llvm/lib/Target/CppBackend cont... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 22:23:46 -0000 Author: dim Date: Fri Dec 9 22:23:45 2011 New Revision: 228379 URL: http://svn.freebsd.org/changeset/base/228379 Log: Upgrade our copy of llvm/clang to 3.0 release. Release notes can be found at: http://llvm.org/releases/3.0/docs/ReleaseNotes.html MFC after: 1 week Added: head/lib/clang/include/MipsGenCodeEmitter.inc (contents, props changed) Modified: head/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp head/contrib/llvm/lib/CodeGen/LLVMTargetMachine.cpp head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp head/contrib/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp head/contrib/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp head/contrib/llvm/lib/Target/ARM/ARMCallingConv.td head/contrib/llvm/lib/Target/ARM/ARMFastISel.cpp head/contrib/llvm/lib/Target/ARM/ARMFrameLowering.cpp head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp head/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td head/contrib/llvm/lib/Target/CppBackend/CPPBackend.cpp head/contrib/llvm/lib/Target/Mips/Mips64InstrInfo.td head/contrib/llvm/lib/Target/Mips/MipsCodeEmitter.cpp head/contrib/llvm/lib/Target/Mips/MipsInstrFPU.td head/contrib/llvm/lib/Target/Mips/MipsInstrFormats.td head/contrib/llvm/lib/Target/Mips/MipsInstrInfo.td head/contrib/llvm/lib/Target/Mips/MipsJITInfo.cpp head/contrib/llvm/lib/Target/PowerPC/PPCFrameLowering.cpp head/contrib/llvm/lib/Target/X86/X86CodeEmitter.cpp head/contrib/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp head/contrib/llvm/tools/clang/include/clang/Driver/CC1Options.td head/contrib/llvm/tools/clang/include/clang/Driver/ToolChain.h head/contrib/llvm/tools/clang/include/clang/Frontend/HeaderSearchOptions.h head/contrib/llvm/tools/clang/lib/Basic/Version.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CGObjCGNU.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp head/contrib/llvm/tools/clang/lib/CodeGen/CodeGenModule.h head/contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains.h head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp head/contrib/llvm/tools/clang/lib/Frontend/CompilerInvocation.cpp head/contrib/llvm/tools/clang/lib/Frontend/InitHeaderSearch.cpp head/lib/clang/include/clang/Basic/Version.inc head/lib/clang/libllvmmipscodegen/Makefile Directory Properties: head/contrib/llvm/ (props changed) head/contrib/llvm/tools/clang/ (props changed) Modified: head/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -527,18 +527,20 @@ bool CompileUnit::addConstantValue(DIE * // Get the raw data form of the large APInt. const APInt Val = CI->getValue(); - const char *Ptr = (const char*)Val.getRawData(); + const uint64_t *Ptr64 = Val.getRawData(); int NumBytes = Val.getBitWidth() / 8; // 8 bits per byte. bool LittleEndian = Asm->getTargetData().isLittleEndian(); - int Incr = (LittleEndian ? 1 : -1); - int Start = (LittleEndian ? 0 : NumBytes - 1); - int Stop = (LittleEndian ? NumBytes : -1); // Output the constant to DWARF one byte at a time. - for (; Start != Stop; Start += Incr) - addUInt(Block, 0, dwarf::DW_FORM_data1, - (unsigned char)0xFF & Ptr[Start]); + for (int i = 0; i < NumBytes; i++) { + uint8_t c; + if (LittleEndian) + c = Ptr64[i / 8] >> (8 * (i & 7)); + else + c = Ptr64[(NumBytes - 1 - i) / 8] >> (8 * ((NumBytes - 1 - i) & 7)); + addUInt(Block, 0, dwarf::DW_FORM_data1, c); + } addBlock(Die, dwarf::DW_AT_const_value, 0, Block); return true; Modified: head/contrib/llvm/lib/CodeGen/LLVMTargetMachine.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/LLVMTargetMachine.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/CodeGen/LLVMTargetMachine.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -119,7 +119,8 @@ LLVMTargetMachine::LLVMTargetMachine(con // we'll crash later. // Provide the user with a useful error message about what's wrong. assert(AsmInfo && "MCAsmInfo not initialized." - "Make sure you include the correct TargetSelect.h!"); + "Make sure you include the correct TargetSelect.h" + "and that InitializeAllTargetMCs() is being invoked!"); } bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM, Modified: head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -2034,14 +2034,17 @@ bool SelectionDAGBuilder::handleJTSwitch return false; APInt Range = ComputeRange(First, Last); - double Density = TSize.roundToDouble() / Range.roundToDouble(); - if (Density < 0.4) + // The density is TSize / Range. Require at least 40%. + // It should not be possible for IntTSize to saturate for sane code, but make + // sure we handle Range saturation correctly. + uint64_t IntRange = Range.getLimitedValue(UINT64_MAX/10); + uint64_t IntTSize = TSize.getLimitedValue(UINT64_MAX/10); + if (IntTSize * 10 < IntRange * 4) return false; DEBUG(dbgs() << "Lowering jump table\n" << "First entry: " << First << ". Last entry: " << Last << '\n' - << "Range: " << Range - << ". Size: " << TSize << ". Density: " << Density << "\n\n"); + << "Range: " << Range << ". Size: " << TSize << ".\n\n"); // Get the MachineFunction which holds the current MBB. This is used when // inserting any additional MBBs necessary to represent the switch. Modified: head/contrib/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -506,7 +506,9 @@ getExprForDwarfGlobalReference(const Glo // Add information about the stub reference to MachOMMI so that the stub // gets emitted by the asmprinter. MCSymbol *SSym = getContext().GetOrCreateSymbol(Name.str()); - MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym); + MachineModuleInfoImpl::StubValueTy &StubSym = + GV->hasHiddenVisibility() ? MachOMMI.getHiddenGVStubEntry(SSym) : + MachOMMI.getGVStubEntry(SSym); if (StubSym.getPointer() == 0) { MCSymbol *Sym = Mang->getSymbol(GV); StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); @@ -534,7 +536,9 @@ getCFIPersonalitySymbol(const GlobalValu // Add information about the stub reference to MachOMMI so that the stub // gets emitted by the asmprinter. MCSymbol *SSym = getContext().GetOrCreateSymbol(Name.str()); - MachineModuleInfoImpl::StubValueTy &StubSym = MachOMMI.getGVStubEntry(SSym); + MachineModuleInfoImpl::StubValueTy &StubSym = + GV->hasHiddenVisibility() ? MachOMMI.getHiddenGVStubEntry(SSym) : + MachOMMI.getGVStubEntry(SSym); if (StubSym.getPointer() == 0) { MCSymbol *Sym = Mang->getSymbol(GV); StubSym = MachineModuleInfoImpl::StubValueTy(Sym, !GV->hasLocalLinkage()); Modified: head/contrib/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -63,6 +63,13 @@ ARMBaseRegisterInfo::ARMBaseRegisterInfo const unsigned* ARMBaseRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const { + bool ghcCall = false; + + if (MF) { + const Function *F = MF->getFunction(); + ghcCall = (F ? F->getCallingConv() == CallingConv::GHC : false); + } + static const unsigned CalleeSavedRegs[] = { ARM::LR, ARM::R11, ARM::R10, ARM::R9, ARM::R8, ARM::R7, ARM::R6, ARM::R5, ARM::R4, @@ -82,7 +89,13 @@ ARMBaseRegisterInfo::getCalleeSavedRegs( ARM::D11, ARM::D10, ARM::D9, ARM::D8, 0 }; - return STI.isTargetDarwin() ? DarwinCalleeSavedRegs : CalleeSavedRegs; + + static const unsigned GhcCalleeSavedRegs[] = { + 0 + }; + + return ghcCall ? GhcCalleeSavedRegs : + STI.isTargetDarwin() ? DarwinCalleeSavedRegs : CalleeSavedRegs; } BitVector ARMBaseRegisterInfo:: Modified: head/contrib/llvm/lib/Target/ARM/ARMCallingConv.td ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMCallingConv.td Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/ARM/ARMCallingConv.td Fri Dec 9 22:23:45 2011 (r228379) @@ -82,6 +82,25 @@ def RetFastCC_ARM_APCS : CallingConv<[ CCDelegateTo ]>; +//===----------------------------------------------------------------------===// +// ARM APCS Calling Convention for GHC +//===----------------------------------------------------------------------===// + +def CC_ARM_APCS_GHC : CallingConv<[ + // Handle all vector types as either f64 or v2f64. + CCIfType<[v1i64, v2i32, v4i16, v8i8, v2f32], CCBitConvertToType>, + CCIfType<[v2i64, v4i32, v8i16, v16i8, v4f32], CCBitConvertToType>, + + CCIfType<[v2f64], CCAssignToReg<[Q4, Q5]>>, + CCIfType<[f64], CCAssignToReg<[D8, D9, D10, D11]>>, + CCIfType<[f32], CCAssignToReg<[S16, S17, S18, S19, S20, S21, S22, S23]>>, + + // Promote i8/i16 arguments to i32. + CCIfType<[i8, i16], CCPromoteToType>, + + // Pass in STG registers: Base, Sp, Hp, R1, R2, R3, R4, SpLim + CCIfType<[i32], CCAssignToReg<[R4, R5, R6, R7, R8, R9, R10, R11]>> +]>; //===----------------------------------------------------------------------===// // ARM AAPCS (EABI) Calling Convention, common parts Modified: head/contrib/llvm/lib/Target/ARM/ARMFastISel.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMFastISel.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/ARM/ARMFastISel.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -1548,6 +1548,11 @@ CCAssignFn *ARMFastISel::CCAssignFnForCa return (Return ? RetCC_ARM_AAPCS: CC_ARM_AAPCS); case CallingConv::ARM_APCS: return (Return ? RetCC_ARM_APCS: CC_ARM_APCS); + case CallingConv::GHC: + if (Return) + llvm_unreachable("Can't return in GHC call convention"); + else + return CC_ARM_APCS_GHC; } } Modified: head/contrib/llvm/lib/Target/ARM/ARMFrameLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMFrameLowering.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/ARM/ARMFrameLowering.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -15,6 +15,8 @@ #include "ARMBaseInstrInfo.h" #include "ARMBaseRegisterInfo.h" #include "ARMMachineFunctionInfo.h" +#include "llvm/CallingConv.h" +#include "llvm/Function.h" #include "MCTargetDesc/ARMAddressingModes.h" #include "llvm/CodeGen/MachineFrameInfo.h" #include "llvm/CodeGen/MachineFunction.h" @@ -139,6 +141,10 @@ void ARMFrameLowering::emitPrologue(Mach unsigned GPRCS1Size = 0, GPRCS2Size = 0, DPRCSSize = 0; int FramePtrSpillFI = 0; + // All calls are tail calls in GHC calling conv, and functions have no prologue/epilogue. + if (MF.getFunction()->getCallingConv() == CallingConv::GHC) + return; + // Allocate the vararg register save area. This is not counted in NumBytes. if (VARegSaveSize) emitSPUpdate(isARM, MBB, MBBI, dl, TII, -VARegSaveSize, @@ -326,6 +332,10 @@ void ARMFrameLowering::emitEpilogue(Mach int NumBytes = (int)MFI->getStackSize(); unsigned FramePtr = RegInfo->getFrameRegister(MF); + // All calls are tail calls in GHC calling conv, and functions have no prologue/epilogue. + if (MF.getFunction()->getCallingConv() == CallingConv::GHC) + return; + if (!AFI->hasStackFrame()) { if (NumBytes != 0) emitSPUpdate(isARM, MBB, MBBI, dl, TII, NumBytes); Modified: head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/ARM/ARMISelLowering.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -1091,6 +1091,8 @@ CCAssignFn *ARMTargetLowering::CCAssignF return (Return ? RetCC_ARM_AAPCS : CC_ARM_AAPCS); case CallingConv::ARM_APCS: return (Return ? RetCC_ARM_APCS : CC_ARM_APCS); + case CallingConv::GHC: + return (Return ? RetCC_ARM_APCS : CC_ARM_APCS_GHC); } } Modified: head/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/ARM/ARMInstrThumb2.td Fri Dec 9 22:23:45 2011 (r228379) @@ -1538,8 +1538,7 @@ multiclass thumb2_ld_multgetName()); Out << "\", " << (load->isVolatile() ? "true" : "false" ) << ", " << bbname << ");"; + if (load->getAlignment()) + nl(Out) << iName << "->setAlignment(" + << load->getAlignment() << ");"; + if (load->isAtomic()) { + StringRef Ordering = ConvertAtomicOrdering(load->getOrdering()); + StringRef CrossThread = ConvertAtomicSynchScope(load->getSynchScope()); + nl(Out) << iName << "->setAtomic(" + << Ordering << ", " << CrossThread << ");"; + } break; } case Instruction::Store: { const StoreInst* store = cast(I); - Out << " new StoreInst(" + Out << "StoreInst* " << iName << " = new StoreInst(" << opNames[0] << ", " << opNames[1] << ", " << (store->isVolatile() ? "true" : "false") << ", " << bbname << ");"; + if (store->getAlignment()) + nl(Out) << iName << "->setAlignment(" + << store->getAlignment() << ");"; + if (store->isAtomic()) { + StringRef Ordering = ConvertAtomicOrdering(store->getOrdering()); + StringRef CrossThread = ConvertAtomicSynchScope(store->getSynchScope()); + nl(Out) << iName << "->setAtomic(" + << Ordering << ", " << CrossThread << ");"; + } break; } case Instruction::GetElementPtr: { @@ -1447,6 +1486,60 @@ void CppWriter::printInstruction(const I Out << "\", " << bbname << ");"; break; } + case Instruction::Fence: { + const FenceInst *fi = cast(I); + StringRef Ordering = ConvertAtomicOrdering(fi->getOrdering()); + StringRef CrossThread = ConvertAtomicSynchScope(fi->getSynchScope()); + Out << "FenceInst* " << iName + << " = new FenceInst(mod->getContext(), " + << Ordering << ", " << CrossThread << ", " << bbname + << ");"; + break; + } + case Instruction::AtomicCmpXchg: { + const AtomicCmpXchgInst *cxi = cast(I); + StringRef Ordering = ConvertAtomicOrdering(cxi->getOrdering()); + StringRef CrossThread = ConvertAtomicSynchScope(cxi->getSynchScope()); + Out << "AtomicCmpXchgInst* " << iName + << " = new AtomicCmpXchgInst(" + << opNames[0] << ", " << opNames[1] << ", " << opNames[2] << ", " + << Ordering << ", " << CrossThread << ", " << bbname + << ");"; + nl(Out) << iName << "->setName(\""; + printEscapedString(cxi->getName()); + Out << "\");"; + break; + } + case Instruction::AtomicRMW: { + const AtomicRMWInst *rmwi = cast(I); + StringRef Ordering = ConvertAtomicOrdering(rmwi->getOrdering()); + StringRef CrossThread = ConvertAtomicSynchScope(rmwi->getSynchScope()); + StringRef Operation; + switch (rmwi->getOperation()) { + case AtomicRMWInst::Xchg: Operation = "AtomicRMWInst::Xchg"; break; + case AtomicRMWInst::Add: Operation = "AtomicRMWInst::Add"; break; + case AtomicRMWInst::Sub: Operation = "AtomicRMWInst::Sub"; break; + case AtomicRMWInst::And: Operation = "AtomicRMWInst::And"; break; + case AtomicRMWInst::Nand: Operation = "AtomicRMWInst::Nand"; break; + case AtomicRMWInst::Or: Operation = "AtomicRMWInst::Or"; break; + case AtomicRMWInst::Xor: Operation = "AtomicRMWInst::Xor"; break; + case AtomicRMWInst::Max: Operation = "AtomicRMWInst::Max"; break; + case AtomicRMWInst::Min: Operation = "AtomicRMWInst::Min"; break; + case AtomicRMWInst::UMax: Operation = "AtomicRMWInst::UMax"; break; + case AtomicRMWInst::UMin: Operation = "AtomicRMWInst::UMin"; break; + case AtomicRMWInst::BAD_BINOP: llvm_unreachable("Bad atomic operation"); + } + Out << "AtomicRMWInst* " << iName + << " = new AtomicRMWInst(" + << Operation << ", " + << opNames[0] << ", " << opNames[1] << ", " + << Ordering << ", " << CrossThread << ", " << bbname + << ");"; + nl(Out) << iName << "->setName(\""; + printEscapedString(rmwi->getName()); + Out << "\");"; + break; + } } DefinedValues.insert(I); nl(Out); @@ -1623,7 +1716,9 @@ void CppWriter::printFunctionBody(const Out << "Value* " << getCppName(AI) << " = args++;"; nl(Out); if (AI->hasName()) { - Out << getCppName(AI) << "->setName(\"" << AI->getName() << "\");"; + Out << getCppName(AI) << "->setName(\""; + printEscapedString(AI->getName()); + Out << "\");"; nl(Out); } } Modified: head/contrib/llvm/lib/Target/Mips/Mips64InstrInfo.td ============================================================================== --- head/contrib/llvm/lib/Target/Mips/Mips64InstrInfo.td Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/Mips/Mips64InstrInfo.td Fri Dec 9 22:23:45 2011 (r228379) @@ -39,51 +39,51 @@ def imm32_63 : ImmLeaf func, bits<5> _rs, string instr_asm, SDNode OpNode, PatFrag PF>: - FR<0x00, func, (outs CPU64Regs:$dst), (ins CPU64Regs:$b, shamt_64:$c), - !strconcat(instr_asm, "\t$dst, $b, $c"), - [(set CPU64Regs:$dst, (OpNode CPU64Regs:$b, (i64 PF:$c)))], + FR<0x00, func, (outs CPU64Regs:$rd), (ins CPU64Regs:$rt, shamt_64:$shamt), + !strconcat(instr_asm, "\t$rd, $rt, $shamt"), + [(set CPU64Regs:$rd, (OpNode CPU64Regs:$rt, (i64 PF:$shamt)))], IIAlu> { let rs = _rs; } class LogicR_shift_rotate_reg64 func, bits<5> _shamt, string instr_asm, SDNode OpNode>: - FR<0x00, func, (outs CPU64Regs:$dst), (ins CPU64Regs:$c, CPU64Regs:$b), - !strconcat(instr_asm, "\t$dst, $b, $c"), - [(set CPU64Regs:$dst, (OpNode CPU64Regs:$b, CPU64Regs:$c))], IIAlu> { + FR<0x00, func, (outs CPU64Regs:$rd), (ins CPU64Regs:$rs, CPU64Regs:$rt), + !strconcat(instr_asm, "\t$rd, $rt, $rs"), + [(set CPU64Regs:$rd, (OpNode CPU64Regs:$rt, CPU64Regs:$rs))], IIAlu> { let shamt = _shamt; } // Mul, Div -let Defs = [HI64, LO64] in { +let rd = 0, shamt = 0, Defs = [HI64, LO64] in { let isCommutable = 1 in class Mul64 func, string instr_asm, InstrItinClass itin>: - FR<0x00, func, (outs), (ins CPU64Regs:$a, CPU64Regs:$b), - !strconcat(instr_asm, "\t$a, $b"), [], itin>; + FR<0x00, func, (outs), (ins CPU64Regs:$rs, CPU64Regs:$rt), + !strconcat(instr_asm, "\t$rs, $rt"), [], itin>; class Div64 func, string instr_asm, InstrItinClass itin>: - FR<0x00, func, (outs), (ins CPU64Regs:$a, CPU64Regs:$b), - !strconcat(instr_asm, "\t$$zero, $a, $b"), - [(op CPU64Regs:$a, CPU64Regs:$b)], itin>; + FR<0x00, func, (outs), (ins CPU64Regs:$rs, CPU64Regs:$rt), + !strconcat(instr_asm, "\t$$zero, $rs, $rt"), + [(op CPU64Regs:$rs, CPU64Regs:$rt)], itin>; } // Move from Hi/Lo let shamt = 0 in { let rs = 0, rt = 0 in class MoveFromLOHI64 func, string instr_asm>: - FR<0x00, func, (outs CPU64Regs:$dst), (ins), - !strconcat(instr_asm, "\t$dst"), [], IIHiLo>; + FR<0x00, func, (outs CPU64Regs:$rd), (ins), + !strconcat(instr_asm, "\t$rd"), [], IIHiLo>; let rt = 0, rd = 0 in class MoveToLOHI64 func, string instr_asm>: - FR<0x00, func, (outs), (ins CPU64Regs:$src), - !strconcat(instr_asm, "\t$src"), [], IIHiLo>; + FR<0x00, func, (outs), (ins CPU64Regs:$rs), + !strconcat(instr_asm, "\t$rs"), [], IIHiLo>; } // Count Leading Ones/Zeros in Word class CountLeading64 func, string instr_asm, list pattern>: - FR<0x1c, func, (outs CPU64Regs:$dst), (ins CPU64Regs:$src), - !strconcat(instr_asm, "\t$dst, $src"), pattern, IIAlu>, + FR<0x1c, func, (outs CPU64Regs:$rd), (ins CPU64Regs:$rs), + !strconcat(instr_asm, "\t$rd, $rs"), pattern, IIAlu>, Requires<[HasBitCount]> { let shamt = 0; let rt = rd; @@ -180,9 +180,9 @@ let Uses = [LO64] in /// Count Leading def DCLZ : CountLeading64<0x24, "dclz", - [(set CPU64Regs:$dst, (ctlz CPU64Regs:$src))]>; + [(set CPU64Regs:$rd, (ctlz CPU64Regs:$rs))]>; def DCLO : CountLeading64<0x25, "dclo", - [(set CPU64Regs:$dst, (ctlz (not CPU64Regs:$src)))]>; + [(set CPU64Regs:$rd, (ctlz (not CPU64Regs:$rs)))]>; //===----------------------------------------------------------------------===// // Arbitrary patterns that map to one or more instructions Modified: head/contrib/llvm/lib/Target/Mips/MipsCodeEmitter.cpp ============================================================================== --- head/contrib/llvm/lib/Target/Mips/MipsCodeEmitter.cpp Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/Mips/MipsCodeEmitter.cpp Fri Dec 9 22:23:45 2011 (r228379) @@ -105,6 +105,9 @@ class MipsCodeEmitter : public MachineFu unsigned getRelocation(const MachineInstr &MI, const MachineOperand &MO) const; + unsigned getMemEncoding(const MachineInstr &MI, unsigned OpNo) const; + unsigned getSizeExtEncoding(const MachineInstr &MI, unsigned OpNo) const; + unsigned getSizeInsEncoding(const MachineInstr &MI, unsigned OpNo) const; }; } @@ -153,6 +156,28 @@ unsigned MipsCodeEmitter::getRelocation( return Mips::reloc_mips_lo; } +unsigned MipsCodeEmitter::getMemEncoding(const MachineInstr &MI, + unsigned OpNo) const { + // Base register is encoded in bits 20-16, offset is encoded in bits 15-0. + assert(MI.getOperand(OpNo).isReg()); + unsigned RegBits = getMachineOpValue(MI, MI.getOperand(OpNo)) << 16; + return + (getMachineOpValue(MI, MI.getOperand(OpNo+1)) & 0xFFFF) | RegBits; +} + +unsigned MipsCodeEmitter::getSizeExtEncoding(const MachineInstr &MI, + unsigned OpNo) const { + // size is encoded as size-1. + return getMachineOpValue(MI, MI.getOperand(OpNo)) - 1; +} + +unsigned MipsCodeEmitter::getSizeInsEncoding(const MachineInstr &MI, + unsigned OpNo) const { + // size is encoded as pos+size-1. + return getMachineOpValue(MI, MI.getOperand(OpNo-1)) + + getMachineOpValue(MI, MI.getOperand(OpNo)) - 1; +} + /// getMachineOpValue - Return binary encoding of operand. If the machine /// operand requires relocation, record the relocation and return zero. unsigned MipsCodeEmitter::getMachineOpValue(const MachineInstr &MI, @@ -238,8 +263,4 @@ FunctionPass *llvm::createMipsJITCodeEmi return new MipsCodeEmitter(TM, JCE); } -unsigned MipsCodeEmitter::getBinaryCodeForInstr(const MachineInstr &MI) const { - // this function will be automatically generated by the CodeEmitterGenerator - // using TableGen - return 0; -} +#include "MipsGenCodeEmitter.inc" Modified: head/contrib/llvm/lib/Target/Mips/MipsInstrFPU.td ============================================================================== --- head/contrib/llvm/lib/Target/Mips/MipsInstrFPU.td Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/Mips/MipsInstrFPU.td Fri Dec 9 22:23:45 2011 (r228379) @@ -76,14 +76,16 @@ def IsNotSingleFloat : Predicate<"!Subta // FP load. class FPLoad op, string opstr, PatFrag FOp, RegisterClass RC, Operand MemOpnd>: - FFI; + FMem; // FP store. class FPStore op, string opstr, PatFrag FOp, RegisterClass RC, Operand MemOpnd>: - FFI; + FMem; // Instructions that convert an FP value to 32-bit fixed point. multiclass FFR1_W_M funct, string opstr> { @@ -158,22 +160,28 @@ defm FSQRT : FFR1P_M<0x4, "sqrt", fsqr // stores, and moves between floating-point and integer registers. // When defining instructions, we reference all 32-bit registers, // regardless of register aliasing. -let fd = 0 in { - /// Move Control Registers From/To CPU Registers - def CFC1 : FFR<0x11, 0x0, 0x2, (outs CPURegs:$rt), (ins CCR:$fs), + +class FFRGPR _fmt, dag outs, dag ins, string asmstr, list pattern>: + FFR<0x11, 0x0, _fmt, outs, ins, asmstr, pattern> { + bits<5> rt; + let ft = rt; + let fd = 0; +} + +/// Move Control Registers From/To CPU Registers +def CFC1 : FFRGPR<0x2, (outs CPURegs:$rt), (ins CCR:$fs), "cfc1\t$rt, $fs", []>; - def CTC1 : FFR<0x11, 0x0, 0x6, (outs CCR:$rt), (ins CPURegs:$fs), - "ctc1\t$fs, $rt", []>; +def CTC1 : FFRGPR<0x6, (outs CCR:$fs), (ins CPURegs:$rt), + "ctc1\t$rt, $fs", []>; - def MFC1 : FFR<0x11, 0x00, 0x00, (outs CPURegs:$rt), (ins FGR32:$fs), +def MFC1 : FFRGPR<0x00, (outs CPURegs:$rt), (ins FGR32:$fs), "mfc1\t$rt, $fs", [(set CPURegs:$rt, (bitconvert FGR32:$fs))]>; - def MTC1 : FFR<0x11, 0x00, 0x04, (outs FGR32:$fs), (ins CPURegs:$rt), +def MTC1 : FFRGPR<0x04, (outs FGR32:$fs), (ins CPURegs:$rt), "mtc1\t$rt, $fs", [(set FGR32:$fs, (bitconvert CPURegs:$rt))]>; -} def FMOV_S : FFR1<0x6, 16, "mov", "s", FGR32, FGR32>; def FMOV_D32 : FFR1<0x6, 17, "mov", "d", AFGR64, AFGR64>, @@ -203,7 +211,7 @@ let Predicates = [NotN64] in { } /// Floating-point Aritmetic -defm FADD : FFR2P_M<0x10, "add", fadd, 1>; +defm FADD : FFR2P_M<0x00, "add", fadd, 1>; defm FDIV : FFR2P_M<0x03, "div", fdiv>; defm FMUL : FFR2P_M<0x02, "mul", fmul, 1>; defm FSUB : FFR2P_M<0x01, "sub", fsub>; @@ -218,12 +226,16 @@ def MIPS_BRANCH_T : PatLeaf<(i32 1)>; /// Floating Point Branch of False/True (Likely) let isBranch=1, isTerminator=1, hasDelaySlot=1, base=0x8, Uses=[FCR31] in - class FBRANCH : FFI<0x11, (outs), - (ins brtarget:$dst), !strconcat(asmstr, "\t$dst"), - [(MipsFPBrcond op, bb:$dst)]>; + class FBRANCH nd, bits<1> tf, PatLeaf op, string asmstr> : + FFI<0x11, (outs), (ins brtarget:$dst), !strconcat(asmstr, "\t$dst"), + [(MipsFPBrcond op, bb:$dst)]> { + let Inst{20-18} = 0; + let Inst{17} = nd; + let Inst{16} = tf; +} -def BC1F : FBRANCH; -def BC1T : FBRANCH; +def BC1F : FBRANCH<0, 0, MIPS_BRANCH_F, "bc1f">; +def BC1T : FBRANCH<0, 1, MIPS_BRANCH_T, "bc1t">; //===----------------------------------------------------------------------===// // Floating Point Flag Conditions @@ -249,11 +261,11 @@ def MIPS_FCOND_NGT : PatLeaf<(i32 15)>; /// Floating Point Compare let Defs=[FCR31] in { - def FCMP_S32 : FCC<0x0, (outs), (ins FGR32:$fs, FGR32:$ft, condcode:$cc), + def FCMP_S32 : FCC<0x10, (outs), (ins FGR32:$fs, FGR32:$ft, condcode:$cc), "c.$cc.s\t$fs, $ft", [(MipsFPCmp FGR32:$fs, FGR32:$ft, imm:$cc)]>; - def FCMP_D32 : FCC<0x1, (outs), (ins AFGR64:$fs, AFGR64:$ft, condcode:$cc), + def FCMP_D32 : FCC<0x11, (outs), (ins AFGR64:$fs, AFGR64:$ft, condcode:$cc), "c.$cc.d\t$fs, $ft", [(MipsFPCmp AFGR64:$fs, AFGR64:$ft, imm:$cc)]>, Requires<[NotFP64bit]>; @@ -287,7 +299,8 @@ let Predicates = [NotFP64bit] in { defm : MovnPats; } -let usesCustomInserter = 1, Uses = [FCR31], Constraints = "$F = $dst" in { +let cc = 0, usesCustomInserter = 1, Uses = [FCR31], + Constraints = "$F = $dst" in { // flag:float, data:int class CondMovFPInt tf, string instr_asm> : FCMOV [(set CPURegs:$dst, (cmov CPURegs:$T, CPURegs:$F))]>; // flag:float, data:float +let cc = 0 in class CondMovFPFP fmt, bits<1> tf, string instr_asm> : FFCMOV val> { + bits<4> Value = val; +} + +def Pseudo : Format<0>; +def FrmR : Format<1>; +def FrmI : Format<2>; +def FrmJ : Format<3>; +def FrmFR : Format<4>; +def FrmFI : Format<5>; +def FrmOther : Format<6>; // Instruction w/ a custom format + // Generic Mips Format class MipsInst pattern, - InstrItinClass itin>: Instruction + InstrItinClass itin, Format f>: Instruction { field bits<32> Inst; + Format Form = f; let Namespace = "Mips"; - bits<6> opcode; + bits<6> Opcode = 0; - // Top 5 bits are the 'opcode' field - let Inst{31-26} = opcode; + // Top 6 bits are the 'opcode' field + let Inst{31-26} = Opcode; - dag OutOperandList = outs; - dag InOperandList = ins; + let OutOperandList = outs; + let InOperandList = ins; let AsmString = asmstr; let Pattern = pattern; let Itinerary = itin; + + // + // Attributes specific to Mips instructions... + // + bits<4> FormBits = Form.Value; + + // TSFlags layout should be kept in sync with MipsInstrInfo.h. + let TSFlags{3-0} = FormBits; } // Mips Pseudo Instructions Format class MipsPseudo pattern>: - MipsInst { + MipsInst { + let isCodeGenOnly = 1; let isPseudo = 1; } @@ -54,7 +79,7 @@ class MipsPseudo op, bits<6> _funct, dag outs, dag ins, string asmstr, list pattern, InstrItinClass itin>: - MipsInst + MipsInst { bits<5> rd; bits<5> rs; @@ -62,7 +87,7 @@ class FR op, bits<6> _funct, dag bits<5> shamt; bits<6> funct; - let opcode = op; + let Opcode = op; let funct = _funct; let Inst{25-21} = rs; @@ -77,13 +102,13 @@ class FR op, bits<6> _funct, dag //===----------------------------------------------------------------------===// class FI op, dag outs, dag ins, string asmstr, list pattern, - InstrItinClass itin>: MipsInst + InstrItinClass itin>: MipsInst { bits<5> rt; bits<5> rs; bits<16> imm16; - let opcode = op; + let Opcode = op; let Inst{25-21} = rs; let Inst{20-16} = rt; @@ -92,13 +117,13 @@ class FI op, dag outs, dag ins, class CBranchBase op, dag outs, dag ins, string asmstr, list pattern, InstrItinClass itin>: - MipsInst + MipsInst { bits<5> rs; bits<5> rt; bits<16> imm16; - let opcode = op; + let Opcode = op; let Inst{25-21} = rs; let Inst{20-16} = rt; @@ -110,11 +135,11 @@ class CBranchBase op, dag outs, //===----------------------------------------------------------------------===// class FJ op, dag outs, dag ins, string asmstr, list pattern, - InstrItinClass itin>: MipsInst + InstrItinClass itin>: MipsInst { bits<26> addr; - let opcode = op; + let Opcode = op; let Inst{25-0} = addr; } @@ -138,7 +163,7 @@ class FJ op, dag outs, dag ins, class FFR op, bits<6> _funct, bits<5> _fmt, dag outs, dag ins, string asmstr, list pattern> : - MipsInst + MipsInst { bits<5> fd; bits<5> fs; @@ -146,7 +171,7 @@ class FFR op, bits<6> _funct, bi bits<5> fmt; bits<6> funct; - let opcode = op; + let Opcode = op; let funct = _funct; let fmt = _fmt; @@ -162,13 +187,13 @@ class FFR op, bits<6> _funct, bi //===----------------------------------------------------------------------===// class FFI op, dag outs, dag ins, string asmstr, list pattern>: - MipsInst + MipsInst { bits<5> ft; bits<5> base; bits<16> imm16; - let opcode = op; + let Opcode = op; let Inst{25-21} = base; let Inst{20-16} = ft; @@ -180,14 +205,14 @@ class FFI op, dag outs, dag ins, //===----------------------------------------------------------------------===// class FCC _fmt, dag outs, dag ins, string asmstr, list pattern> : - MipsInst + MipsInst { bits<5> fs; bits<5> ft; bits<4> cc; bits<5> fmt; - let opcode = 0x11; + let Opcode = 0x11; let fmt = _fmt; let Inst{25-21} = fmt; @@ -201,18 +226,18 @@ class FCC _fmt, dag outs, dag in class FCMOV _tf, dag outs, dag ins, string asmstr, list pattern> : - MipsInst + MipsInst { bits<5> rd; bits<5> rs; - bits<3> N; + bits<3> cc; bits<1> tf; - let opcode = 0; + let Opcode = 0; let tf = _tf; let Inst{25-21} = rs; - let Inst{20-18} = N; + let Inst{20-18} = cc; let Inst{17} = 0; let Inst{16} = tf; let Inst{15-11} = rd; @@ -222,20 +247,20 @@ class FCMOV _tf, dag outs, dag i class FFCMOV _fmt, bits<1> _tf, dag outs, dag ins, string asmstr, list pattern> : - MipsInst + MipsInst { bits<5> fd; bits<5> fs; - bits<3> N; + bits<3> cc; bits<5> fmt; bits<1> tf; - let opcode = 17; + let Opcode = 17; let fmt = _fmt; let tf = _tf; let Inst{25-21} = fmt; - let Inst{20-18} = N; + let Inst{20-18} = cc; let Inst{17} = 0; let Inst{16} = tf; let Inst{15-11} = fs; Modified: head/contrib/llvm/lib/Target/Mips/MipsInstrInfo.td ============================================================================== --- head/contrib/llvm/lib/Target/Mips/MipsInstrInfo.td Fri Dec 9 21:06:20 2011 (r228378) +++ head/contrib/llvm/lib/Target/Mips/MipsInstrInfo.td Fri Dec 9 22:23:45 2011 (r228379) @@ -153,6 +153,7 @@ def uimm16 : Operand { def mem : Operand { let PrintMethod = "printMemOperand"; let MIOperandInfo = (ops CPURegs, simm16); + let EncoderMethod = "getMemEncoding"; } def mem64 : Operand { @@ -163,6 +164,17 @@ def mem64 : Operand { def mem_ea : Operand { let PrintMethod = "printMemOperandEA"; let MIOperandInfo = (ops CPURegs, simm16); + let EncoderMethod = "getMemEncoding"; +} + +// size operand of ext instruction +def size_ext : Operand { + let EncoderMethod = "getSizeExtEncoding"; +} + +// size operand of ins instruction +def size_ins : Operand { + let EncoderMethod = "getSizeInsEncoding"; } // Transformation Function - get the lower 16 bits. @@ -271,14 +283,14 @@ class ArithOverflowR op, bits<6> // Arithmetic and logical instructions with 2 register operands. class ArithLogicI op, string instr_asm, SDNode OpNode, Operand Od, PatLeaf imm_type, RegisterClass RC> : - FI; + FI; class ArithOverflowI op, string instr_asm, SDNode OpNode, Operand Od, PatLeaf imm_type, RegisterClass RC> : - FI; + FI; // Arithmetic Multiply ADD/SUB let rd = 0, shamt = 0, Defs = [HI, LO], Uses = [HI, LO] in @@ -319,16 +331,23 @@ class LogicR_shift_rotate_reg fu // Load Upper Imediate class LoadUpper op, string instr_asm>: - FI { + FI { let rs = 0; } +class FMem op, dag outs, dag ins, string asmstr, list pattern, + InstrItinClass itin>: FFI { + bits<21> addr; + let Inst{25-21} = addr{20-16}; + let Inst{15-0} = addr{15-0}; +} + // Memory Load/Store let canFoldAsLoad = 1 in class LoadM op, string instr_asm, PatFrag OpNode, RegisterClass RC, Operand MemOpnd, bit Pseudo>: - FI { let isPseudo = Pseudo; @@ -336,7 +355,7 @@ class LoadM op, string instr_asm class StoreM op, string instr_asm, PatFrag OpNode, RegisterClass RC, Operand MemOpnd, bit Pseudo>: - FI { let isPseudo = Pseudo; @@ -380,9 +399,9 @@ multiclass StoreM64 op, string i // Conditional Branch class CBranch op, string instr_asm, PatFrag cond_op, RegisterClass RC>: - CBranchBase { + CBranchBase { let isBranch = 1; let isTerminator = 1; let hasDelaySlot = 1; @@ -390,9 +409,9 @@ class CBranch op, string instr_a class CBranchZero op, bits<5> _rt, string instr_asm, PatFrag cond_op, RegisterClass RC>: - CBranchBase { + CBranchBase { let rt = _rt; let isBranch = 1; let isTerminator = 1; @@ -411,9 +430,9 @@ class SetCC_R op, bits<6> func, class SetCC_I op, string instr_asm, PatFrag cond_op, Operand Od, PatLeaf imm_type, RegisterClass RC>: - FI; // Unconditional branch @@ -450,10 +469,8 @@ let isCall=1, hasDelaySlot=1, } class BranchLink: - FI<0x1, (outs), (ins CPURegs:$rs, brtarget:$target, variable_ops), *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 23:26:29 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37093106564A; Fri, 9 Dec 2011 23:26:29 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D66C8FC17; Fri, 9 Dec 2011 23:26:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9NQS9X054316; Fri, 9 Dec 2011 23:26:28 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9NQSeT054313; Fri, 9 Dec 2011 23:26:28 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201112092326.pB9NQSeT054313@svn.freebsd.org> From: Brooks Davis Date: Fri, 9 Dec 2011 23:26:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228380 - head/sys/net X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 23:26:29 -0000 Author: brooks Date: Fri Dec 9 23:26:28 2011 New Revision: 228380 URL: http://svn.freebsd.org/changeset/base/228380 Log: Remove the unused if_free_type() function. X-MFC after: never Modified: head/sys/net/if.c head/sys/net/if_var.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Fri Dec 9 22:23:45 2011 (r228379) +++ head/sys/net/if.c Fri Dec 9 23:26:28 2011 (r228380) @@ -494,19 +494,12 @@ if_free_internal(struct ifnet *ifp) } /* - * This version should only be called by intefaces that switch their type - * after calling if_alloc(). if_free_type() will go away again now that we - * have if_alloctype to cache the original allocation type. For now, assert - * that they match, since we require that in practice. + * Deregister an interface and free the associated storage. */ void -if_free_type(struct ifnet *ifp, u_char type) +if_free(struct ifnet *ifp) { - KASSERT(ifp->if_alloctype == type, - ("if_free_type: type (%d) != alloctype (%d)", type, - ifp->if_alloctype)); - ifp->if_flags |= IFF_DYING; /* XXX: Locking */ IFNET_WLOCK(); @@ -522,18 +515,6 @@ if_free_type(struct ifnet *ifp, u_char t } /* - * This is the normal version of if_free(), used by device drivers to free a - * detached network interface. The contents of if_free_type() will move into - * here when if_free_type() goes away. - */ -void -if_free(struct ifnet *ifp) -{ - - if_free_type(ifp, ifp->if_alloctype); -} - -/* * Interfaces to keep an ifnet type-stable despite the possibility of the * driver calling if_free(). If there are additional references, we defer * freeing the underlying data structure. Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Fri Dec 9 22:23:45 2011 (r228379) +++ head/sys/net/if_var.h Fri Dec 9 23:26:28 2011 (r228380) @@ -865,7 +865,6 @@ void if_down(struct ifnet *); struct ifmultiaddr * if_findmulti(struct ifnet *, struct sockaddr *); void if_free(struct ifnet *); -void if_free_type(struct ifnet *, u_char); void if_initname(struct ifnet *, const char *, int); void if_link_state_change(struct ifnet *, int); int if_printf(struct ifnet *, const char *, ...) __printflike(2, 3); From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 23:26:38 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0618D1065777; Fri, 9 Dec 2011 23:26:35 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (lor.one-eyed-alien.net [69.66.77.232]) by mx1.freebsd.org (Postfix) with ESMTP id E72DE8FC0A; Fri, 9 Dec 2011 23:26:31 +0000 (UTC) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.4/8.14.4) with ESMTP id pB9NPON1068789; Fri, 9 Dec 2011 17:25:24 -0600 (CST) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.4/8.14.4/Submit) id pB9NPO8H068788; Fri, 9 Dec 2011 17:25:24 -0600 (CST) (envelope-from brooks) Date: Fri, 9 Dec 2011 17:25:24 -0600 From: Brooks Davis To: Ben Laurie Message-ID: <20111209232524.GD60242@lor.one-eyed-alien.net> References: <201111112257.pABMvqjl012442@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="u65IjBhB3TIa72Vp" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r227459 - in head/sys: dev/lmc net netgraph netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 23:26:38 -0000 --u65IjBhB3TIa72Vp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Nov 12, 2011 at 04:33:36PM -0800, Ben Laurie wrote: > On Fri, Nov 11, 2011 at 2:57 PM, Brooks Davis wrote: > > Author: brooks > > Date: Fri Nov 11 22:57:52 2011 > > New Revision: 227459 > > URL: http://svn.freebsd.org/changeset/base/227459 > > > > Log: > > ?In r191367 the need for if_free_type() was removed and a new member > > ?if_alloctype was used to store the origional interface type. ?Take > > ?advantage of this change by removing all existing uses of if_free_type= () > > ?in favor of if_free(). >=20 > Just an observation: this change removes an annotation that could be > useful for correctness checking. Do we care? Oops, I meant to respond to this earlier. I think in this case it's not a significant loss because we're only losing this annotation in 7 of the approximately 200 locations we free an interface. A better overall solution to this correctness issue would be a mechanism to assert that assignments to ifp->if_alloctype only occur if_alloc() and that similarly ifp->if_l2com isn't changed outside if_alloc/if_free(). -- Brooks >=20 > > > > ?MFC after: ? ?1 Month > > > > Modified: > > ?head/sys/dev/lmc/if_lmc.c > > ?head/sys/net/if_bridge.c > > ?head/sys/net/if_lagg.c > > ?head/sys/net/if_tap.c > > ?head/sys/net/if_vlan.c > > ?head/sys/netgraph/ng_fec.c > > ?head/sys/netinet/ip_carp.c > > > > Modified: head/sys/dev/lmc/if_lmc.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/dev/lmc/if_lmc.c ? Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745= 8) > > +++ head/sys/dev/lmc/if_lmc.c ? Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745= 9) > > @@ -4945,7 +4945,9 @@ lmc_ifnet_detach(softc_t *sc) > > ? /* Detach from the ifnet kernel interface. */ > > ? if_detach(sc->ifp); > > > > -# if (__FreeBSD_version >=3D 600000) > > +# if (defined(__FreeBSD__) && __FreeBSD_version >=3D 800082) > > + ?if_free(sc->ifp); > > +# elif (defined(__FreeBSD__) && __FreeBSD_version >=3D 600000) > > ? if_free_type(sc->ifp, NSPPP ? IFT_PPP : IFT_OTHER); > > ?# endif > > ? } > > > > Modified: head/sys/net/if_bridge.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/net/if_bridge.c ? ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745= 8) > > +++ head/sys/net/if_bridge.c ? ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745= 9) > > @@ -676,7 +676,7 @@ bridge_clone_destroy(struct ifnet *ifp) > > > > ? ? ? ?bstp_detach(&sc->sc_stp); > > ? ? ? ?ether_ifdetach(ifp); > > - ? ? ? if_free_type(ifp, IFT_ETHER); > > + ? ? ? if_free(ifp); > > > > ? ? ? ?/* Tear down the routing table. */ > > ? ? ? ?bridge_rtable_fini(sc); > > > > Modified: head/sys/net/if_lagg.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/net/if_lagg.c ? ? ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745= 8) > > +++ head/sys/net/if_lagg.c ? ? ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745= 9) > > @@ -275,7 +275,7 @@ lagg_clone_create(struct if_clone *ifc, > > ? ? ? ? ? ? ? ?if (lagg_protos[i].ti_proto =3D=3D LAGG_PROTO_DEFAULT) { > > ? ? ? ? ? ? ? ? ? ? ? ?sc->sc_proto =3D lagg_protos[i].ti_proto; > > ? ? ? ? ? ? ? ? ? ? ? ?if ((error =3D lagg_protos[i].ti_attach(sc)) != =3D 0) { > > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if_free_type(ifp, IFT_ETHER); > > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if_free(ifp); > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?free(sc, M_DEVBUF); > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?return (error); > > ? ? ? ? ? ? ? ? ? ? ? ?} > > @@ -293,7 +293,6 @@ lagg_clone_create(struct if_clone *ifc, > > ? ? ? ?ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_AUTO); > > > > ? ? ? ?if_initname(ifp, ifc->ifc_name, unit); > > - ? ? ? ifp->if_type =3D IFT_ETHER; > > ? ? ? ?ifp->if_softc =3D sc; > > ? ? ? ?ifp->if_start =3D lagg_start; > > ? ? ? ?ifp->if_init =3D lagg_init; > > @@ -305,7 +304,7 @@ lagg_clone_create(struct if_clone *ifc, > > ? ? ? ?IFQ_SET_READY(&ifp->if_snd); > > > > ? ? ? ?/* > > - ? ? ? ?* Attach as an ordinary ethernet device, childs will be attach= ed > > + ? ? ? ?* Attach as an ordinary ethernet device, children will be atta= ched > > ? ? ? ? * as special device IFT_IEEE8023ADLAG. > > ? ? ? ? */ > > ? ? ? ?ether_ifattach(ifp, eaddr); > > @@ -352,7 +351,7 @@ lagg_clone_destroy(struct ifnet *ifp) > > > > ? ? ? ?ifmedia_removeall(&sc->sc_media); > > ? ? ? ?ether_ifdetach(ifp); > > - ? ? ? if_free_type(ifp, IFT_ETHER); > > + ? ? ? if_free(ifp); > > > > ? ? ? ?mtx_lock(&lagg_list_mtx); > > ? ? ? ?SLIST_REMOVE(&lagg_list, sc, lagg_softc, sc_entries); > > > > Modified: head/sys/net/if_tap.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/net/if_tap.c ? ? ? Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745= 8) > > +++ head/sys/net/if_tap.c ? ? ? Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745= 9) > > @@ -218,7 +218,7 @@ tap_destroy(struct tap_softc *tp) > > ? ? ? ?knlist_destroy(&tp->tap_rsel.si_note); > > ? ? ? ?destroy_dev(tp->tap_dev); > > ? ? ? ?ether_ifdetach(ifp); > > - ? ? ? if_free_type(ifp, IFT_ETHER); > > + ? ? ? if_free(ifp); > > > > ? ? ? ?mtx_destroy(&tp->tap_mtx); > > ? ? ? ?free(tp, M_TAP); > > > > Modified: head/sys/net/if_vlan.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/net/if_vlan.c ? ? ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745= 8) > > +++ head/sys/net/if_vlan.c ? ? ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745= 9) > > @@ -967,7 +967,7 @@ vlan_clone_create(struct if_clone *ifc, > > ? ? ? ? ? ? ? ? ? ? ? ? */ > > ? ? ? ? ? ? ? ? ? ? ? ?ether_ifdetach(ifp); > > ? ? ? ? ? ? ? ? ? ? ? ?vlan_unconfig(ifp); > > - ? ? ? ? ? ? ? ? ? ? ? if_free_type(ifp, IFT_ETHER); > > + ? ? ? ? ? ? ? ? ? ? ? if_free(ifp); > > ? ? ? ? ? ? ? ? ? ? ? ?ifc_free_unit(ifc, unit); > > ? ? ? ? ? ? ? ? ? ? ? ?free(ifv, M_VLAN); > > > > @@ -989,7 +989,7 @@ vlan_clone_destroy(struct if_clone *ifc, > > > > ? ? ? ?ether_ifdetach(ifp); ? ?/* first, remove it from system-wide lis= ts */ > > ? ? ? ?vlan_unconfig(ifp); ? ? /* now it can be unconfigured and freed = */ > > - ? ? ? if_free_type(ifp, IFT_ETHER); > > + ? ? ? if_free(ifp); > > ? ? ? ?free(ifv, M_VLAN); > > ? ? ? ?ifc_free_unit(ifc, unit); > > > > > > Modified: head/sys/netgraph/ng_fec.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/netgraph/ng_fec.c ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745= 8) > > +++ head/sys/netgraph/ng_fec.c ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745= 9) > > @@ -1332,7 +1332,7 @@ ng_fec_shutdown(node_p node) > > ? ? ? ?} > > > > ? ? ? ?ether_ifdetach(priv->ifp); > > - ? ? ? if_free_type(priv->ifp, IFT_ETHER); > > + ? ? ? if_free(priv->ifp); > > ? ? ? ?ifmedia_removeall(&priv->ifmedia); > > ? ? ? ?ng_fec_free_unit(priv->unit); > > ? ? ? ?free(priv, M_NETGRAPH); > > > > Modified: head/sys/netinet/ip_carp.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/netinet/ip_carp.c ?Fri Nov 11 22:27:09 2011 ? ? ? ?(r22745= 8) > > +++ head/sys/netinet/ip_carp.c ?Fri Nov 11 22:57:52 2011 ? ? ? ?(r22745= 9) > > @@ -472,7 +472,7 @@ carp_clone_destroy(struct ifnet *ifp) > > ? ? ? ?mtx_unlock(&carp_mtx); > > ? ? ? ?bpfdetach(ifp); > > ? ? ? ?if_detach(ifp); > > - ? ? ? if_free_type(ifp, IFT_ETHER); > > + ? ? ? if_free(ifp); > > ?#ifdef INET > > ? ? ? ?free(sc->sc_imo.imo_membership, M_CARP); > > ?#endif > > >=20 --u65IjBhB3TIa72Vp Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iD8DBQFO4pjjXY6L6fI4GtQRAgRhAKDDJ9KWqyWecmxR0FDnV4eNBGtjIACgsyaz +oWaHZHi/lAct3txgpia95Q= =t61w -----END PGP SIGNATURE----- --u65IjBhB3TIa72Vp-- From owner-svn-src-all@FreeBSD.ORG Fri Dec 9 23:37:56 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04467106566B; Fri, 9 Dec 2011 23:37:56 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E89A18FC08; Fri, 9 Dec 2011 23:37:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pB9Nbtio054695; Fri, 9 Dec 2011 23:37:55 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pB9Nbtx0054693; Fri, 9 Dec 2011 23:37:55 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201112092337.pB9Nbtx0054693@svn.freebsd.org> From: Pyun YongHyeon Date: Fri, 9 Dec 2011 23:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228381 - head/sys/dev/et X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Dec 2011 23:37:56 -0000 Author: yongari Date: Fri Dec 9 23:37:55 2011 New Revision: 228381 URL: http://svn.freebsd.org/changeset/base/228381 Log: FreeBSD driver does not require arpcom structure in softc. Modified: head/sys/dev/et/if_etvar.h Modified: head/sys/dev/et/if_etvar.h ============================================================================== --- head/sys/dev/et/if_etvar.h Fri Dec 9 23:26:28 2011 (r228380) +++ head/sys/dev/et/if_etvar.h Fri Dec 9 23:37:55 2011 (r228381) @@ -290,7 +290,6 @@ struct et_softc { struct resource *sc_irq_res; struct resource *sc_mem_res; - struct arpcom arpcom; int sc_if_flags; uint32_t sc_flags; /* ET_FLAG_ */ int sc_expcap; From owner-svn-src-all@FreeBSD.ORG Sat Dec 10 01:01:45 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2236C106567F; Sat, 10 Dec 2011 01:01:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 125898FC1A; Sat, 10 Dec 2011 01:01:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBA11icp057324; Sat, 10 Dec 2011 01:01:44 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBA11inJ057322; Sat, 10 Dec 2011 01:01:44 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201112100101.pBA11inJ057322@svn.freebsd.org> From: Dimitry Andric Date: Sat, 10 Dec 2011 01:01:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228383 - head/lib/clang/include/clang/Basic X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 01:01:45 -0000 Author: dim Date: Sat Dec 10 01:01:44 2011 New Revision: 228383 URL: http://svn.freebsd.org/changeset/base/228383 Log: Use the correct upstream revision number for llvm/clang 3.0 release. The r145546 revision is from branches/release_30, the r145349 revision is from tags/RELEASE_30/final. MFC after: 1 week Modified: head/lib/clang/include/clang/Basic/Version.inc Modified: head/lib/clang/include/clang/Basic/Version.inc ============================================================================== --- head/lib/clang/include/clang/Basic/Version.inc Sat Dec 10 00:04:08 2011 (r228382) +++ head/lib/clang/include/clang/Basic/Version.inc Sat Dec 10 01:01:44 2011 (r228383) @@ -5,6 +5,6 @@ #define CLANG_VERSION_MINOR 0 #define CLANG_VENDOR "FreeBSD " -#define CLANG_VENDOR_SUFFIX " 20111209" +#define CLANG_VENDOR_SUFFIX " 20111210" -#define SVN_REVISION "145546" +#define SVN_REVISION "145349" From owner-svn-src-all@FreeBSD.ORG Sat Dec 10 01:44:24 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 889551065708; Sat, 10 Dec 2011 01:44:24 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7879E8FC1B; Sat, 10 Dec 2011 01:44:24 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBA1iOWm058632; Sat, 10 Dec 2011 01:44:24 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBA1iOFS058630; Sat, 10 Dec 2011 01:44:24 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201112100144.pBA1iOFS058630@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Sat, 10 Dec 2011 01:44:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228384 - head/contrib/openpam/lib X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 01:44:24 -0000 Author: des Date: Sat Dec 10 01:44:24 2011 New Revision: 228384 URL: http://svn.freebsd.org/changeset/base/228384 Log: Add minimal validation of the service name to fend off at least one attack vector against applications that allow the applicant to specify which policy to apply. Submitted by: Matthias Drochner MFC after: 1 week Modified: head/contrib/openpam/lib/openpam_configure.c Modified: head/contrib/openpam/lib/openpam_configure.c ============================================================================== --- head/contrib/openpam/lib/openpam_configure.c Sat Dec 10 01:01:44 2011 (r228383) +++ head/contrib/openpam/lib/openpam_configure.c Sat Dec 10 01:44:24 2011 (r228384) @@ -285,6 +285,13 @@ openpam_load_chain(pam_handle_t *pamh, size_t len; int r; + /* don't allow to escape from policy_path */ + if (strchr(service, '/')) { + openpam_log(PAM_LOG_ERROR, "invalid service name: %s", + service); + return (-PAM_SYSTEM_ERR); + } + for (path = openpam_policy_path; *path != NULL; ++path) { len = strlen(*path); if ((*path)[len - 1] == '/') { From owner-svn-src-all@FreeBSD.ORG Sat Dec 10 06:55:03 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 701AC106564A; Sat, 10 Dec 2011 06:55:03 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 580CE8FC0A; Sat, 10 Dec 2011 06:55:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBA6t3sf070176; Sat, 10 Dec 2011 06:55:03 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBA6t37f070169; Sat, 10 Dec 2011 06:55:03 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201112100655.pBA6t37f070169@svn.freebsd.org> From: Jack F Vogel Date: Sat, 10 Dec 2011 06:55:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228386 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 06:55:03 -0000 Author: jfv Date: Sat Dec 10 06:55:02 2011 New Revision: 228386 URL: http://svn.freebsd.org/changeset/base/228386 Log: Part 1 of two parts, this is the shared code changes in support of new deltas for both em and igb drivers. Note that I am not able to track all the bugs fixed in this code, I am a consumer of it as a component of my core drivers. It is important to keep the FreeBSD drivers up to date with it however. One important note is there is a key fix for 82574 in this update. Also, there are lots of white space changes, I am not happy about them but have no control over it :) Modified: head/sys/dev/e1000/e1000_80003es2lan.c head/sys/dev/e1000/e1000_80003es2lan.h head/sys/dev/e1000/e1000_82540.c head/sys/dev/e1000/e1000_82541.c head/sys/dev/e1000/e1000_82543.c head/sys/dev/e1000/e1000_82571.c head/sys/dev/e1000/e1000_82575.c head/sys/dev/e1000/e1000_82575.h head/sys/dev/e1000/e1000_api.c head/sys/dev/e1000/e1000_api.h head/sys/dev/e1000/e1000_defines.h head/sys/dev/e1000/e1000_hw.h head/sys/dev/e1000/e1000_ich8lan.c head/sys/dev/e1000/e1000_ich8lan.h head/sys/dev/e1000/e1000_mac.c head/sys/dev/e1000/e1000_nvm.c head/sys/dev/e1000/e1000_nvm.h head/sys/dev/e1000/e1000_phy.c head/sys/dev/e1000/e1000_phy.h head/sys/dev/e1000/e1000_regs.h head/sys/dev/e1000/e1000_vf.c Modified: head/sys/dev/e1000/e1000_80003es2lan.c ============================================================================== --- head/sys/dev/e1000/e1000_80003es2lan.c Sat Dec 10 02:06:11 2011 (r228385) +++ head/sys/dev/e1000/e1000_80003es2lan.c Sat Dec 10 06:55:02 2011 (r228386) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -47,18 +47,18 @@ static void e1000_release_phy_80003es2la static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw); static void e1000_release_nvm_80003es2lan(struct e1000_hw *hw); static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, - u32 offset, - u16 *data); + u32 offset, + u16 *data); static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, - u32 offset, - u16 data); + u32 offset, + u16 data); static s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset, - u16 words, u16 *data); + u16 words, u16 *data); static s32 e1000_get_cfg_done_80003es2lan(struct e1000_hw *hw); static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw); static s32 e1000_get_cable_length_80003es2lan(struct e1000_hw *hw); static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, - u16 *duplex); + u16 *duplex); static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw); static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw); static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw); @@ -68,9 +68,9 @@ static s32 e1000_cfg_kmrn_10_100_80003e static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw); static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw); static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, - u16 *data); + u16 *data); static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, - u16 data); + u16 data); static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw); static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw); static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); @@ -85,8 +85,8 @@ static void e1000_power_down_phy_copper_ static const u16 e1000_gg82563_cable_length_table[] = { 0, 60, 115, 150, 150, 60, 115, 150, 180, 180, 0xFF }; #define GG82563_CABLE_LENGTH_TABLE_SIZE \ - (sizeof(e1000_gg82563_cable_length_table) / \ - sizeof(e1000_gg82563_cable_length_table[0])) + (sizeof(e1000_gg82563_cable_length_table) / \ + sizeof(e1000_gg82563_cable_length_table[0])) /** * e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs. @@ -100,34 +100,34 @@ static s32 e1000_init_phy_params_80003es DEBUGFUNC("e1000_init_phy_params_80003es2lan"); if (hw->phy.media_type != e1000_media_type_copper) { - phy->type = e1000_phy_none; + phy->type = e1000_phy_none; goto out; } else { phy->ops.power_up = e1000_power_up_phy_copper; phy->ops.power_down = e1000_power_down_phy_copper_80003es2lan; } - phy->addr = 1; - phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; - phy->reset_delay_us = 100; - phy->type = e1000_phy_gg82563; - - phy->ops.acquire = e1000_acquire_phy_80003es2lan; - phy->ops.check_polarity = e1000_check_polarity_m88; - phy->ops.check_reset_block = e1000_check_reset_block_generic; - phy->ops.commit = e1000_phy_sw_reset_generic; - phy->ops.get_cfg_done = e1000_get_cfg_done_80003es2lan; - phy->ops.get_info = e1000_get_phy_info_m88; - phy->ops.release = e1000_release_phy_80003es2lan; - phy->ops.reset = e1000_phy_hw_reset_generic; - phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; + phy->addr = 1; + phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; + phy->reset_delay_us = 100; + phy->type = e1000_phy_gg82563; + + phy->ops.acquire = e1000_acquire_phy_80003es2lan; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.check_reset_block = e1000_check_reset_block_generic; + phy->ops.commit = e1000_phy_sw_reset_generic; + phy->ops.get_cfg_done = e1000_get_cfg_done_80003es2lan; + phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.release = e1000_release_phy_80003es2lan; + phy->ops.reset = e1000_phy_hw_reset_generic; + phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_80003es2lan; - phy->ops.get_cable_length = e1000_get_cable_length_80003es2lan; - phy->ops.read_reg = e1000_read_phy_reg_gg82563_80003es2lan; - phy->ops.write_reg = e1000_write_phy_reg_gg82563_80003es2lan; + phy->ops.get_cable_length = e1000_get_cable_length_80003es2lan; + phy->ops.read_reg = e1000_read_phy_reg_gg82563_80003es2lan; + phy->ops.write_reg = e1000_write_phy_reg_gg82563_80003es2lan; - phy->ops.cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan; + phy->ops.cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan; /* This can only be done after all function pointers are setup. */ ret_val = e1000_get_phy_id(hw); @@ -154,19 +154,19 @@ static s32 e1000_init_nvm_params_80003es DEBUGFUNC("e1000_init_nvm_params_80003es2lan"); - nvm->opcode_bits = 8; - nvm->delay_usec = 1; + nvm->opcode_bits = 8; + nvm->delay_usec = 1; switch (nvm->override) { case e1000_nvm_override_spi_large: - nvm->page_size = 32; + nvm->page_size = 32; nvm->address_bits = 16; break; case e1000_nvm_override_spi_small: - nvm->page_size = 8; + nvm->page_size = 8; nvm->address_bits = 8; break; default: - nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; + nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? 16 : 8; break; } @@ -174,7 +174,7 @@ static s32 e1000_init_nvm_params_80003es nvm->type = e1000_nvm_eeprom_spi; size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> - E1000_EECD_SIZE_EX_SHIFT); + E1000_EECD_SIZE_EX_SHIFT); /* * Added to a constant, "size" becomes the left-shift value @@ -185,16 +185,16 @@ static s32 e1000_init_nvm_params_80003es /* EEPROM access above 16k is unsupported */ if (size > 14) size = 14; - nvm->word_size = 1 << size; + nvm->word_size = 1 << size; /* Function Pointers */ - nvm->ops.acquire = e1000_acquire_nvm_80003es2lan; - nvm->ops.read = e1000_read_nvm_eerd; - nvm->ops.release = e1000_release_nvm_80003es2lan; - nvm->ops.update = e1000_update_nvm_checksum_generic; + nvm->ops.acquire = e1000_acquire_nvm_80003es2lan; + nvm->ops.read = e1000_read_nvm_eerd; + nvm->ops.release = e1000_release_nvm_80003es2lan; + nvm->ops.update = e1000_update_nvm_checksum_generic; nvm->ops.valid_led_default = e1000_valid_led_default_generic; - nvm->ops.validate = e1000_validate_nvm_checksum_generic; - nvm->ops.write = e1000_write_nvm_80003es2lan; + nvm->ops.validate = e1000_validate_nvm_checksum_generic; + nvm->ops.write = e1000_write_nvm_80003es2lan; return E1000_SUCCESS; } @@ -215,13 +215,13 @@ static s32 e1000_init_mac_params_80003es hw->phy.media_type = e1000_media_type_internal_serdes; mac->ops.check_for_link = e1000_check_for_serdes_link_generic; mac->ops.setup_physical_interface = - e1000_setup_fiber_serdes_link_generic; + e1000_setup_fiber_serdes_link_generic; break; default: hw->phy.media_type = e1000_media_type_copper; mac->ops.check_for_link = e1000_check_for_copper_link_generic; mac->ops.setup_physical_interface = - e1000_setup_copper_link_80003es2lan; + e1000_setup_copper_link_80003es2lan; break; } @@ -234,9 +234,8 @@ static s32 e1000_init_mac_params_80003es /* FWSM register */ mac->has_fwsm = TRUE; /* ARC supported; valid only if manageability features are enabled. */ - mac->arc_subsystem_valid = - (E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK) - ? TRUE : FALSE; + mac->arc_subsystem_valid = (E1000_READ_REG(hw, E1000_FWSM) & + E1000_FWSM_MODE_MASK) ? TRUE : FALSE; /* Adaptive IFS not supported */ mac->adaptive_ifs = FALSE; @@ -330,7 +329,7 @@ static void e1000_release_phy_80003es2la } /** - * e1000_acquire_mac_csr_80003es2lan - Acquire rights to access Kumeran register + * e1000_acquire_mac_csr_80003es2lan - Acquire right to access Kumeran register * @hw: pointer to the HW structure * * Acquire the semaphore to access the Kumeran interface. @@ -348,7 +347,7 @@ static s32 e1000_acquire_mac_csr_80003es } /** - * e1000_release_mac_csr_80003es2lan - Release rights to access Kumeran Register + * e1000_release_mac_csr_80003es2lan - Release right to access Kumeran Register * @hw: pointer to the HW structure * * Release the semaphore used to access the Kumeran interface @@ -488,7 +487,7 @@ static void e1000_release_swfw_sync_8000 * Read the GG82563 PHY register. **/ static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, - u32 offset, u16 *data) + u32 offset, u16 *data) { s32 ret_val; u32 page_select; @@ -538,14 +537,14 @@ static s32 e1000_read_phy_reg_gg82563_80 usec_delay(200); ret_val = e1000_read_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + MAX_PHY_REG_ADDRESS & offset, + data); usec_delay(200); } else { ret_val = e1000_read_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + MAX_PHY_REG_ADDRESS & offset, + data); } e1000_release_phy_80003es2lan(hw); @@ -563,7 +562,7 @@ out: * Write to the GG82563 PHY register. **/ static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, - u32 offset, u16 data) + u32 offset, u16 data) { s32 ret_val; u32 page_select; @@ -613,14 +612,14 @@ static s32 e1000_write_phy_reg_gg82563_8 usec_delay(200); ret_val = e1000_write_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + MAX_PHY_REG_ADDRESS & offset, + data); usec_delay(200); } else { ret_val = e1000_write_phy_reg_mdic(hw, - MAX_PHY_REG_ADDRESS & offset, - data); + MAX_PHY_REG_ADDRESS & offset, + data); } e1000_release_phy_80003es2lan(hw); @@ -639,7 +638,7 @@ out: * Write "words" of data to the ESB2 NVM. **/ static s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset, - u16 words, u16 *data) + u16 words, u16 *data) { DEBUGFUNC("e1000_write_nvm_80003es2lan"); @@ -729,11 +728,10 @@ static s32 e1000_phy_force_speed_duplex_ usec_delay(1); if (hw->phy.autoneg_wait_to_complete) { - DEBUGOUT("Waiting for forced speed/duplex link " - "on GG82563 phy.\n"); + DEBUGOUT("Waiting for forced speed/duplex link on GG82563 phy.\n"); ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT, - 100000, &link); + 100000, &link); if (ret_val) goto out; @@ -749,12 +747,13 @@ static s32 e1000_phy_force_speed_duplex_ /* Try once more */ ret_val = e1000_phy_has_link_generic(hw, PHY_FORCE_LIMIT, - 100000, &link); + 100000, &link); if (ret_val) goto out; } - ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, &phy_data); + ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, + &phy_data); if (ret_val) goto out; @@ -773,7 +772,8 @@ static s32 e1000_phy_force_speed_duplex_ * duplex. */ phy_data |= GG82563_MSCR_ASSERT_CRS_ON_TX; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, phy_data); + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, + phy_data); out: return ret_val; @@ -826,21 +826,20 @@ out: * Retrieve the current speed and duplex configuration. **/ static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, - u16 *duplex) + u16 *duplex) { s32 ret_val; DEBUGFUNC("e1000_get_link_up_info_80003es2lan"); if (hw->phy.media_type == e1000_media_type_copper) { - ret_val = e1000_get_speed_and_duplex_copper_generic(hw, - speed, - duplex); + ret_val = e1000_get_speed_and_duplex_copper_generic(hw, speed, + duplex); hw->phy.ops.cfg_on_link_up(hw); } else { ret_val = e1000_get_speed_and_duplex_fiber_serdes_generic(hw, - speed, - duplex); + speed, + duplex); } return ret_val; @@ -939,21 +938,21 @@ static s32 e1000_init_hw_80003es2lan(str /* Disable IBIST slave mode (far-end loopback) */ e1000_read_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM, - &kum_reg_data); + &kum_reg_data); kum_reg_data |= E1000_KMRNCTRLSTA_IBIST_DISABLE; e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_INBAND_PARAM, - kum_reg_data); + kum_reg_data); /* Set the transmit descriptor write-back policy */ reg_data = E1000_READ_REG(hw, E1000_TXDCTL(0)); reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) | - E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; + E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; E1000_WRITE_REG(hw, E1000_TXDCTL(0), reg_data); /* ...for both queues. */ reg_data = E1000_READ_REG(hw, E1000_TXDCTL(1)); reg_data = (reg_data & ~E1000_TXDCTL_WTHRESH) | - E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; + E1000_TXDCTL_FULL_TX_DESC_WB | E1000_TXDCTL_COUNT_DESC; E1000_WRITE_REG(hw, E1000_TXDCTL(1), reg_data); /* Enable retransmit on late collisions */ @@ -981,9 +980,9 @@ static s32 e1000_init_hw_80003es2lan(str hw->dev_spec._80003es2lan.mdic_wa_enable = TRUE; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET >> - E1000_KMRNCTRLSTA_OFFSET_SHIFT, - &i); + E1000_KMRNCTRLSTA_OFFSET >> + E1000_KMRNCTRLSTA_OFFSET_SHIFT, + &i); if (!ret_val) { if ((i & E1000_KMRNCTRLSTA_OPMODE_MASK) == E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO) @@ -1056,11 +1055,7 @@ static s32 e1000_copper_link_setup_gg825 DEBUGFUNC("e1000_copper_link_setup_gg82563_80003es2lan"); - if (phy->reset_disable) - goto skip_reset; - - ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, - &data); + ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, &data); if (ret_val) goto out; @@ -1068,8 +1063,7 @@ static s32 e1000_copper_link_setup_gg825 /* Use 25MHz for both link down and 1000Base-T for Tx clock. */ data |= GG82563_MSCR_TX_CLK_1000MBPS_25; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, - data); + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_MAC_SPEC_CTRL, data); if (ret_val) goto out; @@ -1122,7 +1116,6 @@ static s32 e1000_copper_link_setup_gg825 goto out; } -skip_reset: /* Bypass Rx and Tx FIFO's */ ret_val = e1000_write_kmrn_reg_80003es2lan(hw, E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL, @@ -1132,14 +1125,12 @@ skip_reset: goto out; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, - &data); + E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, &data); if (ret_val) goto out; data |= E1000_KMRNCTRLSTA_OPMODE_E_IDLE; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, - data); + E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE, data); if (ret_val) goto out; @@ -1169,18 +1160,18 @@ skip_reset: /* Enable Electrical Idle on the PHY */ data |= GG82563_PMCR_ENABLE_ELECTRICAL_IDLE; ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_PWR_MGMT_CTRL, - data); + data); if (ret_val) goto out; ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - &data); + &data); if (ret_val) goto out; data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - data); + data); if (ret_val) goto out; } @@ -1228,27 +1219,25 @@ static s32 e1000_setup_copper_link_80003 * polling the phy; this fixes erroneous timeouts at 10Mbps. */ ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 4), - 0xFFFF); + 0xFFFF); if (ret_val) goto out; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9), - ®_data); + ®_data); if (ret_val) goto out; reg_data |= 0x3F; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, GG82563_REG(0x34, 9), - reg_data); + reg_data); if (ret_val) goto out; ret_val = e1000_read_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, - ®_data); + E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, ®_data); if (ret_val) goto out; reg_data |= E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, - reg_data); + E1000_KMRNCTRLSTA_OFFSET_INB_CTRL, reg_data); if (ret_val) goto out; @@ -1279,9 +1268,8 @@ static s32 e1000_cfg_on_link_up_80003es2 DEBUGFUNC("e1000_configure_on_link_up"); if (hw->phy.media_type == e1000_media_type_copper) { - ret_val = e1000_get_speed_and_duplex_copper_generic(hw, - &speed, - &duplex); + ret_val = e1000_get_speed_and_duplex_copper_generic(hw, &speed, + &duplex); if (ret_val) goto out; @@ -1314,8 +1302,8 @@ static s32 e1000_cfg_kmrn_10_100_80003es reg_data = E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, - reg_data); + E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, + reg_data); if (ret_val) goto out; @@ -1327,12 +1315,12 @@ static s32 e1000_cfg_kmrn_10_100_80003es do { ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data); + ®_data); if (ret_val) goto out; ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data2); + ®_data2); if (ret_val) goto out; i++; @@ -1343,7 +1331,8 @@ static s32 e1000_cfg_kmrn_10_100_80003es else reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, + reg_data); out: return ret_val; @@ -1367,8 +1356,7 @@ static s32 e1000_cfg_kmrn_1000_80003es2l reg_data = E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT; ret_val = e1000_write_kmrn_reg_80003es2lan(hw, - E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, - reg_data); + E1000_KMRNCTRLSTA_OFFSET_HD_CTRL, reg_data); if (ret_val) goto out; @@ -1380,19 +1368,20 @@ static s32 e1000_cfg_kmrn_1000_80003es2l do { ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data); + ®_data); if (ret_val) goto out; ret_val = hw->phy.ops.read_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, - ®_data2); + ®_data2); if (ret_val) goto out; i++; } while ((reg_data != reg_data2) && (i < GG82563_MAX_KMRN_RETRY)); reg_data &= ~GG82563_KMCR_PASS_FALSE_CARRIER; - ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, reg_data); + ret_val = hw->phy.ops.write_reg(hw, GG82563_PHY_KMRN_MODE_CTRL, + reg_data); out: return ret_val; @@ -1409,7 +1398,7 @@ out: * Release the semaphore before exiting. **/ static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, - u16 *data) + u16 *data) { u32 kmrnctrlsta; s32 ret_val = E1000_SUCCESS; @@ -1421,8 +1410,9 @@ static s32 e1000_read_kmrn_reg_80003es2l goto out; kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & - E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; + E1000_KMRNCTRLSTA_OFFSET) | E1000_KMRNCTRLSTA_REN; E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta); + E1000_WRITE_FLUSH(hw); usec_delay(2); @@ -1446,7 +1436,7 @@ out: * before exiting. **/ static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, - u16 data) + u16 data) { u32 kmrnctrlsta; s32 ret_val = E1000_SUCCESS; @@ -1458,8 +1448,9 @@ static s32 e1000_write_kmrn_reg_80003es2 goto out; kmrnctrlsta = ((offset << E1000_KMRNCTRLSTA_OFFSET_SHIFT) & - E1000_KMRNCTRLSTA_OFFSET) | data; + E1000_KMRNCTRLSTA_OFFSET) | data; E1000_WRITE_REG(hw, E1000_KMRNCTRLSTA, kmrnctrlsta); + E1000_WRITE_FLUSH(hw); usec_delay(2); Modified: head/sys/dev/e1000/e1000_80003es2lan.h ============================================================================== --- head/sys/dev/e1000/e1000_80003es2lan.h Sat Dec 10 02:06:11 2011 (r228385) +++ head/sys/dev/e1000/e1000_80003es2lan.h Sat Dec 10 06:55:02 2011 (r228386) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -35,48 +35,47 @@ #ifndef _E1000_80003ES2LAN_H_ #define _E1000_80003ES2LAN_H_ -#define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00 -#define E1000_KMRNCTRLSTA_OFFSET_INB_CTRL 0x02 -#define E1000_KMRNCTRLSTA_OFFSET_HD_CTRL 0x10 -#define E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE 0x1F - -#define E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS 0x0008 -#define E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS 0x0800 -#define E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING 0x0010 +#define E1000_KMRNCTRLSTA_OFFSET_FIFO_CTRL 0x00 +#define E1000_KMRNCTRLSTA_OFFSET_INB_CTRL 0x02 +#define E1000_KMRNCTRLSTA_OFFSET_HD_CTRL 0x10 +#define E1000_KMRNCTRLSTA_OFFSET_MAC2PHY_OPMODE 0x1F + +#define E1000_KMRNCTRLSTA_FIFO_CTRL_RX_BYPASS 0x0008 +#define E1000_KMRNCTRLSTA_FIFO_CTRL_TX_BYPASS 0x0800 +#define E1000_KMRNCTRLSTA_INB_CTRL_DIS_PADDING 0x0010 #define E1000_KMRNCTRLSTA_HD_CTRL_10_100_DEFAULT 0x0004 -#define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT 0x0000 -#define E1000_KMRNCTRLSTA_OPMODE_E_IDLE 0x2000 +#define E1000_KMRNCTRLSTA_HD_CTRL_1000_DEFAULT 0x0000 +#define E1000_KMRNCTRLSTA_OPMODE_E_IDLE 0x2000 -#define E1000_KMRNCTRLSTA_OPMODE_MASK 0x000C -#define E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO 0x0004 +#define E1000_KMRNCTRLSTA_OPMODE_MASK 0x000C +#define E1000_KMRNCTRLSTA_OPMODE_INBAND_MDIO 0x0004 #define E1000_TCTL_EXT_GCEX_MASK 0x000FFC00 /* Gigabit Carry Extend Padding */ -#define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN 0x00010000 +#define DEFAULT_TCTL_EXT_GCEX_80003ES2LAN 0x00010000 -#define DEFAULT_TIPG_IPGT_1000_80003ES2LAN 0x8 -#define DEFAULT_TIPG_IPGT_10_100_80003ES2LAN 0x9 +#define DEFAULT_TIPG_IPGT_1000_80003ES2LAN 0x8 +#define DEFAULT_TIPG_IPGT_10_100_80003ES2LAN 0x9 /* GG82563 PHY Specific Status Register (Page 0, Register 16 */ -#define GG82563_PSCR_POLARITY_REVERSAL_DISABLE 0x0002 /* 1=Reversal Disabled */ -#define GG82563_PSCR_CROSSOVER_MODE_MASK 0x0060 -#define GG82563_PSCR_CROSSOVER_MODE_MDI 0x0000 /* 00=Manual MDI */ -#define GG82563_PSCR_CROSSOVER_MODE_MDIX 0x0020 /* 01=Manual MDIX */ -#define GG82563_PSCR_CROSSOVER_MODE_AUTO 0x0060 /* 11=Auto crossover */ +#define GG82563_PSCR_POLARITY_REVERSAL_DISABLE 0x0002 /* 1=Reversal Disabled */ +#define GG82563_PSCR_CROSSOVER_MODE_MASK 0x0060 +#define GG82563_PSCR_CROSSOVER_MODE_MDI 0x0000 /* 00=Manual MDI */ +#define GG82563_PSCR_CROSSOVER_MODE_MDIX 0x0020 /* 01=Manual MDIX */ +#define GG82563_PSCR_CROSSOVER_MODE_AUTO 0x0060 /* 11=Auto crossover */ /* PHY Specific Control Register 2 (Page 0, Register 26) */ -#define GG82563_PSCR2_REVERSE_AUTO_NEG 0x2000 - /* 1=Reverse Auto-Negotiation */ +#define GG82563_PSCR2_REVERSE_AUTO_NEG 0x2000 /* 1=Reverse Auto-Nego */ /* MAC Specific Control Register (Page 2, Register 21) */ /* Tx clock speed for Link Down and 1000BASE-T for the following speeds */ -#define GG82563_MSCR_TX_CLK_MASK 0x0007 -#define GG82563_MSCR_TX_CLK_10MBPS_2_5 0x0004 -#define GG82563_MSCR_TX_CLK_100MBPS_25 0x0005 -#define GG82563_MSCR_TX_CLK_1000MBPS_2_5 0x0006 -#define GG82563_MSCR_TX_CLK_1000MBPS_25 0x0007 +#define GG82563_MSCR_TX_CLK_MASK 0x0007 +#define GG82563_MSCR_TX_CLK_10MBPS_2_5 0x0004 +#define GG82563_MSCR_TX_CLK_100MBPS_25 0x0005 +#define GG82563_MSCR_TX_CLK_1000MBPS_2_5 0x0006 +#define GG82563_MSCR_TX_CLK_1000MBPS_25 0x0007 -#define GG82563_MSCR_ASSERT_CRS_ON_TX 0x0010 /* 1=Assert */ +#define GG82563_MSCR_ASSERT_CRS_ON_TX 0x0010 /* 1=Assert */ /* DSP Distance Register (Page 5, Register 26) */ /* @@ -86,19 +85,19 @@ * 3 = 110-140M * 4 = >140M */ -#define GG82563_DSPD_CABLE_LENGTH 0x0007 +#define GG82563_DSPD_CABLE_LENGTH 0x0007 /* Kumeran Mode Control Register (Page 193, Register 16) */ -#define GG82563_KMCR_PASS_FALSE_CARRIER 0x0800 +#define GG82563_KMCR_PASS_FALSE_CARRIER 0x0800 /* Max number of times Kumeran read/write should be validated */ -#define GG82563_MAX_KMRN_RETRY 0x5 +#define GG82563_MAX_KMRN_RETRY 0x5 /* Power Management Control Register (Page 193, Register 20) */ -#define GG82563_PMCR_ENABLE_ELECTRICAL_IDLE 0x0001 - /* 1=Enable SERDES Electrical Idle */ +/* 1=Enable SERDES Electrical Idle */ +#define GG82563_PMCR_ENABLE_ELECTRICAL_IDLE 0x0001 /* In-Band Control Register (Page 194, Register 18) */ -#define GG82563_ICR_DIS_PADDING 0x0010 /* Disable Padding */ +#define GG82563_ICR_DIS_PADDING 0x0010 /* Disable Padding */ #endif Modified: head/sys/dev/e1000/e1000_82540.c ============================================================================== --- head/sys/dev/e1000/e1000_82540.c Sat Dec 10 02:06:11 2011 (r228385) +++ head/sys/dev/e1000/e1000_82540.c Sat Dec 10 06:55:02 2011 (r228386) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -68,23 +68,23 @@ static s32 e1000_init_phy_params_82540(s struct e1000_phy_info *phy = &hw->phy; s32 ret_val = E1000_SUCCESS; - phy->addr = 1; - phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; - phy->reset_delay_us = 10000; - phy->type = e1000_phy_m88; + phy->addr = 1; + phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; + phy->reset_delay_us = 10000; + phy->type = e1000_phy_m88; /* Function Pointers */ - phy->ops.check_polarity = e1000_check_polarity_m88; - phy->ops.commit = e1000_phy_sw_reset_generic; - phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; - phy->ops.get_cable_length = e1000_get_cable_length_m88; - phy->ops.get_cfg_done = e1000_get_cfg_done_generic; - phy->ops.read_reg = e1000_read_phy_reg_m88; - phy->ops.reset = e1000_phy_hw_reset_generic; - phy->ops.write_reg = e1000_write_phy_reg_m88; - phy->ops.get_info = e1000_get_phy_info_m88; - phy->ops.power_up = e1000_power_up_phy_copper; - phy->ops.power_down = e1000_power_down_phy_copper_82540; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.commit = e1000_phy_sw_reset_generic; + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_m88; + phy->ops.get_cable_length = e1000_get_cable_length_m88; + phy->ops.get_cfg_done = e1000_get_cfg_done_generic; + phy->ops.read_reg = e1000_read_phy_reg_m88; + phy->ops.reset = e1000_phy_hw_reset_generic; + phy->ops.write_reg = e1000_write_phy_reg_m88; + phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.power_up = e1000_power_up_phy_copper; + phy->ops.power_down = e1000_power_down_phy_copper_82540; ret_val = e1000_get_phy_id(hw); if (ret_val) @@ -121,32 +121,32 @@ static s32 e1000_init_nvm_params_82540(s DEBUGFUNC("e1000_init_nvm_params_82540"); - nvm->type = e1000_nvm_eeprom_microwire; - nvm->delay_usec = 50; - nvm->opcode_bits = 3; + nvm->type = e1000_nvm_eeprom_microwire; + nvm->delay_usec = 50; + nvm->opcode_bits = 3; switch (nvm->override) { case e1000_nvm_override_microwire_large: - nvm->address_bits = 8; - nvm->word_size = 256; + nvm->address_bits = 8; + nvm->word_size = 256; break; case e1000_nvm_override_microwire_small: - nvm->address_bits = 6; - nvm->word_size = 64; + nvm->address_bits = 6; + nvm->word_size = 64; break; default: - nvm->address_bits = eecd & E1000_EECD_SIZE ? 8 : 6; - nvm->word_size = eecd & E1000_EECD_SIZE ? 256 : 64; + nvm->address_bits = eecd & E1000_EECD_SIZE ? 8 : 6; + nvm->word_size = eecd & E1000_EECD_SIZE ? 256 : 64; break; } /* Function Pointers */ - nvm->ops.acquire = e1000_acquire_nvm_generic; - nvm->ops.read = e1000_read_nvm_microwire; - nvm->ops.release = e1000_release_nvm_generic; - nvm->ops.update = e1000_update_nvm_checksum_generic; - nvm->ops.valid_led_default = e1000_valid_led_default_generic; - nvm->ops.validate = e1000_validate_nvm_checksum_generic; - nvm->ops.write = e1000_write_nvm_microwire; + nvm->ops.acquire = e1000_acquire_nvm_generic; + nvm->ops.read = e1000_read_nvm_microwire; + nvm->ops.release = e1000_release_nvm_generic; + nvm->ops.update = e1000_update_nvm_checksum_generic; + nvm->ops.valid_led_default = e1000_valid_led_default_generic; + nvm->ops.validate = e1000_validate_nvm_checksum_generic; + nvm->ops.write = e1000_write_nvm_microwire; return E1000_SUCCESS; } @@ -198,9 +198,9 @@ static s32 e1000_init_mac_params_82540(s mac->ops.setup_link = e1000_setup_link_generic; /* physical interface setup */ mac->ops.setup_physical_interface = - (hw->phy.media_type == e1000_media_type_copper) - ? e1000_setup_copper_link_82540 - : e1000_setup_fiber_serdes_link_82540; + (hw->phy.media_type == e1000_media_type_copper) + ? e1000_setup_copper_link_82540 + : e1000_setup_fiber_serdes_link_82540; /* check for link */ switch (hw->phy.media_type) { case e1000_media_type_copper: @@ -219,9 +219,9 @@ static s32 e1000_init_mac_params_82540(s } /* link info */ mac->ops.get_link_up_info = - (hw->phy.media_type == e1000_media_type_copper) - ? e1000_get_speed_and_duplex_copper_generic - : e1000_get_speed_and_duplex_fiber_serdes_generic; + (hw->phy.media_type == e1000_media_type_copper) + ? e1000_get_speed_and_duplex_copper_generic + : e1000_get_speed_and_duplex_fiber_serdes_generic; /* multicast address update */ mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_generic; /* writing VFTA */ @@ -374,7 +374,7 @@ static s32 e1000_init_hw_82540(struct e1 txdctl = E1000_READ_REG(hw, E1000_TXDCTL(0)); txdctl = (txdctl & ~E1000_TXDCTL_WTHRESH) | - E1000_TXDCTL_FULL_TX_DESC_WB; + E1000_TXDCTL_FULL_TX_DESC_WB; E1000_WRITE_REG(hw, E1000_TXDCTL(0), txdctl); /* @@ -427,11 +427,13 @@ static s32 e1000_setup_copper_link_82540 if (hw->mac.type == e1000_82545_rev_3 || hw->mac.type == e1000_82546_rev_3) { - ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &data); + ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, + &data); if (ret_val) goto out; data |= 0x00000008; - ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, data); + ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, + data); if (ret_val) goto out; } @@ -508,9 +510,8 @@ static s32 e1000_adjust_serdes_amplitude if (nvm_data != NVM_RESERVED_WORD) { /* Adjust serdes output amplitude only. */ nvm_data &= NVM_SERDES_AMPLITUDE_MASK; - ret_val = hw->phy.ops.write_reg(hw, - M88E1000_PHY_EXT_CTRL, - nvm_data); + ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_EXT_CTRL, + nvm_data); if (ret_val) goto out; } @@ -535,9 +536,8 @@ static s32 e1000_set_vco_speed_82540(str /* Set PHY register 30, page 5, bit 8 to 0 */ - ret_val = hw->phy.ops.read_reg(hw, - M88E1000_PHY_PAGE_SELECT, - &default_page); + ret_val = hw->phy.ops.read_reg(hw, M88E1000_PHY_PAGE_SELECT, + &default_page); if (ret_val) goto out; @@ -570,7 +570,7 @@ static s32 e1000_set_vco_speed_82540(str goto out; ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT, - default_page); + default_page); out: return ret_val; @@ -587,7 +587,6 @@ out: **/ static s32 e1000_set_phy_mode_82540(struct e1000_hw *hw) { - struct e1000_phy_info *phy = &hw->phy; s32 ret_val = E1000_SUCCESS; u16 nvm_data; @@ -604,20 +603,18 @@ static s32 e1000_set_phy_mode_82540(stru if ((nvm_data != NVM_RESERVED_WORD) && (nvm_data & NVM_PHY_CLASS_A)) { ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_PAGE_SELECT, - 0x000B); + 0x000B); if (ret_val) { ret_val = -E1000_ERR_PHY; goto out; } - ret_val = hw->phy.ops.write_reg(hw, - M88E1000_PHY_GEN_CONTROL, - 0x8104); + ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, + 0x8104); if (ret_val) { ret_val = -E1000_ERR_PHY; goto out; } - phy->reset_disable = FALSE; } out: Modified: head/sys/dev/e1000/e1000_82541.c ============================================================================== --- head/sys/dev/e1000/e1000_82541.c Sat Dec 10 02:06:11 2011 (r228385) +++ head/sys/dev/e1000/e1000_82541.c Sat Dec 10 06:55:02 2011 (r228386) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -300,7 +300,7 @@ void e1000_init_function_pointers_82541( **/ static s32 e1000_reset_hw_82541(struct e1000_hw *hw) { - u32 ledctl, ctrl, manc; + u32 ledctl, ctrl, icr, manc; DEBUGFUNC("e1000_reset_hw_82541"); @@ -364,7 +364,7 @@ static s32 e1000_reset_hw_82541(struct e E1000_WRITE_REG(hw, E1000_IMC, 0xFFFFFFFF); /* Clear any pending interrupt events. */ - E1000_READ_REG(hw, E1000_ICR); + icr = E1000_READ_REG(hw, E1000_ICR); return E1000_SUCCESS; } @@ -390,7 +390,7 @@ static s32 e1000_init_hw_82541(struct e1 DEBUGOUT("Error initializing identification LED\n"); /* This is not fatal and we should not stop init due to this */ } - + /* Storing the Speed Power Down value for later use */ ret_val = hw->phy.ops.read_reg(hw, IGP01E1000_GMII_FIFO, @@ -549,8 +549,6 @@ static s32 e1000_setup_copper_link_82541 ctrl &= ~(E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); E1000_WRITE_REG(hw, E1000_CTRL, ctrl); - hw->phy.reset_disable = FALSE; - /* Earlier revs of the IGP phy require us to force MDI. */ if (hw->mac.type == e1000_82541 || hw->mac.type == e1000_82547) { dev_spec->dsp_config = e1000_dsp_config_disabled; Modified: head/sys/dev/e1000/e1000_82543.c ============================================================================== --- head/sys/dev/e1000/e1000_82543.c Sat Dec 10 02:06:11 2011 (r228385) +++ head/sys/dev/e1000/e1000_82543.c Sat Dec 10 06:55:02 2011 (r228386) @@ -1,6 +1,6 @@ /****************************************************************************** - Copyright (c) 2001-2010, Intel Corporation + Copyright (c) 2001-2011, Intel Corporation All rights reserved. Redistribution and use in source and binary forms, with or without @@ -901,7 +901,7 @@ static s32 e1000_phy_hw_reset_82543(stru **/ static s32 e1000_reset_hw_82543(struct e1000_hw *hw) { - u32 ctrl; + u32 ctrl, icr; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Dec 10 07:08:52 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD448106564A; Sat, 10 Dec 2011 07:08:52 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BBC9F8FC0C; Sat, 10 Dec 2011 07:08:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBA78qrF070953; Sat, 10 Dec 2011 07:08:52 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBA78qSp070948; Sat, 10 Dec 2011 07:08:52 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201112100708.pBA78qSp070948@svn.freebsd.org> From: Jack F Vogel Date: Sat, 10 Dec 2011 07:08:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228387 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 07:08:52 -0000 Author: jfv Date: Sat Dec 10 07:08:52 2011 New Revision: 228387 URL: http://svn.freebsd.org/changeset/base/228387 Log: Part 2 of 2 New deltas for the 1G drivers. There have still been intermittent problems with apparent TX hangs for some customers. These have been problematic to reproduce but I believe these changes will address them. Testing on a number of fronts have been positive. EM: there is an important 'chicken bit' fix for 82574 in the shared code this is supported in the core here. - The TX path has been tightened up to improve performance. In particular UDP with jumbo frames was having problems, and the changes here have improved that. - OACTIVE has been used more carefully on the theory that some hangs may be due to a problem in this interaction - Problems with the RX init code, the "lazy" allocation and ring initialization has been found to cause problems in some newer client systems, and as it really is not that big a win (its not in a hot path) it seems best to remove it. - HWTSO was broken when VLAN HWTAGGING or HWFILTER is used, I found this was due to an error in setting up the descriptors in em_xmit. IGB: - TX is also improved here. With multiqueue I realized its very important to handle OACTIVE only under the CORE lock so there are no races between the queues. - Flow Control handling was broken in a couple ways, I have changed and I hope improved that in this delta. - UDP also had a problem in the TX path here, it was change to improve that. - On some hardware, with the driver static, a weird stray interrupt seems to sometimes fire and cause a panic in the RX mbuf refresh code. This is addressed by setting interrupts late in the init path, and also to set all interrupts bits off at the start of that. Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_em.h head/sys/dev/e1000/if_igb.c head/sys/dev/e1000/if_igb.h head/sys/dev/e1000/if_lem.c head/sys/dev/e1000/if_lem.h Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Sat Dec 10 06:55:02 2011 (r228386) +++ head/sys/dev/e1000/if_em.c Sat Dec 10 07:08:52 2011 (r228387) @@ -35,6 +35,7 @@ #ifdef HAVE_KERNEL_OPTION_HEADERS #include "opt_device_polling.h" #include "opt_inet.h" +#include "opt_inet6.h" #endif #include @@ -93,7 +94,7 @@ int em_display_debug_stats = 0; /********************************************************************* * Driver version: *********************************************************************/ -char em_driver_version[] = "7.2.3"; +char em_driver_version[] = "7.3.2"; /********************************************************************* * PCI Device ID Table @@ -286,6 +287,7 @@ static void em_handle_link(void *context static void em_set_sysctl_value(struct adapter *, const char *, const char *, int *, int); +static int em_set_flowcntl(SYSCTL_HANDLER_ARGS); static __inline void em_rx_discard(struct rx_ring *, int); @@ -382,13 +384,8 @@ static int em_rx_process_limit = 100; TUNABLE_INT("hw.em.rx_process_limit", &em_rx_process_limit); SYSCTL_INT(_hw_em, OID_AUTO, rx_process_limit, CTLFLAG_RDTUN, &em_rx_process_limit, 0, - "Maximum number of received packets to process at a time, -1 means unlimited"); - -/* Flow control setting - default to FULL */ -static int em_fc_setting = e1000_fc_full; -TUNABLE_INT("hw.em.fc_setting", &em_fc_setting); -SYSCTL_INT(_hw_em, OID_AUTO, fc_setting, CTLFLAG_RDTUN, &em_fc_setting, 0, - "Flow control"); + "Maximum number of received packets to process " + "at a time, -1 means unlimited"); /* Energy efficient ethernet - default to OFF */ static int eee_setting = 0; @@ -473,6 +470,11 @@ em_attach(device_t dev) INIT_DEBUGOUT("em_attach: begin"); + if (resource_disabled("em", device_get_unit(dev))) { + device_printf(dev, "Disabled by device hint\n"); + return (ENXIO); + } + adapter = device_get_softc(dev); adapter->dev = adapter->osdep.dev = dev; hw = &adapter->hw; @@ -489,6 +491,11 @@ em_attach(device_t dev) OID_AUTO, "debug", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, em_sysctl_debug_info, "I", "Debug Information"); + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "fc", CTLTYPE_INT|CTLFLAG_RW, adapter, 0, + em_set_flowcntl, "I", "Flow Control"); + callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0); /* Determine hardware and mac info */ @@ -560,11 +567,6 @@ em_attach(device_t dev) "max number of rx packets to process", &adapter->rx_process_limit, em_rx_process_limit); - /* Sysctl for setting the interface flow control */ - em_set_sysctl_value(adapter, "flow_control", - "configure flow control", - &adapter->fc_setting, em_fc_setting); - /* * Validate number of transmit and receive descriptors. It * must not exceed hardware maximum, and must be multiple @@ -714,7 +716,8 @@ em_attach(device_t dev) em_get_hw_control(adapter); /* Tell the stack that the interface is not active */ - adapter->ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + adapter->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + adapter->ifp->if_drv_flags |= IFF_DRV_OACTIVE; adapter->led_dev = led_create(em_led_func, adapter, device_get_nameunit(dev)); @@ -847,6 +850,8 @@ em_resume(device_t dev) struct ifnet *ifp = adapter->ifp; EM_CORE_LOCK(adapter); + if (adapter->hw.mac.type == e1000_pch2lan) + e1000_resume_workarounds_pchlan(&adapter->hw); em_init_locked(adapter); em_init_manageability(adapter); EM_CORE_UNLOCK(adapter); @@ -856,17 +861,15 @@ em_resume(device_t dev) } +#ifdef EM_MULTIQUEUE /********************************************************************* - * Transmit entry point + * Multiqueue Transmit routines * - * em_start is called by the stack to initiate a transmit. - * The driver will remain in this routine as long as there are - * packets to transmit and transmit resources are available. - * In case resources are not available stack is notified and - * the packet is requeued. + * em_mq_start is called by the stack to initiate a transmit. + * however, if busy the driver can queue the request rather + * than do an immediate send. It is this that is an advantage + * in this driver, rather than also having multiple tx queues. **********************************************************************/ - -#ifdef EM_MULTIQUEUE static int em_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) { @@ -881,10 +884,6 @@ em_mq_start_locked(struct ifnet *ifp, st return (err); } - /* Call cleanup if number of TX descriptors low */ - if (txr->tx_avail <= EM_TX_CLEANUP_THRESHOLD) - em_txeof(txr); - enq = 0; if (m == NULL) { next = drbr_dequeue(ifp, txr->br); @@ -907,10 +906,6 @@ em_mq_start_locked(struct ifnet *ifp, st ETHER_BPF_MTAP(ifp, next); if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) break; - if (txr->tx_avail < EM_MAX_SCATTER) { - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - break; - } next = drbr_dequeue(ifp, txr->br); } @@ -919,6 +914,11 @@ em_mq_start_locked(struct ifnet *ifp, st txr->queue_status = EM_QUEUE_WORKING; txr->watchdog_time = ticks; } + + if (txr->tx_avail < EM_MAX_SCATTER) + em_txeof(txr); + if (txr->tx_avail < EM_MAX_SCATTER) + ifp->if_drv_flags |= IFF_DRV_OACTIVE; return (err); } @@ -959,7 +959,6 @@ em_qflush(struct ifnet *ifp) } if_qflush(ifp); } - #endif /* EM_MULTIQUEUE */ static void @@ -995,7 +994,6 @@ em_start_locked(struct ifnet *ifp, struc if (em_xmit(txr, &m_head)) { if (m_head == NULL) break; - ifp->if_drv_flags |= IFF_DRV_OACTIVE; IFQ_DRV_PREPEND(&ifp->if_snd, m_head); break; } @@ -1022,6 +1020,12 @@ em_start(struct ifnet *ifp) em_start_locked(ifp, txr); EM_TX_UNLOCK(txr); } + /* + ** If we went inactive schedule + ** a task to clean up. + */ + if (ifp->if_drv_flags & IFF_DRV_OACTIVE) + taskqueue_enqueue(txr->tq, &txr->tx_task); return; } @@ -1038,11 +1042,12 @@ static int em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct adapter *adapter = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; -#ifdef INET - struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; +#if defined(INET) || defined(INET6) + struct ifaddr *ifa = (struct ifaddr *)data; #endif - int error = 0; + bool avoid_reset = FALSE; + int error = 0; if (adapter->in_detach) return (error); @@ -1050,23 +1055,22 @@ em_ioctl(struct ifnet *ifp, u_long comma switch (command) { case SIOCSIFADDR: #ifdef INET - if (ifa->ifa_addr->sa_family == AF_INET) { - /* - * XXX - * Since resetting hardware takes a very long time - * and results in link renegotiation we only - * initialize the hardware only when it is absolutely - * required. - */ + if (ifa->ifa_addr->sa_family == AF_INET) + avoid_reset = TRUE; +#endif + /* + ** Calling init results in link renegotiation, + ** so we avoid doing it when possible. + */ + if (avoid_reset) { ifp->if_flags |= IFF_UP; - if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { - EM_CORE_LOCK(adapter); - em_init_locked(adapter); - EM_CORE_UNLOCK(adapter); - } - arp_ifinit(ifp, ifa); - } else + if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) + em_init(adapter); +#ifdef INET + if (!(ifp->if_flags & IFF_NOARP)) + arp_ifinit(ifp, ifa); #endif + } else error = ether_ioctl(ifp, command, data); break; case SIOCSIFMTU: @@ -1083,6 +1087,7 @@ em_ioctl(struct ifnet *ifp, u_long comma case e1000_ich10lan: case e1000_pch2lan: case e1000_82574: + case e1000_82583: case e1000_80003es2lan: /* 9K Jumbo Frame size */ max_frame_size = 9234; break; @@ -1090,7 +1095,6 @@ em_ioctl(struct ifnet *ifp, u_long comma max_frame_size = 4096; break; /* Adapters that do not support jumbo frames */ - case e1000_82583: case e1000_ich8lan: max_frame_size = ETHER_MAX_LEN; break; @@ -1145,11 +1149,6 @@ em_ioctl(struct ifnet *ifp, u_long comma } break; case SIOCSIFMEDIA: - /* - ** As the speed/duplex settings are being - ** changed, we need to reset the PHY. - */ - adapter->hw.phy.reset_disable = FALSE; /* Check SOL/IDER usage */ EM_CORE_LOCK(adapter); if (e1000_check_reset_block(&adapter->hw)) { @@ -1208,6 +1207,10 @@ em_ioctl(struct ifnet *ifp, u_long comma ifp->if_capenable ^= IFCAP_VLAN_HWFILTER; reinit = 1; } + if (mask & IFCAP_VLAN_HWTSO) { + ifp->if_capenable ^= IFCAP_VLAN_HWTSO; + reinit = 1; + } if ((mask & IFCAP_WOL) && (ifp->if_capabilities & IFCAP_WOL) != 0) { if (mask & IFCAP_WOL_MCAST) @@ -1246,7 +1249,6 @@ em_init_locked(struct adapter *adapter) { struct ifnet *ifp = adapter->ifp; device_t dev = adapter->dev; - u32 pba; INIT_DEBUGOUT("em_init: begin"); @@ -1255,46 +1257,6 @@ em_init_locked(struct adapter *adapter) em_disable_intr(adapter); callout_stop(&adapter->timer); - /* - * Packet Buffer Allocation (PBA) - * Writing PBA sets the receive portion of the buffer - * the remainder is used for the transmit buffer. - */ - switch (adapter->hw.mac.type) { - /* Total Packet Buffer on these is 48K */ - case e1000_82571: - case e1000_82572: - case e1000_80003es2lan: - pba = E1000_PBA_32K; /* 32K for Rx, 16K for Tx */ - break; - case e1000_82573: /* 82573: Total Packet Buffer is 32K */ - pba = E1000_PBA_12K; /* 12K for Rx, 20K for Tx */ - break; - case e1000_82574: - case e1000_82583: - pba = E1000_PBA_20K; /* 20K for Rx, 20K for Tx */ - break; - case e1000_ich8lan: - pba = E1000_PBA_8K; - break; - case e1000_ich9lan: - case e1000_ich10lan: - pba = E1000_PBA_10K; - break; - case e1000_pchlan: - case e1000_pch2lan: - pba = E1000_PBA_26K; - break; - default: - if (adapter->max_frame_size > 8192) - pba = E1000_PBA_40K; /* 40K for Rx, 24K for Tx */ - else - pba = E1000_PBA_48K; /* 48K for Rx, 16K for Tx */ - } - - INIT_DEBUGOUT1("em_init: pba=%dK",pba); - E1000_WRITE_REG(&adapter->hw, E1000_PBA, pba); - /* Get the latest mac address, User can use a LAA */ bcopy(IF_LLADDR(adapter->ifp), adapter->hw.mac.addr, ETHER_ADDR_LEN); @@ -1373,6 +1335,7 @@ em_init_locked(struct adapter *adapter) /* Don't lose promiscuous settings */ em_set_promisc(adapter); + /* Set the interface as ACTIVE */ ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -1403,9 +1366,6 @@ em_init_locked(struct adapter *adapter) /* AMT based hardware can now take control from firmware */ if (adapter->has_manage && adapter->has_amt) em_get_hw_control(adapter); - - /* Don't reset the phy next time init gets called */ - adapter->hw.phy.reset_disable = TRUE; } static void @@ -1995,6 +1955,14 @@ retry: em_transmit_checksum_setup(txr, m_head, ip_off, ip, &txd_upper, &txd_lower); + if (m_head->m_flags & M_VLANTAG) { + /* Set the vlan id. */ + txd_upper |= + (htole16(m_head->m_pkthdr.ether_vtag) << 16); + /* Tell hardware to add tag */ + txd_lower |= htole32(E1000_TXD_CMD_VLE); + } + i = txr->next_avail_desc; /* Set up our transmit descriptors */ @@ -2052,15 +2020,13 @@ retry: if (tso_desc) /* TSO used an extra for sentinel */ txr->tx_avail -= txd_used; - if (m_head->m_flags & M_VLANTAG) { - /* Set the vlan id. */ - ctxd->upper.fields.special = - htole16(m_head->m_pkthdr.ether_vtag); - /* Tell hardware to add tag */ - ctxd->lower.data |= htole32(E1000_TXD_CMD_VLE); - } - tx_buffer->m_head = m_head; + /* + ** Here we swap the map so the last descriptor, + ** which gets the completion interrupt has the + ** real map, and the first descriptor gets the + ** unused map from this descriptor. + */ tx_buffer_mapped->map = tx_buffer->map; tx_buffer->map = map; bus_dmamap_sync(txr->txtag, map, BUS_DMASYNC_PREWRITE); @@ -2230,22 +2196,21 @@ em_local_timer(void *arg) else trigger = E1000_ICS_RXDMT0; - /* - ** Don't do TX watchdog check if we've been paused - */ - if (adapter->pause_frames) { - adapter->pause_frames = 0; - goto out; - } /* ** Check on the state of the TX queue(s), this ** can be done without the lock because its RO ** and the HUNG state will be static if set. */ - for (int i = 0; i < adapter->num_queues; i++, txr++) - if (txr->queue_status == EM_QUEUE_HUNG) + for (int i = 0; i < adapter->num_queues; i++, txr++) { + if ((txr->queue_status == EM_QUEUE_HUNG) && + (adapter->pause_frames == 0)) goto hung; -out: + /* Schedule a TX tasklet if needed */ + if (txr->tx_avail <= EM_MAX_SCATTER) + taskqueue_enqueue(txr->tq, &txr->tx_task); + } + + adapter->pause_frames = 0; callout_reset(&adapter->timer, hz, em_local_timer, adapter); #ifndef DEVICE_POLLING /* Trigger an RX interrupt to guarantee mbuf refresh */ @@ -2264,6 +2229,7 @@ hung: txr->me, txr->tx_avail, txr->next_to_clean); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; adapter->watchdog_events++; + adapter->pause_frames = 0; em_init_locked(adapter); } @@ -2362,7 +2328,8 @@ em_stop(void *arg) callout_stop(&adapter->timer); /* Tell the stack that the interface is no longer active */ - ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; /* Unarm watchdog timer. */ for (int i = 0; i < adapter->num_queues; i++, txr++) { @@ -2458,6 +2425,7 @@ int em_allocate_legacy(struct adapter *adapter) { device_t dev = adapter->dev; + struct tx_ring *txr = adapter->tx_rings; int error, rid = 0; /* Manually turn off all interrupts */ @@ -2479,11 +2447,17 @@ em_allocate_legacy(struct adapter *adapt * deferred processing contexts. */ TASK_INIT(&adapter->que_task, 0, em_handle_que, adapter); - TASK_INIT(&adapter->link_task, 0, em_handle_link, adapter); adapter->tq = taskqueue_create_fast("em_taskq", M_NOWAIT, taskqueue_thread_enqueue, &adapter->tq); - taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s taskq", + taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s que", + device_get_nameunit(adapter->dev)); + /* Use a TX only tasklet for local timer */ + TASK_INIT(&txr->tx_task, 0, em_handle_tx, txr); + txr->tq = taskqueue_create_fast("em_txq", M_NOWAIT, + taskqueue_thread_enqueue, &txr->tq); + taskqueue_start_threads(&txr->tq, 1, PI_NET, "%s txq", device_get_nameunit(adapter->dev)); + TASK_INIT(&adapter->link_task, 0, em_handle_link, adapter); if ((error = bus_setup_intr(dev, adapter->res, INTR_TYPE_NET, em_irq_fast, NULL, adapter, &adapter->tag)) != 0) { device_printf(dev, "Failed to register fast interrupt " @@ -2500,7 +2474,8 @@ em_allocate_legacy(struct adapter *adapt * * Setup the MSIX Interrupt handlers * This is not really Multiqueue, rather - * its just multiple interrupt vectors. + * its just seperate interrupt vectors + * for TX, RX, and Link. * **********************************************************************/ int @@ -2692,7 +2667,6 @@ em_setup_msix(struct adapter *adapter) device_t dev = adapter->dev; int val = 0; - /* ** Setup MSI/X for Hartwell: tests have shown ** use of two queues to be unstable, and to @@ -2712,16 +2686,18 @@ em_setup_msix(struct adapter *adapter) goto msi; } val = pci_msix_count(dev); - if (val < 3) { + /* We only need 3 vectors */ + if (val > 3) + val = 3; + if ((val != 3) && (val != 5)) { bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(EM_MSIX_BAR), adapter->msix_mem); adapter->msix_mem = NULL; device_printf(adapter->dev, - "MSIX: insufficient vectors, using MSI\n"); + "MSIX: incorrect vectors, using MSI\n"); goto msi; } - val = 3; - adapter->num_queues = 1; + if (pci_alloc_msix(dev, &val) == 0) { device_printf(adapter->dev, "Using MSIX interrupts " @@ -2756,6 +2732,7 @@ em_reset(struct adapter *adapter) struct ifnet *ifp = adapter->ifp; struct e1000_hw *hw = &adapter->hw; u16 rx_buffer_size; + u32 pba; INIT_DEBUGOUT("em_reset: begin"); @@ -2771,6 +2748,48 @@ em_reset(struct adapter *adapter) } /* + * Packet Buffer Allocation (PBA) + * Writing PBA sets the receive portion of the buffer + * the remainder is used for the transmit buffer. + */ + switch (hw->mac.type) { + /* Total Packet Buffer on these is 48K */ + case e1000_82571: + case e1000_82572: + case e1000_80003es2lan: + pba = E1000_PBA_32K; /* 32K for Rx, 16K for Tx */ + break; + case e1000_82573: /* 82573: Total Packet Buffer is 32K */ + pba = E1000_PBA_12K; /* 12K for Rx, 20K for Tx */ + break; + case e1000_82574: + case e1000_82583: + pba = E1000_PBA_20K; /* 20K for Rx, 20K for Tx */ + break; + case e1000_ich8lan: + pba = E1000_PBA_8K; + break; + case e1000_ich9lan: + case e1000_ich10lan: + /* Boost Receive side for jumbo frames */ + if (adapter->max_frame_size > 4096) + pba = E1000_PBA_14K; + else + pba = E1000_PBA_10K; + break; + case e1000_pchlan: + case e1000_pch2lan: + pba = E1000_PBA_26K; + break; + default: + if (adapter->max_frame_size > 8192) + pba = E1000_PBA_40K; /* 40K for Rx, 24K for Tx */ + else + pba = E1000_PBA_48K; /* 48K for Rx, 16K for Tx */ + } + E1000_WRITE_REG(&adapter->hw, E1000_PBA, pba); + + /* * These parameters control the automatic generation (Tx) and * response (Rx) to Ethernet PAUSE frames. * - High water mark should allow for at least two frames to be @@ -2785,11 +2804,15 @@ em_reset(struct adapter *adapter) * - The pause time is fairly large at 1000 x 512ns = 512 usec. */ rx_buffer_size = ((E1000_READ_REG(hw, E1000_PBA) & 0xffff) << 10 ); - hw->fc.high_water = rx_buffer_size - roundup2(adapter->max_frame_size, 1024); hw->fc.low_water = hw->fc.high_water - 1500; + if (adapter->fc) /* locally set flow control value? */ + hw->fc.requested_mode = adapter->fc; + else + hw->fc.requested_mode = e1000_fc_full; + if (hw->mac.type == e1000_80003es2lan) hw->fc.pause_time = 0xFFFF; else @@ -2797,15 +2820,22 @@ em_reset(struct adapter *adapter) hw->fc.send_xon = TRUE; - /* Set Flow control, use the tunable location if sane */ - hw->fc.requested_mode = adapter->fc_setting; - - /* Workaround: no TX flow ctrl for PCH */ - if (hw->mac.type == e1000_pchlan) + /* Device specific overrides/settings */ + switch (hw->mac.type) { + case e1000_pchlan: + /* Workaround: no TX flow ctrl for PCH */ hw->fc.requested_mode = e1000_fc_rx_pause; - - /* Override - settings for PCH2LAN, ya its magic :) */ - if (hw->mac.type == e1000_pch2lan) { + hw->fc.pause_time = 0xFFFF; /* override */ + if (ifp->if_mtu > ETHERMTU) { + hw->fc.high_water = 0x3500; + hw->fc.low_water = 0x1500; + } else { + hw->fc.high_water = 0x5000; + hw->fc.low_water = 0x3000; + } + hw->fc.refresh_time = 0x1000; + break; + case e1000_pch2lan: hw->fc.high_water = 0x5C20; hw->fc.low_water = 0x5048; hw->fc.pause_time = 0x0650; @@ -2815,13 +2845,26 @@ em_reset(struct adapter *adapter) E1000_WRITE_REG(hw, E1000_PBA, 12); else E1000_WRITE_REG(hw, E1000_PBA, 26); + break; + case e1000_ich9lan: + case e1000_ich10lan: + if (ifp->if_mtu > ETHERMTU) { + hw->fc.high_water = 0x2800; + hw->fc.low_water = hw->fc.high_water - 8; + break; + } + /* else fall thru */ + default: + if (hw->mac.type == e1000_80003es2lan) + hw->fc.pause_time = 0xFFFF; + break; } /* Issue a global reset */ e1000_reset_hw(hw); E1000_WRITE_REG(hw, E1000_WUC, 0); em_disable_aspm(adapter); - + /* and a re-init */ if (e1000_init_hw(hw) < 0) { device_printf(dev, "Hardware Initialization Failed\n"); return; @@ -2866,28 +2909,25 @@ em_setup_interface(device_t dev, struct ifp->if_capabilities = ifp->if_capenable = 0; #ifdef EM_MULTIQUEUE - /* Multiqueue tx functions */ + /* Multiqueue stack interface */ ifp->if_transmit = em_mq_start; ifp->if_qflush = em_qflush; #endif ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; - ifp->if_capenable |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; - - /* Enable TSO by default, can disable with ifconfig */ ifp->if_capabilities |= IFCAP_TSO4; - ifp->if_capenable |= IFCAP_TSO4; - /* * Tell the upper layer(s) we * support full VLAN capability */ ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); - ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; - ifp->if_capenable |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; + ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING + | IFCAP_VLAN_HWTSO + | IFCAP_VLAN_MTU; + ifp->if_capenable = ifp->if_capabilities; /* - ** Dont turn this on by default, if vlans are + ** Don't turn this on by default, if vlans are ** created on another pseudo device (eg. lagg) ** then vlan events are not passed thru, breaking ** operation, but with HW FILTER off it works. If @@ -3339,11 +3379,6 @@ em_initialize_transmit_unit(struct adapt /* Set the default values for the Tx Inter Packet Gap timer */ switch (adapter->hw.mac.type) { - case e1000_82542: - tipg = DEFAULT_82542_TIPG_IPGT; - tipg |= DEFAULT_82542_TIPG_IPGR1 << E1000_TIPG_IPGR1_SHIFT; - tipg |= DEFAULT_82542_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; - break; case e1000_80003es2lan: tipg = DEFAULT_82543_TIPG_IPGR1; tipg |= DEFAULT_80003ES2LAN_TIPG_IPGR2 << @@ -3813,9 +3848,12 @@ em_txeof(struct tx_ring *txr) /* * If we have a minimum free, clear IFF_DRV_OACTIVE * to tell the stack that it is OK to send packets. + * Notice that all writes of OACTIVE happen under the + * TX lock which, with a single queue, guarantees + * sanity. */ - if (txr->tx_avail > EM_MAX_SCATTER) - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + if (txr->tx_avail >= EM_MAX_SCATTER) + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; /* Disable watchdog if all clean */ if (txr->tx_avail == adapter->num_tx_desc) { @@ -3978,26 +4016,31 @@ em_setup_receive_ring(struct rx_ring *rx struct adapter *adapter = rxr->adapter; struct em_buffer *rxbuf; bus_dma_segment_t seg[1]; - int i, j, nsegs, error = 0; + int rsize, nsegs, error; /* Clear the ring contents */ EM_RX_LOCK(rxr); + rsize = roundup2(adapter->num_rx_desc * + sizeof(struct e1000_rx_desc), EM_DBA_ALIGN); + bzero((void *)rxr->rx_base, rsize); - /* Invalidate all descriptors */ - for (i = 0; i < adapter->num_rx_desc; i++) { - struct e1000_rx_desc* cur; - cur = &rxr->rx_base[i]; - cur->status = 0; + /* + ** Free current RX buffer structs and their mbufs + */ + for (int i = 0; i < adapter->num_rx_desc; i++) { + rxbuf = &rxr->rx_buffers[i]; + if (rxbuf->m_head != NULL) { + bus_dmamap_sync(rxr->rxtag, rxbuf->map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(rxr->rxtag, rxbuf->map); + m_freem(rxbuf->m_head); + } } /* Now replenish the mbufs */ - i = j = rxr->next_to_refresh; - if (++j == adapter->num_rx_desc) - j = 0; - - while (j != rxr->next_to_check) { - rxbuf = &rxr->rx_buffers[i]; + for (int j = 0; j != adapter->num_rx_desc; ++j) { + rxbuf = &rxr->rx_buffers[j]; rxbuf->m_head = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, adapter->rx_mbuf_sz); if (rxbuf->m_head == NULL) { @@ -4021,11 +4064,13 @@ em_setup_receive_ring(struct rx_ring *rx rxbuf->map, BUS_DMASYNC_PREREAD); /* Update descriptor */ - rxr->rx_base[i].buffer_addr = htole64(seg[0].ds_addr); - i = j; - if (++j == adapter->num_rx_desc) - j = 0; + rxr->rx_base[j].buffer_addr = htole64(seg[0].ds_addr); } + rxr->next_to_check = 0; + rxr->next_to_refresh = 0; + bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + #ifdef DEV_NETMAP { /* @@ -4079,9 +4124,6 @@ em_setup_receive_ring(struct rx_ring *rx #endif /* DEV_NETMAP */ fail: - rxr->next_to_refresh = i; - bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); EM_RX_UNLOCK(rxr); return (error); } @@ -4108,10 +4150,9 @@ fail: * the rings that completed, the failing case will have * cleaned up for itself. 'q' failed, so its the terminus. */ - for (int i = 0, n = 0; i < q; ++i) { + for (int i = 0; i < q; ++i) { rxr = &adapter->rx_rings[i]; - n = rxr->next_to_check; - while(n != rxr->next_to_refresh) { + for (int n = 0; n < adapter->num_rx_desc; n++) { struct em_buffer *rxbuf; rxbuf = &rxr->rx_buffers[n]; if (rxbuf->m_head != NULL) { @@ -4121,8 +4162,6 @@ fail: m_freem(rxbuf->m_head); rxbuf->m_head = NULL; } - if (++n == adapter->num_rx_desc) - n = 0; } rxr->next_to_check = 0; rxr->next_to_refresh = 0; @@ -4166,8 +4205,7 @@ em_free_receive_buffers(struct rx_ring * INIT_DEBUGOUT("free_receive_buffers: begin"); if (rxr->rx_buffers != NULL) { - int i = rxr->next_to_check; - while(i != rxr->next_to_refresh) { + for (int i = 0; i < adapter->num_rx_desc; i++) { rxbuf = &rxr->rx_buffers[i]; if (rxbuf->map != NULL) { bus_dmamap_sync(rxr->rxtag, rxbuf->map, @@ -4179,8 +4217,6 @@ em_free_receive_buffers(struct rx_ring * m_freem(rxbuf->m_head); rxbuf->m_head = NULL; } - if (++i == adapter->num_rx_desc) - i = 0; } free(rxr->rx_buffers, M_DEVBUF); rxr->rx_buffers = NULL; @@ -4221,7 +4257,9 @@ em_initialize_receive_unit(struct adapte * up the descriptor ring */ rctl = E1000_READ_REG(hw, E1000_RCTL); - E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); + /* Do not disable if ever enabled on this hardware */ + if ((hw->mac.type != e1000_82574) && (hw->mac.type != e1000_82583)) + E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN); E1000_WRITE_REG(&adapter->hw, E1000_RADV, adapter->rx_abs_int_delay.value); @@ -4235,14 +4273,13 @@ em_initialize_receive_unit(struct adapte ** When using MSIX interrupts we need to throttle ** using the EITR register (82574 only) */ - if (hw->mac.type == e1000_82574) + if (hw->mac.type == e1000_82574) { for (int i = 0; i < 4; i++) E1000_WRITE_REG(hw, E1000_EITR_82574(i), DEFAULT_ITR); - - /* Disable accelerated ackknowledge */ - if (adapter->hw.mac.type == e1000_82574) + /* Disable accelerated acknowledge */ E1000_WRITE_REG(hw, E1000_RFCTL, E1000_RFCTL_ACK_DIS); + } if (ifp->if_capenable & IFCAP_RXCSUM) { rxcsum = E1000_READ_REG(hw, E1000_RXCSUM); @@ -4268,7 +4305,8 @@ em_initialize_receive_unit(struct adapte E1000_WRITE_REG(hw, E1000_RDBAH(i), (u32)(bus_addr >> 32)); E1000_WRITE_REG(hw, E1000_RDBAL(i), (u32)bus_addr); /* Setup the Head and Tail Descriptor Pointers */ - E1000_WRITE_REG(hw, E1000_RDH(i), rxr->next_to_check); + E1000_WRITE_REG(hw, E1000_RDH(i), 0); + E1000_WRITE_REG(hw, E1000_RDT(i), adapter->num_rx_desc - 1); #ifdef DEV_NETMAP /* * an init() while a netmap client is active must @@ -4286,17 +4324,16 @@ em_initialize_receive_unit(struct adapte E1000_WRITE_REG(hw, E1000_RDT(i), t); } else #endif /* DEV_NETMAP */ - E1000_WRITE_REG(hw, E1000_RDT(i), rxr->next_to_refresh); + E1000_WRITE_REG(hw, E1000_RDT(i), adapter->num_rx_desc - 1); } - /* Set early receive threshold on appropriate hw */ + /* Set PTHRESH for improved jumbo performance */ if (((adapter->hw.mac.type == e1000_ich9lan) || (adapter->hw.mac.type == e1000_pch2lan) || (adapter->hw.mac.type == e1000_ich10lan)) && (ifp->if_mtu > ETHERMTU)) { u32 rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(0)); E1000_WRITE_REG(hw, E1000_RXDCTL(0), rxdctl | 3); - E1000_WRITE_REG(hw, E1000_ERT, 0x100 | (1 << 13)); } if (adapter->hw.mac.type == e1000_pch2lan) { @@ -4443,10 +4480,6 @@ em_rxeof(struct rx_ring *rxr, int count, E1000_RXD_SPC_VLAN_MASK); sendmp->m_flags |= M_VLANTAG; } -#ifdef EM_MULTIQUEUE - sendmp->m_pkthdr.flowid = rxr->msix; - sendmp->m_flags |= M_FLOWID; -#endif #ifndef __NO_STRICT_ALIGNMENT skip: #endif @@ -4921,7 +4954,7 @@ em_enable_wakeup(device_t dev) (adapter->hw.mac.type == e1000_pchlan) || (adapter->hw.mac.type == e1000_ich9lan) || (adapter->hw.mac.type == e1000_ich10lan)) - e1000_disable_gig_wol_ich8lan(&adapter->hw); + e1000_suspend_workarounds_ich8lan(&adapter->hw); /* Keep the laser running on Fiber adapters */ if (adapter->hw.phy.media_type == e1000_media_type_fiber || @@ -5518,7 +5551,7 @@ em_add_hw_stats(struct adapter *adapter) static int em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS) { - struct adapter *adapter; + struct adapter *adapter = (struct adapter *)arg1; int error; int result; @@ -5533,10 +5566,8 @@ em_sysctl_nvm_info(SYSCTL_HANDLER_ARGS) * first 32 16-bit words of the EEPROM to * the screen. */ - if (result == 1) { - adapter = (struct adapter *)arg1; + if (result == 1) em_print_nvm_info(adapter); - } return (error); } @@ -5626,6 +5657,49 @@ em_set_sysctl_value(struct adapter *adap OID_AUTO, name, CTLTYPE_INT|CTLFLAG_RW, limit, value, description); } + +/* +** Set flow control using sysctl: +** Flow control values: +** 0 - off +** 1 - rx pause +** 2 - tx pause +** 3 - full +*/ +static int +em_set_flowcntl(SYSCTL_HANDLER_ARGS) +{ + int error; + static int input = 3; /* default is full */ + struct adapter *adapter = (struct adapter *) arg1; + + error = sysctl_handle_int(oidp, &input, 0, req); + + if ((error) || (req->newptr == NULL)) + return (error); + + if (input == adapter->fc) /* no change? */ + return (error); + + switch (input) { + case e1000_fc_rx_pause: + case e1000_fc_tx_pause: + case e1000_fc_full: + case e1000_fc_none: + adapter->hw.fc.requested_mode = input; + adapter->fc = input; + break; + default: + /* Do nothing */ + return (error); + } + + adapter->hw.fc.current_mode = adapter->hw.fc.requested_mode; + e1000_force_mac_fc(&adapter->hw); + return (error); +} + + static int em_sysctl_debug_info(SYSCTL_HANDLER_ARGS) { @@ -5662,10 +5736,11 @@ em_print_debug_info(struct adapter *adap printf("Interface is RUNNING "); else printf("Interface is NOT RUNNING\n"); + if (adapter->ifp->if_drv_flags & IFF_DRV_OACTIVE) - printf("and ACTIVE\n"); - else printf("and INACTIVE\n"); + else + printf("and ACTIVE\n"); device_printf(dev, "hw tdh = %d, hw tdt = %d\n", E1000_READ_REG(&adapter->hw, E1000_TDH(0)), Modified: head/sys/dev/e1000/if_em.h ============================================================================== --- head/sys/dev/e1000/if_em.h Sat Dec 10 06:55:02 2011 (r228386) +++ head/sys/dev/e1000/if_em.h Sat Dec 10 07:08:52 2011 (r228387) @@ -212,7 +212,8 @@ #define EM_BAR_MEM_TYPE_64BIT 0x00000004 #define EM_MSIX_BAR 3 /* On 82575 */ -#if !defined(SYSCTL_ADD_UQUAD) +/* More backward compatibility */ +#if __FreeBSD_version < 900000 #define SYSCTL_ADD_UQUAD SYSCTL_ADD_QUAD #endif @@ -418,11 +419,11 @@ struct adapter { u32 shadow_vfta[EM_VFTA_SIZE]; /* Info about the interface */ - u8 link_active; + u16 link_active; + u16 fc; u16 link_speed; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@FreeBSD.ORG Sat Dec 10 08:26:53 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B71FD1065670; Sat, 10 Dec 2011 08:26:53 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 56CFF8FC12; Sat, 10 Dec 2011 08:26:51 +0000 (UTC) Received: by bkbzv15 with SMTP id zv15so4853973bkb.13 for ; Sat, 10 Dec 2011 00:26:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:x-comment-to:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=FVK8bYJ3T/B+hQEEn884hd+VdpkZXGYc7OB7/P8QSJo=; b=NqVBdssWUR4UNBW5pzEy6EjYdPDin53nUOacFe2NzjOIUNvsVIedZKpflwed6PrVyw BgKdf9b4VA/cNoxELT9/tKOCm/u/dj4Y8qJa+sDNzoYB8ZJqHnmD+hkYHX+483Si/EEy ZUnWGEO5vu8H5aUoWRiuM28JEIwcjT5DkvEmI= Received: by 10.205.81.141 with SMTP id zy13mr5534365bkb.50.1323505611159; Sat, 10 Dec 2011 00:26:51 -0800 (PST) Received: from localhost ([95.69.173.122]) by mx.google.com with ESMTPS id d2sm15586371bky.11.2011.12.10.00.26.47 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 10 Dec 2011 00:26:49 -0800 (PST) From: Mikolaj Golub To: John Baldwin References: <201111242054.pAOKs6vj012296@svn.freebsd.org> <201111281330.11720.jhb@freebsd.org> <86liqt1ier.fsf@kopusha.home.net> <4EE1024C.6040800@FreeBSD.org> <86k466aip3.fsf@kopusha.home.net> <4EE12CE0.5070803@FreeBSD.org> X-Comment-To: John Baldwin Sender: Mikolaj Golub Date: Sat, 10 Dec 2011 10:26:46 +0200 In-Reply-To: <4EE12CE0.5070803@FreeBSD.org> (John Baldwin's message of "Thu, 08 Dec 2011 16:32:16 -0500") Message-ID: <86y5ukvnll.fsf@kopusha.home.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Cc: svn-src-head@freebsd.org, Robert Watson , svn-src-all@freebsd.org, src-committers@freebsd.org, Kostik Belousov Subject: Re: svn commit: r227956 - head/usr.bin/procstat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 08:26:53 -0000 --=-=-= On Thu, 08 Dec 2011 16:32:16 -0500 John Baldwin wrote: >> JB> Hmm, I would stick as close to limits output as possible. I would >> JB> consider duplicating the unit field in each of soft and hard, so you >> JB> end up with something like this: >> >> JB> PID COMM RLIMIT SOFT HARD >> JB> 48798 zsh cputime 100000 secs infinity secs >> JB> 48798 zsh filesize infinity kb infinity kb >> JB> 48798 zsh datasize 524288 kb 524288 kb >> >> JB> etc. >> >> Ok. >> >> JB> (Things like 'openfiles' is simply more intuitive than 'nofile' (no >> JB> file?, huh? oh, num open files.. (except not all users will make the >> JB> last step there). >> >> Then why do we have so non-intuitive rlimit_ident names? >> >> It looks like they are used only in procfs_rlimit.c. Do procfs(5) users always >> make that last step with 'nofile'? :-) JB> Well, I suspect it's best not to change the names in procfs in case JB> there are existing binaries that parse the output of that file JB> (unfortunately). >> Is it possible to change rlimit_ident names? Just to ones that are used by >> limit(1) or (if they look too long) to something like below: JB> Hmm, I have no idea what other things might use rlimit_ident. Probably JB> not many. (Also, for fun, note that the 'ulimit' and 'limit' built-in JB> commands in sh and csh also have their own sets of names, fun!) I would JB> maybe add a rlimit_names[] (just leave rlimit_ident alone), and give JB> that the names from limits(1), and change both procstat and sh's JB> ulimit' command to use those. Adding yet another rlimit names to the header file does not look so attractive for me as it was just using/reusing what we had :-). So I decided to hardcode the names in procstat_rlimit.c (see the attached patch). Output example: PID COMM RLIMIT SOFT HARD 11949 zsh cputime 10000 sec infinity 11949 zsh filesize infinity infinity 11949 zsh datasize 524288 kB 524288 kB 11949 zsh stacksize 65536 kB 65536 kB 11949 zsh coredumpsize 190734 MB 190734 MB 11949 zsh memoryuse infinity infinity 11949 zsh memorylocked infinity infinity 11949 zsh maxprocesses 5547 5547 11949 zsh openfiles 11095 11095 11949 zsh sbsize infinity infinity 11949 zsh vmemoryuse infinity infinity 11949 zsh pseudo-terminals infinity infinity 11949 zsh swapuse infinity infinity -- Mikolaj Golub --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=procstat_rlimit.c.patch Index: usr.bin/procstat/procstat_rlimit.c =================================================================== --- usr.bin/procstat/procstat_rlimit.c (revision 228285) +++ usr.bin/procstat/procstat_rlimit.c (working copy) @@ -28,7 +28,6 @@ #include #include -#define _RLIMIT_IDENT #include #include #include @@ -36,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -43,17 +43,60 @@ #include "procstat.h" +static struct { + const char *name; + const char *suffix; +} rlimit_param[13] = { + {"cputime", "sec"}, + {"filesize", "B "}, + {"datasize", "B "}, + {"stacksize", "B "}, + {"coredumpsize", "B "}, + {"memoryuse", "B "}, + {"memorylocked", "B "}, + {"maxprocesses", " "}, + {"openfiles", " "}, + {"sbsize", "B "}, + {"vmemoryuse", "B "}, + {"pseudo-terminals", " "}, + {"swapuse", "B "}, +}; + +#if RLIM_NLIMITS > 13 +#error "Resource limits have grown. Add new entries to rlimit_param[]." +#endif + static struct rlimit rlimit[RLIM_NLIMITS]; +static +const char *humanize_rlimit(int indx, rlim_t limit) +{ + static char buf[14]; + int scale; + + if (limit == RLIM_INFINITY) + return "infinity "; + + scale = humanize_number(buf, sizeof(buf) - 1, (int64_t)limit, + rlimit_param[indx].suffix, HN_AUTOSCALE | HN_GETSCALE, HN_DECIMAL); + (void)humanize_number(buf, sizeof(buf) - 1, (int64_t)limit, + rlimit_param[indx].suffix, HN_AUTOSCALE, HN_DECIMAL); + /* Pad with one space if there is no suffix prefix. */ + if (scale == 0) + sprintf(buf + strlen(buf), " "); + return (buf); +} + void procstat_rlimit(struct kinfo_proc *kipp) { int error, i, name[4]; size_t len; - if (!hflag) - printf("%5s %-16s %-10s %12s %12s\n", "PID", "COMM", "RLIMIT", - "CURRENT", "MAX"); + if (!hflag) { + printf("%5s %-16s %-16s %16s %16s\n", + "PID", "COMM", "RLIMIT", "SOFT ", "HARD "); + } name[0] = CTL_KERN; name[1] = KERN_PROC; name[2] = KERN_PROC_RLIMIT; @@ -68,11 +111,9 @@ procstat_rlimit(struct kinfo_proc *kipp) return; for (i = 0; i < RLIM_NLIMITS; i++) { - printf("%5d %-16s %-10s %12jd %12jd\n", kipp->ki_pid, - kipp->ki_comm, rlimit_ident[i], - rlimit[i].rlim_cur == RLIM_INFINITY ? - -1 : rlimit[i].rlim_cur, - rlimit[i].rlim_max == RLIM_INFINITY ? - -1 : rlimit[i].rlim_max); + printf("%5d %-16s %-16s ", kipp->ki_pid, kipp->ki_comm, + rlimit_param[i].name); + printf("%16s ", humanize_rlimit(i, rlimit[i].rlim_cur)); + printf("%16s\n", humanize_rlimit(i, rlimit[i].rlim_max)); } } --=-=-=-- From owner-svn-src-all@FreeBSD.ORG Sat Dec 10 10:52:54 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B7D7D106564A; Sat, 10 Dec 2011 10:52:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A79AD8FC0A; Sat, 10 Dec 2011 10:52:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAAqsUO092533; Sat, 10 Dec 2011 10:52:54 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAAqsoV092530; Sat, 10 Dec 2011 10:52:54 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201112101052.pBAAqsoV092530@svn.freebsd.org> From: Michael Tuexen Date: Sat, 10 Dec 2011 10:52:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228391 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 10:52:54 -0000 Author: tuexen Date: Sat Dec 10 10:52:54 2011 New Revision: 228391 URL: http://svn.freebsd.org/changeset/base/228391 Log: Fix a bug reported by Irene Ruengeler which resulted in not sending out HEARTBEATs when requested by the user. The HEARTBEATs were only queued, but not actually sent out. MFC after: 2 months. Modified: head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_constants.h ============================================================================== --- head/sys/netinet/sctp_constants.h Sat Dec 10 09:34:39 2011 (r228390) +++ head/sys/netinet/sctp_constants.h Sat Dec 10 10:52:54 2011 (r228391) @@ -391,6 +391,8 @@ __FBSDID("$FreeBSD$"); #define SCTP_OUTPUT_FROM_COOKIE_ACK 14 #define SCTP_OUTPUT_FROM_DRAIN 15 #define SCTP_OUTPUT_FROM_CLOSING 16 +#define SCTP_OUTPUT_FROM_SOCKOPT 17 + /* SCTP chunk types are moved sctp.h for application (NAT, FW) use */ /* align to 32-bit sizes */ Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sat Dec 10 09:34:39 2011 (r228390) +++ head/sys/netinet/sctp_usrreq.c Sat Dec 10 10:52:54 2011 (r228391) @@ -4727,6 +4727,7 @@ sctp_setopt(struct socket *so, int optna if (paddrp->spp_flags & SPP_HB_DEMAND) { /* on demand HB */ sctp_send_hb(stcb, net, SCTP_SO_LOCKED); + sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED); sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net); } if ((paddrp->spp_flags & SPP_PMTUD_DISABLE) && (paddrp->spp_pathmtu >= SCTP_SMALLEST_PMTU)) { From owner-svn-src-all@FreeBSD.ORG Sat Dec 10 13:02:53 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E7D6106564A; Sat, 10 Dec 2011 13:02:53 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DE848FC08; Sat, 10 Dec 2011 13:02:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAD2rEH006200; Sat, 10 Dec 2011 13:02:53 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAD2r5n006197; Sat, 10 Dec 2011 13:02:53 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201112101302.pBAD2r5n006197@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Sat, 10 Dec 2011 13:02:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228392 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 13:02:53 -0000 Author: pjd Date: Sat Dec 10 13:02:52 2011 New Revision: 228392 URL: http://svn.freebsd.org/changeset/base/228392 Log: Move ru_inblock increment into arc_read_nolock() so we don't account for cached reads. Discussed with: gibbs No objections from: avg Tested by: Marcus Reid MFC after: 1 week Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Dec 10 10:52:54 2011 (r228391) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Sat Dec 10 13:02:52 2011 (r228392) @@ -3105,6 +3105,9 @@ top: ARCSTAT_CONDSTAT(!(hdr->b_flags & ARC_PREFETCH), demand, prefetch, hdr->b_type != ARC_BUFC_METADATA, data, metadata, misses); +#ifdef _KERNEL + curthread->td_ru.ru_inblock++; +#endif if (vd != NULL && l2arc_ndev != 0 && !(l2arc_norw && devw)) { /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Dec 10 10:52:54 2011 (r228391) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c Sat Dec 10 13:02:52 2011 (r228392) @@ -627,10 +627,6 @@ dbuf_read(dmu_buf_impl_t *db, zio_t *zio } else if (db->db_state == DB_UNCACHED) { spa_t *spa = dn->dn_objset->os_spa; -#ifdef _KERNEL - curthread->td_ru.ru_inblock++; -#endif - if (zio == NULL) zio = zio_root(spa, NULL, NULL, ZIO_FLAG_CANFAIL); dbuf_read_impl(db, zio, &flags); From owner-svn-src-all@FreeBSD.ORG Sat Dec 10 18:00:53 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A3BE106566B; Sat, 10 Dec 2011 18:00:53 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A7078FC16; Sat, 10 Dec 2011 18:00:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAI0r6Z016110; Sat, 10 Dec 2011 18:00:53 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAI0rMI016108; Sat, 10 Dec 2011 18:00:53 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <201112101800.pBAI0rMI016108@svn.freebsd.org> From: Jack F Vogel Date: Sat, 10 Dec 2011 18:00:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228393 - head/sys/dev/e1000 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 18:00:53 -0000 Author: jfv Date: Sat Dec 10 18:00:53 2011 New Revision: 228393 URL: http://svn.freebsd.org/changeset/base/228393 Log: Fix NETMAP code problem in the build. Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Sat Dec 10 13:02:52 2011 (r228392) +++ head/sys/dev/e1000/if_em.c Sat Dec 10 18:00:53 2011 (r228393) @@ -4100,7 +4100,7 @@ em_setup_receive_ring(struct rx_ring *rx if (sj < 0) sj += adapter->num_rx_desc; - for (j = 0; j != adapter->num_rx_desc; j++, sj++) { + for (int j = 0; j != adapter->num_rx_desc; j++, sj++) { void *addr; int sz; From owner-svn-src-all@FreeBSD.ORG Sat Dec 10 18:11:06 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8D1271065672; Sat, 10 Dec 2011 18:11:06 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7C9388FC08; Sat, 10 Dec 2011 18:11:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAIB6e5016476; Sat, 10 Dec 2011 18:11:06 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAIB6fb016472; Sat, 10 Dec 2011 18:11:06 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112101811.pBAIB6fb016472@svn.freebsd.org> From: Ed Schouten Date: Sat, 10 Dec 2011 18:11:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228394 - in head: usr.bin/find usr.bin/lex usr.sbin/mount_portalfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 18:11:06 -0000 Author: ed Date: Sat Dec 10 18:11:06 2011 New Revision: 228394 URL: http://svn.freebsd.org/changeset/base/228394 Log: Replace char copyright[] by static const char copyright[]. It seems the latter is used throughout the tree. Modified: head/usr.bin/find/main.c head/usr.bin/lex/main.c head/usr.sbin/mount_portalfs/mount_portalfs.c Modified: head/usr.bin/find/main.c ============================================================================== --- head/usr.bin/find/main.c Sat Dec 10 18:00:53 2011 (r228393) +++ head/usr.bin/find/main.c Sat Dec 10 18:11:06 2011 (r228394) @@ -31,7 +31,7 @@ */ #ifndef lint -char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1990, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ Modified: head/usr.bin/lex/main.c ============================================================================== --- head/usr.bin/lex/main.c Sat Dec 10 18:00:53 2011 (r228393) +++ head/usr.bin/lex/main.c Sat Dec 10 18:11:06 2011 (r228394) @@ -27,7 +27,7 @@ */ #ifndef lint -char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1990 The Regents of the University of California.\n\ All rights reserved.\n"; #endif /* not lint */ Modified: head/usr.sbin/mount_portalfs/mount_portalfs.c ============================================================================== --- head/usr.sbin/mount_portalfs/mount_portalfs.c Sat Dec 10 18:00:53 2011 (r228393) +++ head/usr.sbin/mount_portalfs/mount_portalfs.c Sat Dec 10 18:11:06 2011 (r228394) @@ -31,7 +31,7 @@ */ #ifndef lint -char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1992, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ From owner-svn-src-all@FreeBSD.ORG Sat Dec 10 18:21:04 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1852A106566B; Sat, 10 Dec 2011 18:21:04 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 088F58FC08; Sat, 10 Dec 2011 18:21:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAIL3Qb016817; Sat, 10 Dec 2011 18:21:03 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAIL3B1016815; Sat, 10 Dec 2011 18:21:03 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112101821.pBAIL3B1016815@svn.freebsd.org> From: Ed Schouten Date: Sat, 10 Dec 2011 18:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228395 - head/usr.bin/grep X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 18:21:04 -0000 Author: ed Date: Sat Dec 10 18:21:03 2011 New Revision: 228395 URL: http://svn.freebsd.org/changeset/base/228395 Log: Add missing "static const" to long options table. This table is only used in this C file and passed to getopt_long(), so we can safely add static and const to it. Modified: head/usr.bin/grep/grep.c Modified: head/usr.bin/grep/grep.c ============================================================================== --- head/usr.bin/grep/grep.c Sat Dec 10 18:11:06 2011 (r228394) +++ head/usr.bin/grep/grep.c Sat Dec 10 18:21:03 2011 (r228395) @@ -166,7 +166,7 @@ usage(void) static const char *optstr = "0123456789A:B:C:D:EFGHIJMLOPSRUVZabcd:e:f:hilm:nopqrsuvwxXy"; -struct option long_options[] = +static const struct option long_options[] = { {"binary-files", required_argument, NULL, BIN_OPT}, {"help", no_argument, NULL, HELP_OPT}, From owner-svn-src-all@FreeBSD.ORG Sat Dec 10 18:27:56 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF0DA1065672; Sat, 10 Dec 2011 18:27:55 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D52EF8FC12; Sat, 10 Dec 2011 18:27:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAIRtMa017056; Sat, 10 Dec 2011 18:27:55 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAIRtg3017051; Sat, 10 Dec 2011 18:27:55 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112101827.pBAIRtg3017051@svn.freebsd.org> From: Ed Schouten Date: Sat, 10 Dec 2011 18:27:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228396 - head/usr.bin/truss X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 18:27:56 -0000 Author: ed Date: Sat Dec 10 18:27:55 2011 New Revision: 228396 URL: http://svn.freebsd.org/changeset/base/228396 Log: Add more static keywords to truss(1) source code. There are some tables in the source code that are only used by the individual source files themselves. Therefore there is no need to export them. Modified: head/usr.bin/truss/amd64-linux32.c head/usr.bin/truss/i386-linux.c head/usr.bin/truss/main.c head/usr.bin/truss/syscalls.c Modified: head/usr.bin/truss/amd64-linux32.c ============================================================================== --- head/usr.bin/truss/amd64-linux32.c Sat Dec 10 18:21:03 2011 (r228395) +++ head/usr.bin/truss/amd64-linux32.c Sat Dec 10 18:27:55 2011 (r228396) @@ -228,7 +228,7 @@ amd64_linux32_syscall_entry(struct truss /* * Linux syscalls return negative errno's, we do positive and map them */ -const int bsd_to_linux_errno[] = { +static const int bsd_to_linux_errno[] = { -0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -35, -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, Modified: head/usr.bin/truss/i386-linux.c ============================================================================== --- head/usr.bin/truss/i386-linux.c Sat Dec 10 18:21:03 2011 (r228395) +++ head/usr.bin/truss/i386-linux.c Sat Dec 10 18:27:55 2011 (r228396) @@ -228,7 +228,7 @@ i386_linux_syscall_entry(struct trussinf /* * Linux syscalls return negative errno's, we do positive and map them */ -const int bsd_to_linux_errno[] = { +static const int bsd_to_linux_errno[] = { -0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -35, -12, -13, -14, -15, -16, -17, -18, -19, -20, -21, -22, -23, -24, -25, -26, -27, -28, -29, Modified: head/usr.bin/truss/main.c ============================================================================== --- head/usr.bin/truss/main.c Sat Dec 10 18:21:03 2011 (r228395) +++ head/usr.bin/truss/main.c Sat Dec 10 18:27:55 2011 (r228396) @@ -74,7 +74,7 @@ usage(void) * WARNING! "FreeBSD a.out" must be first, or set_etype will not * work correctly. */ -struct ex_types { +static struct ex_types { const char *type; void (*enter_syscall)(struct trussinfo *, int); long (*exit_syscall)(struct trussinfo *, int); Modified: head/usr.bin/truss/syscalls.c ============================================================================== --- head/usr.bin/truss/syscalls.c Sat Dec 10 18:21:03 2011 (r228395) +++ head/usr.bin/truss/syscalls.c Sat Dec 10 18:27:55 2011 (r228396) @@ -89,7 +89,7 @@ static const char rcsid[] = /* * This should probably be in its own file, sorted alphabetically. */ -struct syscall syscalls[] = { +static struct syscall syscalls[] = { { .name = "fcntl", .ret_type = 1, .nargs = 3, .args = { { Int, 0 } , { Fcntl, 1 }, { Fcntlflag | OUT, 2 } } }, { .name = "fork", .ret_type = 1, .nargs = 0 }, @@ -283,7 +283,7 @@ static struct xlat kevent_flags[] = { X(EV_CLEAR) X(EV_FLAG1) X(EV_ERROR) X(EV_EOF) XEND }; -struct xlat poll_flags[] = { +static struct xlat poll_flags[] = { X(POLLSTANDARD) X(POLLIN) X(POLLPRI) X(POLLOUT) X(POLLERR) X(POLLHUP) X(POLLNVAL) X(POLLRDNORM) X(POLLRDBAND) X(POLLWRBAND) X(POLLINIGNEOF) XEND From owner-svn-src-all@FreeBSD.ORG Sat Dec 10 18:35:26 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8261C106564A; Sat, 10 Dec 2011 18:35:26 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 725D18FC08; Sat, 10 Dec 2011 18:35:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAIZQTv017320; Sat, 10 Dec 2011 18:35:26 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAIZQpc017318; Sat, 10 Dec 2011 18:35:26 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201112101835.pBAIZQpc017318@svn.freebsd.org> From: Ed Schouten Date: Sat, 10 Dec 2011 18:35:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228397 - head/libexec/comsat X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 18:35:26 -0000 Author: ed Date: Sat Dec 10 18:35:26 2011 New Revision: 228397 URL: http://svn.freebsd.org/changeset/base/228397 Log: Make comsat(8) approximately 15% smaller. This program only consists of a single C file, so simply mark everything except main() static. Modified: head/libexec/comsat/comsat.c Modified: head/libexec/comsat/comsat.c ============================================================================== --- head/libexec/comsat/comsat.c Sat Dec 10 18:27:55 2011 (r228396) +++ head/libexec/comsat/comsat.c Sat Dec 10 18:35:26 2011 (r228397) @@ -68,17 +68,17 @@ static const char rcsid[] = #include #include -int debug = 0; +static int debug = 0; #define dsyslog if (debug) syslog #define MAXIDLE 120 -char hostname[MAXHOSTNAMELEN]; +static char hostname[MAXHOSTNAMELEN]; -void jkfprintf(FILE *, char[], char[], off_t); -void mailfor(char *); -void notify(struct utmpx *, char[], off_t, int); -void reapchildren(int); +static void jkfprintf(FILE *, char[], char[], off_t); +static void mailfor(char *); +static void notify(struct utmpx *, char[], off_t, int); +static void reapchildren(int); int main(int argc __unused, char *argv[] __unused) @@ -115,13 +115,13 @@ main(int argc __unused, char *argv[] __u } } -void +static void reapchildren(int signo __unused) { while (wait3(NULL, WNOHANG, NULL) > 0); } -void +static void mailfor(char *name) { struct utmpx *utp; @@ -157,7 +157,7 @@ mailfor(char *name) static const char *cr; -void +static void notify(struct utmpx *utp, char file[], off_t offset, int folder) { FILE *tp; @@ -219,7 +219,7 @@ notify(struct utmpx *utp, char file[], o _exit(0); } -void +static void jkfprintf(FILE *tp, char user[], char file[], off_t offset) { unsigned char *cp, ch; From owner-svn-src-all@FreeBSD.ORG Sat Dec 10 18:42:00 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D626B1065670; Sat, 10 Dec 2011 18:42:00 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C65CF8FC0A; Sat, 10 Dec 2011 18:42:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAIg0Jm017535; Sat, 10 Dec 2011 18:42:00 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAIg01W017533; Sat, 10 Dec 2011 18:42:00 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201112101842.pBAIg01W017533@svn.freebsd.org> From: Alan Cox Date: Sat, 10 Dec 2011 18:42:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228398 - head/sys/i386/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 18:42:00 -0000 Author: alc Date: Sat Dec 10 18:42:00 2011 New Revision: 228398 URL: http://svn.freebsd.org/changeset/base/228398 Log: Avoid the possibility of integer overflow in the calculation of VM_KMEM_SIZE_MAX. Specifically, if the user/kernel address space split was changed such that the kernel address space was greater than or equal to 2 GB, then overflow would occur. PR: 161721 MFC after: 3 weeks Modified: head/sys/i386/include/vmparam.h Modified: head/sys/i386/include/vmparam.h ============================================================================== --- head/sys/i386/include/vmparam.h Sat Dec 10 18:35:26 2011 (r228397) +++ head/sys/i386/include/vmparam.h Sat Dec 10 18:42:00 2011 (r228398) @@ -186,11 +186,12 @@ #endif /* - * Ceiling on amount of kmem_map kva space. + * Ceiling on the amount of kmem_map KVA space: 40% of the entire KVA space + * rounded to the nearest multiple of the superpage size. */ #ifndef VM_KMEM_SIZE_MAX -#define VM_KMEM_SIZE_MAX ((VM_MAX_KERNEL_ADDRESS - \ - VM_MIN_KERNEL_ADDRESS) * 2 / 5) +#define VM_KMEM_SIZE_MAX (((((VM_MAX_KERNEL_ADDRESS - \ + VM_MIN_KERNEL_ADDRESS) >> (PDRSHIFT - 2)) + 5) / 10) << PDRSHIFT) #endif /* initial pagein size of beginning of executable file */ From owner-svn-src-all@FreeBSD.ORG Sat Dec 10 21:05:06 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AADF7106564A; Sat, 10 Dec 2011 21:05:06 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9329D8FC17; Sat, 10 Dec 2011 21:05:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBAL563H022004; Sat, 10 Dec 2011 21:05:06 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBAL563t022002; Sat, 10 Dec 2011 21:05:06 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201112102105.pBAL563t022002@svn.freebsd.org> From: Eitan Adler Date: Sat, 10 Dec 2011 21:05:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228399 - head/sys/dev/bwn X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Dec 2011 21:05:06 -0000 Author: eadler (ports committer) Date: Sat Dec 10 21:05:06 2011 New Revision: 228399 URL: http://svn.freebsd.org/changeset/base/228399 Log: - fix typo Approved by: kib@ Modified: head/sys/dev/bwn/if_bwnvar.h Modified: head/sys/dev/bwn/if_bwnvar.h ============================================================================== --- head/sys/dev/bwn/if_bwnvar.h Sat Dec 10 18:42:00 2011 (r228398) +++ head/sys/dev/bwn/if_bwnvar.h Sat Dec 10 21:05:06 2011 (r228399) @@ -714,7 +714,7 @@ struct bwn_txhdr { uint16_t tx_status; struct bwn_plcp6 rts_plcp; uint8_t rts_frame[16]; - uint8_t pad1[2];; + uint8_t pad1[2]; struct bwn_plcp6 plcp; } __packed old; /* format > r410 */