From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 00:21:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 197871065678; Sun, 21 Jun 2009 00:21:34 +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 072DB8FC08; Sun, 21 Jun 2009 00:21:34 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5L0LX6A090531; Sun, 21 Jun 2009 00:21:33 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5L0LXFD090527; Sun, 21 Jun 2009 00:21:33 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200906210021.n5L0LXFD090527@svn.freebsd.org> From: Alan Cox Date: Sun, 21 Jun 2009 00:21: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: r194562 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 00:21:34 -0000 Author: alc Date: Sun Jun 21 00:21:33 2009 New Revision: 194562 URL: http://svn.freebsd.org/changeset/base/194562 Log: Strive for greater consistency among the places that implement real, fictious, and contiguous page allocation. Eliminate unnecessary reinitialization of a page's fields. Modified: head/sys/vm/device_pager.c head/sys/vm/vm_page.c head/sys/vm/vm_phys.c Modified: head/sys/vm/device_pager.c ============================================================================== --- head/sys/vm/device_pager.c Sat Jun 20 23:38:21 2009 (r194561) +++ head/sys/vm/device_pager.c Sun Jun 21 00:21:33 2009 (r194562) @@ -307,6 +307,7 @@ dev_pager_getfake(paddr) m->flags = PG_FICTITIOUS; m->oflags = VPO_BUSY; + /* Fictitious pages don't use "act_count". */ m->valid = VM_PAGE_BITS_ALL; m->dirty = 0; m->busy = 0; Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Jun 20 23:38:21 2009 (r194561) +++ head/sys/vm/vm_page.c Sun Jun 21 00:21:33 2009 (r194562) @@ -1108,10 +1108,13 @@ vm_page_alloc(vm_object_t object, vm_pin * At this point we had better have found a good page. */ - KASSERT( - m != NULL, - ("vm_page_alloc(): missing page on free queue") - ); + KASSERT(m != NULL, ("vm_page_alloc: missing page")); + KASSERT(m->queue == PQ_NONE, ("vm_page_alloc: page %p has unexpected queue %d", + m, m->queue)); + KASSERT(m->wire_count == 0, ("vm_page_alloc: page %p is wired", m)); + KASSERT(m->hold_count == 0, ("vm_page_alloc: page %p is held", m)); + KASSERT(m->busy == 0, ("vm_page_alloc: page %p is busy", m)); + KASSERT(m->dirty == 0, ("vm_page_alloc: page %p is dirty", m)); if ((m->flags & PG_CACHED) != 0) { KASSERT(m->valid != 0, ("vm_page_alloc: cached page %p is invalid", m)); @@ -1150,12 +1153,8 @@ vm_page_alloc(vm_object_t object, vm_pin if (req & VM_ALLOC_WIRED) { atomic_add_int(&cnt.v_wire_count, 1); m->wire_count = 1; - } else - m->wire_count = 0; - m->hold_count = 0; + } m->act_count = 0; - m->busy = 0; - KASSERT(m->dirty == 0, ("vm_page_alloc: free/cache page %p was dirty", m)); mtx_unlock(&vm_page_queue_free_mtx); if ((req & VM_ALLOC_NOOBJ) == 0) Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Sat Jun 20 23:38:21 2009 (r194561) +++ head/sys/vm/vm_phys.c Sun Jun 21 00:21:33 2009 (r194562) @@ -689,6 +689,14 @@ done: KASSERT(m->queue == PQ_NONE, ("vm_phys_alloc_contig: page %p has unexpected queue %d", m, m->queue)); + KASSERT(m->wire_count == 0, + ("vm_phys_alloc_contig: page %p is wired", m)); + KASSERT(m->hold_count == 0, + ("vm_phys_alloc_contig: page %p is held", m)); + KASSERT(m->busy == 0, + ("vm_phys_alloc_contig: page %p is busy", m)); + KASSERT(m->dirty == 0, + ("vm_phys_alloc_contig: page %p is dirty", m)); m_object = m->object; if ((m->flags & PG_CACHED) != 0) { m->valid = 0; @@ -705,10 +713,7 @@ done: /* Don't clear the PG_ZERO flag; we'll need it later. */ m->flags = PG_UNMANAGED | (m->flags & PG_ZERO); m->oflags = 0; - KASSERT(m->dirty == 0, - ("vm_phys_alloc_contig: page %p was dirty", m)); - m->wire_count = 0; - m->busy = 0; + /* Unmanaged pages don't use "act_count". */ if (m_object != NULL && m_object->type == OBJT_VNODE && m_object->cache == NULL) { From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 01:17:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7872106564A; Sun, 21 Jun 2009 01:17:38 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5AEB8FC0C; Sun, 21 Jun 2009 01:17:38 +0000 (UTC) (envelope-from kmacy@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5L1HcKY091563; Sun, 21 Jun 2009 01:17:38 GMT (envelope-from kmacy@svn.freebsd.org) Received: (from kmacy@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5L1Hc85091561; Sun, 21 Jun 2009 01:17:38 GMT (envelope-from kmacy@svn.freebsd.org) Message-Id: <200906210117.n5L1Hc85091561@svn.freebsd.org> From: Kip Macy Date: Sun, 21 Jun 2009 01:17: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: r194563 - head/sys/dev/cxgb/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 01:17:39 -0000 Author: kmacy Date: Sun Jun 21 01:17:38 2009 New Revision: 194563 URL: http://svn.freebsd.org/changeset/base/194563 Log: fix !x86 cxgb compile Modified: head/sys/dev/cxgb/sys/uipc_mvec.c Modified: head/sys/dev/cxgb/sys/uipc_mvec.c ============================================================================== --- head/sys/dev/cxgb/sys/uipc_mvec.c Sun Jun 21 00:21:33 2009 (r194562) +++ head/sys/dev/cxgb/sys/uipc_mvec.c Sun Jun 21 01:17:38 2009 (r194563) @@ -90,7 +90,7 @@ retry: n = n->m_next; } #else - err = bus_dmamap_load_mbuf_sg(txq->entry_tag, map, m, segs, + err = bus_dmamap_load_mbuf_sg(txq->entry_tag, map, *m, segs, &seg_count, 0); #endif if (seg_count == 0) { From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 01:54:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A3891065674; Sun, 21 Jun 2009 01:54:47 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 486418FC14; Sun, 21 Jun 2009 01:54:47 +0000 (UTC) (envelope-from kan@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5L1slFb092344; Sun, 21 Jun 2009 01:54:47 GMT (envelope-from kan@svn.freebsd.org) Received: (from kan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5L1slhb092342; Sun, 21 Jun 2009 01:54:47 GMT (envelope-from kan@svn.freebsd.org) Message-Id: <200906210154.n5L1slhb092342@svn.freebsd.org> From: Alexander Kabaev Date: Sun, 21 Jun 2009 01:54: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: r194564 - head/gnu/lib/libgcov X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 01:54:47 -0000 Author: kan Date: Sun Jun 21 01:54:47 2009 New Revision: 194564 URL: http://svn.freebsd.org/changeset/base/194564 Log: Compile static gcov library with -fPIC to match what stock GCC builds are doing. This is required for libgcov.a to be usable on amd64. Reported by: stas Modified: head/gnu/lib/libgcov/Makefile Modified: head/gnu/lib/libgcov/Makefile ============================================================================== --- head/gnu/lib/libgcov/Makefile Sun Jun 21 01:17:38 2009 (r194563) +++ head/gnu/lib/libgcov/Makefile Sun Jun 21 01:54:47 2009 (r194564) @@ -27,7 +27,15 @@ OBJS_T= ${SYMS:S/$/.o/} OBJS_P= ${SYMS:S/$/.po/} OBJS_S= ${SYMS:S/$/.So/} -COMMONHDRS= tm.h tconfig.h gcov-iov.h options.h +#----------------------------------------------------------------------- +# +# Helpful shortcuts for compiler invocations. +# +CC_T = ${CC} -c ${CFLAGS} -fPIC +CC_P = ${CC} -c ${CFLAGS} -p -fPIC +CC_S = ${CC} -c ${CFLAGS} ${PICFLAG} -DSHARED + +COMMONHDRS= tm.h tconfig.h gcov-iov.h options.h CLEANFILES+= ${COMMONHDRS} cs-tm.h cs-tconfig.h options.h optionlist ${COMMONHDRS}: ${.CURDIR}/../../usr.bin/cc/cc_tools/Makefile @@ -36,16 +44,16 @@ ${COMMONHDRS}: ${.CURDIR}/../../usr.bin/ ${OBJS} beforedepend: ${COMMONHDRS} ${OBJS_T}: libgcov.c - ${CC} -c ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} + ${CC_T} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} .if !defined(NO_PIC) ${OBJS_S}: libgcov.c - ${CC} -c ${PICFLAG} ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} + ${CC_S} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} .endif .if ${MK_PROFILE} != "no" ${OBJS_P}: libgcov.c - ${CC} -c -p ${CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} + ${CC_P} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} .endif .include From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 02:47:21 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54BC71065673; Sun, 21 Jun 2009 02:47:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id E1D1B8FC0A; Sun, 21 Jun 2009 02:47:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-159-184.carlnfd1.nsw.optusnet.com.au (c122-106-159-184.carlnfd1.nsw.optusnet.com.au [122.106.159.184]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n5L2lHYL011826 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 21 Jun 2009 12:47:18 +1000 Date: Sun, 21 Jun 2009 12:47:17 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Brooks Davis In-Reply-To: <20090620183728.GA72393@lor.one-eyed-alien.net> Message-ID: <20090621123046.V30192@delplex.bde.org> References: <200906191552.n5JFqZcG047705@svn.freebsd.org> <20090620130238.N29302@delplex.bde.org> <20090620183728.GA72393@lor.one-eyed-alien.net> 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, Bruce Evans Subject: Re: svn commit: r194493 - head/usr.bin/catman X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 02:47:21 -0000 On Sat, 20 Jun 2009, Brooks Davis wrote: > On Sat, Jun 20, 2009 at 01:57:07PM +1000, Bruce Evans wrote: >> On Fri, 19 Jun 2009, Brooks Davis wrote: >> >>> Log: >>> When checking if we can write to a file, use access() instead of a >>> manual permission check based on stat output. Also, get rid of the >>> executability check since it is not used. >> >> This seems to add some security holes. From "man assert | col -bx": >> >> %%% >> SECURITY CONSIDERATIONS >> The access() system call is a potential security hole due to race condi- >> tions and should never be used. Set-user-ID and set-group-ID applica- >> ... >> %%% > > The code I replaced was effectivly a hand rolled version of access() based > on examining stat(1) results. I think both are equivalently wrong from > a security perspective. Not really. It is impossible to hand-roll access using only stat() results, since ACL/MAC/other results might also be needed, and it is difficult to hand-roll it since it is difficult even to know which results are needed. The hand-rolling that you removed didn't even know about the immutable flags, which _are_ in the stat() results. This both are inequivalently wrong from a security perspective. catman would probably be better from a non-secuity persepective if it didn't use access(). It can only use the results to avoid some errors in advance. It does this, but the advantages of doing this are small at best. man(1) doesn't do this. It just attempts to open a temporary cat file in the cat directory. When this fails, it assumes that this is intended and doesn't print a warning. If this succeeds, than it later attempts to rename the temporary fail. If this fails (e.g., due to someone settting uchg on the source or target file), then it assumes that this is not intended and prints a warning. >>> Modified: head/usr.bin/catman/catman.c >>> ============================================================================== >>> --- head/usr.bin/catman/catman.c Fri Jun 19 15:31:40 2009 (r194492) >>> +++ head/usr.bin/catman/catman.c Fri Jun 19 15:52:35 2009 (r194493) >>> @@ -759,14 +742,6 @@ main(int argc, char **argv) >>> { >>> int opt; >>> >>> - if ((uid = getuid()) == 0) { >>> - fprintf(stderr, "don't run %s as root, use:\n echo", argv[0]); >>> - for (optind = 0; optind < argc; optind++) { >>> - fprintf(stderr, " %s", argv[optind]); >>> - } >>> - fprintf(stderr, " | nice -5 su -m man\n"); >>> - exit(1); >>> - } >>> while ((opt = getopt(argc, argv, "vnfLrh")) != -1) { >>> switch (opt) { >>> case 'f': >> >> Surely it is wrong to remove the enforcement of not running as root? > > Yes that was an error, I've restored that check. Thanks for the catch. The named `uid' variable should be removed now, since it is no longer needed outside this function and was never needed inside this function. Bruce From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 06:06:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E88BF1065672; Sun, 21 Jun 2009 06:06: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 D53B58FC08; Sun, 21 Jun 2009 06:06:43 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5L66h0v097400; Sun, 21 Jun 2009 06:06:43 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5L66hLc097397; Sun, 21 Jun 2009 06:06:43 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200906210606.n5L66hLc097397@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 21 Jun 2009 06:06: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: r194569 - head/sys/dev/fxp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 06:06:44 -0000 Author: yongari Date: Sun Jun 21 06:06:43 2009 New Revision: 194569 URL: http://svn.freebsd.org/changeset/base/194569 Log: Introduce Rx mbuf dma tag and use it in Rx path. Previously it used common mbuf dma tag for both Tx and Rx path but Rx buffer should have single DMA segment and maximum buffer size of the segment should be less than MCLBYTES. fxp(4) also have to check Tx completion status which was updated by DMA so we need BUS_DMASYNC_PREREAD and BUS_DMASYNC_POSTWRITE synchronization in Tx path. Fix all misuse of bus_dmamap_sync(9) in fxp(4). I guess this change shall fix occasional driver breakage in PAE environments. While I'm here add error messages of dma tag/buffer creation and correct messages. Modified: head/sys/dev/fxp/if_fxp.c head/sys/dev/fxp/if_fxpvar.h Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Sun Jun 21 02:49:21 2009 (r194568) +++ head/sys/dev/fxp/if_fxp.c Sun Jun 21 06:06:43 2009 (r194569) @@ -642,9 +642,18 @@ fxp_attach(device_t dev) BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, sc->maxsegsize * sc->maxtxseg + sizeof(struct ether_vlan_header), sc->maxtxseg, sc->maxsegsize, 0, - busdma_lock_mutex, &Giant, &sc->fxp_mtag); + busdma_lock_mutex, &Giant, &sc->fxp_txmtag); if (error) { - device_printf(dev, "could not allocate dma tag\n"); + device_printf(dev, "could not create TX DMA tag\n"); + goto fail; + } + + error = bus_dma_tag_create(bus_get_dma_tag(dev), 2, 0, + BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + MCLBYTES, 1, MCLBYTES, 0, + busdma_lock_mutex, &Giant, &sc->fxp_rxmtag); + if (error) { + device_printf(dev, "could not create RX DMA tag\n"); goto fail; } @@ -653,18 +662,20 @@ fxp_attach(device_t dev) sizeof(struct fxp_stats), 1, sizeof(struct fxp_stats), 0, busdma_lock_mutex, &Giant, &sc->fxp_stag); if (error) { - device_printf(dev, "could not allocate dma tag\n"); + device_printf(dev, "could not create stats DMA tag\n"); goto fail; } error = bus_dmamem_alloc(sc->fxp_stag, (void **)&sc->fxp_stats, BUS_DMA_NOWAIT | BUS_DMA_ZERO, &sc->fxp_smap); - if (error) + if (error) { + device_printf(dev, "could not allocate stats DMA memory\n"); goto fail; + } error = bus_dmamap_load(sc->fxp_stag, sc->fxp_smap, sc->fxp_stats, sizeof(struct fxp_stats), fxp_dma_map_addr, &sc->stats_addr, 0); if (error) { - device_printf(dev, "could not map the stats buffer\n"); + device_printf(dev, "could not load the stats DMA buffer\n"); goto fail; } @@ -673,20 +684,22 @@ fxp_attach(device_t dev) FXP_TXCB_SZ, 1, FXP_TXCB_SZ, 0, busdma_lock_mutex, &Giant, &sc->cbl_tag); if (error) { - device_printf(dev, "could not allocate dma tag\n"); + device_printf(dev, "could not create TxCB DMA tag\n"); goto fail; } error = bus_dmamem_alloc(sc->cbl_tag, (void **)&sc->fxp_desc.cbl_list, BUS_DMA_NOWAIT | BUS_DMA_ZERO, &sc->cbl_map); - if (error) + if (error) { + device_printf(dev, "could not allocate TxCB DMA memory\n"); goto fail; + } error = bus_dmamap_load(sc->cbl_tag, sc->cbl_map, sc->fxp_desc.cbl_list, FXP_TXCB_SZ, fxp_dma_map_addr, &sc->fxp_desc.cbl_addr, 0); if (error) { - device_printf(dev, "could not map DMA memory\n"); + device_printf(dev, "could not load TxCB DMA buffer\n"); goto fail; } @@ -695,18 +708,23 @@ fxp_attach(device_t dev) sizeof(struct fxp_cb_mcs), 1, sizeof(struct fxp_cb_mcs), 0, busdma_lock_mutex, &Giant, &sc->mcs_tag); if (error) { - device_printf(dev, "could not allocate dma tag\n"); + device_printf(dev, + "could not create multicast setup DMA tag\n"); goto fail; } error = bus_dmamem_alloc(sc->mcs_tag, (void **)&sc->mcsp, - BUS_DMA_NOWAIT, &sc->mcs_map); - if (error) + BUS_DMA_NOWAIT | BUS_DMA_ZERO, &sc->mcs_map); + if (error) { + device_printf(dev, + "could not allocate multicast setup DMA memory\n"); goto fail; + } error = bus_dmamap_load(sc->mcs_tag, sc->mcs_map, sc->mcsp, sizeof(struct fxp_cb_mcs), fxp_dma_map_addr, &sc->mcs_addr, 0); if (error) { - device_printf(dev, "can't map the multicast setup command\n"); + device_printf(dev, + "can't load the multicast setup DMA buffer\n"); goto fail; } @@ -718,13 +736,13 @@ fxp_attach(device_t dev) tcbp = sc->fxp_desc.cbl_list; for (i = 0; i < FXP_NTXCB; i++) { txp[i].tx_cb = tcbp + i; - error = bus_dmamap_create(sc->fxp_mtag, 0, &txp[i].tx_map); + error = bus_dmamap_create(sc->fxp_txmtag, 0, &txp[i].tx_map); if (error) { device_printf(dev, "can't create DMA map for TX\n"); goto fail; } } - error = bus_dmamap_create(sc->fxp_mtag, 0, &sc->spare_map); + error = bus_dmamap_create(sc->fxp_rxmtag, 0, &sc->spare_map); if (error) { device_printf(dev, "can't create spare DMA map\n"); goto fail; @@ -736,7 +754,7 @@ fxp_attach(device_t dev) sc->fxp_desc.rx_head = sc->fxp_desc.rx_tail = NULL; for (i = 0; i < FXP_NRFABUFS; i++) { rxp = &sc->fxp_desc.rx_list[i]; - error = bus_dmamap_create(sc->fxp_mtag, 0, &rxp->rx_map); + error = bus_dmamap_create(sc->fxp_rxmtag, 0, &rxp->rx_map); if (error) { device_printf(dev, "can't create DMA map for RX\n"); goto fail; @@ -910,29 +928,32 @@ fxp_release(struct fxp_softc *sc) bus_dmamem_free(sc->mcs_tag, sc->mcsp, sc->mcs_map); } bus_release_resources(sc->dev, sc->fxp_spec, sc->fxp_res); - if (sc->fxp_mtag) { + if (sc->fxp_rxmtag) { for (i = 0; i < FXP_NRFABUFS; i++) { rxp = &sc->fxp_desc.rx_list[i]; if (rxp->rx_mbuf != NULL) { - bus_dmamap_sync(sc->fxp_mtag, rxp->rx_map, + bus_dmamap_sync(sc->fxp_rxmtag, rxp->rx_map, BUS_DMASYNC_POSTREAD); - bus_dmamap_unload(sc->fxp_mtag, rxp->rx_map); + bus_dmamap_unload(sc->fxp_rxmtag, rxp->rx_map); m_freem(rxp->rx_mbuf); } - bus_dmamap_destroy(sc->fxp_mtag, rxp->rx_map); + bus_dmamap_destroy(sc->fxp_rxmtag, rxp->rx_map); } - bus_dmamap_destroy(sc->fxp_mtag, sc->spare_map); + bus_dmamap_destroy(sc->fxp_rxmtag, sc->spare_map); + bus_dma_tag_destroy(sc->fxp_rxmtag); + } + if (sc->fxp_txmtag) { for (i = 0; i < FXP_NTXCB; i++) { txp = &sc->fxp_desc.tx_list[i]; if (txp->tx_mbuf != NULL) { - bus_dmamap_sync(sc->fxp_mtag, txp->tx_map, + bus_dmamap_sync(sc->fxp_txmtag, txp->tx_map, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->fxp_mtag, txp->tx_map); + bus_dmamap_unload(sc->fxp_txmtag, txp->tx_map); m_freem(txp->tx_mbuf); } - bus_dmamap_destroy(sc->fxp_mtag, txp->tx_map); + bus_dmamap_destroy(sc->fxp_txmtag, txp->tx_map); } - bus_dma_tag_destroy(sc->fxp_mtag); + bus_dma_tag_destroy(sc->fxp_txmtag); } if (sc->fxp_stag) bus_dma_tag_destroy(sc->fxp_stag); @@ -1324,7 +1345,8 @@ fxp_start_body(struct ifnet *ifp) * going again if suspended. */ if (txqueued > 0) { - bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); fxp_scb_wait(sc); fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_RESUME); /* @@ -1498,7 +1520,7 @@ fxp_encap(struct fxp_softc *sc, struct m *m_head = m; } - error = bus_dmamap_load_mbuf_sg(sc->fxp_mtag, txp->tx_map, *m_head, + error = bus_dmamap_load_mbuf_sg(sc->fxp_txmtag, txp->tx_map, *m_head, segs, &nseg, 0); if (error == EFBIG) { m = m_collapse(*m_head, M_DONTWAIT, sc->maxtxseg); @@ -1508,7 +1530,7 @@ fxp_encap(struct fxp_softc *sc, struct m return (ENOMEM); } *m_head = m; - error = bus_dmamap_load_mbuf_sg(sc->fxp_mtag, txp->tx_map, + error = bus_dmamap_load_mbuf_sg(sc->fxp_txmtag, txp->tx_map, *m_head, segs, &nseg, 0); if (error != 0) { m_freem(*m_head); @@ -1524,7 +1546,7 @@ fxp_encap(struct fxp_softc *sc, struct m } KASSERT(nseg <= sc->maxtxseg, ("too many DMA segments")); - bus_dmamap_sync(sc->fxp_mtag, txp->tx_map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->fxp_txmtag, txp->tx_map, BUS_DMASYNC_PREWRITE); cbp = txp->tx_cb; for (i = 0; i < nseg; i++) { @@ -1706,14 +1728,15 @@ fxp_txeof(struct fxp_softc *sc) struct fxp_tx *txp; ifp = sc->ifp; - bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREREAD); + bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); for (txp = sc->fxp_desc.tx_first; sc->tx_queued && (le16toh(txp->tx_cb->cb_status) & FXP_CB_STATUS_C) != 0; txp = txp->tx_next) { if (txp->tx_mbuf != NULL) { - bus_dmamap_sync(sc->fxp_mtag, txp->tx_map, + bus_dmamap_sync(sc->fxp_txmtag, txp->tx_map, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->fxp_mtag, txp->tx_map); + bus_dmamap_unload(sc->fxp_txmtag, txp->tx_map); m_freem(txp->tx_mbuf); txp->tx_mbuf = NULL; /* clear this to reset csum offload bits */ @@ -1723,7 +1746,8 @@ fxp_txeof(struct fxp_softc *sc) ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } sc->fxp_desc.tx_first = txp; - bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); if (sc->tx_queued == 0) { sc->watchdog_timer = 0; if (sc->need_mcsetup) @@ -1878,7 +1902,7 @@ fxp_intr_body(struct fxp_softc *sc, stru m = rxp->rx_mbuf; rfa = (struct fxp_rfa *)(m->m_ext.ext_buf + RFA_ALIGNMENT_FUDGE); - bus_dmamap_sync(sc->fxp_mtag, rxp->rx_map, + bus_dmamap_sync(sc->fxp_rxmtag, rxp->rx_map, BUS_DMASYNC_POSTREAD); #ifdef DEVICE_POLLING /* loop at most count times if count >=0 */ @@ -2113,9 +2137,10 @@ fxp_stop(struct fxp_softc *sc) if (txp != NULL) { for (i = 0; i < FXP_NTXCB; i++) { if (txp[i].tx_mbuf != NULL) { - bus_dmamap_sync(sc->fxp_mtag, txp[i].tx_map, + bus_dmamap_sync(sc->fxp_txmtag, txp[i].tx_map, BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->fxp_mtag, txp[i].tx_map); + bus_dmamap_unload(sc->fxp_txmtag, + txp[i].tx_map); m_freem(txp[i].tx_mbuf); txp[i].tx_mbuf = NULL; /* clear this to reset csum offload bits */ @@ -2123,7 +2148,8 @@ fxp_stop(struct fxp_softc *sc) } } } - bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); sc->tx_queued = 0; } @@ -2395,7 +2421,8 @@ fxp_init_body(struct fxp_softc *sc) * unit. It will execute the NOP and then suspend. */ tcbp->cb_command = htole16(FXP_CB_COMMAND_NOP | FXP_CB_COMMAND_S); - bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); sc->fxp_desc.tx_first = sc->fxp_desc.tx_last = txp; sc->tx_queued = 1; @@ -2545,7 +2572,7 @@ fxp_new_rfabuf(struct fxp_softc *sc, str le32enc(&rfa->rbd_addr, 0xffffffff); /* Map the RFA into DMA memory. */ - error = bus_dmamap_load(sc->fxp_mtag, sc->spare_map, rfa, + error = bus_dmamap_load(sc->fxp_rxmtag, sc->spare_map, rfa, MCLBYTES - RFA_ALIGNMENT_FUDGE, fxp_dma_map_addr, &rxp->rx_addr, 0); if (error) { @@ -2554,13 +2581,13 @@ fxp_new_rfabuf(struct fxp_softc *sc, str } if (rxp->rx_mbuf != NULL) - bus_dmamap_unload(sc->fxp_mtag, rxp->rx_map); + bus_dmamap_unload(sc->fxp_rxmtag, rxp->rx_map); tmp_map = sc->spare_map; sc->spare_map = rxp->rx_map; rxp->rx_map = tmp_map; rxp->rx_mbuf = m; - bus_dmamap_sync(sc->fxp_mtag, rxp->rx_map, + bus_dmamap_sync(sc->fxp_rxmtag, rxp->rx_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); return (0); } @@ -2582,7 +2609,7 @@ fxp_add_rfabuf(struct fxp_softc *sc, str p_rx->rx_next = rxp; le32enc(&p_rfa->link_addr, rxp->rx_addr); p_rfa->rfa_control = 0; - bus_dmamap_sync(sc->fxp_mtag, p_rx->rx_map, + bus_dmamap_sync(sc->fxp_rxmtag, p_rx->rx_map, BUS_DMASYNC_PREWRITE); } else { rxp->rx_next = NULL; @@ -2626,7 +2653,7 @@ fxp_discard_rfabuf(struct fxp_softc *sc, le32enc(&rfa->link_addr, 0xffffffff); le32enc(&rfa->rbd_addr, 0xffffffff); - bus_dmamap_sync(sc->fxp_mtag, rxp->rx_map, + bus_dmamap_sync(sc->fxp_rxmtag, rxp->rx_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); } @@ -2946,7 +2973,8 @@ fxp_mc_setup(struct fxp_softc *sc) * Start the multicast setup command. */ fxp_scb_wait(sc); - bus_dmamap_sync(sc->mcs_tag, sc->mcs_map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(sc->mcs_tag, sc->mcs_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->mcs_addr); fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START); Modified: head/sys/dev/fxp/if_fxpvar.h ============================================================================== --- head/sys/dev/fxp/if_fxpvar.h Sun Jun 21 02:49:21 2009 (r194568) +++ head/sys/dev/fxp/if_fxpvar.h Sun Jun 21 06:06:43 2009 (r194569) @@ -152,7 +152,8 @@ struct fxp_softc { struct resource_spec *fxp_spec; /* the resource spec we used */ void *ih; /* interrupt handler cookie */ struct mtx sc_mtx; - bus_dma_tag_t fxp_mtag; /* bus DMA tag for mbufs */ + bus_dma_tag_t fxp_txmtag; /* bus DMA tag for Tx mbufs */ + bus_dma_tag_t fxp_rxmtag; /* bus DMA tag for Rx mbufs */ bus_dma_tag_t fxp_stag; /* bus DMA tag for stats */ bus_dmamap_t fxp_smap; /* bus DMA map for stats */ bus_dma_tag_t cbl_tag; /* DMA tag for the TxCB list */ From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 06:18:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 057F31065673; Sun, 21 Jun 2009 06:18:20 +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 E7E868FC20; Sun, 21 Jun 2009 06:18:19 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5L6IJOu097628; Sun, 21 Jun 2009 06:18:19 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5L6IJHM097626; Sun, 21 Jun 2009 06:18:19 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200906210618.n5L6IJHM097626@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 21 Jun 2009 06:18: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: r194570 - head/sys/dev/fxp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 06:18:20 -0000 Author: yongari Date: Sun Jun 21 06:18:19 2009 New Revision: 194570 URL: http://svn.freebsd.org/changeset/base/194570 Log: Due to possible PCI bus lock-up issues fxp(4) didn't perform full hardware reset in attach phase. Selective reset does not clear configured parameters so I think full hardware reset is required. To prevent PCI bus lock-up, do selective reset first which will get off the controller from PCI bus and request software reset after selective reset. Software reset will unmask interrupts so disable it after the reset. Modified: head/sys/dev/fxp/if_fxp.c Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Sun Jun 21 06:06:43 2009 (r194569) +++ head/sys/dev/fxp/if_fxp.c Sun Jun 21 06:18:19 2009 (r194570) @@ -466,10 +466,14 @@ fxp_attach(device_t dev) } /* - * Reset to a stable state. + * Put CU/RU idle state and prepare full reset. */ CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SELECTIVE_RESET); DELAY(10); + /* Full reset and disable interrupts. */ + CSR_WRITE_4(sc, FXP_CSR_PORT, FXP_PORT_SOFTWARE_RESET); + DELAY(10); + CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE); /* * Find out how large of an SEEPROM we have. From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 06:27:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE7E51065670; Sun, 21 Jun 2009 06:27:35 +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 9CC9A8FC0A; Sun, 21 Jun 2009 06:27:35 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5L6RZcn097832; Sun, 21 Jun 2009 06:27:35 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5L6RZ16097829; Sun, 21 Jun 2009 06:27:35 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200906210627.n5L6RZ16097829@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 21 Jun 2009 06:27: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: r194571 - head/sys/dev/fxp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 06:27:36 -0000 Author: yongari Date: Sun Jun 21 06:27:35 2009 New Revision: 194571 URL: http://svn.freebsd.org/changeset/base/194571 Log: Don't blindly enable Rx lock-up workaround. Newer chips do not need the Rx lock-up workaround. Obtained from: NetBSD Modified: head/sys/dev/fxp/if_fxp.c head/sys/dev/fxp/if_fxpvar.h Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Sun Jun 21 06:18:19 2009 (r194570) +++ head/sys/dev/fxp/if_fxp.c Sun Jun 21 06:27:35 2009 (r194571) @@ -500,6 +500,13 @@ fxp_attach(device_t dev) sc->flags |= FXP_FLAG_WOLCAP; } + /* Receiver lock-up workaround detection. */ + fxp_read_eeprom(sc, &data, 3, 1); + if ((data & 0x03) != 0x03) { + sc->flags |= FXP_FLAG_RXBUG; + device_printf(dev, "Enabling Rx lock-up workaround\n"); + } + /* * Determine whether we must use the 503 serial interface. */ @@ -2021,7 +2028,7 @@ fxp_tick(void *xsc) if (sp->rx_good) { ifp->if_ipackets += le32toh(sp->rx_good); sc->rx_idle_secs = 0; - } else { + } else if (sc->flags & FXP_FLAG_RXBUG) { /* * Receiver's been idle for another second. */ Modified: head/sys/dev/fxp/if_fxpvar.h ============================================================================== --- head/sys/dev/fxp/if_fxpvar.h Sun Jun 21 06:18:19 2009 (r194570) +++ head/sys/dev/fxp/if_fxpvar.h Sun Jun 21 06:27:35 2009 (r194571) @@ -204,6 +204,7 @@ struct fxp_softc { #define FXP_FLAG_82559_RXCSUM 0x1000 /* 82559 compatible RX checksum */ #define FXP_FLAG_WOLCAP 0x2000 /* WOL capability */ #define FXP_FLAG_WOL 0x4000 /* WOL active */ +#define FXP_FLAG_RXBUG 0x8000 /* Rx lock-up bug */ /* Macros to ease CSR access. */ #define CSR_READ_1(sc, reg) bus_read_1(sc->fxp_res[0], reg) From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 06:46:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 489C21065672; Sun, 21 Jun 2009 06:46:33 +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 36E948FC12; Sun, 21 Jun 2009 06:46:33 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5L6kXAU098184; Sun, 21 Jun 2009 06:46:33 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5L6kXx0098182; Sun, 21 Jun 2009 06:46:33 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200906210646.n5L6kXx0098182@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 21 Jun 2009 06:46: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: r194572 - head/sys/dev/fxp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 06:46:33 -0000 Author: yongari Date: Sun Jun 21 06:46:32 2009 New Revision: 194572 URL: http://svn.freebsd.org/changeset/base/194572 Log: Always check fxp(4) is running, see if it can accept frames from upper stack in fxp_start_body(). fxp(4) drops driver lock in Rx path so check the fxp(4) is still running after reacquiring driver lock in Rx path. Also don't invoke fxp_intr_body if fxp(4) is not running. With this change there is no need to set suspend bit in device attach phase. Modified: head/sys/dev/fxp/if_fxp.c Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Sun Jun 21 06:27:35 2009 (r194571) +++ head/sys/dev/fxp/if_fxp.c Sun Jun 21 06:46:32 2009 (r194572) @@ -992,7 +992,6 @@ fxp_detach(device_t dev) #endif FXP_LOCK(sc); - sc->suspended = 1; /* Do same thing as we do for suspend */ /* * Stop DMA and drop transmit queue, but disable interrupts first. */ @@ -1319,6 +1318,10 @@ fxp_start_body(struct ifnet *ifp) if (sc->need_mcsetup) return; + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != + IFF_DRV_RUNNING) + return; + if (sc->tx_queued > FXP_NTXCB_HIWAT) fxp_txeof(sc); /* @@ -1727,7 +1730,8 @@ fxp_intr(void *xsc) * First ACK all the interrupts in this pass. */ CSR_WRITE_1(sc, FXP_CSR_SCB_STATACK, statack); - fxp_intr_body(sc, ifp, statack, -1); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + fxp_intr_body(sc, ifp, statack, -1); } FXP_UNLOCK(sc); } @@ -1987,6 +1991,8 @@ fxp_intr_body(struct fxp_softc *sc, stru (*ifp->if_input)(ifp, m); FXP_LOCK(sc); rx_npkts++; + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return (rx_npkts); } else { /* Reuse RFA and loaded DMA map. */ ifp->if_iqdrops++; @@ -2070,7 +2076,8 @@ fxp_tick(void *xsc) */ if (sc->rx_idle_secs > FXP_MAX_RX_IDLE) { sc->rx_idle_secs = 0; - fxp_mc_setup(sc); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + fxp_mc_setup(sc); } /* * If there is no pending command, start another stats From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 07:17:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87E47106566C; Sun, 21 Jun 2009 07:17:50 +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 750258FC14; Sun, 21 Jun 2009 07:17:50 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5L7HoNC098775; Sun, 21 Jun 2009 07:17:50 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5L7HoOn098772; Sun, 21 Jun 2009 07:17:50 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200906210717.n5L7HoOn098772@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 21 Jun 2009 07: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: r194573 - head/sys/dev/fxp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 07:17:50 -0000 Author: yongari Date: Sun Jun 21 07:17:49 2009 New Revision: 194573 URL: http://svn.freebsd.org/changeset/base/194573 Log: Overhaul fxp(4) multicast filter programming. fxp(4) hardwares do not allow multicast filter programming when controller is busy to send/receive frames. So it used to mark need_mcsetup bit and defer multicast filter programming until controller becomes idle state. To detect when the controller is idle fxp(4) relied on Tx completion interrupt with NOP command and fxp_start_body and fxp_intr_body had to see whether pending multicast filter programming was requested. This resulted in very complex logic and sometimes it did not work as expected. Since the controller should be in idle state before any multicast filter modifications I changed it to reinitialize the controller whenever multicast filter programming is required. This is the same way what OpenBSD and NetBSD does. Also I added IFF_DRV_RUNNING check in ioctl handler so controller would be reinitialized only if it is absolutely needed. With this change I guess we can remove fxp(4) DELAY hack in ifioctl for IPv6 case. Modified: head/sys/dev/fxp/if_fxp.c head/sys/dev/fxp/if_fxpvar.h Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Sun Jun 21 06:46:32 2009 (r194572) +++ head/sys/dev/fxp/if_fxp.c Sun Jun 21 07:17:49 2009 (r194573) @@ -1310,14 +1310,6 @@ fxp_start_body(struct ifnet *ifp) FXP_LOCK_ASSERT(sc, MA_OWNED); - /* - * See if we need to suspend xmit until the multicast filter - * has been reprogrammed (which can only be done at the head - * of the command chain). - */ - if (sc->need_mcsetup) - return; - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) return; @@ -1763,11 +1755,8 @@ fxp_txeof(struct fxp_softc *sc) sc->fxp_desc.tx_first = txp; bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - if (sc->tx_queued == 0) { + if (sc->tx_queued == 0) sc->watchdog_timer = 0; - if (sc->need_mcsetup) - fxp_mc_setup(sc); - } } static void @@ -2077,7 +2066,8 @@ fxp_tick(void *xsc) if (sc->rx_idle_secs > FXP_MAX_RX_IDLE) { sc->rx_idle_secs = 0; if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) - fxp_mc_setup(sc); + fxp_init_body(sc); + return; } /* * If there is no pending command, start another stats @@ -2219,7 +2209,6 @@ fxp_init_body(struct fxp_softc *sc) struct fxp_cb_ias *cb_ias; struct fxp_cb_tx *tcbp; struct fxp_tx *txp; - struct fxp_cb_mcs *mcsp; int i, prm; FXP_LOCK_ASSERT(sc, MA_OWNED); @@ -2262,25 +2251,10 @@ fxp_init_body(struct fxp_softc *sc) fxp_load_ucode(sc); /* - * Initialize the multicast address list. + * Set IFF_ALLMULTI status. It's needed in configure action + * command. */ - if (fxp_mc_addrs(sc)) { - mcsp = sc->mcsp; - mcsp->cb_status = 0; - mcsp->cb_command = - htole16(FXP_CB_COMMAND_MCAS | FXP_CB_COMMAND_EL); - mcsp->link_addr = 0xffffffff; - /* - * Start the multicast setup command. - */ - fxp_scb_wait(sc); - bus_dmamap_sync(sc->mcs_tag, sc->mcs_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->mcs_addr); - fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START); - /* ...and wait for it to complete. */ - fxp_dma_wait(sc, &mcsp->cb_status, sc->mcs_tag, sc->mcs_map); - } + fxp_mc_addrs(sc); /* * We temporarily use memory that contains the TxCB list to @@ -2354,7 +2328,7 @@ fxp_init_body(struct fxp_softc *sc) cbp->force_fdx = 0; /* (don't) force full duplex */ cbp->fdx_pin_en = 1; /* (enable) FDX# pin */ cbp->multi_ia = 0; /* (don't) accept multiple IAs */ - cbp->mc_all = sc->flags & FXP_FLAG_ALL_MCAST ? 1 : 0; + cbp->mc_all = ifp->if_flags & IFF_ALLMULTI ? 1 : 0; cbp->gamla_rx = sc->flags & FXP_FLAG_EXT_RFA ? 1 : 0; cbp->vlan_strip_en = ((sc->flags & FXP_FLAG_EXT_RFA) != 0 && (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) != 0) ? 1 : 0; @@ -2410,11 +2384,17 @@ fxp_init_body(struct fxp_softc *sc) fxp_scb_wait(sc); bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->fxp_desc.cbl_addr); fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START); /* ...and wait for it to complete. */ fxp_dma_wait(sc, &cb_ias->cb_status, sc->cbl_tag, sc->cbl_map); /* + * Initialize the multicast address list. + */ + fxp_mc_setup(sc); + + /* * Initialize transmit control block (TxCB) list. */ txp = sc->fxp_desc.tx_list; @@ -2445,6 +2425,7 @@ fxp_init_body(struct fxp_softc *sc) sc->tx_queued = 1; fxp_scb_wait(sc); + CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->fxp_desc.cbl_addr); fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START); /* @@ -2725,11 +2706,6 @@ fxp_ioctl(struct ifnet *ifp, u_long comm switch (command) { case SIOCSIFFLAGS: FXP_LOCK(sc); - if (ifp->if_flags & IFF_ALLMULTI) - sc->flags |= FXP_FLAG_ALL_MCAST; - else - sc->flags &= ~FXP_FLAG_ALL_MCAST; - /* * If interface is marked up and not running, then start it. * If it is marked down and running, stop it. @@ -2737,35 +2713,24 @@ fxp_ioctl(struct ifnet *ifp, u_long comm * such as IFF_PROMISC are handled. */ if (ifp->if_flags & IFF_UP) { - fxp_init_body(sc); + if (((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) && + ((ifp->if_flags ^ sc->if_flags) & + (IFF_PROMISC | IFF_ALLMULTI | IFF_LINK0)) != 0) + fxp_init_body(sc); + else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + fxp_init_body(sc); } else { - if (ifp->if_drv_flags & IFF_DRV_RUNNING) + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) fxp_stop(sc); } + sc->if_flags = ifp->if_flags; FXP_UNLOCK(sc); break; case SIOCADDMULTI: case SIOCDELMULTI: - FXP_LOCK(sc); - if (ifp->if_flags & IFF_ALLMULTI) - sc->flags |= FXP_FLAG_ALL_MCAST; - else - sc->flags &= ~FXP_FLAG_ALL_MCAST; - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if ((sc->flags & FXP_FLAG_ALL_MCAST) == 0) - fxp_mc_setup(sc); - /* - * fxp_mc_setup() can set FXP_FLAG_ALL_MCAST, so check it - * again rather than else {}. - */ - if (sc->flags & FXP_FLAG_ALL_MCAST) - fxp_init_body(sc); - FXP_UNLOCK(sc); - error = 0; + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + fxp_init(sc); break; case SIOCSIFMEDIA: @@ -2869,13 +2834,13 @@ fxp_mc_addrs(struct fxp_softc *sc) int nmcasts; nmcasts = 0; - if ((sc->flags & FXP_FLAG_ALL_MCAST) == 0) { + if ((ifp->if_flags & IFF_ALLMULTI) == 0) { IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (nmcasts >= MAXMCADDR) { - sc->flags |= FXP_FLAG_ALL_MCAST; + ifp->if_flags |= IFF_ALLMULTI; nmcasts = 0; break; } @@ -2900,87 +2865,28 @@ fxp_mc_addrs(struct fxp_softc *sc) * points to the TxCB ring, but the mcsetup descriptor itself is not part * of it. We then can do 'CU_START' on the mcsetup descriptor and have it * lead into the regular TxCB ring when it completes. - * - * This function must be called at splimp. */ static void fxp_mc_setup(struct fxp_softc *sc) { - struct fxp_cb_mcs *mcsp = sc->mcsp; - struct fxp_tx *txp; + struct fxp_cb_mcs *mcsp; int count; FXP_LOCK_ASSERT(sc, MA_OWNED); - /* - * If there are queued commands, we must wait until they are all - * completed. If we are already waiting, then add a NOP command - * with interrupt option so that we're notified when all commands - * have been completed - fxp_start() ensures that no additional - * TX commands will be added when need_mcsetup is true. - */ - if (sc->tx_queued) { - /* - * need_mcsetup will be true if we are already waiting for the - * NOP command to be completed (see below). In this case, bail. - */ - if (sc->need_mcsetup) - return; - sc->need_mcsetup = 1; - - /* - * Add a NOP command with interrupt so that we are notified - * when all TX commands have been processed. - */ - txp = sc->fxp_desc.tx_last->tx_next; - txp->tx_mbuf = NULL; - txp->tx_cb->cb_status = 0; - txp->tx_cb->cb_command = htole16(FXP_CB_COMMAND_NOP | - FXP_CB_COMMAND_S | FXP_CB_COMMAND_I); - /* - * Advance the end of list forward. - */ - sc->fxp_desc.tx_last->tx_cb->cb_command &= - htole16(~FXP_CB_COMMAND_S); - bus_dmamap_sync(sc->cbl_tag, sc->cbl_map, BUS_DMASYNC_PREWRITE); - sc->fxp_desc.tx_last = txp; - sc->tx_queued++; - /* - * Issue a resume in case the CU has just suspended. - */ - fxp_scb_wait(sc); - fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_RESUME); - /* - * Set a 5 second timer just in case we don't hear from the - * card again. - */ - sc->watchdog_timer = 5; - - return; - } - sc->need_mcsetup = 0; - /* - * Initialize multicast setup descriptor. - */ + mcsp = sc->mcsp; mcsp->cb_status = 0; - mcsp->cb_command = htole16(FXP_CB_COMMAND_MCAS | - FXP_CB_COMMAND_S | FXP_CB_COMMAND_I); - mcsp->link_addr = htole32(sc->fxp_desc.cbl_addr); - txp = &sc->fxp_desc.mcs_tx; - txp->tx_mbuf = NULL; - txp->tx_cb = (struct fxp_cb_tx *)sc->mcsp; - txp->tx_next = sc->fxp_desc.tx_list; - (void) fxp_mc_addrs(sc); - sc->fxp_desc.tx_first = sc->fxp_desc.tx_last = txp; - sc->tx_queued = 1; + mcsp->cb_command = htole16(FXP_CB_COMMAND_MCAS | FXP_CB_COMMAND_EL); + mcsp->link_addr = 0xffffffff; + fxp_mc_addrs(sc); /* - * Wait until command unit is not active. This should never - * be the case when nothing is queued, but make sure anyway. + * Wait until command unit is idle. This should never be the + * case when nothing is queued, but make sure anyway. */ count = 100; - while ((CSR_READ_1(sc, FXP_CSR_SCB_RUSCUS) >> 6) == - FXP_SCB_CUS_ACTIVE && --count) + while ((CSR_READ_1(sc, FXP_CSR_SCB_RUSCUS) >> 6) != + FXP_SCB_CUS_IDLE && --count) DELAY(10); if (count == 0) { device_printf(sc->dev, "command queue timeout\n"); @@ -2995,9 +2901,8 @@ fxp_mc_setup(struct fxp_softc *sc) BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->mcs_addr); fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START); - - sc->watchdog_timer = 2; - return; + /* ...and wait for it to complete. */ + fxp_dma_wait(sc, &mcsp->cb_status, sc->mcs_tag, sc->mcs_map); } static uint32_t fxp_ucode_d101a[] = D101_A_RCVBUNDLE_UCODE; Modified: head/sys/dev/fxp/if_fxpvar.h ============================================================================== --- head/sys/dev/fxp/if_fxpvar.h Sun Jun 21 06:46:32 2009 (r194572) +++ head/sys/dev/fxp/if_fxpvar.h Sun Jun 21 07:17:49 2009 (r194573) @@ -165,7 +165,6 @@ struct fxp_softc { int maxtxseg; /* maximum # of TX segments */ int maxsegsize; /* maximum size of a TX segment */ int tx_queued; /* # of active TxCB's */ - int need_mcsetup; /* multicast filter needs programming */ struct fxp_stats *fxp_stats; /* Pointer to interface stats */ uint32_t stats_addr; /* DMA address of the stats structure */ int rx_idle_secs; /* # of seconds RX has been idle */ @@ -185,6 +184,7 @@ struct fxp_softc { int cu_resume_bug; int revision; int flags; + int if_flags; uint8_t rfa_size; uint32_t tx_cmd; }; @@ -195,7 +195,6 @@ struct fxp_softc { #define FXP_FLAG_EXT_TXCB 0x0008 /* enable use of extended TXCB */ #define FXP_FLAG_SERIAL_MEDIA 0x0010 /* 10Mbps serial interface */ #define FXP_FLAG_LONG_PKT_EN 0x0020 /* enable long packet reception */ -#define FXP_FLAG_ALL_MCAST 0x0040 /* accept all multicast frames */ #define FXP_FLAG_CU_RESUME_BUG 0x0080 /* requires workaround for CU_RESUME */ #define FXP_FLAG_UCODE 0x0100 /* ucode is loaded */ #define FXP_FLAG_DEFERRED_RNR 0x0200 /* DEVICE_POLLING deferred RNR */ From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 07:34:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 25C4E106566C; Sun, 21 Jun 2009 07:34:13 +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 12CE28FC19; Sun, 21 Jun 2009 07:34:13 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5L7YCaW099134; Sun, 21 Jun 2009 07:34:12 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5L7YC36099131; Sun, 21 Jun 2009 07:34:12 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200906210734.n5L7YC36099131@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 21 Jun 2009 07:34:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194574 - head/sys/dev/fxp X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 07:34:13 -0000 Author: yongari Date: Sun Jun 21 07:34:12 2009 New Revision: 194574 URL: http://svn.freebsd.org/changeset/base/194574 Log: For ICH based fxp(4) controllers treat them as 82559 compatibles. To detect which controller is ICH based one, add a new member variable ich to struct fxp_ident and move the struct to if_fxpvar.h. Since I've faked controller revision, don't allow microcode loading for ICH based controllers. With this change all ICH based controllers will have WOL and Rx checksum offload capability. PR: kern/135451 Tested by: Alexey Shuvaev ( shuvaev <> physik dot uni-wuerzburg dot de ), pluknet ( pluknet <> gmail dot com ), Gary Jennejohn ( gary.jennejohn <> freenet dot de ) Modified: head/sys/dev/fxp/if_fxp.c head/sys/dev/fxp/if_fxpvar.h Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Sun Jun 21 07:17:49 2009 (r194573) +++ head/sys/dev/fxp/if_fxp.c Sun Jun 21 07:34:12 2009 (r194574) @@ -140,12 +140,6 @@ static u_char fxp_cb_config_template[] = 0x5 /* 21 */ }; -struct fxp_ident { - uint16_t devid; - int16_t revid; /* -1 matches anything */ - char *name; -}; - /* * Claim various Intel PCI device identifiers for this driver. The * sub-vendor and sub-device field are extensively used to identify @@ -153,52 +147,52 @@ struct fxp_ident { * them. */ static struct fxp_ident fxp_ident_table[] = { - { 0x1029, -1, "Intel 82559 PCI/CardBus Pro/100" }, - { 0x1030, -1, "Intel 82559 Pro/100 Ethernet" }, - { 0x1031, -1, "Intel 82801CAM (ICH3) Pro/100 VE Ethernet" }, - { 0x1032, -1, "Intel 82801CAM (ICH3) Pro/100 VE Ethernet" }, - { 0x1033, -1, "Intel 82801CAM (ICH3) Pro/100 VM Ethernet" }, - { 0x1034, -1, "Intel 82801CAM (ICH3) Pro/100 VM Ethernet" }, - { 0x1035, -1, "Intel 82801CAM (ICH3) Pro/100 Ethernet" }, - { 0x1036, -1, "Intel 82801CAM (ICH3) Pro/100 Ethernet" }, - { 0x1037, -1, "Intel 82801CAM (ICH3) Pro/100 Ethernet" }, - { 0x1038, -1, "Intel 82801CAM (ICH3) Pro/100 VM Ethernet" }, - { 0x1039, -1, "Intel 82801DB (ICH4) Pro/100 VE Ethernet" }, - { 0x103A, -1, "Intel 82801DB (ICH4) Pro/100 Ethernet" }, - { 0x103B, -1, "Intel 82801DB (ICH4) Pro/100 VM Ethernet" }, - { 0x103C, -1, "Intel 82801DB (ICH4) Pro/100 Ethernet" }, - { 0x103D, -1, "Intel 82801DB (ICH4) Pro/100 VE Ethernet" }, - { 0x103E, -1, "Intel 82801DB (ICH4) Pro/100 VM Ethernet" }, - { 0x1050, -1, "Intel 82801BA (D865) Pro/100 VE Ethernet" }, - { 0x1051, -1, "Intel 82562ET (ICH5/ICH5R) Pro/100 VE Ethernet" }, - { 0x1059, -1, "Intel 82551QM Pro/100 M Mobile Connection" }, - { 0x1064, -1, "Intel 82562EZ (ICH6)" }, - { 0x1065, -1, "Intel 82562ET/EZ/GT/GZ PRO/100 VE Ethernet" }, - { 0x1068, -1, "Intel 82801FBM (ICH6-M) Pro/100 VE Ethernet" }, - { 0x1069, -1, "Intel 82562EM/EX/GX Pro/100 Ethernet" }, - { 0x1091, -1, "Intel 82562GX Pro/100 Ethernet" }, - { 0x1092, -1, "Intel Pro/100 VE Network Connection" }, - { 0x1093, -1, "Intel Pro/100 VM Network Connection" }, - { 0x1094, -1, "Intel Pro/100 946GZ (ICH7) Network Connection" }, - { 0x1209, -1, "Intel 82559ER Embedded 10/100 Ethernet" }, - { 0x1229, 0x01, "Intel 82557 Pro/100 Ethernet" }, - { 0x1229, 0x02, "Intel 82557 Pro/100 Ethernet" }, - { 0x1229, 0x03, "Intel 82557 Pro/100 Ethernet" }, - { 0x1229, 0x04, "Intel 82558 Pro/100 Ethernet" }, - { 0x1229, 0x05, "Intel 82558 Pro/100 Ethernet" }, - { 0x1229, 0x06, "Intel 82559 Pro/100 Ethernet" }, - { 0x1229, 0x07, "Intel 82559 Pro/100 Ethernet" }, - { 0x1229, 0x08, "Intel 82559 Pro/100 Ethernet" }, - { 0x1229, 0x09, "Intel 82559ER Pro/100 Ethernet" }, - { 0x1229, 0x0c, "Intel 82550 Pro/100 Ethernet" }, - { 0x1229, 0x0d, "Intel 82550 Pro/100 Ethernet" }, - { 0x1229, 0x0e, "Intel 82550 Pro/100 Ethernet" }, - { 0x1229, 0x0f, "Intel 82551 Pro/100 Ethernet" }, - { 0x1229, 0x10, "Intel 82551 Pro/100 Ethernet" }, - { 0x1229, -1, "Intel 82557/8/9 Pro/100 Ethernet" }, - { 0x2449, -1, "Intel 82801BA/CAM (ICH2/3) Pro/100 Ethernet" }, - { 0x27dc, -1, "Intel 82801GB (ICH7) 10/100 Ethernet" }, - { 0, -1, NULL }, + { 0x1029, -1, 0, "Intel 82559 PCI/CardBus Pro/100" }, + { 0x1030, -1, 0, "Intel 82559 Pro/100 Ethernet" }, + { 0x1031, -1, 3, "Intel 82801CAM (ICH3) Pro/100 VE Ethernet" }, + { 0x1032, -1, 3, "Intel 82801CAM (ICH3) Pro/100 VE Ethernet" }, + { 0x1033, -1, 3, "Intel 82801CAM (ICH3) Pro/100 VM Ethernet" }, + { 0x1034, -1, 3, "Intel 82801CAM (ICH3) Pro/100 VM Ethernet" }, + { 0x1035, -1, 3, "Intel 82801CAM (ICH3) Pro/100 Ethernet" }, + { 0x1036, -1, 3, "Intel 82801CAM (ICH3) Pro/100 Ethernet" }, + { 0x1037, -1, 3, "Intel 82801CAM (ICH3) Pro/100 Ethernet" }, + { 0x1038, -1, 3, "Intel 82801CAM (ICH3) Pro/100 VM Ethernet" }, + { 0x1039, -1, 4, "Intel 82801DB (ICH4) Pro/100 VE Ethernet" }, + { 0x103A, -1, 4, "Intel 82801DB (ICH4) Pro/100 Ethernet" }, + { 0x103B, -1, 4, "Intel 82801DB (ICH4) Pro/100 VM Ethernet" }, + { 0x103C, -1, 4, "Intel 82801DB (ICH4) Pro/100 Ethernet" }, + { 0x103D, -1, 4, "Intel 82801DB (ICH4) Pro/100 VE Ethernet" }, + { 0x103E, -1, 4, "Intel 82801DB (ICH4) Pro/100 VM Ethernet" }, + { 0x1050, -1, 5, "Intel 82801BA (D865) Pro/100 VE Ethernet" }, + { 0x1051, -1, 5, "Intel 82562ET (ICH5/ICH5R) Pro/100 VE Ethernet" }, + { 0x1059, -1, 0, "Intel 82551QM Pro/100 M Mobile Connection" }, + { 0x1064, -1, 6, "Intel 82562EZ (ICH6)" }, + { 0x1065, -1, 6, "Intel 82562ET/EZ/GT/GZ PRO/100 VE Ethernet" }, + { 0x1068, -1, 6, "Intel 82801FBM (ICH6-M) Pro/100 VE Ethernet" }, + { 0x1069, -1, 6, "Intel 82562EM/EX/GX Pro/100 Ethernet" }, + { 0x1091, -1, 7, "Intel 82562GX Pro/100 Ethernet" }, + { 0x1092, -1, 7, "Intel Pro/100 VE Network Connection" }, + { 0x1093, -1, 7, "Intel Pro/100 VM Network Connection" }, + { 0x1094, -1, 7, "Intel Pro/100 946GZ (ICH7) Network Connection" }, + { 0x1209, -1, 0, "Intel 82559ER Embedded 10/100 Ethernet" }, + { 0x1229, 0x01, 0, "Intel 82557 Pro/100 Ethernet" }, + { 0x1229, 0x02, 0, "Intel 82557 Pro/100 Ethernet" }, + { 0x1229, 0x03, 0, "Intel 82557 Pro/100 Ethernet" }, + { 0x1229, 0x04, 0, "Intel 82558 Pro/100 Ethernet" }, + { 0x1229, 0x05, 0, "Intel 82558 Pro/100 Ethernet" }, + { 0x1229, 0x06, 0, "Intel 82559 Pro/100 Ethernet" }, + { 0x1229, 0x07, 0, "Intel 82559 Pro/100 Ethernet" }, + { 0x1229, 0x08, 0, "Intel 82559 Pro/100 Ethernet" }, + { 0x1229, 0x09, 0, "Intel 82559ER Pro/100 Ethernet" }, + { 0x1229, 0x0c, 0, "Intel 82550 Pro/100 Ethernet" }, + { 0x1229, 0x0d, 0, "Intel 82550 Pro/100 Ethernet" }, + { 0x1229, 0x0e, 0, "Intel 82550 Pro/100 Ethernet" }, + { 0x1229, 0x0f, 0, "Intel 82551 Pro/100 Ethernet" }, + { 0x1229, 0x10, 0, "Intel 82551 Pro/100 Ethernet" }, + { 0x1229, -1, 0, "Intel 82557/8/9 Pro/100 Ethernet" }, + { 0x2449, -1, 2, "Intel 82801BA/CAM (ICH2/3) Pro/100 Ethernet" }, + { 0x27dc, -1, 7, "Intel 82801GB (ICH7) 10/100 Ethernet" }, + { 0, -1, 0, NULL }, }; #ifdef FXP_IP_CSUM_WAR @@ -214,6 +208,7 @@ static int fxp_shutdown(device_t dev); static int fxp_suspend(device_t dev); static int fxp_resume(device_t dev); +static struct fxp_ident *fxp_find_ident(device_t dev); static void fxp_intr(void *xsc); static void fxp_rxcsum(struct fxp_softc *sc, struct ifnet *ifp, struct mbuf *m, uint16_t status, int pos); @@ -360,11 +355,8 @@ fxp_dma_wait(struct fxp_softc *sc, volat device_printf(sc->dev, "DMA timeout\n"); } -/* - * Return identification string if this device is ours. - */ -static int -fxp_probe(device_t dev) +static struct fxp_ident * +fxp_find_ident(device_t dev) { uint16_t devid; uint8_t revid; @@ -376,11 +368,26 @@ fxp_probe(device_t dev) for (ident = fxp_ident_table; ident->name != NULL; ident++) { if (ident->devid == devid && (ident->revid == revid || ident->revid == -1)) { - device_set_desc(dev, ident->name); - return (BUS_PROBE_DEFAULT); + return (ident); } } } + return (NULL); +} + +/* + * Return identification string if this device is ours. + */ +static int +fxp_probe(device_t dev) +{ + struct fxp_ident *ident; + + ident = fxp_find_ident(dev); + if (ident != NULL) { + device_set_desc(dev, ident->name); + return (BUS_PROBE_DEFAULT); + } return (ENXIO); } @@ -483,11 +490,17 @@ fxp_attach(device_t dev) /* * Find out the chip revision; lump all 82557 revs together. */ - fxp_read_eeprom(sc, &data, 5, 1); - if ((data >> 8) == 1) - sc->revision = FXP_REV_82557; - else - sc->revision = pci_get_revid(dev); + sc->ident = fxp_find_ident(dev); + if (sc->ident->ich > 0) { + /* Assume ICH controllers are 82559. */ + sc->revision = FXP_REV_82559_A0; + } else { + fxp_read_eeprom(sc, &data, 5, 1); + if ((data >> 8) == 1) + sc->revision = FXP_REV_82557; + else + sc->revision = pci_get_revid(dev); + } /* * Check availability of WOL. 82559ER does not support WOL. @@ -560,9 +573,8 @@ fxp_attach(device_t dev) * * See Intel 82801BA/82801BAM Specification Update, Errata #30. */ - i = pci_get_device(dev); - if (i == 0x2449 || (i > 0x1030 && i < 0x1039) || - sc->revision >= FXP_REV_82559_A0) { + if ((sc->ident->ich >= 2 && sc->ident->ich <= 3) || + (sc->ident->ich == 0 && sc->revision >= FXP_REV_82559_A0)) { fxp_read_eeprom(sc, &data, 10, 1); if (data & 0x02) { /* STB enable */ uint16_t cksum; @@ -2246,9 +2258,13 @@ fxp_init_body(struct fxp_softc *sc) /* * Attempt to load microcode if requested. + * For ICH based controllers do not load microcode. */ - if (ifp->if_flags & IFF_LINK0 && (sc->flags & FXP_FLAG_UCODE) == 0) - fxp_load_ucode(sc); + if (sc->ident->ich == 0) { + if (ifp->if_flags & IFF_LINK0 && + (sc->flags & FXP_FLAG_UCODE) == 0) + fxp_load_ucode(sc); + } /* * Set IFF_ALLMULTI status. It's needed in configure action Modified: head/sys/dev/fxp/if_fxpvar.h ============================================================================== --- head/sys/dev/fxp/if_fxpvar.h Sun Jun 21 07:17:49 2009 (r194573) +++ head/sys/dev/fxp/if_fxpvar.h Sun Jun 21 07:34:12 2009 (r194574) @@ -142,6 +142,13 @@ struct fxp_desc_list { bus_dma_tag_t rx_tag; }; +struct fxp_ident { + uint16_t devid; + int16_t revid; /* -1 matches anything */ + uint8_t ich; + char *name; +}; + /* * NOTE: Elements are ordered for optimal cacheline behavior, and NOT * for functional grouping. @@ -151,6 +158,7 @@ struct fxp_softc { struct resource *fxp_res[2]; /* I/O and IRQ resources */ struct resource_spec *fxp_spec; /* the resource spec we used */ void *ih; /* interrupt handler cookie */ + struct fxp_ident *ident; struct mtx sc_mtx; bus_dma_tag_t fxp_txmtag; /* bus DMA tag for Tx mbufs */ bus_dma_tag_t fxp_rxmtag; /* bus DMA tag for Rx mbufs */ From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 07:54:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49268106564A; Sun, 21 Jun 2009 07:54:48 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 374BB8FC0A; Sun, 21 Jun 2009 07:54:48 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5L7smbO099525; Sun, 21 Jun 2009 07:54:48 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5L7smrr099523; Sun, 21 Jun 2009 07:54:48 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200906210754.n5L7smrr099523@svn.freebsd.org> From: Roman Divacky Date: Sun, 21 Jun 2009 07:54: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: r194575 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 07:54:48 -0000 Author: rdivacky Date: Sun Jun 21 07:54:47 2009 New Revision: 194575 URL: http://svn.freebsd.org/changeset/base/194575 Log: In non-debugging mode make this define (void)0 instead of nothing. This helps to catch bugs like the below with clang. if (cond); <--- note the trailing ; something(); Approved by: ed (mentor) Discussed on: current@ Modified: head/sys/kern/sysv_msg.c Modified: head/sys/kern/sysv_msg.c ============================================================================== --- head/sys/kern/sysv_msg.c Sun Jun 21 07:34:12 2009 (r194574) +++ head/sys/kern/sysv_msg.c Sun Jun 21 07:54:47 2009 (r194575) @@ -80,7 +80,7 @@ static int sysvmsg_modload(struct module #ifdef MSG_DEBUG #define DPRINTF(a) printf a #else -#define DPRINTF(a) +#define DPRINTF(a) (void)0 #endif static void msg_freehdr(struct msg *msghdr); From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 08:36:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 470B5106564A; Sun, 21 Jun 2009 08:36:31 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 354C98FC19; Sun, 21 Jun 2009 08:36:31 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5L8aV5h000459; Sun, 21 Jun 2009 08:36:31 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5L8aVWs000457; Sun, 21 Jun 2009 08:36:31 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200906210836.n5L8aVWs000457@svn.freebsd.org> From: Roman Divacky Date: Sun, 21 Jun 2009 08:36:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194576 - head/sys/fs/ntfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 08:36:31 -0000 Author: rdivacky Date: Sun Jun 21 08:36:30 2009 New Revision: 194576 URL: http://svn.freebsd.org/changeset/base/194576 Log: In non-debugging mode make this define (void)0 instead of nothing. This helps to catch bugs like the below with clang. if (cond); <--- note the trailing ; something(); Approved by: ed (mentor) Discussed on: current@ Modified: head/sys/fs/ntfs/ntfs.h Modified: head/sys/fs/ntfs/ntfs.h ============================================================================== --- head/sys/fs/ntfs/ntfs.h Sun Jun 21 07:54:47 2009 (r194575) +++ head/sys/fs/ntfs/ntfs.h Sun Jun 21 08:36:30 2009 (r194576) @@ -296,11 +296,11 @@ MALLOC_DECLARE(M_NTFSNTHASH); #if NTFS_DEBUG > 1 #define ddprintf(a) printf a #else -#define ddprintf(a) +#define ddprintf(a) (void)0 #endif #else -#define dprintf(a) -#define ddprintf(a) +#define dprintf(a) (void)0 +#define ddprintf(a) (void)0 #endif extern struct vop_vector ntfs_vnodeops; From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 08:49:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 047B9106564A; Sun, 21 Jun 2009 08:49:07 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D08FB8FC1E; Sun, 21 Jun 2009 08:49:06 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5L8n6Hw000743; Sun, 21 Jun 2009 08:49:06 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5L8n6Ki000741; Sun, 21 Jun 2009 08:49:06 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200906210849.n5L8n6Ki000741@svn.freebsd.org> From: Roman Divacky Date: Sun, 21 Jun 2009 08:49:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194577 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 08:49:07 -0000 Author: rdivacky Date: Sun Jun 21 08:49:06 2009 New Revision: 194577 URL: http://svn.freebsd.org/changeset/base/194577 Log: In non-debugging mode make this define (void)0 instead of nothing. This helps to catch bugs like the below with clang. if (cond); <--- note the trailing ; something(); Approved by: ed (mentor) Discussed on: current@ Modified: head/sys/net/bridgestp.c Modified: head/sys/net/bridgestp.c ============================================================================== --- head/sys/net/bridgestp.c Sun Jun 21 08:36:30 2009 (r194576) +++ head/sys/net/bridgestp.c Sun Jun 21 08:49:06 2009 (r194577) @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$"); #ifdef BRIDGESTP_DEBUG #define DPRINTF(fmt, arg...) printf("bstp: " fmt, ##arg) #else -#define DPRINTF(fmt, arg...) +#define DPRINTF(fmt, arg...) (void)0 #endif #define PV2ADDR(pv, eaddr) do { \ From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 09:01:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A415106566C; Sun, 21 Jun 2009 09:01:12 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D6F78FC19; Sun, 21 Jun 2009 09:01:12 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5L91C4o001055; Sun, 21 Jun 2009 09:01:12 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5L91CrW001048; Sun, 21 Jun 2009 09:01:12 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200906210901.n5L91CrW001048@svn.freebsd.org> From: Roman Divacky Date: Sun, 21 Jun 2009 09:01:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194578 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 09:01:12 -0000 Author: rdivacky Date: Sun Jun 21 09:01:12 2009 New Revision: 194578 URL: http://svn.freebsd.org/changeset/base/194578 Log: In non-debugging mode make this define (void)0 instead of nothing. This helps to catch bugs like the below with clang. if (cond); <--- note the trailing ; something(); Approved by: ed (mentor) Discussed on: current@ Modified: head/sys/sys/ktr.h head/sys/sys/lock.h head/sys/sys/lock_profile.h head/sys/sys/mutex.h head/sys/sys/sched.h head/sys/sys/sx.h Modified: head/sys/sys/ktr.h ============================================================================== --- head/sys/sys/ktr.h Sun Jun 21 08:49:06 2009 (r194577) +++ head/sys/sys/ktr.h Sun Jun 21 09:01:12 2009 (r194578) @@ -147,13 +147,13 @@ void ktr_tracepoint(u_int mask, const ch #define CTR4(m, format, p1, p2, p3, p4) CTR6(m, format, p1, p2, p3, p4, 0, 0) #define CTR5(m, format, p1, p2, p3, p4, p5) CTR6(m, format, p1, p2, p3, p4, p5, 0) #else /* KTR */ -#define CTR0(m, d) -#define CTR1(m, d, p1) -#define CTR2(m, d, p1, p2) -#define CTR3(m, d, p1, p2, p3) -#define CTR4(m, d, p1, p2, p3, p4) -#define CTR5(m, d, p1, p2, p3, p4, p5) -#define CTR6(m, d, p1, p2, p3, p4, p5, p6) +#define CTR0(m, d) (void)0 +#define CTR1(m, d, p1) (void)0 +#define CTR2(m, d, p1, p2) (void)0 +#define CTR3(m, d, p1, p2, p3) (void)0 +#define CTR4(m, d, p1, p2, p3, p4) (void)0 +#define CTR5(m, d, p1, p2, p3, p4, p5) (void)0 +#define CTR6(m, d, p1, p2, p3, p4, p5, p6) (void)0 #endif /* KTR */ #define TR0(d) CTR0(KTR_GEN, d) Modified: head/sys/sys/lock.h ============================================================================== --- head/sys/sys/lock.h Sun Jun 21 08:49:06 2009 (r194577) +++ head/sys/sys/lock.h Sun Jun 21 09:01:12 2009 (r194578) @@ -283,21 +283,21 @@ void witness_thread_exit(struct thread * witness_line(lock) #else /* WITNESS */ -#define WITNESS_INIT(lock, type) -#define WITNESS_DESTROY(lock) +#define WITNESS_INIT(lock, type) (void)0 +#define WITNESS_DESTROY(lock) (void)0 #define WITNESS_DEFINEORDER(lock1, lock2) 0 -#define WITNESS_CHECKORDER(lock, flags, file, line, interlock) -#define WITNESS_LOCK(lock, flags, file, line) -#define WITNESS_UPGRADE(lock, flags, file, line) -#define WITNESS_DOWNGRADE(lock, flags, file, line) -#define WITNESS_UNLOCK(lock, flags, file, line) +#define WITNESS_CHECKORDER(lock, flags, file, line, interlock) (void)0 +#define WITNESS_LOCK(lock, flags, file, line) (void)0 +#define WITNESS_UPGRADE(lock, flags, file, line) (void)0 +#define WITNESS_DOWNGRADE(lock, flags, file, line) (void)0 +#define WITNESS_UNLOCK(lock, flags, file, line) (void)0 #define WITNESS_CHECK(flags, lock, fmt, ...) 0 -#define WITNESS_WARN(flags, lock, fmt, ...) -#define WITNESS_SAVE_DECL(n) -#define WITNESS_SAVE(lock, n) -#define WITNESS_RESTORE(lock, n) -#define WITNESS_NORELEASE(lock) -#define WITNESS_RELEASEOK(lock) +#define WITNESS_WARN(flags, lock, fmt, ...) (void)0 +#define WITNESS_SAVE_DECL(n) (void)0 +#define WITNESS_SAVE(lock, n) (void)0 +#define WITNESS_RESTORE(lock, n) (void)0 +#define WITNESS_NORELEASE(lock) (void)0 +#define WITNESS_RELEASEOK(lock) (void)0 #define WITNESS_FILE(lock) ("?") #define WITNESS_LINE(lock) (0) #endif /* WITNESS */ Modified: head/sys/sys/lock_profile.h ============================================================================== --- head/sys/sys/lock_profile.h Sun Jun 21 08:49:06 2009 (r194577) +++ head/sys/sys/lock_profile.h Sun Jun 21 09:01:12 2009 (r194578) @@ -63,10 +63,10 @@ lock_profile_obtain_lock_failed(struct l #else /* !LOCK_PROFILING */ -#define lock_profile_release_lock(lo) -#define lock_profile_obtain_lock_failed(lo, contested, waittime) -#define lock_profile_obtain_lock_success(lo, contested, waittime, file, line) -#define lock_profile_thread_exit(td) +#define lock_profile_release_lock(lo) (void)0 +#define lock_profile_obtain_lock_failed(lo, contested, waittime) (void)0 +#define lock_profile_obtain_lock_success(lo, contested, waittime, file, line) (void)0 +#define lock_profile_thread_exit(td) (void)0 #endif /* !LOCK_PROFILING */ Modified: head/sys/sys/mutex.h ============================================================================== --- head/sys/sys/mutex.h Sun Jun 21 08:49:06 2009 (r194577) +++ head/sys/sys/mutex.h Sun Jun 21 09:01:12 2009 (r194578) @@ -438,7 +438,7 @@ struct mtx_args { #define GIANT_REQUIRED mtx_assert(&Giant, MA_OWNED) #else /* INVARIANTS */ -#define mtx_assert(m, what) +#define mtx_assert(m, what) (void)0 #define GIANT_REQUIRED #endif /* INVARIANTS */ Modified: head/sys/sys/sched.h ============================================================================== --- head/sys/sys/sched.h Sun Jun 21 08:49:06 2009 (r194577) +++ head/sys/sys/sched.h Sun Jun 21 09:01:12 2009 (r194578) @@ -173,7 +173,7 @@ extern long sched_switch_stats[SWT_COUNT #else #define SCHED_STAT_DEFINE_VAR(name, descr, ptr) #define SCHED_STAT_DEFINE(name, descr) -#define SCHED_STAT_INC(var) +#define SCHED_STAT_INC(var) (void)0 #endif /* Modified: head/sys/sys/sx.h ============================================================================== --- head/sys/sys/sx.h Sun Jun 21 08:49:06 2009 (r194577) +++ head/sys/sys/sx.h Sun Jun 21 09:01:12 2009 (r194578) @@ -293,7 +293,7 @@ __sx_sunlock(struct sx *sx, const char * #ifdef INVARIANTS #define sx_assert(sx, what) _sx_assert((sx), (what), LOCK_FILE, LOCK_LINE) #else -#define sx_assert(sx, what) +#define sx_assert(sx, what) (void)0 #endif #endif /* _KERNEL */ From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 09:39:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 042FF106566C; Sun, 21 Jun 2009 09:39:44 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E55398FC1B; Sun, 21 Jun 2009 09:39:43 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5L9dh7s001793; Sun, 21 Jun 2009 09:39:43 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5L9dhVH001790; Sun, 21 Jun 2009 09:39:43 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906210939.n5L9dhVH001790@svn.freebsd.org> From: Xin LI Date: Sun, 21 Jun 2009 09:39: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: r194579 - head/usr.bin/gzip X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 09:39:44 -0000 Author: delphij Date: Sun Jun 21 09:39:43 2009 New Revision: 194579 URL: http://svn.freebsd.org/changeset/base/194579 Log: Add support for uncompressing pack(1)'ed files. Pack(1) is a program found in some commercial Unix systems, which utilizes Huffman minimum redundancy code tree to compress files. This implementation supports the "new" pack format only, just like GNU gzip did. Thanks for oliver@'s archive set which I can test against, and Mingyan Guo for providing helpful review of my code. PR: bin/109567 MFC after: 1 month Added: head/usr.bin/gzip/unpack.c (contents, props changed) Modified: head/usr.bin/gzip/gzip.c Modified: head/usr.bin/gzip/gzip.c ============================================================================== --- head/usr.bin/gzip/gzip.c Sun Jun 21 09:01:12 2009 (r194578) +++ head/usr.bin/gzip/gzip.c Sun Jun 21 09:39:43 2009 (r194579) @@ -79,6 +79,9 @@ enum filetype { #ifndef NO_COMPRESS_SUPPORT FT_Z, #endif +#ifndef NO_PACK_SUPPORT + FT_PACK, +#endif FT_LAST, FT_UNKNOWN }; @@ -95,6 +98,10 @@ enum filetype { #define Z_MAGIC "\037\235" #endif +#ifndef NO_PACK_SUPPORT +#define PACK_MAGIC "\037\036" +#endif + #define GZ_SUFFIX ".gz" #define BUFLEN (64 * 1024) @@ -143,7 +150,7 @@ static suffixes_t suffixes[] = { }; #define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0]) -static const char gzip_version[] = "FreeBSD gzip 20070711"; +static const char gzip_version[] = "FreeBSD gzip 20090621"; #ifndef SMALL static const char gzip_copyright[] = \ @@ -248,6 +255,10 @@ static FILE *zdopen(int); static off_t zuncompress(FILE *, FILE *, char *, size_t, off_t *); #endif +#ifndef NO_PACK_SUPPORT +static off_t unpack(int, int, char *, size_t, off_t *); +#endif + int main(int, char **p); #ifdef SMALL @@ -1104,6 +1115,11 @@ file_gettype(u_char *buf) return FT_Z; else #endif +#ifndef NO_PACK_SUPPORT + if (memcmp(buf, PACK_MAGIC, 2) == 0) + return FT_PACK; + else +#endif return FT_UNKNOWN; } @@ -1458,6 +1474,17 @@ file_uncompress(char *file, char *outfil } else #endif +#ifndef NO_PACK_SUPPORT + if (method == FT_PACK) { + if (lflag) { + maybe_warnx("no -l with packed files"); + goto lose; + } + + size = unpack(fd, zfd, NULL, 0, NULL); + } else +#endif + #ifndef SMALL if (method == FT_UNKNOWN) { if (lflag) { @@ -1651,6 +1678,12 @@ handle_stdin(void) fclose(in); break; #endif +#ifndef NO_PACK_SUPPORT + case FT_PACK: + usize = unpack(STDIN_FILENO, STDOUT_FILENO, + (char *)header1, sizeof header1, &gsize); + break; +#endif } #ifndef SMALL @@ -2038,6 +2071,9 @@ display_version(void) #ifndef NO_COMPRESS_SUPPORT #include "zuncompress.c" #endif +#ifndef NO_PACK_SUPPORT +#include "unpack.c" +#endif static ssize_t read_retry(int fd, void *buf, size_t sz) Added: head/usr.bin/gzip/unpack.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/gzip/unpack.c Sun Jun 21 09:39:43 2009 (r194579) @@ -0,0 +1,322 @@ +/*- + * Copyright (c) 2009 Xin LI + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* This file is #included by gzip.c */ + +/* + * pack(1) file format: + * + * The first 7 bytes is the header: + * 00, 01 - Signature (US, RS), we already validated it earlier. + * 02..05 - Uncompressed size + * 06 - Level for the huffman tree (<=24) + * + * pack(1) will then store symbols (leaf) nodes count in each huffman + * tree levels, each level would consume 1 byte (See [1]). + * + * After the symbol count table, there is the symbol table, storing + * symbols represented by coresponding leaf node. EOB is not being + * explicitly transmitted (not necessary anyway) in the symbol table. + * + * Compressed data goes after the symbol table. + * + * NOTES + * + * [1] If we count EOB into the symbols, that would mean that we will + * have at most 256 symbols in the huffman tree. pack(1) rejects empty + * file and files that just repeats one character, which means that we + * will have at least 2 symbols. Therefore, pack(1) would reduce the + * last level symbol count by 2 which makes it a number in + * range [0..254], so all levels' symbol count would fit into 1 byte. + */ + +#define PACK_HEADER_LENGTH 7 +#define HTREE_MAXLEVEL 24 + +/* + * unpack descriptor + * + * Represent the huffman tree in a similiar way that pack(1) would + * store in a packed file. We store all symbols in a linear table, + * and store pointers to each level's first symbol. In addition to + * that, maintain two counts for each level: inner nodes count and + * leaf nodes count. + */ +typedef struct { + int symbol_size; /* Size of the symbol table */ + int treelevels; /* Levels for the huffman tree */ + + int *symbolsin; /* Table of leaf symbols count in + each level */ + int *inodesin; /* Table of internal nodes count in + each level */ + + char *symbol; /* The symbol table */ + char *symbol_eob; /* Pointer to the EOB symbol */ + char **tree; /* Decoding huffman tree (pointers to + first symbol of each tree level */ + + off_t uncompressed_size; /* Uncompressed size */ + FILE *fpIn; /* Input stream */ + FILE *fpOut; /* Output stream */ +} unpack_descriptor_t; + +/* + * Release resource allocated to an unpack descriptor. + * + * Caller is responsible to make sure that all of these pointers are + * initialized (in our case, they all point to valid memory block). + * We don't zero out pointers here because nobody else would ever + * reference the memory block without scrubing them. + */ +static void +unpack_descriptor_fini(unpack_descriptor_t *unpackd) +{ + + free(unpackd->symbolsin); + free(unpackd->inodesin); + free(unpackd->symbol); + free(unpackd->tree); + + fclose(unpackd->fpIn); + fclose(unpackd->fpOut); +} + +/* + * Recursively fill the internal node count table + */ +static void +unpackd_fill_inodesin(const unpack_descriptor_t *unpackd, int level) +{ + + /* + * The internal nodes would be 1/2 of total internal nodes and + * leaf nodes in the next level. For the last level there + * would be no internal node by defination. + */ + if (level < unpackd->treelevels) { + unpackd_fill_inodesin(unpackd, level + 1); + unpackd->inodesin[level] = (unpackd->inodesin[level + 1] + + unpackd->symbolsin[level + 1]) / 2; + } else + unpackd->inodesin[level] = 0; +} + +/* + * Update counter for accepted bytes + */ +static void +accepted_bytes(off_t *bytes_in, off_t newbytes) +{ + + if (bytes_in != NULL) + (*bytes_in) += newbytes; +} + +/* + * Read file header and construct the tree. Also, prepare the buffered I/O + * for decode rountine. + * + * Return value is uncompressed size. + */ +static void +unpack_parse_header(int in, int out, char *pre, size_t prelen, off_t *bytes_in, + unpack_descriptor_t *unpackd) +{ + unsigned char hdr[PACK_HEADER_LENGTH]; /* buffer for header */ + ssize_t bytesread; /* Bytes read from the file */ + int i, j, thisbyte; + + /* Prepend the header buffer if we already read some data */ + if (prelen != 0) + memcpy(hdr, pre, prelen); + + /* Read in and fill the rest bytes of header */ + bytesread = read(in, hdr + prelen, PACK_HEADER_LENGTH - prelen); + if (bytesread < 0) + maybe_err("Error reading pack header"); + + accepted_bytes(bytes_in, PACK_HEADER_LENGTH); + + /* Obtain uncompressed length (bytes 2,3,4,5)*/ + unpackd->uncompressed_size = 0; + for (i = 2; i <= 5; i++) { + unpackd->uncompressed_size <<= 8; + unpackd->uncompressed_size |= hdr[i]; + } + + /* Get the levels of the tree */ + unpackd->treelevels = hdr[6]; + if (unpackd->treelevels > HTREE_MAXLEVEL || unpackd->treelevels < 1) + maybe_errx("Huffman tree has insane levels"); + + /* Let libc take care for buffering from now on */ + if ((unpackd->fpIn = fdopen(in, "r")) == NULL) + maybe_err("Can not fdopen() input stream"); + if ((unpackd->fpOut = fdopen(out, "w")) == NULL) + maybe_err("Can not fdopen() output stream"); + + /* Allocate for the tables of bounds and the tree itself */ + unpackd->inodesin = + calloc(unpackd->treelevels, sizeof(*(unpackd->inodesin))); + unpackd->symbolsin = + calloc(unpackd->treelevels, sizeof(*(unpackd->symbolsin))); + unpackd->tree = + calloc(unpackd->treelevels, (sizeof (*(unpackd->tree)))); + if (unpackd->inodesin == NULL || unpackd->symbolsin == NULL || + unpackd->tree == NULL) + maybe_err("calloc"); + + /* We count from 0 so adjust to match array upper bound */ + unpackd->treelevels--; + + /* Read the levels symbol count table and caculate total */ + unpackd->symbol_size = 1; /* EOB */ + for (i = 0; i <= unpackd->treelevels; i++) { + if ((thisbyte = fgetc(unpackd->fpIn)) == EOF) + maybe_err("File appears to be truncated"); + unpackd->symbolsin[i] = (unsigned char)thisbyte; + unpackd->symbol_size += unpackd->symbolsin[i]; + } + accepted_bytes(bytes_in, unpackd->treelevels); + if (unpackd->symbol_size > 256) + maybe_errx("Bad symbol table"); + + /* Allocate for the symbol table, point symbol_eob at the beginning */ + unpackd->symbol_eob = unpackd->symbol = calloc(1, unpackd->symbol_size); + if (unpackd->symbol == NULL) + maybe_err("calloc"); + + /* + * Read in the symbol table, which contain [2, 256] symbols. + * In order to fit the count in one byte, pack(1) would offset + * it by reducing 2 from the actual number from the last level. + * + * We adjust the last level's symbol count by 1 here, because + * the EOB symbol is not being transmitted explicitly. Another + * adjustment would be done later afterward. + */ + unpackd->symbolsin[unpackd->treelevels]++; + for (i = 0; i <= unpackd->treelevels; i++) { + unpackd->tree[i] = unpackd->symbol_eob; + for (j = 0; j < unpackd->symbolsin[i]; j++) { + if ((thisbyte = fgetc(unpackd->fpIn)) == EOF) + maybe_errx("Symbol table truncated"); + *unpackd->symbol_eob++ = (char)thisbyte; + } + accepted_bytes(bytes_in, unpackd->symbolsin[i]); + } + + /* Now, take account for the EOB symbol as well */ + unpackd->symbolsin[unpackd->treelevels]++; + + /* + * The symbolsin table has been constructed now. + * Caculate the internal nodes count table based on it. + */ + unpackd_fill_inodesin(unpackd, 0); +} + +/* + * Decode huffman stream, based on the huffman tree. + */ +static void +unpack_decode(const unpack_descriptor_t *unpackd, off_t *bytes_in) +{ + int thislevel, thiscode, thisbyte, inlevelindex; + int i; + off_t bytes_out = 0; + const char *thissymbol; /* The symbol pointer decoded from stream */ + + /* + * Decode huffman. Fetch every bytes from the file, get it + * into 'thiscode' bit-by-bit, then output the symbol we got + * when one has been found. + * + * Assumption: sizeof(int) > ((max tree levels + 1) / 8). + * bad things could happen if not. + */ + thislevel = 0; + thiscode = thisbyte = 0; + + while ((thisbyte = fgetc(unpackd->fpIn)) != EOF) { + accepted_bytes(bytes_in, 1); + + /* + * Split one bit from thisbyte, from highest to lowest, + * feed the bit into thiscode, until we got a symbol from + * the tree. + */ + for (i = 7; i >= 0; i--) { + thiscode = (thiscode << 1) | ((thisbyte >> i) & 1); + + /* Did we got a symbol? (referencing leaf node) */ + if (thiscode >= unpackd->inodesin[thislevel]) { + inlevelindex = + thiscode - unpackd->inodesin[thislevel]; + if (inlevelindex > unpackd->symbolsin[thislevel]) + maybe_errx("File corrupt"); + + thissymbol = + &(unpackd->tree[thislevel][inlevelindex]); + if ((thissymbol == unpackd->symbol_eob) && + (bytes_out == unpackd->uncompressed_size)) + goto finished; + + fputc((*thissymbol), unpackd->fpOut); + bytes_out++; + + /* Prepare for next input */ + thislevel = 0; thiscode = 0; + } else { + thislevel++; + if (thislevel > unpackd->treelevels) + maybe_errx("File corrupt"); + } + } + } + +finished: + if (bytes_out != unpackd->uncompressed_size) + maybe_errx("Premature EOF"); +} + +/* Handler for pack(1)'ed file */ +static off_t +unpack(int in, int out, char *pre, size_t prelen, off_t *bytes_in) +{ + unpack_descriptor_t unpackd; + + unpack_parse_header(dup(in), dup(out), pre, prelen, bytes_in, &unpackd); + unpack_decode(&unpackd, bytes_in); + unpack_descriptor_fini(&unpackd); + + /* If we reached here, the unpack was successful */ + return (unpackd.uncompressed_size); +} + From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 10:10:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 948851065670; Sun, 21 Jun 2009 10:10:44 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 825A68FC17; Sun, 21 Jun 2009 10:10:44 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LAAide002415; Sun, 21 Jun 2009 10:10:44 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LAAijU002410; Sun, 21 Jun 2009 10:10:44 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906211010.n5LAAijU002410@svn.freebsd.org> From: Robert Watson Date: Sun, 21 Jun 2009 10:10: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: r194580 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 10:10:45 -0000 Author: rwatson Date: Sun Jun 21 10:10:44 2009 New Revision: 194580 URL: http://svn.freebsd.org/changeset/base/194580 Log: Remove historical support for capturing IPX packets in the output path using raw IPX sockets. While functional, this support is disabled using a flag that can't be changed from userspace, and google reveals no documentation or use of that flag anywhere. This eliminates a potential lock order reversal and code reentrance issue in which the output path reentered the input path in IPX. An alternative to removal would be to use the netisr, as a comment I added in 2005 suggests. While this change is fairly straight-forward, the lack of any consumers or the easy possibility of consumers (kernel modification and recompile required) suggests that this is simply an unused feature. Update README to remove this TODO, and a TODO regarding IPX/IP encapsulation which was also removed a few years ago. MFC after: 1 week Modified: head/sys/netipx/README head/sys/netipx/ipx_input.c head/sys/netipx/ipx_outputfl.c head/sys/netipx/ipx_var.h Modified: head/sys/netipx/README ============================================================================== --- head/sys/netipx/README Sun Jun 21 09:39:43 2009 (r194579) +++ head/sys/netipx/README Sun Jun 21 10:10:44 2009 (r194580) @@ -39,11 +39,3 @@ Modifications Copyright (c) 2004-2006 Ro but unsent data. As with TCP, it should instead grab its own reference to the socket so that it is not released, as hold onto it until the data transfer is complete. - -(3) Raw socket capture of IPX output intercepts packets in the SPX output - routine in order to feed them back into the raw socket. This results - in recursion into the socket code in the transmit path; instead, - captured packets should be fed into a netisr that reinjects them into - raw sockets from a new (asynchronous) context. - -(4) IPX over IP encapsulation needs work to make it properly MPSAFE. Modified: head/sys/netipx/ipx_input.c ============================================================================== --- head/sys/netipx/ipx_input.c Sun Jun 21 09:39:43 2009 (r194579) +++ head/sys/netipx/ipx_input.c Sun Jun 21 10:10:44 2009 (r194580) @@ -452,53 +452,3 @@ ipx_undo_route(struct route *ro) RTFREE(ro->ro_rt); } } - -/* - * XXXRW: This code should be run in its own netisr dispatch to avoid a call - * back into the socket code from the IPX output path. - */ -void -ipx_watch_output(struct mbuf *m, struct ifnet *ifp) -{ - struct ipxpcb *ipxp; - struct ifaddr *ifa; - struct ipx_ifaddr *ia; - - /* - * Give any raw listeners a crack at the packet - */ - IPX_LIST_LOCK(); - LIST_FOREACH(ipxp, &ipxrawpcb_list, ipxp_list) { - struct mbuf *m0 = m_copy(m, 0, (int)M_COPYALL); - if (m0 != NULL) { - struct ipx *ipx; - - M_PREPEND(m0, sizeof(*ipx), M_DONTWAIT); - if (m0 == NULL) - continue; - ipx = mtod(m0, struct ipx *); - ipx->ipx_sna.x_net = ipx_zeronet; - for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) - if (ifp == ia->ia_ifp) - break; - if (ia == NULL) - ipx->ipx_sna.x_host = ipx_zerohost; - else - ipx->ipx_sna.x_host = - ia->ia_addr.sipx_addr.x_host; - - if (ifp != NULL && (ifp->if_flags & IFF_POINTOPOINT)) - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (ifa->ifa_addr->sa_family == AF_IPX) { - ipx->ipx_sna = IA_SIPX(ifa)->sipx_addr; - break; - } - } - ipx->ipx_len = ntohl(m0->m_pkthdr.len); - IPX_LOCK(ipxp); - ipx_input(m0, ipxp); - IPX_UNLOCK(ipxp); - } - } - IPX_LIST_UNLOCK(); -} Modified: head/sys/netipx/ipx_outputfl.c ============================================================================== --- head/sys/netipx/ipx_outputfl.c Sun Jun 21 09:39:43 2009 (r194579) +++ head/sys/netipx/ipx_outputfl.c Sun Jun 21 10:10:44 2009 (r194580) @@ -74,8 +74,6 @@ __FBSDID("$FreeBSD$"); #include #include -static int ipx_copy_output = 0; - int ipx_outputfl(struct mbuf *m0, struct route *ro, int flags) { @@ -150,9 +148,6 @@ gotif: if (htons(ipx->ipx_len) <= ifp->if_mtu) { ipxstat.ipxs_localout++; - if (ipx_copy_output) { - ipx_watch_output(m0, ifp); - } error = (*ifp->if_output)(ifp, m0, (struct sockaddr *)dst, ro); goto done; @@ -161,9 +156,6 @@ gotif: error = EMSGSIZE; } bad: - if (ipx_copy_output) { - ipx_watch_output(m0, ifp); - } m_freem(m0); done: if (ro == &ipxroute && (flags & IPX_ROUTETOIF) == 0 && Modified: head/sys/netipx/ipx_var.h ============================================================================== --- head/sys/netipx/ipx_var.h Sun Jun 21 09:39:43 2009 (r194579) +++ head/sys/netipx/ipx_var.h Sun Jun 21 10:10:44 2009 (r194580) @@ -124,7 +124,6 @@ int ipx_output_type20(struct mbuf *); int ipx_peeraddr(struct socket *so, struct sockaddr **nam); void ipx_printhost(struct ipx_addr *addr); int ipx_sockaddr(struct socket *so, struct sockaddr **nam); -void ipx_watch_output(struct mbuf *m, struct ifnet *ifp); #endif /* _KERNEL */ From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 10:29:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6B77106566C; Sun, 21 Jun 2009 10:29:31 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D35868FC13; Sun, 21 Jun 2009 10:29:31 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LATVva002867; Sun, 21 Jun 2009 10:29:31 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LATVNu002851; Sun, 21 Jun 2009 10:29:31 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200906211029.n5LATVNu002851@svn.freebsd.org> From: Roman Divacky Date: Sun, 21 Jun 2009 10:29:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194581 - in head/sys: net netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 10:29:32 -0000 Author: rdivacky Date: Sun Jun 21 10:29:31 2009 New Revision: 194581 URL: http://svn.freebsd.org/changeset/base/194581 Log: Switch cmd argument to u_long. This matches what if_ethersubr.c does and allows the code to compile cleanly on amd64 with clang. Reviewed by: rwatson Approved by: ed (mentor) Modified: head/sys/net/fddi.h head/sys/net/firewire.h head/sys/net/if.c head/sys/net/if_arc.h head/sys/net/if_arcsubr.c head/sys/net/if_fddisubr.c head/sys/net/if_fwsubr.c head/sys/net/if_iso88025subr.c head/sys/net/iso88025.h head/sys/netinet/ip_mroute.c head/sys/netinet/ip_mroute.h head/sys/netinet/raw_ip.c head/sys/netinet6/ip6_mroute.c head/sys/netinet6/ip6_mroute.h head/sys/netinet6/raw_ip6.c Modified: head/sys/net/fddi.h ============================================================================== --- head/sys/net/fddi.h Sun Jun 21 10:10:44 2009 (r194580) +++ head/sys/net/fddi.h Sun Jun 21 10:29:31 2009 (r194581) @@ -99,7 +99,7 @@ struct fddi_header { void fddi_ifattach(struct ifnet *, const u_int8_t *, int); void fddi_ifdetach(struct ifnet *, int); -int fddi_ioctl(struct ifnet *, int, caddr_t); +int fddi_ioctl(struct ifnet *, u_long, caddr_t); #endif /* _KERNEL */ #endif /* _NET_FDDI_H_ */ Modified: head/sys/net/firewire.h ============================================================================== --- head/sys/net/firewire.h Sun Jun 21 10:10:44 2009 (r194580) +++ head/sys/net/firewire.h Sun Jun 21 10:29:31 2009 (r194581) @@ -135,7 +135,7 @@ extern void firewire_input(struct ifnet extern void firewire_ifattach(struct ifnet *, struct fw_hwaddr *); extern void firewire_ifdetach(struct ifnet *); extern void firewire_busreset(struct ifnet *); -extern int firewire_ioctl(struct ifnet *, int, caddr_t); +extern int firewire_ioctl(struct ifnet *, u_long, caddr_t); #endif /* !_KERNEL */ Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Sun Jun 21 10:10:44 2009 (r194580) +++ head/sys/net/if.c Sun Jun 21 10:29:31 2009 (r194581) @@ -2382,7 +2382,7 @@ ifioctl(struct socket *so, u_long cmd, c error = (*ifp->if_ioctl)(ifp, cmd, data); #else { - int ocmd = cmd; + u_long ocmd = cmd; switch (cmd) { Modified: head/sys/net/if_arc.h ============================================================================== --- head/sys/net/if_arc.h Sun Jun 21 10:10:44 2009 (r194580) +++ head/sys/net/if_arc.h Sun Jun 21 10:29:31 2009 (r194581) @@ -134,7 +134,7 @@ int arc_isphds(u_int8_t); void arc_input(struct ifnet *, struct mbuf *); int arc_output(struct ifnet *, struct mbuf *, struct sockaddr *, struct route *); -int arc_ioctl(struct ifnet *, int, caddr_t); +int arc_ioctl(struct ifnet *, u_long, caddr_t); void arc_frag_init(struct ifnet *); struct mbuf * arc_frag_next(struct ifnet *); Modified: head/sys/net/if_arcsubr.c ============================================================================== --- head/sys/net/if_arcsubr.c Sun Jun 21 10:10:44 2009 (r194580) +++ head/sys/net/if_arcsubr.c Sun Jun 21 10:29:31 2009 (r194581) @@ -672,7 +672,7 @@ arc_ifdetach(struct ifnet *ifp) } int -arc_ioctl(struct ifnet *ifp, int command, caddr_t data) +arc_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; Modified: head/sys/net/if_fddisubr.c ============================================================================== --- head/sys/net/if_fddisubr.c Sun Jun 21 10:10:44 2009 (r194580) +++ head/sys/net/if_fddisubr.c Sun Jun 21 10:29:31 2009 (r194581) @@ -617,7 +617,7 @@ fddi_ifdetach(ifp, bpf) int fddi_ioctl (ifp, command, data) struct ifnet *ifp; - int command; + u_long command; caddr_t data; { struct ifaddr *ifa; Modified: head/sys/net/if_fwsubr.c ============================================================================== --- head/sys/net/if_fwsubr.c Sun Jun 21 10:10:44 2009 (r194580) +++ head/sys/net/if_fwsubr.c Sun Jun 21 10:29:31 2009 (r194581) @@ -631,7 +631,7 @@ firewire_input(struct ifnet *ifp, struct } int -firewire_ioctl(struct ifnet *ifp, int command, caddr_t data) +firewire_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; Modified: head/sys/net/if_iso88025subr.c ============================================================================== --- head/sys/net/if_iso88025subr.c Sun Jun 21 10:10:44 2009 (r194580) +++ head/sys/net/if_iso88025subr.c Sun Jun 21 10:29:31 2009 (r194581) @@ -149,7 +149,7 @@ iso88025_ifdetach(ifp, bpf) } int -iso88025_ioctl(struct ifnet *ifp, int command, caddr_t data) +iso88025_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct ifaddr *ifa; struct ifreq *ifr; Modified: head/sys/net/iso88025.h ============================================================================== --- head/sys/net/iso88025.h Sun Jun 21 10:10:44 2009 (r194580) +++ head/sys/net/iso88025.h Sun Jun 21 10:29:31 2009 (r194581) @@ -164,7 +164,7 @@ struct iso88025_addr { void iso88025_ifattach (struct ifnet *, const u_int8_t *, int); void iso88025_ifdetach (struct ifnet *, int); -int iso88025_ioctl (struct ifnet *, int , caddr_t ); +int iso88025_ioctl (struct ifnet *, u_long, caddr_t ); int iso88025_output (struct ifnet *, struct mbuf *, struct sockaddr *, struct route *); void iso88025_input (struct ifnet *, struct mbuf *); Modified: head/sys/netinet/ip_mroute.c ============================================================================== --- head/sys/netinet/ip_mroute.c Sun Jun 21 10:10:44 2009 (r194580) +++ head/sys/netinet/ip_mroute.c Sun Jun 21 10:29:31 2009 (r194581) @@ -292,7 +292,7 @@ static int X_ip_mrouter_done(void); static int X_ip_mrouter_get(struct socket *, struct sockopt *); static int X_ip_mrouter_set(struct socket *, struct sockopt *); static int X_legal_vif_num(int); -static int X_mrt_ioctl(int, caddr_t, int); +static int X_mrt_ioctl(u_long, caddr_t, int); static int add_bw_upcall(struct bw_upcall *); static int add_mfc(struct mfcctl2 *); @@ -511,7 +511,7 @@ X_ip_mrouter_get(struct socket *so, stru * Handle ioctl commands to obtain information from the cache */ static int -X_mrt_ioctl(int cmd, caddr_t data, int fibnum __unused) +X_mrt_ioctl(u_long cmd, caddr_t data, int fibnum __unused) { int error = 0; Modified: head/sys/netinet/ip_mroute.h ============================================================================== --- head/sys/netinet/ip_mroute.h Sun Jun 21 10:10:44 2009 (r194580) +++ head/sys/netinet/ip_mroute.h Sun Jun 21 10:29:31 2009 (r194581) @@ -352,7 +352,7 @@ struct sockopt; extern int (*ip_mrouter_set)(struct socket *, struct sockopt *); extern int (*ip_mrouter_get)(struct socket *, struct sockopt *); extern int (*ip_mrouter_done)(void); -extern int (*mrt_ioctl)(int, caddr_t, int); +extern int (*mrt_ioctl)(u_long, caddr_t, int); #endif /* _KERNEL */ Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Sun Jun 21 10:10:44 2009 (r194580) +++ head/sys/netinet/raw_ip.c Sun Jun 21 10:29:31 2009 (r194581) @@ -111,7 +111,7 @@ int (*ip_mrouter_get)(struct socket *, s int (*ip_mrouter_done)(void); int (*ip_mforward)(struct ip *, struct ifnet *, struct mbuf *, struct ip_moptions *); -int (*mrt_ioctl)(int, caddr_t, int); +int (*mrt_ioctl)(u_long, caddr_t, int); int (*legal_vif_num)(int); u_long (*ip_mcast_src)(int); Modified: head/sys/netinet6/ip6_mroute.c ============================================================================== --- head/sys/netinet6/ip6_mroute.c Sun Jun 21 10:10:44 2009 (r194580) +++ head/sys/netinet6/ip6_mroute.c Sun Jun 21 10:29:31 2009 (r194581) @@ -343,7 +343,7 @@ int X_ip6_mforward(struct ip6_hdr *, str int X_ip6_mrouter_done(void); int X_ip6_mrouter_set(struct socket *, struct sockopt *); int X_ip6_mrouter_get(struct socket *, struct sockopt *); -int X_mrt6_ioctl(int, caddr_t); +int X_mrt6_ioctl(u_long, caddr_t); static void pim6_init(void) @@ -449,7 +449,7 @@ X_ip6_mrouter_get(struct socket *so, str * Handle ioctl commands to obtain information from the cache */ int -X_mrt6_ioctl(int cmd, caddr_t data) +X_mrt6_ioctl(u_long cmd, caddr_t data) { int ret; Modified: head/sys/netinet6/ip6_mroute.h ============================================================================== --- head/sys/netinet6/ip6_mroute.h Sun Jun 21 10:10:44 2009 (r194580) +++ head/sys/netinet6/ip6_mroute.h Sun Jun 21 10:29:31 2009 (r194581) @@ -265,7 +265,7 @@ struct rtdetq { /* XXX: rtdetq is also extern int (*ip6_mrouter_set)(struct socket *so, struct sockopt *sopt); extern int (*ip6_mrouter_get)(struct socket *so, struct sockopt *sopt); extern int (*ip6_mrouter_done)(void); -extern int (*mrt6_ioctl)(int, caddr_t); +extern int (*mrt6_ioctl)(u_long, caddr_t); #endif /* _KERNEL */ #endif /* !_NETINET6_IP6_MROUTE_H_ */ Modified: head/sys/netinet6/raw_ip6.c ============================================================================== --- head/sys/netinet6/raw_ip6.c Sun Jun 21 10:10:44 2009 (r194580) +++ head/sys/netinet6/raw_ip6.c Sun Jun 21 10:29:31 2009 (r194581) @@ -145,7 +145,7 @@ int (*ip6_mrouter_set)(struct socket *, int (*ip6_mrouter_get)(struct socket *, struct sockopt *); int (*ip6_mrouter_done)(void); int (*ip6_mforward)(struct ip6_hdr *, struct ifnet *, struct mbuf *); -int (*mrt6_ioctl)(int, caddr_t); +int (*mrt6_ioctl)(u_long, caddr_t); /* * Setup generic address and protocol structures for raw_input routine, then From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 11:21:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAED5106564A; Sun, 21 Jun 2009 11:21:16 +0000 (UTC) (envelope-from remko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D91238FC1B; Sun, 21 Jun 2009 11:21:16 +0000 (UTC) (envelope-from remko@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LBLGeF005645; Sun, 21 Jun 2009 11:21:16 GMT (envelope-from remko@svn.freebsd.org) Received: (from remko@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LBLGNe005642; Sun, 21 Jun 2009 11:21:16 GMT (envelope-from remko@svn.freebsd.org) Message-Id: <200906211121.n5LBLGNe005642@svn.freebsd.org> From: Remko Lodder Date: Sun, 21 Jun 2009 11:21:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194582 - in head/sys/dev/usb: . storage X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 11:21:17 -0000 Author: remko Date: Sun Jun 21 11:21:16 2009 New Revision: 194582 URL: http://svn.freebsd.org/changeset/base/194582 Log: Add support for the Myson Heden 8813. Note that I also added the usbdev to the list, because the 8813 version is not yet known there. I might have twisted the sorting there but because 8813 comes before 8818, I added it before that (with _8813 to differentiate) the item. PR: 135628 Submitted by: Yoshikazu GOTO Approved by: imp (mentor, implicit) Modified: head/sys/dev/usb/storage/umass.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Sun Jun 21 10:29:31 2009 (r194581) +++ head/sys/dev/usb/storage/umass.c Sun Jun 21 11:21:16 2009 (r194582) @@ -629,6 +629,10 @@ static const struct umass_devdescr umass UMASS_PROTO_DEFAULT, IGNORE_RESIDUE | NO_SYNCHRONIZE_CACHE }, + {USB_VENDOR_MYSON, USB_PRODUCT_MYSON_HEDEN_8813, RID_WILDCARD, + UMASS_PROTO_SCSI | UMASS_PROTO_BBB, + NO_SYNCHRONIZE_CACHE + }, {USB_VENDOR_MYSON, USB_PRODUCT_MYSON_STARREADER, RID_WILDCARD, UMASS_PROTO_DEFAULT, NO_SYNCHRONIZE_CACHE Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Sun Jun 21 10:29:31 2009 (r194581) +++ head/sys/dev/usb/usbdevs Sun Jun 21 11:21:16 2009 (r194582) @@ -1819,6 +1819,7 @@ product MSYSTEMS DISKONKEY 0x0010 DiskOn product MSYSTEMS DISKONKEY2 0x0011 DiskOnKey /* Myson products */ +product MYSON HEDEN_8813 0x8813 USB-IDE product MYSON HEDEN 0x8818 USB-IDE product MYSON STARREADER 0x9920 USB flash card adapter From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 12:58:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 470AE106566C; Sun, 21 Jun 2009 12:58:57 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 350D18FC0A; Sun, 21 Jun 2009 12:58:57 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LCwvjT007367; Sun, 21 Jun 2009 12:58:57 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LCwvfc007365; Sun, 21 Jun 2009 12:58:57 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200906211258.n5LCwvfc007365@svn.freebsd.org> From: Stanislav Sedov Date: Sun, 21 Jun 2009 12:58: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: r194583 - head/lib/libc/arm/string X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 12:58:57 -0000 Author: stas Date: Sun Jun 21 12:58:56 2009 New Revision: 194583 URL: http://svn.freebsd.org/changeset/base/194583 Log: - Fix strncmp on arm. Return 0 as result without performing the main cycle only if the len passed is equal to 0. If end address overflows use last possible address as the end address. Based on: discussion on arm@ MFC after: 1 month Modified: head/lib/libc/arm/string/strncmp.S Modified: head/lib/libc/arm/string/strncmp.S ============================================================================== --- head/lib/libc/arm/string/strncmp.S Sun Jun 21 11:21:16 2009 (r194582) +++ head/lib/libc/arm/string/strncmp.S Sun Jun 21 12:58:56 2009 (r194583) @@ -33,13 +33,17 @@ __FBSDID("$FreeBSD$"); ENTRY(strncmp) -/* if ((len - 1) < 0) return 0 */ - subs r2, r2, #1 - movmi r0, #0 - movmi pc, lr +/* if (len == 0) return 0 */ + cmp r2, #0 + moveq r0, #0 + moveq pc, lr /* ip == last src address to compare */ - add ip, r0, r2 + adds ip, r0, r2 + sub ip, ip, #1 +/* Use last possible address on overflow. */ + movcs ip, #0 + subcs ip, ip, #1 1: ldrb r2, [r0], #1 ldrb r3, [r1], #1 From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 13:07:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB02C106564A; Sun, 21 Jun 2009 13:07:22 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from mx0.deglitch.com (backbone.deglitch.com [IPv6:2001:16d8:fffb:4::abba]) by mx1.freebsd.org (Postfix) with ESMTP id 8A1BE8FC12; Sun, 21 Jun 2009 13:07:22 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from orion.SpringDaemons.com (unknown [77.232.3.143]) by mx0.deglitch.com (Postfix) with ESMTPA id C2E3D8FC27; Sun, 21 Jun 2009 17:07:20 +0400 (MSD) Received: from orion (localhost [127.0.0.1]) by orion.SpringDaemons.com (Postfix) with SMTP id C466039D90; Sun, 21 Jun 2009 17:07:26 +0400 (MSD) Date: Sun, 21 Jun 2009 17:07:21 +0400 From: Stanislav Sedov To: Roman Divacky Message-Id: <20090621170721.7f934033.stas@FreeBSD.org> In-Reply-To: <200906210901.n5L91CrW001048@svn.freebsd.org> References: <200906210901.n5L91CrW001048@svn.freebsd.org> Organization: The FreeBSD Project X-Mailer: carrier-pigeon Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="PGP-SHA1"; boundary="Signature=_Sun__21_Jun_2009_17_07_21_+0400_smPSYrcDUDWaV.f3" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194578 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 13:07:23 -0000 --Signature=_Sun__21_Jun_2009_17_07_21_+0400_smPSYrcDUDWaV.f3 Content-Type: text/plain; charset=US-ASCII Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, 21 Jun 2009 09:01:12 +0000 (UTC) Roman Divacky mentioned: > Modified: head/sys/sys/lock_profile.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/sys/lock_profile.h Sun Jun 21 08:49:06 2009 (r194577) > +++ head/sys/sys/lock_profile.h Sun Jun 21 09:01:12 2009 (r194578) > @@ -63,10 +63,10 @@ lock_profile_obtain_lock_failed(struct l > =20 > #else /* !LOCK_PROFILING */ > =20 > -#define lock_profile_release_lock(lo) > -#define lock_profile_obtain_lock_failed(lo, contested, waittime) > -#define lock_profile_obtain_lock_success(lo, contested, waittime, file, = line) > -#define lock_profile_thread_exit(td) > +#define lock_profile_release_lock(lo) (void)0 > +#define lock_profile_obtain_lock_failed(lo, contested, waittime) (void)0 > +#define lock_profile_obtain_lock_success(lo, contested, waittime, file, = line) (void)0 > +#define lock_profile_thread_exit(td) (void)0 > =20 > #endif /* !LOCK_PROFILING */ This now overflows the 80-column line limit, while it is used to not before. Can you, please, add line breaks wherever required? --=20 Stanislav Sedov ST4096-RIPE --Signature=_Sun__21_Jun_2009_17_07_21_+0400_smPSYrcDUDWaV.f3 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- iQIcBAEBAgAGBQJKPjCOAAoJEKN82nOYvCd0JOMQAJ6ymfOtMjo9oTFBO5gAO4f3 nxdbHo+bLlxcjSAJLBA78DGEVqB0LLfUXkmNqgsEO/mVEn+HoWnsiHmfgwSQ8/1D QsRhXx/S6VqvVHX1XqrA8cHN58gCKp3evWM7tTES+TqJPJV4uRRMMd9FDefzQooA rTfze8lSSUMYAE/u1l/Y0osnshcM09gag2wg4/OQnoktKxZ+E1WuWx2IFacbi/yh /A9sL22nVtX+V8+tlH/HHSeOaHf9Zbb/ooIwj6n3kWPZKN+41q2CyOy6hM/ymRYZ y7H4vsyBsxW9NdyvRvnU3wZUHNuBrW90/2n+w94NwdJZsAem2GykpL4EUtHFkLkg MiDmUhNEQIqUAeiNWpTpJBdkPVLkUcsZH/LeBm0HyC2HLllBH6gs1roKYot09OK7 zzP9csCZf5wyG/UFk/QUxcqZQupPGodQKjGrn7A5x+IaREXhAprLEySAjfgEpayD SVvPxgJpFMefYLWvZVANIWL5/fqxahXCbdFyTYyVmsIIWlYCvNnVJl/Aokbjb4X5 Ss2Re26mfm27YTDLTKJQyjIie25VrGWLSF4U3JPEKsHdWch34ZHaPHG6YJ7/gwRh XM4cLY0uoDWpc7aQxw+5HIlofeIRCuZI9N3png1FqGZeUu7bnOraX8UJCT0QYiNk xlL8BZC0DVbo1yvKVVWj =JlID -----END PGP SIGNATURE----- --Signature=_Sun__21_Jun_2009_17_07_21_+0400_smPSYrcDUDWaV.f3-- From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 13:13:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44C8F1065672; Sun, 21 Jun 2009 13:13:14 +0000 (UTC) (envelope-from remko@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 32AD28FC13; Sun, 21 Jun 2009 13:13:14 +0000 (UTC) (envelope-from remko@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LDDEmv007681; Sun, 21 Jun 2009 13:13:14 GMT (envelope-from remko@svn.freebsd.org) Received: (from remko@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LDDEo1007679; Sun, 21 Jun 2009 13:13:14 GMT (envelope-from remko@svn.freebsd.org) Message-Id: <200906211313.n5LDDEo1007679@svn.freebsd.org> From: Remko Lodder Date: Sun, 21 Jun 2009 13:13: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: r194584 - head/sys/dev/usb/storage X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 13:13:14 -0000 Author: remko Date: Sun Jun 21 13:13:13 2009 New Revision: 194584 URL: http://svn.freebsd.org/changeset/base/194584 Log: use PROTO_DEFAULT. Requested by: hps Modified: head/sys/dev/usb/storage/umass.c Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Sun Jun 21 12:58:56 2009 (r194583) +++ head/sys/dev/usb/storage/umass.c Sun Jun 21 13:13:13 2009 (r194584) @@ -630,7 +630,7 @@ static const struct umass_devdescr umass IGNORE_RESIDUE | NO_SYNCHRONIZE_CACHE }, {USB_VENDOR_MYSON, USB_PRODUCT_MYSON_HEDEN_8813, RID_WILDCARD, - UMASS_PROTO_SCSI | UMASS_PROTO_BBB, + UMASS_PROTO_DEFAULT, NO_SYNCHRONIZE_CACHE }, {USB_VENDOR_MYSON, USB_PRODUCT_MYSON_STARREADER, RID_WILDCARD, From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 13:15:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C980A106564A; Sun, 21 Jun 2009 13:15:56 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7A788FC14; Sun, 21 Jun 2009 13:15:56 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LDFuuP007771; Sun, 21 Jun 2009 13:15:56 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LDFuut007769; Sun, 21 Jun 2009 13:15:56 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200906211315.n5LDFuut007769@svn.freebsd.org> From: Stanislav Sedov Date: Sun, 21 Jun 2009 13:15: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: r194585 - head/lib/libc/arm/string X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 13:15:57 -0000 Author: stas Date: Sun Jun 21 13:15:56 2009 New Revision: 194585 URL: http://svn.freebsd.org/changeset/base/194585 Log: - Eliminate extra subcs instruction. I have not noticed before that we always perform substraction now, so no instruction could be rordered to eliminate the conditional substraction. Modified: head/lib/libc/arm/string/strncmp.S Modified: head/lib/libc/arm/string/strncmp.S ============================================================================== --- head/lib/libc/arm/string/strncmp.S Sun Jun 21 13:13:13 2009 (r194584) +++ head/lib/libc/arm/string/strncmp.S Sun Jun 21 13:15:56 2009 (r194585) @@ -40,10 +40,9 @@ ENTRY(strncmp) /* ip == last src address to compare */ adds ip, r0, r2 - sub ip, ip, #1 /* Use last possible address on overflow. */ movcs ip, #0 - subcs ip, ip, #1 + sub ip, ip, #1 1: ldrb r2, [r0], #1 ldrb r3, [r1], #1 From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 13:41:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8BFE106564A; Sun, 21 Jun 2009 13:41:32 +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 A398B8FC0A; Sun, 21 Jun 2009 13:41:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LDfWJn008290; Sun, 21 Jun 2009 13:41:32 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LDfWEx008281; Sun, 21 Jun 2009 13:41:32 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200906211341.n5LDfWEx008281@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 21 Jun 2009 13:41: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: r194586 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 13:41:33 -0000 Author: kib Date: Sun Jun 21 13:41:32 2009 New Revision: 194586 URL: http://svn.freebsd.org/changeset/base/194586 Log: Add another flags argument to vn_open_cred. Use it to specify that some vn_open_cred invocations shall not audit namei path. In particular, specify VN_OPEN_NOAUDIT for dotdot lookup performed by default implementation of vop_vptocnp, and for the open done for core file. vn_fullpath is called from the audit code, and vn_open there need to disable audit to avoid infinite recursion. Core file is created on return to user mode, that, in particular, happens during syscall return. The creation of the core file is audited by direct calls, and we do not want to overwrite audit information for syscall. Reported, reviewed and tested by: rwatson Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c head/sys/cddl/compat/opensolaris/sys/vnode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/kern/kern_alq.c head/sys/kern/kern_sig.c head/sys/kern/vfs_default.c head/sys/kern/vfs_vnops.c head/sys/sys/vnode.h Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Sun Jun 21 13:15:56 2009 (r194585) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Sun Jun 21 13:41:32 2009 (r194586) @@ -85,7 +85,8 @@ kobj_open_file_vnode(const char *file) flags = FREAD; NDINIT(&nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td); - error = vn_open_cred(&nd, &flags, O_NOFOLLOW, curthread->td_ucred, NULL); + error = vn_open_cred(&nd, &flags, O_NOFOLLOW, 0, curthread->td_ucred, + NULL); NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) return (NULL); Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/vnode.h Sun Jun 21 13:15:56 2009 (r194585) +++ head/sys/cddl/compat/opensolaris/sys/vnode.h Sun Jun 21 13:41:32 2009 (r194586) @@ -182,7 +182,7 @@ vn_openat(char *pnamep, enum uio_seg seg vref(startvp); NDINIT_ATVP(&nd, operation, MPSAFE, UIO_SYSSPACE, pnamep, startvp, td); filemode |= O_NOFOLLOW; - error = vn_open_cred(&nd, &filemode, createmode, td->td_ucred, NULL); + error = vn_open_cred(&nd, &filemode, createmode, 0, td->td_ucred, NULL); NDFREE(&nd, NDF_ONLY_PNBUF); if (error == 0) { /* We just unlock so we hold a reference. */ Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Jun 21 13:15:56 2009 (r194585) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Sun Jun 21 13:41:32 2009 (r194586) @@ -4519,7 +4519,7 @@ vop_getextattr { flags = FREAD; NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_SYSSPACE, attrname, xvp, td); - error = vn_open_cred(&nd, &flags, 0, ap->a_cred, NULL); + error = vn_open_cred(&nd, &flags, 0, 0, ap->a_cred, NULL); vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { @@ -4640,7 +4640,7 @@ vop_setextattr { flags = FFLAGS(O_WRONLY | O_CREAT); NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_SYSSPACE, attrname, xvp, td); - error = vn_open_cred(&nd, &flags, 0600, ap->a_cred, NULL); + error = vn_open_cred(&nd, &flags, 0600, 0, ap->a_cred, NULL); vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { Modified: head/sys/kern/kern_alq.c ============================================================================== --- head/sys/kern/kern_alq.c Sun Jun 21 13:15:56 2009 (r194585) +++ head/sys/kern/kern_alq.c Sun Jun 21 13:41:32 2009 (r194586) @@ -351,7 +351,7 @@ alq_open(struct alq **alqp, const char * NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_SYSSPACE, file, td); flags = FWRITE | O_NOFOLLOW | O_CREAT; - error = vn_open_cred(&nd, &flags, cmode, cred, NULL); + error = vn_open_cred(&nd, &flags, cmode, 0, cred, NULL); if (error) return (error); Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Sun Jun 21 13:15:56 2009 (r194585) +++ head/sys/kern/kern_sig.c Sun Jun 21 13:41:32 2009 (r194586) @@ -2940,7 +2940,8 @@ coredump(struct thread *td) restart: NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_SYSSPACE, name, td); flags = O_CREAT | FWRITE | O_NOFOLLOW; - error = vn_open(&nd, &flags, S_IRUSR | S_IWUSR, NULL); + error = vn_open_cred(&nd, &flags, S_IRUSR | S_IWUSR, VN_OPEN_NOAUDIT, + NULL, NULL); if (error) { #ifdef AUDIT audit_proc_coredump(td, name, error); Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Sun Jun 21 13:15:56 2009 (r194585) +++ head/sys/kern/vfs_default.c Sun Jun 21 13:41:32 2009 (r194586) @@ -723,7 +723,7 @@ vop_stdvptocnp(struct vop_vptocnp_args * NDINIT_ATVP(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, "..", vp, td); flags = FREAD; - error = vn_open(&nd, &flags, 0, NULL); + error = vn_open_cred(&nd, &flags, 0, VN_OPEN_NOAUDIT, NULL, NULL); if (error) { vn_lock(vp, locked | LK_RETRY); return (error); Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Sun Jun 21 13:15:56 2009 (r194585) +++ head/sys/kern/vfs_vnops.c Sun Jun 21 13:41:32 2009 (r194586) @@ -91,7 +91,7 @@ vn_open(ndp, flagp, cmode, fp) { struct thread *td = ndp->ni_cnd.cn_thread; - return (vn_open_cred(ndp, flagp, cmode, td->td_ucred, fp)); + return (vn_open_cred(ndp, flagp, cmode, 0, td->td_ucred, fp)); } /* @@ -102,11 +102,8 @@ vn_open(ndp, flagp, cmode, fp) * due to the NDINIT being done elsewhere. */ int -vn_open_cred(ndp, flagp, cmode, cred, fp) - struct nameidata *ndp; - int *flagp, cmode; - struct ucred *cred; - struct file *fp; +vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, u_int vn_open_flags, + struct ucred *cred, struct file *fp) { struct vnode *vp; struct mount *mp; @@ -124,9 +121,11 @@ restart: if (fmode & O_CREAT) { ndp->ni_cnd.cn_nameiop = CREATE; ndp->ni_cnd.cn_flags = ISOPEN | LOCKPARENT | LOCKLEAF | - MPSAFE | AUDITVNODE1; + MPSAFE; if ((fmode & O_EXCL) == 0 && (fmode & O_NOFOLLOW) == 0) ndp->ni_cnd.cn_flags |= FOLLOW; + if (!(vn_open_flags & VN_OPEN_NOAUDIT)) + ndp->ni_cnd.cn_flags |= AUDITVNODE1; bwillwrite(); if ((error = namei(ndp)) != 0) return (error); @@ -181,9 +180,11 @@ restart: ndp->ni_cnd.cn_nameiop = LOOKUP; ndp->ni_cnd.cn_flags = ISOPEN | ((fmode & O_NOFOLLOW) ? NOFOLLOW : FOLLOW) | - LOCKLEAF | MPSAFE | AUDITVNODE1; + LOCKLEAF | MPSAFE; if (!(fmode & FWRITE)) ndp->ni_cnd.cn_flags |= LOCKSHARED; + if (!(vn_open_flags & VN_OPEN_NOAUDIT)) + ndp->ni_cnd.cn_flags |= AUDITVNODE1; if ((error = namei(ndp)) != 0) return (error); if (!mpsafe) Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Sun Jun 21 13:15:56 2009 (r194585) +++ head/sys/sys/vnode.h Sun Jun 21 13:41:32 2009 (r194586) @@ -562,6 +562,9 @@ vn_canvmio(struct vnode *vp) */ #include "vnode_if.h" +/* vn_open_flags */ +#define VN_OPEN_NOAUDIT 0x00000001 + /* * Public vnode manipulation functions. */ @@ -637,7 +640,7 @@ int _vn_lock(struct vnode *vp, int flags #define vn_lock(vp, flags) _vn_lock(vp, flags, __FILE__, __LINE__) int vn_open(struct nameidata *ndp, int *flagp, int cmode, struct file *fp); int vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, - struct ucred *cred, struct file *fp); + u_int vn_open_flags, struct ucred *cred, struct file *fp); int vn_pollrecord(struct vnode *vp, struct thread *p, int events); int vn_rdwr(enum uio_rw rw, struct vnode *vp, void *base, int len, off_t offset, enum uio_seg segflg, int ioflg, From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 13:48:26 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: by hub.freebsd.org (Postfix, from userid 1033) id A049F1065670; Sun, 21 Jun 2009 13:48:26 +0000 (UTC) Date: Sun, 21 Jun 2009 13:48:26 +0000 From: Alexey Dokuchaev To: Bruce Evans Message-ID: <20090621134826.GA44901@FreeBSD.org> References: <200906191552.n5JFqZcG047705@svn.freebsd.org> <20090620130238.N29302@delplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20090620130238.N29302@delplex.bde.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Brooks Davis , src-committers@FreeBSD.org Subject: Re: svn commit: r194493 - head/usr.bin/catman X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 13:48:27 -0000 Bruce Evans wrote: > I've never seen a machine that actually runs catman. I remove the > cat directories on all my machines to prevent any saving of cat > pages. All FreeBSD cluster machines that I checked (just 3) have > 0, 1 and 2 saved cat pages. This shows shows that catman isn't run > on them and that root rarely looks at man pages on them. This kinda brings up the question, do we actually need catman(1) at all these days of fast CPU and disks and plenty of RAM? ./danfe From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 14:48:11 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38EDE106564A; Sun, 21 Jun 2009 14:48:11 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id E62528FC14; Sun, 21 Jun 2009 14:48:10 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 372126D418; Sun, 21 Jun 2009 16:48:10 +0200 (CEST) Received: by ds4.des.no (Postfix, from userid 1001) id 12E79844C4; Sun, 21 Jun 2009 16:48:10 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Alexey Dokuchaev References: <200906191552.n5JFqZcG047705@svn.freebsd.org> <20090620130238.N29302@delplex.bde.org> <20090621134826.GA44901@FreeBSD.org> Date: Sun, 21 Jun 2009 16:48:09 +0200 In-Reply-To: <20090621134826.GA44901@FreeBSD.org> (Alexey Dokuchaev's message of "Sun, 21 Jun 2009 13:48:26 +0000") Message-ID: <86skhty76e.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Brooks Davis , Bruce Evans , src-committers@FreeBSD.org Subject: Re: svn commit: r194493 - head/usr.bin/catman X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 14:48:11 -0000 Alexey Dokuchaev writes: > This kinda brings up the question, do we actually need catman(1) at all > these days of fast CPU and disks and plenty of RAM? Show me the fast CPU and plenty of RAM on this board: http://www.soekris.com/net4801.htm DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 15:03:04 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9BF01065678; Sun, 21 Jun 2009 15:03:04 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id A87AA8FC0A; Sun, 21 Jun 2009 15:03:04 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id F3D7C6D41E; Sun, 21 Jun 2009 17:03:03 +0200 (CEST) Received: by ds4.des.no (Postfix, from userid 1001) id D0442844C4; Sun, 21 Jun 2009 17:03:03 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Bruce Evans References: <200906191552.n5JFqZcG047705@svn.freebsd.org> <20090620130238.N29302@delplex.bde.org> Date: Sun, 21 Jun 2009 17:03:03 +0200 In-Reply-To: <20090620130238.N29302@delplex.bde.org> (Bruce Evans's message of "Sat, 20 Jun 2009 13:57:07 +1000 (EST)") Message-ID: <86ocshy6hk.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, Brooks Davis , src-committers@FreeBSD.org Subject: Re: svn commit: r194493 - head/usr.bin/catman X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 15:03:05 -0000 Bruce Evans writes: > I've never seen a machine that actually runs catman. I remove the > cat directories on all my machines to prevent any saving of cat > pages. All FreeBSD cluster machines that I checked (just 3) have > 0, 1 and 2 saved cat pages. This shows shows that catman isn't run > on them and that root rarely looks at man pages on them. Most stock FreeBSD installations don't need to run catman, because cat pages for the default locale (which are also used for any locale man(1) doesn't recognize) are included on the installation ISOs and installed by default. Adding cat pages for the other locales man(1) recognizes (en.ISO8859-1 and en.UTF-8) would add around 13 MB to the ISO and 20 MB to the installed system. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 16:11:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A9181065675; Sun, 21 Jun 2009 16:11:26 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 886FF8FC08; Sun, 21 Jun 2009 16:11:26 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LGBQSC011805; Sun, 21 Jun 2009 16:11:26 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LGBQeO011803; Sun, 21 Jun 2009 16:11:26 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906211611.n5LGBQeO011803@svn.freebsd.org> From: Robert Watson Date: Sun, 21 Jun 2009 16:11: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: r194590 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 16:11:27 -0000 Author: rwatson Date: Sun Jun 21 16:11:26 2009 New Revision: 194590 URL: http://svn.freebsd.org/changeset/base/194590 Log: Update copyright on netipx. Modified: head/sys/netipx/README Modified: head/sys/netipx/README ============================================================================== --- head/sys/netipx/README Sun Jun 21 16:10:40 2009 (r194589) +++ head/sys/netipx/README Sun Jun 21 16:11:26 2009 (r194590) @@ -25,7 +25,7 @@ The Regents of the University of Califor Modifications Copyright (c) 1995, Mike Mitchell Modifications Copyright (c) 1995, John Hay -Modifications Copyright (c) 2004-2006 Robert N. M. Watson +Modifications Copyright (c) 2004-2009 Robert N. M. Watson */ From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 16:11:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 716CC1065674; Sun, 21 Jun 2009 16:11:40 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F5E58FC15; Sun, 21 Jun 2009 16:11:40 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LGBeSm011845; Sun, 21 Jun 2009 16:11:40 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LGBerf011842; Sun, 21 Jun 2009 16:11:40 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906211611.n5LGBerf011842@svn.freebsd.org> From: Robert Watson Date: Sun, 21 Jun 2009 16:11: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: r194591 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 16:11:40 -0000 Author: rwatson Date: Sun Jun 21 16:11:40 2009 New Revision: 194591 URL: http://svn.freebsd.org/changeset/base/194591 Log: Remove unuxed ipx_zerohost. MFC after: 3 days Modified: head/sys/netipx/ipx_input.c head/sys/netipx/ipx_var.h Modified: head/sys/netipx/ipx_input.c ============================================================================== --- head/sys/netipx/ipx_input.c Sun Jun 21 16:11:26 2009 (r194590) +++ head/sys/netipx/ipx_input.c Sun Jun 21 16:11:40 2009 (r194591) @@ -106,7 +106,6 @@ static void ipx_forward(struct mbuf *m); static void ipxintr(struct mbuf *m); const union ipx_net ipx_zeronet; -const union ipx_host ipx_zerohost; const union ipx_net ipx_broadnet = { .s_net[0] = 0xffff, .s_net[1] = 0xffff }; Modified: head/sys/netipx/ipx_var.h ============================================================================== --- head/sys/netipx/ipx_var.h Sun Jun 21 16:11:26 2009 (r194590) +++ head/sys/netipx/ipx_var.h Sun Jun 21 16:11:40 2009 (r194591) @@ -97,7 +97,6 @@ extern struct sockaddr_ipx ipx_netmask; extern struct sockaddr_ipx ipx_hostmask; extern const union ipx_net ipx_zeronet; -extern const union ipx_host ipx_zerohost; extern const union ipx_net ipx_broadnet; extern const union ipx_host ipx_broadhost; From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 16:56:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27C5A1065675; Sun, 21 Jun 2009 16:56:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1537A8FC18; Sun, 21 Jun 2009 16:56:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LGunoW012857; Sun, 21 Jun 2009 16:56:49 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LGunTK012855; Sun, 21 Jun 2009 16:56:49 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906211656.n5LGunTK012855@svn.freebsd.org> From: Robert Watson Date: Sun, 21 Jun 2009 16:56: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: r194595 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 16:56:50 -0000 Author: rwatson Date: Sun Jun 21 16:56:49 2009 New Revision: 194595 URL: http://svn.freebsd.org/changeset/base/194595 Log: Minor style cleanups. MFC after: 3 days Modified: head/sys/netipx/ipx.c Modified: head/sys/netipx/ipx.c ============================================================================== --- head/sys/netipx/ipx.c Sun Jun 21 16:42:52 2009 (r194594) +++ head/sys/netipx/ipx.c Sun Jun 21 16:56:49 2009 (r194595) @@ -82,9 +82,9 @@ __FBSDID("$FreeBSD$"); */ struct ipx_ifaddr *ipx_ifaddr; -static void ipx_ifscrub(struct ifnet *ifp, struct ipx_ifaddr *ia); -static int ipx_ifinit(struct ifnet *ifp, struct ipx_ifaddr *ia, - struct sockaddr_ipx *sipx, int scrub); +static void ipx_ifscrub(struct ifnet *ifp, struct ipx_ifaddr *ia); +static int ipx_ifinit(struct ifnet *ifp, struct ipx_ifaddr *ia, + struct sockaddr_ipx *sipx, int scrub); /* * Generic internet control operations (ioctl's). @@ -111,7 +111,6 @@ ipx_control(struct socket *so, u_long cm break; switch (cmd) { - case SIOCGIFADDR: if (ia == NULL) return (EADDRNOTAVAIL); @@ -182,18 +181,20 @@ ipx_control(struct socket *so, u_long cm ifa->ifa_dstaddr = (struct sockaddr *)&ia->ia_dstaddr; if (ifp->if_flags & IFF_BROADCAST) { ia->ia_broadaddr.sipx_family = AF_IPX; - ia->ia_broadaddr.sipx_len = sizeof(ia->ia_addr); - ia->ia_broadaddr.sipx_addr.x_host = ipx_broadhost; + ia->ia_broadaddr.sipx_len = + sizeof(ia->ia_addr); + ia->ia_broadaddr.sipx_addr.x_host = + ipx_broadhost; } } break; + default: if (td && (error = priv_check(td, PRIV_NET_HWIOCTL)) != 0) return (error); } switch (cmd) { - case SIOCSIFDSTADDR: if ((ifp->if_flags & IFF_POINTOPOINT) == 0) return (EINVAL); @@ -202,7 +203,8 @@ ipx_control(struct socket *so, u_long cm ia->ia_flags &= ~IFA_ROUTE; } if (ifp->if_ioctl) { - error = (*ifp->if_ioctl)(ifp, SIOCSIFDSTADDR, (void *)ia); + error = (*ifp->if_ioctl)(ifp, SIOCSIFDSTADDR, + (void *)ia); if (error) return (error); } @@ -263,8 +265,8 @@ ipx_control(struct socket *so, u_long cm } /* -* Delete any previous route for an old address. -*/ + * Delete any previous route for an old address. + */ static void ipx_ifscrub(struct ifnet *ifp, struct ipx_ifaddr *ia) { @@ -277,9 +279,9 @@ ipx_ifscrub(struct ifnet *ifp, struct ip ia->ia_flags &= ~IFA_ROUTE; } } + /* - * Initialize an interface's internet address - * and routing table entry. + * Initialize an interface's internet address and routing table entry. */ static int ipx_ifinit(struct ifnet *ifp, struct ipx_ifaddr *ia, @@ -295,15 +297,13 @@ ipx_ifinit(struct ifnet *ifp, struct ipx ia->ia_addr = *sipx; /* - * The convention we shall adopt for naming is that - * a supplied address of zero means that "we don't care". - * Use the MAC address of the interface. If it is an - * interface without a MAC address, like a serial line, the - * address must be supplied. + * The convention we shall adopt for naming is that a supplied + * address of zero means that "we don't care". Use the MAC address + * of the interface. If it is an interface without a MAC address, + * like a serial line, the address must be supplied. * - * Give the interface a chance to initialize - * if this is its first address, - * and to validate the address if necessary. + * Give the interface a chance to initialize if this is its first + * address, and to validate the address if necessary. */ if (ifp->if_ioctl != NULL && (error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (void *)ia))) { @@ -313,6 +313,7 @@ ipx_ifinit(struct ifnet *ifp, struct ipx } splx(s); ia->ia_ifa.ifa_metric = ifp->if_metric; + /* * Add route for the network. */ @@ -349,10 +350,12 @@ ipx_iaonnetof(struct ipx_addr *dst) compare = &satoipx_addr(ia->ia_dstaddr); if (ipx_hosteq(*dst, *compare)) return (ia); - if (ipx_neteqnn(net, ia->ia_addr.sipx_addr.x_net)) + if (ipx_neteqnn(net, + ia->ia_addr.sipx_addr.x_net)) ia_maybe = ia; } else { - if (ipx_neteqnn(net, ia->ia_addr.sipx_addr.x_net)) + if (ipx_neteqnn(net, + ia->ia_addr.sipx_addr.x_net)) return (ia); } } @@ -360,7 +363,6 @@ ipx_iaonnetof(struct ipx_addr *dst) return (ia_maybe); } - void ipx_printhost(struct ipx_addr *addr) { @@ -373,7 +375,6 @@ ipx_printhost(struct ipx_addr *addr) port = ntohs(work.x_port); if (ipx_nullnet(work) && ipx_nullhost(work)) { - if (port) printf("*.%x", port); else From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 17:32:55 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F77010656B4; Sun, 21 Jun 2009 17:32:55 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (cl-162.ewr-01.us.sixxs.net [IPv6:2001:4830:1200:a1::2]) by mx1.freebsd.org (Postfix) with ESMTP id C32828FC23; Sun, 21 Jun 2009 17:32:54 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.3/8.14.3) with ESMTP id n5LHX5sl089631; Sun, 21 Jun 2009 12:33:05 -0500 (CDT) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.3/8.14.3/Submit) id n5LHX4ww089630; Sun, 21 Jun 2009 12:33:04 -0500 (CDT) (envelope-from brooks) Date: Sun, 21 Jun 2009 12:33:04 -0500 From: Brooks Davis To: Dag-Erling Sm??rgrav Message-ID: <20090621173304.GA89146@lor.one-eyed-alien.net> References: <200906191552.n5JFqZcG047705@svn.freebsd.org> <20090620130238.N29302@delplex.bde.org> <20090621134826.GA44901@FreeBSD.org> <86skhty76e.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5mCyUwZo2JvN/JJP" Content-Disposition: inline In-Reply-To: <86skhty76e.fsf@ds4.des.no> User-Agent: Mutt/1.5.17 (2007-11-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (lor.one-eyed-alien.net [127.0.0.1]); Sun, 21 Jun 2009 12:33:06 -0500 (CDT) Cc: Alexey Dokuchaev , Brooks Davis , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org Subject: Re: svn commit: r194493 - head/usr.bin/catman X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 17:32:56 -0000 --5mCyUwZo2JvN/JJP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jun 21, 2009 at 04:48:09PM +0200, Dag-Erling Sm??rgrav wrote: > Alexey Dokuchaev writes: > > This kinda brings up the question, do we actually need catman(1) at all > > these days of fast CPU and disks and plenty of RAM? >=20 > Show me the fast CPU and plenty of RAM on this board: >=20 > http://www.soekris.com/net4801.htm For such hardware, the OpenBSD mdoc renderer is likely to be a better fit anyway. It's orders of magnitude faster than *roff and wouldn't waste space on catpages that will in all likely hood never be used. -- Brooks --5mCyUwZo2JvN/JJP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iD8DBQFKPm7QXY6L6fI4GtQRAmb9AJ9rJIdsXQpXOhZTnI6Pq9tGs4He8wCg1j0G bkQXZ1z1tQrcysSKc8gUJME= =sbGr -----END PGP SIGNATURE----- --5mCyUwZo2JvN/JJP-- From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 19:17:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C9BC106567E; Sun, 21 Jun 2009 19:17:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A8418FC17; Sun, 21 Jun 2009 19:17:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LJHMg5015900; Sun, 21 Jun 2009 19:17:22 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LJHMNi015898; Sun, 21 Jun 2009 19:17:22 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906211917.n5LJHMNi015898@svn.freebsd.org> From: Sam Leffler Date: Sun, 21 Jun 2009 19:17: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: r194600 - head/sys/dev/ic X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 19:17:24 -0000 Author: sam Date: Sun Jun 21 19:17:22 2009 New Revision: 194600 URL: http://svn.freebsd.org/changeset/base/194600 Log: add %b formats for various registers Modified: head/sys/dev/ic/ns16550.h Modified: head/sys/dev/ic/ns16550.h ============================================================================== --- head/sys/dev/ic/ns16550.h Sun Jun 21 19:02:32 2009 (r194599) +++ head/sys/dev/ic/ns16550.h Sun Jun 21 19:17:22 2009 (r194600) @@ -46,6 +46,8 @@ #define IER_ERLS 0x4 #define IER_EMSC 0x8 +#define IER_BITS "\20\1ERXRDY\2ETXRDY\3ERLS\4EMSC" + #define com_iir 2 /* interrupt identification register (R) */ #define REG_IIR com_iir #define IIR_IMASK 0xf @@ -57,6 +59,8 @@ #define IIR_MLSC 0x0 #define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */ +#define IIR_BITS "\20\1NOPEND\2TXRDY\3RXRDY" + #define com_lcr 3 /* line control register (R/W) */ #define com_cfcr com_lcr /* character format control register (R/W) */ #define REG_LCR com_lcr @@ -97,6 +101,8 @@ #define MCR_RTS 0x02 #define MCR_DTR 0x01 +#define MCR_BITS "\20\1DTR\2RTS\3DRS\4IE\5LOOPBACK\10PRESCALE" + #define com_lsr 5 /* line status register (R/W) */ #define REG_LSR com_lsr #define LSR_RCV_FIFO 0x80 @@ -111,6 +117,8 @@ #define LSR_RXRDY 0x01 #define LSR_RCV_MASK 0x1f +#define LSR_BITS "\20\1RXRDY\2OE\3PE\4FE\5BI\6THRE\7TEMT\10RCV_FIFO" + #define com_msr 6 /* modem status register (R/W) */ #define REG_MSR com_msr #define MSR_DCD 0x80 @@ -122,6 +130,8 @@ #define MSR_DDSR 0x02 #define MSR_DCTS 0x01 +#define MSR_BITS "\20\1DCTS\2DDSR\3TERI\4DDCD\5CTS\6DSR\7RI\10DCD" + /* 8250 multiplexed registers #[0-1]. Access enabled by LCR[7]. */ #define com_dll 0 /* divisor latch low (R/W) */ #define com_dlbl com_dll @@ -154,6 +164,8 @@ #define FCR_RX_HIGH 0xc0 #define FIFO_RX_HIGH FCR_RX_HIGH +#define FCR_BITS "\20\1ENABLE\2RCV_RST\3XMT_RST\4DMA" + /* 16650 registers #2,[4-7]. Access enabled by LCR_EFR_ENABLE. */ #define com_efr 2 /* enhanced features register (R/W) */ From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 19:21:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E221106568A; Sun, 21 Jun 2009 19:21:01 +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 523F88FC13; Sun, 21 Jun 2009 19:21:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LJL1tw016005; Sun, 21 Jun 2009 19:21:01 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LJL103015999; Sun, 21 Jun 2009 19:21:01 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200906211921.n5LJL103015999@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 21 Jun 2009 19:21: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: r194601 - in head/sys: fs/nullfs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 19:21:02 -0000 Author: kib Date: Sun Jun 21 19:21:01 2009 New Revision: 194601 URL: http://svn.freebsd.org/changeset/base/194601 Log: Add explicit struct ucred * argument for VOP_VPTOCNP, to be used by vn_open_cred in default implementation. Valid struct ucred is needed for audit and MAC, and curthread credentials may be wrong. This further requires modifying the interface of vn_fullpath(9), but it is out of scope of this change. Reviewed by: rwatson Modified: head/sys/fs/nullfs/null_vnops.c head/sys/kern/vfs_cache.c head/sys/kern/vfs_default.c head/sys/kern/vnode_if.src head/sys/sys/vnode.h Modified: head/sys/fs/nullfs/null_vnops.c ============================================================================== --- head/sys/fs/nullfs/null_vnops.c Sun Jun 21 19:17:22 2009 (r194600) +++ head/sys/fs/nullfs/null_vnops.c Sun Jun 21 19:21:01 2009 (r194601) @@ -747,6 +747,7 @@ null_vptocnp(struct vop_vptocnp_args *ap struct vnode *vp = ap->a_vp; struct vnode **dvp = ap->a_vpp; struct vnode *lvp, *ldvp; + struct ucred *cred = ap->a_cred; int error, locked; if (vp->v_type == VDIR) @@ -757,7 +758,7 @@ null_vptocnp(struct vop_vptocnp_args *ap vhold(lvp); VOP_UNLOCK(vp, 0); /* vp is held by vn_vptocnp_locked that called us */ ldvp = lvp; - error = vn_vptocnp(&ldvp, ap->a_buf, ap->a_buflen); + error = vn_vptocnp(&ldvp, cred, ap->a_buf, ap->a_buflen); vdrop(lvp); if (error != 0) { vn_lock(vp, locked | LK_RETRY); Modified: head/sys/kern/vfs_cache.c ============================================================================== --- head/sys/kern/vfs_cache.c Sun Jun 21 19:17:22 2009 (r194600) +++ head/sys/kern/vfs_cache.c Sun Jun 21 19:21:01 2009 (r194601) @@ -206,7 +206,8 @@ SYSCTL_OPAQUE(_vfs_cache, OID_AUTO, nchs static void cache_zap(struct namecache *ncp); -static int vn_vptocnp_locked(struct vnode **vp, char *buf, u_int *buflen); +static int vn_vptocnp_locked(struct vnode **vp, struct ucred *cred, char *buf, + u_int *buflen); static int vn_fullpath1(struct thread *td, struct vnode *vp, struct vnode *rdir, char *buf, char **retbuf, u_int buflen); @@ -1037,12 +1038,12 @@ vn_fullpath_global(struct thread *td, st } int -vn_vptocnp(struct vnode **vp, char *buf, u_int *buflen) +vn_vptocnp(struct vnode **vp, struct ucred *cred, char *buf, u_int *buflen) { int error; CACHE_RLOCK(); - error = vn_vptocnp_locked(vp, buf, buflen); + error = vn_vptocnp_locked(vp, cred, buf, buflen); if (error == 0) { /* * vn_vptocnp_locked() dropped hold acquired by @@ -1057,7 +1058,8 @@ vn_vptocnp(struct vnode **vp, char *buf, } static int -vn_vptocnp_locked(struct vnode **vp, char *buf, u_int *buflen) +vn_vptocnp_locked(struct vnode **vp, struct ucred *cred, char *buf, + u_int *buflen) { struct vnode *dvp; struct namecache *ncp; @@ -1089,7 +1091,7 @@ vn_vptocnp_locked(struct vnode **vp, cha CACHE_RUNLOCK(); vfslocked = VFS_LOCK_GIANT((*vp)->v_mount); vn_lock(*vp, LK_SHARED | LK_RETRY); - error = VOP_VPTOCNP(*vp, &dvp, buf, buflen); + error = VOP_VPTOCNP(*vp, &dvp, cred, buf, buflen); VOP_UNLOCK(*vp, 0); vdrop(*vp); VFS_UNLOCK_GIANT(vfslocked); @@ -1137,7 +1139,7 @@ vn_fullpath1(struct thread *td, struct v numfullpathcalls++; CACHE_RLOCK(); if (vp->v_type != VDIR) { - error = vn_vptocnp_locked(&vp, buf, &buflen); + error = vn_vptocnp_locked(&vp, td->td_ucred, buf, &buflen); if (error) return (error); if (buflen == 0) { @@ -1167,7 +1169,7 @@ vn_fullpath1(struct thread *td, struct v error, vp, NULL, 0, 0); break; } - error = vn_vptocnp_locked(&vp, buf, &buflen); + error = vn_vptocnp_locked(&vp, td->td_ucred, buf, &buflen); if (error) break; if (buflen == 0) { Modified: head/sys/kern/vfs_default.c ============================================================================== --- head/sys/kern/vfs_default.c Sun Jun 21 19:17:22 2009 (r194600) +++ head/sys/kern/vfs_default.c Sun Jun 21 19:21:01 2009 (r194601) @@ -693,6 +693,7 @@ vop_stdvptocnp(struct vop_vptocnp_args * { struct vnode *vp = ap->a_vp; struct vnode **dvp = ap->a_vpp; + struct ucred *cred = ap->a_cred; char *buf = ap->a_buf; int *buflen = ap->a_buflen; char *dirbuf, *cpos; @@ -713,7 +714,7 @@ vop_stdvptocnp(struct vop_vptocnp_args * if (vp->v_type != VDIR) return (ENOENT); - error = VOP_GETATTR(vp, &va, td->td_ucred); + error = VOP_GETATTR(vp, &va, cred); if (error) return (error); @@ -723,7 +724,7 @@ vop_stdvptocnp(struct vop_vptocnp_args * NDINIT_ATVP(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, "..", vp, td); flags = FREAD; - error = vn_open_cred(&nd, &flags, 0, VN_OPEN_NOAUDIT, NULL, NULL); + error = vn_open_cred(&nd, &flags, 0, VN_OPEN_NOAUDIT, cred, NULL); if (error) { vn_lock(vp, locked | LK_RETRY); return (error); @@ -738,7 +739,7 @@ vop_stdvptocnp(struct vop_vptocnp_args * *dvp = (*dvp)->v_mount->mnt_vnodecovered; VREF(mvp); VOP_UNLOCK(mvp, 0); - vn_close(mvp, FREAD, td->td_ucred, td); + vn_close(mvp, FREAD, cred, td); VREF(*dvp); vn_lock(*dvp, LK_EXCLUSIVE | LK_RETRY); covered = 1; @@ -803,7 +804,7 @@ out: vrele(mvp); } else { VOP_UNLOCK(mvp, 0); - vn_close(mvp, FREAD, td->td_ucred, td); + vn_close(mvp, FREAD, cred, td); } vn_lock(vp, locked | LK_RETRY); return (error); Modified: head/sys/kern/vnode_if.src ============================================================================== --- head/sys/kern/vnode_if.src Sun Jun 21 19:17:22 2009 (r194600) +++ head/sys/kern/vnode_if.src Sun Jun 21 19:21:01 2009 (r194601) @@ -607,6 +607,7 @@ vop_vptofh { vop_vptocnp { IN struct vnode *vp; OUT struct vnode **vpp; + IN struct ucred *cred; INOUT char *buf; INOUT int *buflen; }; Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Sun Jun 21 19:17:22 2009 (r194600) +++ head/sys/sys/vnode.h Sun Jun 21 19:21:01 2009 (r194601) @@ -601,7 +601,8 @@ int insmntque1(struct vnode *vp, struct int insmntque(struct vnode *vp, struct mount *mp); u_quad_t init_va_filerev(void); int speedup_syncer(void); -int vn_vptocnp(struct vnode **vp, char *buf, u_int *buflen); +int vn_vptocnp(struct vnode **vp, struct ucred *cred, char *buf, + u_int *buflen); #define textvp_fullpath(p, rb, rfb) \ vn_fullpath(FIRST_THREAD_IN_PROC(p), (p)->p_textvp, rb, rfb) int vn_fullpath(struct thread *td, struct vnode *vn, From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 19:30:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A19171065675; Sun, 21 Jun 2009 19:30:33 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E4068FC08; Sun, 21 Jun 2009 19:30:33 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LJUXCw016247; Sun, 21 Jun 2009 19:30:33 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LJUXVJ016236; Sun, 21 Jun 2009 19:30:33 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906211930.n5LJUXVJ016236@svn.freebsd.org> From: Robert Watson Date: Sun, 21 Jun 2009 19:30: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: r194602 - in head/sys: net netatalk netinet netinet6 netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 19:30:34 -0000 Author: rwatson Date: Sun Jun 21 19:30:33 2009 New Revision: 194602 URL: http://svn.freebsd.org/changeset/base/194602 Log: Clean up common ifaddr management: - Unify reference count and lock initialization in a single function, ifa_init(). - Move tear-down from a macro (IFAFREE) to a function ifa_free(). - Move reference count bump from a macro (IFAREF) to a function ifa_ref(). - Instead of using a u_int protected by a mutex to refcount(9) for reference count management. The ifa_mtx is now used for exactly one ioctl, and possibly should be removed. MFC after: 3 weeks Modified: head/sys/net/if.c head/sys/net/if_var.h head/sys/net/route.c head/sys/net/rtsock.c head/sys/netatalk/at_control.c head/sys/netinet/in.c head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/nd6_nbr.c head/sys/netipx/ipx.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Sun Jun 21 19:21:01 2009 (r194601) +++ head/sys/net/if.c Sun Jun 21 19:30:33 2009 (r194602) @@ -758,7 +758,7 @@ if_attach_internal(struct ifnet *ifp, in socksize = roundup2(socksize, sizeof(long)); ifasize = sizeof(*ifa) + 2 * socksize; ifa = malloc(ifasize, M_IFADDR, M_WAITOK | M_ZERO); - IFA_LOCK_INIT(ifa); + ifa_init(ifa); sdl = (struct sockaddr_dl *)(ifa + 1); sdl->sdl_len = socksize; sdl->sdl_family = AF_LINK; @@ -775,7 +775,6 @@ if_attach_internal(struct ifnet *ifp, in sdl->sdl_len = masklen; while (namelen != 0) sdl->sdl_data[--namelen] = 0xff; - ifa->ifa_refcnt = 1; TAILQ_INSERT_HEAD(&ifp->if_addrhead, ifa, ifa_link); /* Reliably crash if used uninitialized. */ ifp->if_broadcastaddr = NULL; @@ -896,7 +895,7 @@ if_purgeaddrs(struct ifnet *ifp) } #endif /* INET6 */ TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); - IFAFREE(ifa); + ifa_free(ifa); } } @@ -1013,7 +1012,7 @@ if_detach_internal(struct ifnet *ifp, in if (!TAILQ_EMPTY(&ifp->if_addrhead)) { ifa = TAILQ_FIRST(&ifp->if_addrhead); TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); - IFAFREE(ifa); + ifa_free(ifa); } } @@ -1420,6 +1419,34 @@ if_rtdel(struct radix_node *rn, void *ar } /* + * Reference count functions for ifaddrs. + */ +void +ifa_init(struct ifaddr *ifa) +{ + + mtx_init(&ifa->ifa_mtx, "ifaddr", NULL, MTX_DEF); + refcount_init(&ifa->ifa_refcnt, 1); +} + +void +ifa_ref(struct ifaddr *ifa) +{ + + refcount_acquire(&ifa->ifa_refcnt); +} + +void +ifa_free(struct ifaddr *ifa) +{ + + if (refcount_release(&ifa->ifa_refcnt)) { + mtx_destroy(&ifa->ifa_mtx); + free(ifa, M_IFADDR); + } +} + +/* * XXX: Because sockaddr_dl has deeper structure than the sockaddr * structs used to represent other address families, it is necessary * to perform a different comparison. @@ -1711,10 +1738,10 @@ link_rtrequest(int cmd, struct rtentry * return; ifa = ifaof_ifpforaddr(dst, ifp); if (ifa) { - IFAREF(ifa); /* XXX */ + ifa_ref(ifa); /* XXX */ oifa = rt->rt_ifa; rt->rt_ifa = ifa; - IFAFREE(oifa); + ifa_free(oifa); if (ifa->ifa_rtrequest && ifa->ifa_rtrequest != link_rtrequest) ifa->ifa_rtrequest(cmd, rt, info); } Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Sun Jun 21 19:21:01 2009 (r194601) +++ head/sys/net/if_var.h Sun Jun 21 19:30:33 2009 (r194602) @@ -706,11 +706,14 @@ struct ifaddr { /* for compatibility with other BSDs */ #define ifa_list ifa_link -#define IFA_LOCK_INIT(ifa) \ - mtx_init(&(ifa)->ifa_mtx, "ifaddr", NULL, MTX_DEF) +#ifdef _KERNEL #define IFA_LOCK(ifa) mtx_lock(&(ifa)->ifa_mtx) #define IFA_UNLOCK(ifa) mtx_unlock(&(ifa)->ifa_mtx) -#define IFA_DESTROY(ifa) mtx_destroy(&(ifa)->ifa_mtx) + +void ifa_free(struct ifaddr *ifa); +void ifa_init(struct ifaddr *ifa); +void ifa_ref(struct ifaddr *ifa); +#endif /* * The prefix structure contains information about one prefix @@ -741,24 +744,6 @@ struct ifmultiaddr { }; #ifdef _KERNEL -#define IFAFREE(ifa) \ - do { \ - IFA_LOCK(ifa); \ - KASSERT((ifa)->ifa_refcnt > 0, \ - ("ifa %p !(ifa_refcnt > 0)", ifa)); \ - if (--(ifa)->ifa_refcnt == 0) { \ - IFA_DESTROY(ifa); \ - free(ifa, M_IFADDR); \ - } else \ - IFA_UNLOCK(ifa); \ - } while (0) - -#define IFAREF(ifa) \ - do { \ - IFA_LOCK(ifa); \ - ++(ifa)->ifa_refcnt; \ - IFA_UNLOCK(ifa); \ - } while (0) extern struct rwlock ifnet_lock; #define IFNET_LOCK_INIT() \ Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Sun Jun 21 19:21:01 2009 (r194601) +++ head/sys/net/route.c Sun Jun 21 19:30:33 2009 (r194602) @@ -474,7 +474,7 @@ rtfree(struct rtentry *rt) * e.g other routes and ifaddrs. */ if (rt->rt_ifa) - IFAFREE(rt->rt_ifa); + ifa_free(rt->rt_ifa); /* * The key is separatly alloc'd so free it (see rt_setgate()). * This also frees the gateway, as they are always malloc'd @@ -1126,7 +1126,7 @@ rtrequest1_fib(int req, struct rt_addrin * This moved from below so that rnh->rnh_addaddr() can * examine the ifa and ifa->ifa_ifp if it so desires. */ - IFAREF(ifa); + ifa_ref(ifa); rt->rt_ifa = ifa; rt->rt_ifp = ifa->ifa_ifp; rt->rt_rmx.rmx_weight = 1; @@ -1136,7 +1136,7 @@ rtrequest1_fib(int req, struct rt_addrin if (rn_mpath_capable(rnh) && rt_mpath_conflict(rnh, rt, netmask)) { if (rt->rt_ifa) { - IFAFREE(rt->rt_ifa); + ifa_free(rt->rt_ifa); } Free(rt_key(rt)); RT_LOCK_DESTROY(rt); @@ -1153,7 +1153,7 @@ rtrequest1_fib(int req, struct rt_addrin */ if (rn == NULL) { if (rt->rt_ifa) - IFAFREE(rt->rt_ifa); + ifa_free(rt->rt_ifa); Free(rt_key(rt)); RT_LOCK_DESTROY(rt); uma_zfree(V_rtzone, rt); @@ -1409,8 +1409,8 @@ rtinit1(struct ifaddr *ifa, int cmd, int */ if (memcmp(rt->rt_ifa->ifa_addr, ifa->ifa_addr, ifa->ifa_addr->sa_len)) { - IFAFREE(rt->rt_ifa); - IFAREF(ifa); + ifa_free(rt->rt_ifa); + ifa_ref(ifa); rt->rt_ifp = ifa->ifa_ifp; rt->rt_ifa = ifa; } Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Sun Jun 21 19:21:01 2009 (r194601) +++ head/sys/net/rtsock.c Sun Jun 21 19:30:33 2009 (r194602) @@ -694,7 +694,7 @@ route_output(struct mbuf *m, struct sock rt->rt_ifa->ifa_rtrequest != NULL) { rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt, &info); - IFAFREE(rt->rt_ifa); + ifa_free(rt->rt_ifa); } if (info.rti_info[RTAX_GATEWAY] != NULL) { RT_UNLOCK(rt); @@ -712,7 +712,7 @@ route_output(struct mbuf *m, struct sock } if (info.rti_ifa != NULL && info.rti_ifa != rt->rt_ifa) { - IFAREF(info.rti_ifa); + ifa_ref(info.rti_ifa); rt->rt_ifa = info.rti_ifa; rt->rt_ifp = info.rti_ifp; } Modified: head/sys/netatalk/at_control.c ============================================================================== --- head/sys/netatalk/at_control.c Sun Jun 21 19:21:01 2009 (r194601) +++ head/sys/netatalk/at_control.c Sun Jun 21 19:30:33 2009 (r194602) @@ -189,8 +189,7 @@ at_control(struct socket *so, u_long cmd * and link our new one on the end */ ifa = (struct ifaddr *)aa; - IFA_LOCK_INIT(ifa); - ifa->ifa_refcnt = 1; + ifa_init(ifa); /* * As the at_ifaddr contains the actual sockaddrs, @@ -325,7 +324,7 @@ at_control(struct socket *so, u_long cmd /* * Now reclaim the reference. */ - IFAFREE(ifa0); + ifa_free(ifa0); break; default: Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Sun Jun 21 19:21:01 2009 (r194601) +++ head/sys/netinet/in.c Sun Jun 21 19:30:33 2009 (r194602) @@ -377,11 +377,10 @@ in_control(struct socket *so, u_long cmd } ifa = &ia->ia_ifa; - IFA_LOCK_INIT(ifa); + ifa_init(ifa); ifa->ifa_addr = (struct sockaddr *)&ia->ia_addr; ifa->ifa_dstaddr = (struct sockaddr *)&ia->ia_dstaddr; ifa->ifa_netmask = (struct sockaddr *)&ia->ia_sockmask; - ifa->ifa_refcnt = 1; ia->ia_sockmask.sin_len = 8; ia->ia_sockmask.sin_family = AF_INET; @@ -617,7 +616,7 @@ in_control(struct socket *so, u_long cmd IN_MULTI_UNLOCK(); } } - IFAFREE(&ia->ia_ifa); + ifa_free(&ia->ia_ifa); splx(s); return (error); Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Sun Jun 21 19:21:01 2009 (r194601) +++ head/sys/netinet6/in6.c Sun Jun 21 19:30:33 2009 (r194602) @@ -784,9 +784,9 @@ in6_update_ifa(struct ifnet *ifp, struct if (ia == NULL) return (ENOBUFS); bzero((caddr_t)ia, sizeof(*ia)); + ifa_init(&ia->ia_ifa); LIST_INIT(&ia->ia6_memberships); /* Initialize the address and masks, and put time stamp */ - IFA_LOCK_INIT(&ia->ia_ifa); ia->ia_ifa.ifa_addr = (struct sockaddr *)&ia->ia_addr; ia->ia_addr.sin6_family = AF_INET6; ia->ia_addr.sin6_len = sizeof(ia->ia_addr); @@ -811,7 +811,6 @@ in6_update_ifa(struct ifnet *ifp, struct } else V_in6_ifaddr = ia; - ia->ia_ifa.ifa_refcnt = 1; IF_ADDR_LOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_UNLOCK(ifp); @@ -1387,7 +1386,7 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st * release another refcnt for the link from in6_ifaddr. * Note that we should decrement the refcnt at least once for all *BSD. */ - IFAFREE(&oia->ia_ifa); + ifa_free(&oia->ia_ifa); splx(s); } Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Sun Jun 21 19:21:01 2009 (r194601) +++ head/sys/netinet6/in6_ifattach.c Sun Jun 21 19:30:33 2009 (r194602) @@ -827,7 +827,7 @@ in6_ifdetach(struct ifnet *ifp) IF_ADDR_LOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, (struct ifaddr *)ia, ifa_link); IF_ADDR_UNLOCK(ifp); - IFAFREE(&ia->ia_ifa); + ifa_free(&ia->ia_ifa); /* also remove from the IPv6 address chain(itojun&jinmei) */ oia = ia; @@ -845,7 +845,7 @@ in6_ifdetach(struct ifnet *ifp) } } - IFAFREE(&oia->ia_ifa); + ifa_free(&oia->ia_ifa); } in6_pcbpurgeif0(&V_udbinfo, ifp); Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Sun Jun 21 19:21:01 2009 (r194601) +++ head/sys/netinet6/nd6_nbr.c Sun Jun 21 19:30:33 2009 (r194602) @@ -1223,7 +1223,7 @@ nd6_dad_start(struct ifaddr *ifa, int de * (re)initialization. */ dp->dad_ifa = ifa; - IFAREF(ifa); /* just for safety */ + ifa_ref(ifa); /* just for safety */ dp->dad_count = V_ip6_dad_count; dp->dad_ns_icount = dp->dad_na_icount = 0; dp->dad_ns_ocount = dp->dad_ns_tcount = 0; @@ -1258,7 +1258,7 @@ nd6_dad_stop(struct ifaddr *ifa) TAILQ_REMOVE(&V_dadq, (struct dadq *)dp, dad_list); free(dp, M_IP6NDP); dp = NULL; - IFAFREE(ifa); + ifa_free(ifa); } static void @@ -1301,7 +1301,7 @@ nd6_dad_timer(struct dadq *dp) TAILQ_REMOVE(&V_dadq, (struct dadq *)dp, dad_list); free(dp, M_IP6NDP); dp = NULL; - IFAFREE(ifa); + ifa_free(ifa); goto done; } @@ -1354,7 +1354,7 @@ nd6_dad_timer(struct dadq *dp) TAILQ_REMOVE(&V_dadq, (struct dadq *)dp, dad_list); free(dp, M_IP6NDP); dp = NULL; - IFAFREE(ifa); + ifa_free(ifa); } } @@ -1432,7 +1432,7 @@ nd6_dad_duplicated(struct ifaddr *ifa) TAILQ_REMOVE(&V_dadq, (struct dadq *)dp, dad_list); free(dp, M_IP6NDP); dp = NULL; - IFAFREE(ifa); + ifa_free(ifa); } static void Modified: head/sys/netipx/ipx.c ============================================================================== --- head/sys/netipx/ipx.c Sun Jun 21 19:21:01 2009 (r194601) +++ head/sys/netipx/ipx.c Sun Jun 21 19:30:33 2009 (r194602) @@ -170,8 +170,7 @@ ipx_control(struct socket *so, u_long cm ipx_ifaddr = oia; ia = oia; ifa = (struct ifaddr *)ia; - IFA_LOCK_INIT(ifa); - ifa->ifa_refcnt = 1; + ifa_init(ifa); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); ia->ia_ifp = ifp; ifa->ifa_addr = (struct sockaddr *)&ia->ia_addr; @@ -231,7 +230,7 @@ ipx_control(struct socket *so, u_long cm else printf("Didn't unlink ipxifadr from list\n"); } - IFAFREE((&oia->ia_ifa)); + ifa_free(&oia->ia_ifa); return (0); case SIOCAIFADDR: From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 20:08:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3239E106564A; Sun, 21 Jun 2009 20:08:08 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 20B178FC08; Sun, 21 Jun 2009 20:08:08 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LK88ur017382; Sun, 21 Jun 2009 20:08:08 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LK88hT017380; Sun, 21 Jun 2009 20:08:08 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906212008.n5LK88hT017380@svn.freebsd.org> From: Robert Watson Date: Sun, 21 Jun 2009 20:08: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: r194606 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 20:08:08 -0000 Author: rwatson Date: Sun Jun 21 20:08:07 2009 New Revision: 194606 URL: http://svn.freebsd.org/changeset/base/194606 Log: In ipx_control(), lock if_addr_mtx when adding/removing addresses from interface address lists, and don't add an address until it's fully initialized. MFC after: 3 weeks Modified: head/sys/netipx/ipx.c Modified: head/sys/netipx/ipx.c ============================================================================== --- head/sys/netipx/ipx.c Sun Jun 21 19:50:06 2009 (r194605) +++ head/sys/netipx/ipx.c Sun Jun 21 20:08:07 2009 (r194606) @@ -171,12 +171,9 @@ ipx_control(struct socket *so, u_long cm ia = oia; ifa = (struct ifaddr *)ia; ifa_init(ifa); - TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); ia->ia_ifp = ifp; ifa->ifa_addr = (struct sockaddr *)&ia->ia_addr; - ifa->ifa_netmask = (struct sockaddr *)&ipx_netmask; - ifa->ifa_dstaddr = (struct sockaddr *)&ia->ia_dstaddr; if (ifp->if_flags & IFF_BROADCAST) { ia->ia_broadaddr.sipx_family = AF_IPX; @@ -185,6 +182,9 @@ ipx_control(struct socket *so, u_long cm ia->ia_broadaddr.sipx_addr.x_host = ipx_broadhost; } + IF_ADDR_LOCK(ifp); + TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); + IF_ADDR_UNLOCK(ifp); } break; @@ -217,7 +217,9 @@ ipx_control(struct socket *so, u_long cm case SIOCDIFADDR: ipx_ifscrub(ifp, ia); ifa = (struct ifaddr *)ia; + IF_ADDR_LOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); + IF_ADDR_UNLOCK(ifp); oia = ia; if (oia == (ia = ipx_ifaddr)) { ipx_ifaddr = ia->ia_next; From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 20:29:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 746B11065673; Sun, 21 Jun 2009 20:29: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 631ED8FC16; Sun, 21 Jun 2009 20:29:14 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LKTEaL017792; Sun, 21 Jun 2009 20:29:14 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LKTEMx017790; Sun, 21 Jun 2009 20:29:14 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200906212029.n5LKTEMx017790@svn.freebsd.org> From: Alan Cox Date: Sun, 21 Jun 2009 20:29:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194607 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 20:29:15 -0000 Author: alc Date: Sun Jun 21 20:29:14 2009 New Revision: 194607 URL: http://svn.freebsd.org/changeset/base/194607 Log: Implement a mechanism within vm_phys_alloc_contig() to defer all necessary calls to vdrop() until after the free page queues lock is released. This eliminates repeatedly releasing and reacquiring the free page queues lock each time the last cached page is reclaimed from a vnode-backed object. Modified: head/sys/vm/vm_phys.c Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Sun Jun 21 20:08:07 2009 (r194606) +++ head/sys/vm/vm_phys.c Sun Jun 21 20:29:14 2009 (r194607) @@ -594,7 +594,7 @@ vm_phys_alloc_contig(unsigned long npage struct vm_phys_seg *seg; vm_object_t m_object; vm_paddr_t pa, pa_last, size; - vm_page_t m, m_ret; + vm_page_t deferred_vdrop_list, m, m_ret; int flind, i, oind, order, pind; size = npages << PAGE_SHIFT; @@ -604,6 +604,7 @@ vm_phys_alloc_contig(unsigned long npage ("vm_phys_alloc_contig: alignment must be a power of 2")); KASSERT((boundary & (boundary - 1)) == 0, ("vm_phys_alloc_contig: boundary must be a power of 2")); + deferred_vdrop_list = NULL; /* Compute the queue that is the best fit for npages. */ for (order = 0; (1 << order) < npages; order++); mtx_lock(&vm_page_queue_free_mtx); @@ -697,10 +698,23 @@ done: ("vm_phys_alloc_contig: page %p is busy", m)); KASSERT(m->dirty == 0, ("vm_phys_alloc_contig: page %p is dirty", m)); - m_object = m->object; if ((m->flags & PG_CACHED) != 0) { m->valid = 0; + m_object = m->object; vm_page_cache_remove(m); + if (m_object->type == OBJT_VNODE && + m_object->cache == NULL) { + /* + * Enqueue the vnode for deferred vdrop(). + * + * Unmanaged pages don't use "pageq", so it + * can be safely abused to construct a short- + * lived queue of vnodes. + */ + m->pageq.tqe_prev = m_object->handle; + m->pageq.tqe_next = deferred_vdrop_list; + deferred_vdrop_list = m; + } } else { KASSERT(VM_PAGE_IS_FREE(m), ("vm_phys_alloc_contig: page %p is not free", m)); @@ -714,13 +728,6 @@ done: m->flags = PG_UNMANAGED | (m->flags & PG_ZERO); m->oflags = 0; /* Unmanaged pages don't use "act_count". */ - if (m_object != NULL && - m_object->type == OBJT_VNODE && - m_object->cache == NULL) { - mtx_unlock(&vm_page_queue_free_mtx); - vdrop(m_object->handle); - mtx_lock(&vm_page_queue_free_mtx); - } } for (; i < roundup2(npages, 1 << imin(oind, order)); i++) { m = &m_ret[i]; @@ -730,6 +737,10 @@ done: vm_phys_free_pages(m, 0); } mtx_unlock(&vm_page_queue_free_mtx); + while (deferred_vdrop_list != NULL) { + vdrop((struct vnode *)deferred_vdrop_list->pageq.tqe_prev); + deferred_vdrop_list = deferred_vdrop_list->pageq.tqe_next; + } return (m_ret); } From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 21:04:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11FCB1065675; Sun, 21 Jun 2009 21:04:13 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F3FD68FC14; Sun, 21 Jun 2009 21:04:12 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LL4CQu018551; Sun, 21 Jun 2009 21:04:12 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LL4CCs018547; Sun, 21 Jun 2009 21:04:12 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906212104.n5LL4CCs018547@svn.freebsd.org> From: Robert Watson Date: Sun, 21 Jun 2009 21:04:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194608 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 21:04:14 -0000 Author: rwatson Date: Sun Jun 21 21:04:12 2009 New Revision: 194608 URL: http://svn.freebsd.org/changeset/base/194608 Log: Introduce basic locking of global IPX address list 'ipx_ifaddr' using a new rwlock, ipx_ifaddr_rw, wrapped with macros. This locking is necessary but not sufficient, in isolation, to satisfy the stability requirements of a fully parallel IPX input path during interface reconfiguration. MFC after: 3 weeks Modified: head/sys/netipx/ipx.c head/sys/netipx/ipx_if.h head/sys/netipx/ipx_input.c head/sys/netipx/ipx_outputfl.c head/sys/netipx/ipx_pcb.c Modified: head/sys/netipx/ipx.c ============================================================================== --- head/sys/netipx/ipx.c Sun Jun 21 20:29:14 2009 (r194607) +++ head/sys/netipx/ipx.c Sun Jun 21 21:04:12 2009 (r194608) @@ -65,8 +65,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include @@ -78,9 +80,10 @@ __FBSDID("$FreeBSD$"); #include /* - * XXXRW: Requires synchronization. + * The IPX-layer address list is protected by ipx_ifaddr_rw. */ -struct ipx_ifaddr *ipx_ifaddr; +struct rwlock ipx_ifaddr_rw; +struct ipx_ifaddr *ipx_ifaddr; static void ipx_ifscrub(struct ifnet *ifp, struct ipx_ifaddr *ia); static int ipx_ifinit(struct ifnet *ifp, struct ipx_ifaddr *ia, @@ -345,6 +348,8 @@ ipx_iaonnetof(struct ipx_addr *dst) struct ipx_ifaddr *ia_maybe = NULL; union ipx_net net = dst->x_net; + IPX_IFADDR_LOCK_ASSERT(); + for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) { if ((ifp = ia->ia_ifp) != NULL) { if (ifp->if_flags & IFF_POINTOPOINT) { Modified: head/sys/netipx/ipx_if.h ============================================================================== --- head/sys/netipx/ipx_if.h Sun Jun 21 20:29:14 2009 (r194607) +++ head/sys/netipx/ipx_if.h Sun Jun 21 21:04:12 2009 (r194608) @@ -105,7 +105,16 @@ struct ipx_aliasreq { #define ETHERTYPE_IPX 0x8137 /* Only Ethernet_II Available */ #ifdef _KERNEL -extern struct ipx_ifaddr *ipx_ifaddr; +extern struct rwlock ipx_ifaddr_rw; +extern struct ipx_ifaddr *ipx_ifaddr; + +#define IPX_IFADDR_LOCK_INIT() rw_init(&ipx_ifaddr_rw, "ipx_ifaddr_rw") +#define IPX_IFADDR_LOCK_ASSERT() rw_assert(&ipx_ifaddr_rw, RA_LOCKED) +#define IPX_IFADDR_RLOCK() rw_rlock(&ipx_ifaddr_rw) +#define IPX_IFADDR_RUNLOCK() rw_runlock(&ipx_ifaddr_rw) +#define IPX_IFADDR_WLOCK() rw_wlock(&ipx_ifaddr_rw) +#define IPX_IFADDR_WUNLOCK() rw_wunlock(&ipx_ifaddr_rw) +#define IPX_IFADDR_RLOCK_ASSERT() rw_assert(&ipx_ifaddr_rw, RA_WLOCKED) struct ipx_ifaddr *ipx_iaonnetof(struct ipx_addr *dst); #endif Modified: head/sys/netipx/ipx_input.c ============================================================================== --- head/sys/netipx/ipx_input.c Sun Jun 21 20:29:14 2009 (r194607) +++ head/sys/netipx/ipx_input.c Sun Jun 21 21:04:12 2009 (r194608) @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -146,6 +147,7 @@ ipx_init(void) LIST_INIT(&ipxrawpcb_list); IPX_LIST_LOCK_INIT(); + IPX_IFADDR_LOCK_INIT(); ipx_netmask.sipx_len = 6; ipx_netmask.sipx_addr.x_net = ipx_broadnet; @@ -253,11 +255,15 @@ ipxintr(struct mbuf *m) * If it is a broadcast to the net where it was * received from, treat it as ours. */ + IPX_IFADDR_RLOCK(); for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) if((ia->ia_ifa.ifa_ifp == m->m_pkthdr.rcvif) && ipx_neteq(ia->ia_addr.sipx_addr, - ipx->ipx_dna)) + ipx->ipx_dna)) { + IPX_IFADDR_RUNLOCK(); goto ours; + } + IPX_IFADDR_RUNLOCK(); /* * Look to see if I need to eat this packet. @@ -278,12 +284,13 @@ ipxintr(struct mbuf *m) * Is this our packet? If not, forward. */ } else { + IPX_IFADDR_RLOCK(); for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) if (ipx_hosteq(ipx->ipx_dna, ia->ia_addr.sipx_addr) && (ipx_neteq(ipx->ipx_dna, ia->ia_addr.sipx_addr) || ipx_neteqnn(ipx->ipx_dna.x_net, ipx_zeronet))) break; - + IPX_IFADDR_RUNLOCK(); if (ia == NULL) { ipx_forward(m); return; @@ -370,13 +377,17 @@ ipx_forward(struct mbuf *m) * age the packet so we can eat it safely the second time around. */ if (ipx->ipx_dna.x_host.c_host[0] & 0x1) { - struct ipx_ifaddr *ia = ipx_iaonnetof(&ipx->ipx_dna); + struct ipx_ifaddr *ia; struct ifnet *ifp; + + IPX_IFADDR_RLOCK(); + ia = ipx_iaonnetof(&ipx->ipx_dna); if (ia != NULL) { /* I'm gonna hafta eat this packet */ agedelta += IPX_MAXHOPS - ipx->ipx_tc; ipx->ipx_tc = IPX_MAXHOPS; } + IPX_IFADDR_RUNLOCK(); if ((ok_back = ipx_do_route(&ipx->ipx_sna,&ipx_sroute)) == 0) { /* error = ENETUNREACH; He'll never get it! */ ipxstat.ipxs_noroute++; Modified: head/sys/netipx/ipx_outputfl.c ============================================================================== --- head/sys/netipx/ipx_outputfl.c Sun Jun 21 20:29:14 2009 (r194607) +++ head/sys/netipx/ipx_outputfl.c Sun Jun 21 21:04:12 2009 (r194608) @@ -101,14 +101,18 @@ ipx_outputfl(struct mbuf *m0, struct rou * short circuit routing lookup. */ if (flags & IPX_ROUTETOIF) { - struct ipx_ifaddr *ia = ipx_iaonnetof(&ipx->ipx_dna); + struct ipx_ifaddr *ia; + IPX_IFADDR_RLOCK(); + ia = ipx_iaonnetof(&ipx->ipx_dna); if (ia == NULL) { + IPX_IFADDR_RUNLOCK(); ipxstat.ipxs_noroute++; error = ENETUNREACH; goto bad; } ifp = ia->ia_ifp; + IPX_IFADDR_RUNLOCK(); goto gotif; } rtalloc_ign(ro, 0); @@ -200,6 +204,7 @@ ipx_output_type20(struct mbuf *m) /* * Now see if we have already seen this. */ + IPX_IFADDR_RLOCK(); for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) if(ia->ia_ifa.ifa_ifp == m->m_pkthdr.rcvif) { if(tia == NULL) @@ -207,15 +212,20 @@ ipx_output_type20(struct mbuf *m) for (i=0;iipx_tc;i++,nbnet++) if(ipx_neteqnn(ia->ia_addr.sipx_addr.x_net, - *nbnet)) + *nbnet)) { + IPX_IFADDR_RUNLOCK(); goto bad; + } } + /* * Don't route the packet if the interface where it come from * does not have an IPX address. */ - if(tia == NULL) + if (tia == NULL) { + IPX_IFADDR_RUNLOCK(); goto bad; + } /* * Add our receiving interface to the list. @@ -266,6 +276,7 @@ ipx_output_type20(struct mbuf *m) } skip_this: ; } + IPX_IFADDR_RUNLOCK(); bad: m_freem(m); Modified: head/sys/netipx/ipx_pcb.c ============================================================================== --- head/sys/netipx/ipx_pcb.c Sun Jun 21 20:29:14 2009 (r194607) +++ head/sys/netipx/ipx_pcb.c Sun Jun 21 21:04:12 2009 (r194608) @@ -222,10 +222,13 @@ ipx_pcbconnect(struct ipxpcb *ipxp, stru * If we found a route, use the address * corresponding to the outgoing interface */ - if (ro->ro_rt != NULL && (ifp = ro->ro_rt->rt_ifp) != NULL) + if (ro->ro_rt != NULL && (ifp = ro->ro_rt->rt_ifp) != NULL) { + IPX_IFADDR_RLOCK(); for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) if (ia->ia_ifp == ifp) break; + IPX_IFADDR_RUNLOCK(); + } if (ia == NULL) { u_short fport = sipx->sipx_addr.x_port; sipx->sipx_addr.x_port = 0; @@ -251,20 +254,29 @@ ipx_pcbconnect(struct ipxpcb *ipxp, stru * If we found a route, use the address * corresponding to the outgoing interface */ - if (ro->ro_rt != NULL && (ifp = ro->ro_rt->rt_ifp) != NULL) + if (ro->ro_rt != NULL && (ifp = ro->ro_rt->rt_ifp) != NULL) { + IPX_IFADDR_RLOCK(); for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) if (ia->ia_ifp == ifp) break; + IPX_IFADDR_RUNLOCK(); + } if (ia == NULL) { u_short fport = sipx->sipx_addr.x_port; sipx->sipx_addr.x_port = 0; ia = (struct ipx_ifaddr *) ifa_ifwithdstaddr((struct sockaddr *)sipx); sipx->sipx_addr.x_port = fport; - if (ia == NULL) + if (ia == NULL) { + IPX_IFADDR_RLOCK(); ia = ipx_iaonnetof(&sipx->sipx_addr); - if (ia == NULL) + IPX_IFADDR_RUNLOCK(); + } + if (ia == NULL) { + IPX_IFADDR_RLOCK(); ia = ipx_ifaddr; + IPX_IFADDR_RUNLOCK(); + } if (ia == NULL) return (EADDRNOTAVAIL); } From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 21:38:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E4631065675; Sun, 21 Jun 2009 21:38:13 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3CC6C8FC1A; Sun, 21 Jun 2009 21:38:13 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LLcD4l019224; Sun, 21 Jun 2009 21:38:13 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LLcDrp019222; Sun, 21 Jun 2009 21:38:13 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <200906212138.n5LLcDrp019222@svn.freebsd.org> From: Olivier Houchard Date: Sun, 21 Jun 2009 21:38: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: r194609 - head/sys/arm/arm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 21:38:13 -0000 Author: cognet Date: Sun Jun 21 21:38:12 2009 New Revision: 194609 URL: http://svn.freebsd.org/changeset/base/194609 Log: Disable write-back until I figure out what's wrong with it on the i81342. There's no need to disable the MMU once we're done inflating the kernel. Modified: head/sys/arm/arm/elf_trampoline.c Modified: head/sys/arm/arm/elf_trampoline.c ============================================================================== --- head/sys/arm/arm/elf_trampoline.c Sun Jun 21 21:04:12 2009 (r194608) +++ head/sys/arm/arm/elf_trampoline.c Sun Jun 21 21:38:12 2009 (r194609) @@ -550,7 +550,7 @@ setup_pagetables(unsigned int pt_addr, v for (addr = physstart; addr < physend; addr += L1_S_SIZE) { pd[addr >> L1_S_SHIFT] = L1_TYPE_S|L1_S_C|L1_S_AP(AP_KRW)| L1_S_DOM(PMAP_DOMAIN_KERNEL) | addr; - if (write_back) + if (write_back && 0) pd[addr >> L1_S_SHIFT] |= L1_S_B; } /* XXX: See below */ @@ -610,12 +610,6 @@ __start(void) (unsigned int)&func_end + 800 , 0); if (altdst > dst) dst = altdst; - cpu_idcache_wbinv_all(); - cpu_l2cache_wbinv_all(); - __asm __volatile("mrc p15, 0, %0, c1, c0, 0\n" - "bic %0, %0, #1\n" /* MMU_ENABLE */ - "mcr p15, 0, %0, c1, c0, 0\n" - : "=r" (pt_addr)); } else #endif dst = 4 + load_kernel((unsigned int)&kernel_start, From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 21:42:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B0481065674; Sun, 21 Jun 2009 21:42:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6FE918FC17; Sun, 21 Jun 2009 21:42:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5LLgT1r019356; Sun, 21 Jun 2009 21:42:29 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5LLgTtr019354; Sun, 21 Jun 2009 21:42:29 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906212142.n5LLgTtr019354@svn.freebsd.org> From: Robert Watson Date: Sun, 21 Jun 2009 21:42:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194610 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 21:42:30 -0000 Author: rwatson Date: Sun Jun 21 21:42:29 2009 New Revision: 194610 URL: http://svn.freebsd.org/changeset/base/194610 Log: Add ipx_ifaddr locking to ipx_control(), which should close most remaining potential races in ifconfig's management of IPX addresses. This is largely accomplished by dropping a global write lock for the IPX address list over the body of in_control(), although there are some places we bump the refcount on an ifaddr of interest while calling out to the routing code or link layer code, which might require revisiting. Annotate one as a potential race if two simultaneous delete ioctls are issued for the same IPX addresses at once. MFC after: 3 weeks Modified: head/sys/netipx/ipx.c Modified: head/sys/netipx/ipx.c ============================================================================== --- head/sys/netipx/ipx.c Sun Jun 21 21:38:12 2009 (r194609) +++ head/sys/netipx/ipx.c Sun Jun 21 21:42:29 2009 (r194610) @@ -1,6 +1,8 @@ /*- * Copyright (c) 1984, 1985, 1986, 1987, 1993 - * The Regents of the University of California. All rights reserved. + * The Regents of the University of California. + * Copyright (c) 2009 Robert N. M. Watson + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -109,32 +111,44 @@ ipx_control(struct socket *so, u_long cm */ if (ifp == NULL) return (EADDRNOTAVAIL); + + IPX_IFADDR_WLOCK(); for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) if (ia->ia_ifp == ifp) break; switch (cmd) { case SIOCGIFADDR: - if (ia == NULL) - return (EADDRNOTAVAIL); + if (ia == NULL) { + error = EADDRNOTAVAIL; + goto out; + } *(struct sockaddr_ipx *)&ifr->ifr_addr = ia->ia_addr; - return (0); + goto out; case SIOCGIFBRDADDR: - if (ia == NULL) - return (EADDRNOTAVAIL); - if ((ifp->if_flags & IFF_BROADCAST) == 0) - return (EINVAL); + if (ia == NULL) { + error = EADDRNOTAVAIL; + goto out; + } + if ((ifp->if_flags & IFF_BROADCAST) == 0) { + error = EINVAL; + goto out; + } *(struct sockaddr_ipx *)&ifr->ifr_dstaddr = ia->ia_broadaddr; - return (0); + goto out; case SIOCGIFDSTADDR: - if (ia == NULL) - return (EADDRNOTAVAIL); - if ((ifp->if_flags & IFF_POINTOPOINT) == 0) - return (EINVAL); + if (ia == NULL) { + error = EADDRNOTAVAIL; + goto out; + } + if ((ifp->if_flags & IFF_POINTOPOINT) == 0) { + error = EINVAL; + goto out; + } *(struct sockaddr_ipx *)&ifr->ifr_dstaddr = ia->ia_dstaddr; - return (0); + goto out; } switch (cmd) { @@ -143,7 +157,7 @@ ipx_control(struct socket *so, u_long cm priv = (cmd == SIOCAIFADDR) ? PRIV_NET_ADDIFADDR : PRIV_NET_DELIFADDR; if (td && (error = priv_check(td, priv)) != 0) - return (error); + goto out; if (ifra->ifra_addr.sipx_family == AF_IPX) for (oia = ia; ia != NULL; ia = ia->ia_next) { if (ia->ia_ifp == ifp && @@ -151,20 +165,24 @@ ipx_control(struct socket *so, u_long cm ifra->ifra_addr.sipx_addr)) break; } - if (cmd == SIOCDIFADDR && ia == NULL) - return (EADDRNOTAVAIL); + if (cmd == SIOCDIFADDR && ia == NULL) { + error = EADDRNOTAVAIL; + goto out; + } /* FALLTHROUGH */ case SIOCSIFADDR: case SIOCSIFDSTADDR: if (td && (error = priv_check(td, PRIV_NET_SETLLADDR)) != 0) - return (error); + goto out; if (ia == NULL) { oia = (struct ipx_ifaddr *) malloc(sizeof(*ia), M_IFADDR, - M_WAITOK | M_ZERO); - if (oia == NULL) - return (ENOBUFS); + M_NOWAIT | M_ZERO); + if (oia == NULL) { + error = ENOBUFS; + goto out; + } if ((ia = ipx_ifaddr) != NULL) { for ( ; ia->ia_next != NULL; ia = ia->ia_next) ; @@ -193,32 +211,48 @@ ipx_control(struct socket *so, u_long cm default: if (td && (error = priv_check(td, PRIV_NET_HWIOCTL)) != 0) - return (error); + goto out; } switch (cmd) { case SIOCSIFDSTADDR: - if ((ifp->if_flags & IFF_POINTOPOINT) == 0) - return (EINVAL); + if ((ifp->if_flags & IFF_POINTOPOINT) == 0) { + error = EINVAL; + goto out; + } if (ia->ia_flags & IFA_ROUTE) { rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST); ia->ia_flags &= ~IFA_ROUTE; } + ifa_ref(&ia->ia_ifa); + IPX_IFADDR_WUNLOCK(); if (ifp->if_ioctl) { error = (*ifp->if_ioctl)(ifp, SIOCSIFDSTADDR, (void *)ia); - if (error) + if (error) { + ifa_free(&ia->ia_ifa); return (error); + } } *(struct sockaddr *)&ia->ia_dstaddr = ifr->ifr_dstaddr; + ifa_free(&ia->ia_ifa); return (0); case SIOCSIFADDR: - return (ipx_ifinit(ifp, ia, - (struct sockaddr_ipx *)&ifr->ifr_addr, 1)); + ifa_ref(&ia->ia_ifa); + IPX_IFADDR_WUNLOCK(); + error = ipx_ifinit(ifp, ia, + (struct sockaddr_ipx *)&ifr->ifr_addr, 1); + ifa_free(&ia->ia_ifa); + return (error); case SIOCDIFADDR: + /* XXXRW: Potential race here while ipx_ifaddr_rw is dropped. */ + ifa_ref(&ia->ia_ifa); + IPX_IFADDR_WUNLOCK(); ipx_ifscrub(ifp, ia); + IPX_IFADDR_WLOCK(); + ifa_free(&ia->ia_ifa); ifa = (struct ifaddr *)ia; IF_ADDR_LOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); @@ -236,6 +270,7 @@ ipx_control(struct socket *so, u_long cm printf("Didn't unlink ipxifadr from list\n"); } ifa_free(&oia->ia_ifa); + IPX_IFADDR_WUNLOCK(); return (0); case SIOCAIFADDR: @@ -249,6 +284,8 @@ ipx_control(struct socket *so, u_long cm ia->ia_addr.sipx_addr)) hostIsNew = 0; } + ifa_ref(&ia->ia_ifa); + IPX_IFADDR_WUNLOCK(); if ((ifp->if_flags & IFF_POINTOPOINT) && (ifra->ifra_dstaddr.sipx_family == AF_IPX)) { if (hostIsNew == 0) @@ -259,13 +296,19 @@ ipx_control(struct socket *so, u_long cm if (ifra->ifra_addr.sipx_family == AF_IPX && (hostIsNew || dstIsNew)) error = ipx_ifinit(ifp, ia, &ifra->ifra_addr, 0); + ifa_free(&ia->ia_ifa); return (error); default: + IPX_IFADDR_WUNLOCK(); if (ifp->if_ioctl == NULL) return (EOPNOTSUPP); return ((*ifp->if_ioctl)(ifp, cmd, data)); } + +out: + IPX_IFADDR_WUNLOCK(); + return (error); } /* From owner-svn-src-head@FreeBSD.ORG Sun Jun 21 22:48:09 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0191C1065672; Sun, 21 Jun 2009 22:48:09 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id BF7998FC12; Sun, 21 Jun 2009 22:48:08 +0000 (UTC) (envelope-from bms@incunabulum.net) Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id DC310374EF1; Sun, 21 Jun 2009 18:48:07 -0400 (EDT) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute2.internal (MEProxy); Sun, 21 Jun 2009 18:48:07 -0400 X-Sasl-enc: hashDleOHiqv5le2lQ588AkQpJ7yBqWIdum7rp0Xue3i 1245624487 Received: from [192.168.123.18] (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id DF54D1F5BA; Sun, 21 Jun 2009 18:48:06 -0400 (EDT) Message-ID: <4A3EB89E.3010503@incunabulum.net> Date: Sun, 21 Jun 2009 23:47:58 +0100 From: Bruce Simpson User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Brooks Davis References: <200906191552.n5JFqZcG047705@svn.freebsd.org> <20090620130238.N29302@delplex.bde.org> <20090621134826.GA44901@FreeBSD.org> <86skhty76e.fsf@ds4.des.no> <20090621173304.GA89146@lor.one-eyed-alien.net> In-Reply-To: <20090621173304.GA89146@lor.one-eyed-alien.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Alexey Dokuchaev , src-committers@FreeBSD.org, svn-src-all@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org, Dag-Erling Sm??rgrav Subject: Re: svn commit: r194493 - head/usr.bin/catman X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jun 2009 22:48:09 -0000 Brooks Davis wrote: > On Sun, Jun 21, 2009 at 04:48:09PM +0200, Dag-Erling Sm??rgrav wrote: > >> Alexey Dokuchaev writes: >> >>> This kinda brings up the question, do we actually need catman(1) at all >>> these days of fast CPU and disks and plenty of RAM? >>> >> Show me the fast CPU and plenty of RAM on this board: >> >> http://www.soekris.com/net4801.htm >> > > For such hardware, the OpenBSD mdoc renderer is likely to be a better > fit anyway. It's orders of magnitude faster than *roff and wouldn't > waste space on catpages that will in all likely hood never be used. > Also, why are people expecting to render man pages on an embedded platform anyway? I thought the reasoning behind embedded systems was that they were just that, and the usual expectations of desktop systems didn't necessarily apply. I don't expect to be able to read man pages on my pfSense firewall -- and its custom installed predecessor before that, didn't have man pages installed at all to save space in the runtime image. So surely the point about the Soekris here is moot? best, BMS From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 01:29:59 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99A74106566C; Mon, 22 Jun 2009 01:29:59 +0000 (UTC) (envelope-from fullermd@over-yonder.net) Received: from thyme.infocus-llc.com (server.infocus-llc.com [206.156.254.44]) by mx1.freebsd.org (Postfix) with ESMTP id 66D228FC15; Mon, 22 Jun 2009 01:29:59 +0000 (UTC) (envelope-from fullermd@over-yonder.net) Received: from draco.over-yonder.net (c-75-65-240-232.hsd1.ms.comcast.net [75.65.240.232]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by thyme.infocus-llc.com (Postfix) with ESMTPSA id 2E5B537B5F7; Sun, 21 Jun 2009 20:12:52 -0500 (CDT) Received: by draco.over-yonder.net (Postfix, from userid 100) id 61E5E61C51; Sun, 21 Jun 2009 20:12:51 -0500 (CDT) Date: Sun, 21 Jun 2009 20:12:51 -0500 From: "Matthew D. Fuller" To: Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= Message-ID: <20090622011251.GA3734@over-yonder.net> References: <200906191552.n5JFqZcG047705@svn.freebsd.org> <20090620130238.N29302@delplex.bde.org> <20090621134826.GA44901@FreeBSD.org> <86skhty76e.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <86skhty76e.fsf@ds4.des.no> X-Editor: vi X-OS: FreeBSD User-Agent: Mutt/1.5.19-fullermd.4 (2009-01-05) X-Virus-Scanned: clamav-milter 0.95.2 at thyme.infocus-llc.com X-Virus-Status: Clean Cc: Alexey Dokuchaev , Brooks Davis , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org Subject: Re: svn commit: r194493 - head/usr.bin/catman X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 01:30:00 -0000 On Sun, Jun 21, 2009 at 04:48:09PM +0200 I heard the voice of Dag-Erling Smørgrav, and lo! it spake thus: > Alexey Dokuchaev writes: > > This kinda brings up the question, do we actually need catman(1) at all > > these days of fast CPU and disks and plenty of RAM? > > Show me the fast CPU and plenty of RAM on this board: Actually, I looked at this sort of things some years ago when I was sitting in front of a PPro (which was way outdated by that time), and even the largest manpage I could find in base didn't take more than 6 or 8 seconds to render. Now, a PPro 200 probably has rather more suds than a net4801, but it's not a huge difference. One can come up with situations where there's reason to use catman, but my conclusion at the time was that I couldn't come up with any value in man(1) writing out catpages. -- Matthew Fuller (MF4839) | fullermd@over-yonder.net Systems/Network Administrator | http://www.over-yonder.net/~fullermd/ On the Internet, nobody can hear you scream. From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 02:02:00 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B485A1065672; Mon, 22 Jun 2009 02:02:00 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 6EB8E8FC13; Mon, 22 Jun 2009 02:02:00 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 819956D418; Mon, 22 Jun 2009 04:01:59 +0200 (CEST) Received: by ds4.des.no (Postfix, from userid 1001) id 64B25844E2; Mon, 22 Jun 2009 04:01:59 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Bruce Simpson References: <200906191552.n5JFqZcG047705@svn.freebsd.org> <20090620130238.N29302@delplex.bde.org> <20090621134826.GA44901@FreeBSD.org> <86skhty76e.fsf@ds4.des.no> <20090621173304.GA89146@lor.one-eyed-alien.net> <4A3EB89E.3010503@incunabulum.net> Date: Mon, 22 Jun 2009 04:01:59 +0200 In-Reply-To: <4A3EB89E.3010503@incunabulum.net> (Bruce Simpson's message of "Sun, 21 Jun 2009 23:47:58 +0100") Message-ID: <86vdmpvxew.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Alexey Dokuchaev , Brooks Davis , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans , svn-src-head@FreeBSD.org Subject: Re: svn commit: r194493 - head/usr.bin/catman X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 02:02:01 -0000 Bruce Simpson writes: > Also, why are people expecting to render man pages on an embedded > platform anyway? You'd be surprised how often I type 'man pf.conf' on that box :) DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 04:13:03 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B73B1065670; Mon, 22 Jun 2009 04:13:03 +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 044A28FC12; Mon, 22 Jun 2009 04:13:02 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-106-159-184.carlnfd1.nsw.optusnet.com.au (c122-106-159-184.carlnfd1.nsw.optusnet.com.au [122.106.159.184]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n5M4CvKX003616 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 22 Jun 2009 14:12:59 +1000 Date: Mon, 22 Jun 2009 14:12:57 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Konstantin Belousov In-Reply-To: <200906211341.n5LDfWEx008281@svn.freebsd.org> Message-ID: <20090622133231.W31111@delplex.bde.org> References: <200906211341.n5LDfWEx008281@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: r194586 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 04:13:03 -0000 On Sun, 21 Jun 2009, Konstantin Belousov wrote: > Log: > Add another flags argument to vn_open_cred. Use it to specify that some > vn_open_cred invocations shall not audit namei path. > Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c > ============================================================================== > --- head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Sun Jun 21 13:15:56 2009 (r194585) > +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Sun Jun 21 13:41:32 2009 (r194586) > @@ -85,7 +85,8 @@ kobj_open_file_vnode(const char *file) > > flags = FREAD; > NDINIT(&nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td); > - error = vn_open_cred(&nd, &flags, O_NOFOLLOW, curthread->td_ucred, NULL); > + error = vn_open_cred(&nd, &flags, O_NOFOLLOW, 0, curthread->td_ucred, > + NULL); I was going to ask "why not put the flag in the existing flags arg, like O_NOFOLLOW here?", but it seems that there is no existing flags arg and the above O_NOFOLLOW is garbage. O_NOFOLLOW happens to be 0x100, so I think the above asks for mode S_IRUSR. Now I will ask "why not put O_NOFOLLOW here and the new flag in the existing pointer-to-flags arg?". > Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h > ============================================================================== > --- head/sys/cddl/compat/opensolaris/sys/vnode.h Sun Jun 21 13:15:56 2009 (r194585) > +++ head/sys/cddl/compat/opensolaris/sys/vnode.h Sun Jun 21 13:41:32 2009 (r194586) > @@ -182,7 +182,7 @@ vn_openat(char *pnamep, enum uio_seg seg > vref(startvp); > NDINIT_ATVP(&nd, operation, MPSAFE, UIO_SYSSPACE, pnamep, startvp, td); > filemode |= O_NOFOLLOW; > - error = vn_open_cred(&nd, &filemode, createmode, td->td_ucred, NULL); > + error = vn_open_cred(&nd, &filemode, createmode, 0, td->td_ucred, NULL); Here it does put O_NOFOLLOW in the existing pointer-to-flags arg. It obfuscates the open-flags variable by naming it filemode. > Modified: head/sys/kern/vfs_vnops.c > ============================================================================== > --- head/sys/kern/vfs_vnops.c Sun Jun 21 13:15:56 2009 (r194585) > +++ head/sys/kern/vfs_vnops.c Sun Jun 21 13:41:32 2009 (r194586) > @@ -102,11 +102,8 @@ vn_open(ndp, flagp, cmode, fp) > * due to the NDINIT being done elsewhere. > */ > int > -vn_open_cred(ndp, flagp, cmode, cred, fp) > - struct nameidata *ndp; > - int *flagp, cmode; > - struct ucred *cred; > - struct file *fp; > +vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, u_int vn_open_flags, > + struct ucred *cred, struct file *fp) > { > struct vnode *vp; > struct mount *mp; > @@ -124,9 +121,11 @@ restart: > if (fmode & O_CREAT) { Internally, flags are obfuscated by copying *flagp to the misnamed local variable fmode. The pointer-to-flags variable has about 12 spare bits in it. It already has just 1 kernel-only flag (O_HASLOCK, misnamed FHASLOCK and misassigned in the middle of the user flags). fcntl.h's list of open flags has been obfuscated by putting AT_ flags in the middle of the list. Bruce From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 04:21:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36295106564A; Mon, 22 Jun 2009 04:21:03 +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 C86918FC0A; Mon, 22 Jun 2009 04:21:02 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5M4L2S0027152; Mon, 22 Jun 2009 04:21:02 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5M4L2HG027149; Mon, 22 Jun 2009 04:21:02 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200906220421.n5M4L2HG027149@svn.freebsd.org> From: Alan Cox Date: Mon, 22 Jun 2009 04:21: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: r194611 - in head/sys: amd64/include i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 04:21:03 -0000 Author: alc Date: Mon Jun 22 04:21:02 2009 New Revision: 194611 URL: http://svn.freebsd.org/changeset/base/194611 Log: Eliminate dead code. These definitions should have been deleted with the introduction of i686_mem.c in r45405. Merge adjacent #ifdef _KERNEL/#endif blocks. Modified: head/sys/amd64/include/pmap.h head/sys/i386/include/pmap.h Modified: head/sys/amd64/include/pmap.h ============================================================================== --- head/sys/amd64/include/pmap.h Sun Jun 21 21:42:29 2009 (r194610) +++ head/sys/amd64/include/pmap.h Mon Jun 22 04:21:02 2009 (r194611) @@ -175,9 +175,7 @@ typedef u_int64_t pml4_entry_t; #define PML4pml4e ((pd_entry_t *)(addr_PML4pml4e)) extern u_int64_t KPML4phys; /* physical address of kernel level 4 */ -#endif -#ifdef _KERNEL /* * virtual address to page table entry and * to physical address. @@ -294,14 +292,6 @@ struct pv_chunk { #ifdef _KERNEL -#define NPPROVMTRR 8 -#define PPRO_VMTRRphysBase0 0x200 -#define PPRO_VMTRRphysMask0 0x201 -struct ppro_vmtrr { - u_int64_t base, mask; -}; -extern struct ppro_vmtrr PPro_vmtrr[NPPROVMTRR]; - extern caddr_t CADDR1; extern pt_entry_t *CMAP1; extern vm_paddr_t phys_avail[]; Modified: head/sys/i386/include/pmap.h ============================================================================== --- head/sys/i386/include/pmap.h Sun Jun 21 21:42:29 2009 (r194610) +++ head/sys/i386/include/pmap.h Mon Jun 22 04:21:02 2009 (r194611) @@ -185,9 +185,7 @@ extern pd_entry_t PTDpde[]; extern pdpt_entry_t *IdlePDPT; #endif extern pd_entry_t *IdlePTD; /* physical address of "Idle" state directory */ -#endif -#ifdef _KERNEL /* * virtual address to page table entry and * to physical address. @@ -450,14 +448,6 @@ struct pv_chunk { #ifdef _KERNEL -#define NPPROVMTRR 8 -#define PPRO_VMTRRphysBase0 0x200 -#define PPRO_VMTRRphysMask0 0x201 -struct ppro_vmtrr { - u_int64_t base, mask; -}; -extern struct ppro_vmtrr PPro_vmtrr[NPPROVMTRR]; - extern caddr_t CADDR1; extern pt_entry_t *CMAP1; extern vm_paddr_t phys_avail[]; From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 09:24:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2FD4106564A; Mon, 22 Jun 2009 09:24:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9187D8FC20; Mon, 22 Jun 2009 09:24:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5M9OkT6033004; Mon, 22 Jun 2009 09:24:46 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5M9Ok2g033002; Mon, 22 Jun 2009 09:24:46 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200906220924.n5M9Ok2g033002@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 22 Jun 2009 09:24: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: r194616 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 09:24:47 -0000 Author: bz Date: Mon Jun 22 09:24:46 2009 New Revision: 194616 URL: http://svn.freebsd.org/changeset/base/194616 Log: Remove a hack from r186086 so that IPsec via loopback routes continued working. It was targeted for stable/7 compatibility and actually never did anything in HEAD. Reminded by: rwatson X-MFC after: never Modified: head/sys/netinet/in_pcb.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Mon Jun 22 08:09:35 2009 (r194615) +++ head/sys/netinet/in_pcb.c Mon Jun 22 09:24:46 2009 (r194616) @@ -705,10 +705,6 @@ in_pcbladdr(struct inpcb *inp, struct in ia = ifatoia(ifa_ifwithnet(sintosa(&sain))); if (cred == NULL || !prison_flag(cred, PR_IP4)) { -#if __FreeBSD_version < 800000 - if (ia == NULL) - ia = (struct in_ifaddr *)sro.ro_rt->rt_ifa; -#endif if (ia == NULL) { error = ENETUNREACH; goto done; From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 10:08:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA71E106566C; Mon, 22 Jun 2009 10:08:48 +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 B8A5E8FC08; Mon, 22 Jun 2009 10:08:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MA8mWe033919; Mon, 22 Jun 2009 10:08:48 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MA8mMD033917; Mon, 22 Jun 2009 10:08:48 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200906221008.n5MA8mMD033917@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 22 Jun 2009 10:08: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: r194617 - head/sys/cddl/compat/opensolaris/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 10:08:49 -0000 Author: kib Date: Mon Jun 22 10:08:48 2009 New Revision: 194617 URL: http://svn.freebsd.org/changeset/base/194617 Log: O_NOFOLLOW shall be in flags, not in cmode. Noted by: bde Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c ============================================================================== --- head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Mon Jun 22 09:24:46 2009 (r194616) +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Mon Jun 22 10:08:48 2009 (r194617) @@ -83,10 +83,9 @@ kobj_open_file_vnode(const char *file) } FILEDESC_XUNLOCK(fd); - flags = FREAD; + flags = FREAD | O_NOFOLLOW; NDINIT(&nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td); - error = vn_open_cred(&nd, &flags, O_NOFOLLOW, 0, curthread->td_ucred, - NULL); + error = vn_open_cred(&nd, &flags, 0, 0, curthread->td_ucred, NULL); NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) return (NULL); From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 10:11:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17D82106566C; Mon, 22 Jun 2009 10:11:36 +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 E08078FC13; Mon, 22 Jun 2009 10:11:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MABZts034021; Mon, 22 Jun 2009 10:11:35 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MABZDS034019; Mon, 22 Jun 2009 10:11:35 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200906221011.n5MABZDS034019@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 22 Jun 2009 10: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: r194618 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 10:11:36 -0000 Author: kib Date: Mon Jun 22 10:11:35 2009 New Revision: 194618 URL: http://svn.freebsd.org/changeset/base/194618 Log: Move definitions of AT_* constants from the middle of the open(2) flags enumeration. Noted by: bde Modified: head/sys/sys/fcntl.h Modified: head/sys/sys/fcntl.h ============================================================================== --- head/sys/sys/fcntl.h Mon Jun 22 10:08:48 2009 (r194617) +++ head/sys/sys/fcntl.h Mon Jun 22 10:11:35 2009 (r194618) @@ -105,23 +105,6 @@ typedef __pid_t pid_t; #ifdef _KERNEL #define FHASLOCK 0x4000 /* descriptor holds advisory lock */ #endif -/* Defined by POSIX Extended API Set Part 2 */ -#if __BSD_VISIBLE -/* - * Magic value that specify the use of the current working directory - * to determine the target of relative file paths in the openat() and - * similar syscalls. - */ -#define AT_FDCWD -100 - -/* - * Miscellaneous flags for the *at() syscalls. - */ -#define AT_EACCESS 0x100 /* Check access using effective user and group ID */ -#define AT_SYMLINK_NOFOLLOW 0x200 /* Do not follow symbolic links */ -#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic link */ -#define AT_REMOVEDIR 0x800 /* Remove directory instead of file */ -#endif /* Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. */ #define O_NOCTTY 0x8000 /* don't assign controlling terminal */ @@ -195,6 +178,24 @@ typedef __pid_t pid_t; #if __BSD_VISIBLE #endif +/* Defined by POSIX Extended API Set Part 2 */ +#if __BSD_VISIBLE +/* + * Magic value that specify the use of the current working directory + * to determine the target of relative file paths in the openat() and + * similar syscalls. + */ +#define AT_FDCWD -100 + +/* + * Miscellaneous flags for the *at() syscalls. + */ +#define AT_EACCESS 0x100 /* Check access using effective user and group ID */ +#define AT_SYMLINK_NOFOLLOW 0x200 /* Do not follow symbolic links */ +#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic link */ +#define AT_REMOVEDIR 0x800 /* Remove directory instead of file */ +#endif + /* * Constants used for fcntl(2) */ From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 10:22:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A028106568F; Mon, 22 Jun 2009 10:22:37 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by mx1.freebsd.org (Postfix) with ESMTP id 30A6A8FC14; Mon, 22 Jun 2009 10:22:36 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n5MAMWUD058930 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 22 Jun 2009 13:22:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n5MAMW2M046040; Mon, 22 Jun 2009 13:22:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n5MAMWIM046039; Mon, 22 Jun 2009 13:22:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 22 Jun 2009 13:22:32 +0300 From: Kostik Belousov To: Bruce Evans Message-ID: <20090622102232.GM2884@deviant.kiev.zoral.com.ua> References: <200906211341.n5LDfWEx008281@svn.freebsd.org> <20090622133231.W31111@delplex.bde.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="37nyS7qXrnu4wN2o" Content-Disposition: inline In-Reply-To: <20090622133231.W31111@delplex.bde.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.1 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 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: r194586 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 10:22:39 -0000 --37nyS7qXrnu4wN2o Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 22, 2009 at 02:12:57PM +1000, Bruce Evans wrote: > On Sun, 21 Jun 2009, Konstantin Belousov wrote: >=20 > >Log: > > Add another flags argument to vn_open_cred. Use it to specify that some > > vn_open_cred invocations shall not audit namei path. >=20 > >Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.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/cddl/compat/opensolaris/kern/opensolaris_kobj.c Sun Jun 21= =20 > >13:15:56 2009 (r194585) > >+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Sun Jun 21= =20 > >13:41:32 2009 (r194586) > >@@ -85,7 +85,8 @@ kobj_open_file_vnode(const char *file) > > > > flags =3D FREAD; > > NDINIT(&nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td); > >- error =3D vn_open_cred(&nd, &flags, O_NOFOLLOW, curthread->td_ucred,= =20 > >NULL); > >+ error =3D vn_open_cred(&nd, &flags, O_NOFOLLOW, 0, curthread->td_ucred, > >+ NULL); >=20 > I was going to ask "why not put the flag in the existing flags arg, > like O_NOFOLLOW here?", but it seems that there is no existing flags > arg and the above O_NOFOLLOW is garbage. O_NOFOLLOW happens to be > 0x100, so I think the above asks for mode S_IRUSR. I fixed this, O_NOFOLLOW is set in flags. >=20 > Now I will ask "why not put O_NOFOLLOW here and the new flag in the > existing pointer-to-flags arg?". I do not quite understand what is named by "here". O_NOFOLLOW is defined as a user-supplied flag for the mode argument of the open(2), that determines that it must go in the flags. I do not want to put kernel-only flags into the mode argument, at least because it shrinks the space available for further additions of the open(2) mode flags, that is periodically done by the standards freebsd tries to follow. >=20 > >Modified: head/sys/cddl/compat/opensolaris/sys/vnode.h > >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > >--- head/sys/cddl/compat/opensolaris/sys/vnode.h Sun Jun 21 13:15:56=20 > >2009 (r194585) > >+++ head/sys/cddl/compat/opensolaris/sys/vnode.h Sun Jun 21 13:41:32=20 > >2009 (r194586) > >@@ -182,7 +182,7 @@ vn_openat(char *pnamep, enum uio_seg seg > > vref(startvp); > > NDINIT_ATVP(&nd, operation, MPSAFE, UIO_SYSSPACE, pnamep, startvp,=20 > > td); > > filemode |=3D O_NOFOLLOW; > >- error =3D vn_open_cred(&nd, &filemode, createmode, td->td_ucred, NULL); > >+ error =3D vn_open_cred(&nd, &filemode, createmode, 0, td->td_ucred,=20 > >NULL); >=20 > Here it does put O_NOFOLLOW in the existing pointer-to-flags arg. It > obfuscates the open-flags variable by naming it filemode. >=20 > >Modified: head/sys/kern/vfs_vnops.c > >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > >--- head/sys/kern/vfs_vnops.c Sun Jun 21 13:15:56 2009 (r194585) > >+++ head/sys/kern/vfs_vnops.c Sun Jun 21 13:41:32 2009 (r194586) > >@@ -102,11 +102,8 @@ vn_open(ndp, flagp, cmode, fp) > > * due to the NDINIT being done elsewhere. > > */ > >int > >-vn_open_cred(ndp, flagp, cmode, cred, fp) > >- struct nameidata *ndp; > >- int *flagp, cmode; > >- struct ucred *cred; > >- struct file *fp; > >+vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, u_int=20 > >vn_open_flags, > >+ struct ucred *cred, struct file *fp) > >{ > > struct vnode *vp; > > struct mount *mp; > >@@ -124,9 +121,11 @@ restart: > > if (fmode & O_CREAT) { >=20 > Internally, flags are obfuscated by copying *flagp to the misnamed local > variable fmode. >=20 > The pointer-to-flags variable has about 12 spare bits in it. It already > has just 1 kernel-only flag (O_HASLOCK, misnamed FHASLOCK and misassigned > in the middle of the user flags). fcntl.h's list of open flags has > been obfuscated by putting AT_ flags in the middle of the list. I moved the AT_* definitions in sys/fcntl.h after the list. --37nyS7qXrnu4wN2o Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAko/W2cACgkQC3+MBN1Mb4j/7gCeI0aqQi0175YQN7oXtEY04XM8 XWAAn2dGN1NK7VbblBKRpsaXXCZkpd2S =MhGT -----END PGP SIGNATURE----- --37nyS7qXrnu4wN2o-- From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 10:23:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B1B1106564A; Mon, 22 Jun 2009 10:23:55 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 079D08FC12; Mon, 22 Jun 2009 10:23:55 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MANtvI034326; Mon, 22 Jun 2009 10:23:55 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MANsF8034318; Mon, 22 Jun 2009 10:23:54 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906221023.n5MANsF8034318@svn.freebsd.org> From: Robert Watson Date: Mon, 22 Jun 2009 10:23: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: r194619 - head/sys/netatalk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 10:23:55 -0000 Author: rwatson Date: Mon Jun 22 10:23:54 2009 New Revision: 194619 URL: http://svn.freebsd.org/changeset/base/194619 Log: Add a global rwlock, at_ifaddr_rw, to protect the global netatalk address lists, at_ifaddr_list. Acquire the lock, and use ifaddr refcounts where necessary, to close most known address-related races in netatalk. Annotate one potential race in at_control() where we acquire an ifaddr reference, drop the global lock, and scrub the address from the ifnet before re-acquiring the global lock, which could allow for a writer-writer race. MFC after: 3 weeks Modified: head/sys/netatalk/COPYRIGHT head/sys/netatalk/aarp.c head/sys/netatalk/at_control.c head/sys/netatalk/at_var.h head/sys/netatalk/ddp_input.c head/sys/netatalk/ddp_output.c head/sys/netatalk/ddp_pcb.c Modified: head/sys/netatalk/COPYRIGHT ============================================================================== --- head/sys/netatalk/COPYRIGHT Mon Jun 22 10:11:35 2009 (r194618) +++ head/sys/netatalk/COPYRIGHT Mon Jun 22 10:23:54 2009 (r194619) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2005 Robert N. M. Watson + * Copyright (c) 2004-2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without Modified: head/sys/netatalk/aarp.c ============================================================================== --- head/sys/netatalk/aarp.c Mon Jun 22 10:11:35 2009 (r194618) +++ head/sys/netatalk/aarp.c Mon Jun 22 10:23:54 2009 (r194619) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2005 Robert N. M. Watson + * Copyright (c) 2004-2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -149,6 +149,8 @@ at_ifawithnet(struct sockaddr_at *sat) struct at_ifaddr *aa; struct sockaddr_at *sat2; + AT_IFADDR_LOCK_ASSERT(); + for (aa = at_ifaddr_list; aa != NULL; aa = aa->aa_next) { sat2 = &(aa->aa_addr); if (sat2->sat_addr.s_net == sat->sat_addr.s_net) @@ -199,7 +201,9 @@ aarpwhohas(struct ifnet *ifp, struct soc * same address as we're looking for. If the net is phase 2, * generate an 802.2 and SNAP header. */ + AT_IFADDR_RLOCK(); if ((aa = at_ifawithnet(sat)) == NULL) { + AT_IFADDR_RUNLOCK(); m_freem(m); return; } @@ -212,8 +216,10 @@ aarpwhohas(struct ifnet *ifp, struct soc eh->ether_type = htons(sizeof(struct llc) + sizeof(struct ether_aarp)); M_PREPEND(m, sizeof(struct llc), M_DONTWAIT); - if (m == NULL) + if (m == NULL) { + AT_IFADDR_RUNLOCK(); return; + } llc = mtod(m, struct llc *); llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP; llc->llc_control = LLC_UI; @@ -238,6 +244,7 @@ aarpwhohas(struct ifnet *ifp, struct soc printf("aarp: sending request for %u.%u\n", ntohs(AA_SAT(aa)->sat_addr.s_net), AA_SAT(aa)->sat_addr.s_node); #endif /* NETATALKDEBUG */ + AT_IFADDR_RUNLOCK(); sa.sa_len = sizeof(struct sockaddr); sa.sa_family = AF_UNSPEC; @@ -251,9 +258,11 @@ aarpresolve(struct ifnet *ifp, struct mb struct at_ifaddr *aa; struct aarptab *aat; + AT_IFADDR_RLOCK(); if (at_broadcast(destsat)) { m->m_flags |= M_BCAST; if ((aa = at_ifawithnet(destsat)) == NULL) { + AT_IFADDR_RUNLOCK(); m_freem(m); return (0); } @@ -263,8 +272,10 @@ aarpresolve(struct ifnet *ifp, struct mb else bcopy(ifp->if_broadcastaddr, (caddr_t)desten, sizeof(ifp->if_addrlen)); + AT_IFADDR_RUNLOCK(); return (1); } + AT_IFADDR_RUNLOCK(); AARPTAB_LOCK(); AARPTAB_LOOK(aat, destsat->sat_addr); @@ -368,10 +379,14 @@ at_aarpinput(struct ifnet *ifp, struct m sat.sat_len = sizeof(struct sockaddr_at); sat.sat_family = AF_APPLETALK; sat.sat_addr.s_net = net; + AT_IFADDR_RLOCK(); if ((aa = at_ifawithnet(&sat)) == NULL) { + AT_IFADDR_RUNLOCK(); m_freem(m); return; } + ifa_ref(&aa->aa_ifa); + AT_IFADDR_RUNLOCK(); bcopy(ea->aarp_spnet, &spa.s_net, sizeof(spa.s_net)); bcopy(ea->aarp_tpnet, &tpa.s_net, sizeof(tpa.s_net)); } else { @@ -379,6 +394,7 @@ at_aarpinput(struct ifnet *ifp, struct m * Since we don't know the net, we just look for the first * phase 1 address on the interface. */ + IF_ADDR_LOCK(ifp); for (aa = (struct at_ifaddr *)TAILQ_FIRST(&ifp->if_addrhead); aa; aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) { @@ -388,9 +404,12 @@ at_aarpinput(struct ifnet *ifp, struct m } } if (aa == NULL) { + IF_ADDR_UNLOCK(ifp); m_freem(m); return; } + ifa_ref(&aa->aa_ifa); + IF_ADDR_UNLOCK(ifp); tpa.s_net = spa.s_net = AA_SAT(aa)->sat_addr.s_net; } @@ -411,6 +430,7 @@ at_aarpinput(struct ifnet *ifp, struct m */ callout_stop(&aa->aa_callout); wakeup(aa); + ifa_free(&aa->aa_ifa); m_freem(m); return; } else if (op != AARPOP_PROBE) { @@ -419,6 +439,7 @@ at_aarpinput(struct ifnet *ifp, struct m * means that someone's saying they have the same * source address as the one we're using. Get upset. */ + ifa_free(&aa->aa_ifa); log(LOG_ERR, "aarp: duplicate AT address!! %x:%x:%x:%x:%x:%x\n", ea->aarp_sha[0], ea->aarp_sha[1], @@ -440,6 +461,7 @@ at_aarpinput(struct ifnet *ifp, struct m */ aarptfree(aat); AARPTAB_UNLOCK(); + ifa_free(&aa->aa_ifa); m_freem(m); return; } @@ -473,6 +495,7 @@ at_aarpinput(struct ifnet *ifp, struct m */ if (tpa.s_net != ma.s_net || tpa.s_node != ma.s_node || op == AARPOP_RESPONSE || (aa->aa_flags & AFA_PROBING)) { + ifa_free(&aa->aa_ifa); m_freem(m); return; } @@ -490,8 +513,10 @@ at_aarpinput(struct ifnet *ifp, struct m eh->ether_type = htons(sizeof(struct llc) + sizeof(struct ether_aarp)); M_PREPEND(m, sizeof(struct llc), M_DONTWAIT); - if (m == NULL) + if (m == NULL) { + ifa_free(&aa->aa_ifa); return; + } llc = mtod(m, struct llc *); llc->llc_dsap = llc->llc_ssap = LLC_SNAP_LSAP; llc->llc_control = LLC_UI; @@ -504,6 +529,7 @@ at_aarpinput(struct ifnet *ifp, struct m bcopy(&ma.s_net, ea->aarp_spnet, sizeof(ea->aarp_spnet)); } else eh->ether_type = htons(ETHERTYPE_AARP); + ifa_free(&aa->aa_ifa); ea->aarp_tpnode = ea->aarp_spnode; ea->aarp_spnode = ma.s_node; @@ -602,11 +628,14 @@ aarpprobe(void *arg) return; } else callout_reset(&aa->aa_callout, hz / 5, aarpprobe, ifp); + ifa_ref(&aa->aa_ifa); AARPTAB_UNLOCK(); m = m_gethdr(M_DONTWAIT, MT_DATA); - if (m == NULL) + if (m == NULL) { + ifa_free(&aa->aa_ifa); return; + } #ifdef MAC mac_netatalk_aarp_send(ifp, m); #endif @@ -657,6 +686,7 @@ aarpprobe(void *arg) printf("aarp: sending probe for %u.%u\n", ntohs(AA_SAT(aa)->sat_addr.s_net), AA_SAT(aa)->sat_addr.s_node); #endif /* NETATALKDEBUG */ + ifa_free(&aa->aa_ifa); sa.sa_len = sizeof(struct sockaddr); sa.sa_family = AF_UNSPEC; Modified: head/sys/netatalk/at_control.c ============================================================================== --- head/sys/netatalk/at_control.c Mon Jun 22 10:11:35 2009 (r194618) +++ head/sys/netatalk/at_control.c Mon Jun 22 10:23:54 2009 (r194619) @@ -1,5 +1,6 @@ /*- * Copyright (c) 1990,1991 Regents of The University of Michigan. + * Copyright (c) 2009 Robert N. M. Watson * All Rights Reserved. * * Permission to use, copy, modify, and distribute this software and @@ -22,16 +23,19 @@ * Ann Arbor, Michigan * +1-313-764-2278 * netatalk@umich.edu - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include #include #include +#include #include #include #include +#include #include #include #include @@ -43,7 +47,10 @@ #include #include -struct at_ifaddr *at_ifaddr_list; +struct rwlock at_ifaddr_rw; +struct at_ifaddr *at_ifaddr_list; + +RW_SYSINIT(at_ifaddr_rw, &at_ifaddr_rw, "at_ifaddr_rw"); static int aa_dorangeroute(struct ifaddr *ifa, u_int first, u_int last, int cmd); @@ -75,10 +82,12 @@ at_control(struct socket *so, u_long cmd struct at_ifaddr *aa0; struct at_ifaddr *aa = NULL; struct ifaddr *ifa, *ifa0; + int error; /* * If we have an ifp, then find the matching at_ifaddr if it exists */ + AT_IFADDR_WLOCK(); if (ifp != NULL) { for (aa = at_ifaddr_list; aa != NULL; aa = aa->aa_next) { if (aa->aa_ifp == ifp) @@ -112,8 +121,10 @@ at_control(struct socket *so, u_long cmd * If we a retrying to delete an addres but didn't find such, * then rewurn with an error */ - if (cmd == SIOCDIFADDR && aa == NULL) + if (cmd == SIOCDIFADDR && aa == NULL) { + AT_IFADDR_WUNLOCK(); return (EADDRNOTAVAIL); + } /*FALLTHROUGH*/ case SIOCSIFADDR: @@ -122,8 +133,10 @@ at_control(struct socket *so, u_long cmd * * XXXRW: Layering? */ - if (priv_check(td, PRIV_NET_ADDIFADDR)) + if (priv_check(td, PRIV_NET_ADDIFADDR)) { + AT_IFADDR_WUNLOCK(); return (EPERM); + } sat = satosat(&ifr->ifr_addr); nr = (struct netrange *)sat->sat_zero; @@ -160,7 +173,11 @@ at_control(struct socket *so, u_long cmd */ if (aa == NULL) { aa0 = malloc(sizeof(struct at_ifaddr), M_IFADDR, - M_WAITOK | M_ZERO); + M_NOWAIT | M_ZERO); + if (aa0 == NULL) { + AT_IFADDR_WUNLOCK(); + return (ENOBUFS); + } callout_init(&aa0->aa_callout, CALLOUT_MPSAFE); if ((aa = at_ifaddr_list) != NULL) { /* @@ -219,8 +236,15 @@ at_control(struct socket *so, u_long cmd /* * If we DID find one then we clobber any routes * dependent on it.. + * + * XXXRW: While we ref the ifaddr, there are + * potential races here still. */ + ifa_ref(&aa->aa_ifa); + AT_IFADDR_WUNLOCK(); at_scrub(ifp, aa); + AT_IFADDR_WLOCK(); + ifa_free(&aa->aa_ifa); } break; @@ -248,8 +272,10 @@ at_control(struct socket *so, u_long cmd } } - if (aa == NULL) + if (aa == NULL) { + AT_IFADDR_WUNLOCK(); return (EADDRNOTAVAIL); + } break; } @@ -275,25 +301,31 @@ at_control(struct socket *so, u_long cmd aa->aa_firstnet; ((struct netrange *)&sat->sat_zero)->nr_lastnet = aa->aa_lastnet; + AT_IFADDR_WUNLOCK(); break; case SIOCSIFADDR: - return (at_ifinit(ifp, aa, - (struct sockaddr_at *)&ifr->ifr_addr)); + ifa_ref(&aa->aa_ifa); + AT_IFADDR_WUNLOCK(); + error = at_ifinit(ifp, aa, + (struct sockaddr_at *)&ifr->ifr_addr); + ifa_free(&aa->aa_ifa); + return (error); case SIOCAIFADDR: - if (sateqaddr(&ifra->ifra_addr, &aa->aa_addr)) + if (sateqaddr(&ifra->ifra_addr, &aa->aa_addr)) { + AT_IFADDR_WUNLOCK(); return (0); - return (at_ifinit(ifp, aa, - (struct sockaddr_at *)&ifr->ifr_addr)); + } + ifa_ref(&aa->aa_ifa); + AT_IFADDR_WUNLOCK(); + error = at_ifinit(ifp, aa, + (struct sockaddr_at *)&ifr->ifr_addr); + ifa_free(&aa->aa_ifa); + return (error); case SIOCDIFADDR: /* - * scrub all routes.. didn't we just DO this? XXX yes, del it - */ - at_scrub(ifp, aa); - - /* * remove the ifaddr from the interface */ ifa0 = (struct ifaddr *)aa; @@ -320,6 +352,7 @@ at_control(struct socket *so, u_long cmd else panic("at_control"); } + AT_IFADDR_WUNLOCK(); /* * Now reclaim the reference. @@ -328,6 +361,7 @@ at_control(struct socket *so, u_long cmd break; default: + AT_IFADDR_WUNLOCK(); if (ifp == NULL || ifp->if_ioctl == NULL) return (EOPNOTSUPP); return ((*ifp->if_ioctl)(ifp, cmd, data)); @@ -673,6 +707,8 @@ at_broadcast(struct sockaddr_at *sat) { struct at_ifaddr *aa; + AT_IFADDR_LOCK_ASSERT(); + /* * If the node is not right, it can't be a broadcast */ @@ -807,36 +843,6 @@ aa_dosingleroute(struct ifaddr *ifa, str (struct sockaddr *) &mask, flags, NULL)); } -#if 0 - -static void -aa_clean(void) -{ - struct at_ifaddr *aa; - struct ifaddr *ifa; - struct ifnet *ifp; - - while ((aa = at_ifaddr_list) != NULL) { - ifp = aa->aa_ifp; - at_scrub(ifp, aa); - at_ifaddr_list = aa->aa_next; - if ((ifa = ifp->if_addrlist) == (struct ifaddr *)aa) - ifp->if_addrlist = ifa->ifa_next; - else { - while (ifa->ifa_next && - (ifa->ifa_next != (struct ifaddr *)aa)) - ifa = ifa->ifa_next; - if (ifa->ifa_next) - ifa->ifa_next = - ((struct ifaddr *)aa)->ifa_next; - else - panic("at_entry"); - } - } -} - -#endif - static int aa_claim_addr(struct ifaddr *ifa, struct sockaddr *gw0) { Modified: head/sys/netatalk/at_var.h ============================================================================== --- head/sys/netatalk/at_var.h Mon Jun 22 10:11:35 2009 (r194618) +++ head/sys/netatalk/at_var.h Mon Jun 22 10:23:54 2009 (r194619) @@ -61,7 +61,15 @@ struct at_aliasreq { #define AFA_PHASE2 0x0004 #ifdef _KERNEL +extern struct rwlock at_ifaddr_rw; extern struct at_ifaddr *at_ifaddr_list; + +#define AT_IFADDR_LOCK_INIT() rw_init(&at_ifaddr_rw, "at_ifaddr_rw") +#define AT_IFADDR_LOCK_ASSERT() rw_assert(&at_ifaddr_rw, RA_LOCKED) +#define AT_IFADDR_RLOCK() rw_rlock(&at_ifaddr_rw) +#define AT_IFADDR_RUNLOCK() rw_runlock(&at_ifaddr_rw) +#define AT_IFADDR_WLOCK() rw_wlock(&at_ifaddr_rw) +#define AT_IFADDR_WUNLOCK() rw_wunlock(&at_ifaddr_rw) #endif #endif /* _NETATALK_AT_VAR_H_ */ Modified: head/sys/netatalk/ddp_input.c ============================================================================== --- head/sys/netatalk/ddp_input.c Mon Jun 22 10:11:35 2009 (r194618) +++ head/sys/netatalk/ddp_input.c Mon Jun 22 10:23:54 2009 (r194619) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004 Robert N. M. Watson + * Copyright (c) 2004-2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -161,6 +161,7 @@ ddp_input(struct mbuf *m, struct ifnet * * Make sure that we point to the phase1 ifaddr info and that * it's valid for this packet. */ + AT_IFADDR_RLOCK(); for (aa = at_ifaddr_list; aa != NULL; aa = aa->aa_next) { if ((aa->aa_ifp == ifp) && ((aa->aa_flags & AFA_PHASE2) == 0) @@ -173,6 +174,7 @@ ddp_input(struct mbuf *m, struct ifnet * * maybe we got a broadcast not meant for us.. ditch it. */ if (aa == NULL) { + AT_IFADDR_RUNLOCK(); m_freem(m); return; } @@ -187,6 +189,7 @@ ddp_input(struct mbuf *m, struct ifnet * if (m->m_len < sizeof(struct ddpehdr) && ((m = m_pullup(m, sizeof(struct ddpehdr))) == NULL)) { + AT_IFADDR_RUNLOCK(); ddpstat.ddps_tooshort++; return; } @@ -206,6 +209,7 @@ ddp_input(struct mbuf *m, struct ifnet * to.sat_addr.s_node = ddpe.deh_dnode; to.sat_port = ddpe.deh_dport; + AT_IFADDR_RLOCK(); if (to.sat_addr.s_net == ATADDR_ANYNET) { /* * The TO address doesn't specify a net, so by @@ -278,6 +282,9 @@ ddp_input(struct mbuf *m, struct ifnet * } } } + if (aa != NULL) + ifa_ref(&aa->aa_ifa); + AT_IFADDR_RUNLOCK(); /* * Adjust the length, removing any padding that may have been added @@ -287,8 +294,7 @@ ddp_input(struct mbuf *m, struct ifnet * mlen = m->m_pkthdr.len; if (mlen < dlen) { ddpstat.ddps_toosmall++; - m_freem(m); - return; + goto out; } if (mlen > dlen) m_adj(m, dlen - mlen); @@ -304,10 +310,8 @@ ddp_input(struct mbuf *m, struct ifnet * /* * If we've explicitly disabled it, don't route anything. */ - if (ddp_forward == 0) { - m_freem(m); - return; - } + if (ddp_forward == 0) + goto out; /* * If the cached forwarding route is still valid, use it. @@ -346,10 +350,8 @@ ddp_input(struct mbuf *m, struct ifnet * */ if ((to.sat_addr.s_net != satosat(&forwro.ro_dst)->sat_addr.s_net) && - (ddpe.deh_hops == DDP_MAXHOPS)) { - m_freem(m); - return; - } + (ddpe.deh_hops == DDP_MAXHOPS)) + goto out; /* * A ddp router might use the same interface to forward the @@ -357,10 +359,8 @@ ddp_input(struct mbuf *m, struct ifnet * * to cross from one interface to another however. */ if (ddp_firewall && ((forwro.ro_rt == NULL) || - (forwro.ro_rt->rt_ifp != ifp))) { - m_freem(m); - return; - } + (forwro.ro_rt->rt_ifp != ifp))) + goto out; /* * Adjust the header. If it was a short header then it would @@ -377,6 +377,8 @@ ddp_input(struct mbuf *m, struct ifnet * ddpstat.ddps_cantforward++; else ddpstat.ddps_forward++; + if (aa != NULL) + ifa_free(&aa->aa_ifa); return; } @@ -393,8 +395,7 @@ ddp_input(struct mbuf *m, struct ifnet * if (ddp_cksum && cksum && cksum != at_cksum(m, sizeof(int))) { ddpstat.ddps_badsum++; - m_freem(m); - return; + goto out; } m_adj(m, sizeof(struct ddpehdr)); } else @@ -405,11 +406,11 @@ ddp_input(struct mbuf *m, struct ifnet * */ DDP_LIST_SLOCK(); if ((ddp = ddp_search(&from, &to, aa)) == NULL) - goto out; + goto out_unlock; #ifdef MAC if (mac_socket_check_deliver(ddp->ddp_socket, m) != 0) - goto out; + goto out_unlock; #endif /* @@ -423,7 +424,7 @@ ddp_input(struct mbuf *m, struct ifnet * * If the socket is full (or similar error) dump the packet. */ ddpstat.ddps_nosockspace++; - goto out; + goto out_unlock; } /* @@ -431,8 +432,11 @@ ddp_input(struct mbuf *m, struct ifnet * */ sorwakeup_locked(ddp->ddp_socket); m = NULL; -out: +out_unlock: DDP_LIST_SUNLOCK(); +out: + if (aa != NULL) + ifa_free(&aa->aa_ifa); if (m != NULL) m_freem(m); } Modified: head/sys/netatalk/ddp_output.c ============================================================================== --- head/sys/netatalk/ddp_output.c Mon Jun 22 10:11:35 2009 (r194618) +++ head/sys/netatalk/ddp_output.c Mon Jun 22 10:23:54 2009 (r194619) @@ -142,12 +142,16 @@ ddp_route(struct mbuf *m, struct route * if ((ro->ro_rt != NULL) && (ro->ro_rt->rt_ifa) && (ifp = ro->ro_rt->rt_ifa->ifa_ifp)) { net = ntohs(satosat(ro->ro_rt->rt_gateway)->sat_addr.s_net); + AT_IFADDR_RLOCK(); for (aa = at_ifaddr_list; aa != NULL; aa = aa->aa_next) { if (((net == 0) || (aa->aa_ifp == ifp)) && net >= ntohs(aa->aa_firstnet) && net <= ntohs(aa->aa_lastnet)) break; } + if (aa != NULL) + ifa_ref(&aa->aa_ifa); + AT_IFADDR_RUNLOCK(); } else { m_freem(m); #ifdef NETATALK_DEBUG @@ -199,6 +203,7 @@ ddp_route(struct mbuf *m, struct route * if (!(aa->aa_flags & AFA_PHASE2)) { MGET(m0, M_DONTWAIT, MT_DATA); if (m0 == NULL) { + ifa_free(&aa->aa_ifa); m_freem(m); printf("ddp_route: no buffers\n"); return (ENOBUFS); @@ -231,8 +236,11 @@ ddp_route(struct mbuf *m, struct route * if ((satosat(&aa->aa_addr)->sat_addr.s_net == satosat(&ro->ro_dst)->sat_addr.s_net) && (satosat(&aa->aa_addr)->sat_addr.s_node == - satosat(&ro->ro_dst)->sat_addr.s_node)) + satosat(&ro->ro_dst)->sat_addr.s_node)) { + ifa_free(&aa->aa_ifa); return (if_simloop(ifp, m, gate.sat_family, 0)); + } + ifa_free(&aa->aa_ifa); /* XXX */ return ((*ifp->if_output)(ifp, m, (struct sockaddr *)&gate, NULL)); Modified: head/sys/netatalk/ddp_pcb.c ============================================================================== --- head/sys/netatalk/ddp_pcb.c Mon Jun 22 10:11:35 2009 (r194618) +++ head/sys/netatalk/ddp_pcb.c Mon Jun 22 10:23:54 2009 (r194619) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2004-2005 Robert N. M. Watson + * Copyright (c) 2004-2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -104,6 +104,7 @@ at_pcbsetaddr(struct ddpcb *ddp, struct /* * Validate passed address. */ + aa = NULL; if (addr != NULL) { sat = (struct sockaddr_at *)addr; if (sat->sat_family != AF_APPLETALK) @@ -111,6 +112,7 @@ at_pcbsetaddr(struct ddpcb *ddp, struct if (sat->sat_addr.s_node != ATADDR_ANYNODE || sat->sat_addr.s_net != ATADDR_ANYNET) { + AT_IFADDR_RLOCK(); for (aa = at_ifaddr_list; aa != NULL; aa = aa->aa_next) { if ((sat->sat_addr.s_net == @@ -119,6 +121,7 @@ at_pcbsetaddr(struct ddpcb *ddp, struct AA_SAT(aa)->sat_addr.s_node)) break; } + AT_IFADDR_RUNLOCK(); if (aa == NULL) return (EADDRNOTAVAIL); } @@ -142,9 +145,13 @@ at_pcbsetaddr(struct ddpcb *ddp, struct if (sat->sat_addr.s_node == ATADDR_ANYNODE && sat->sat_addr.s_net == ATADDR_ANYNET) { - if (at_ifaddr_list == NULL) + AT_IFADDR_RLOCK(); + if (at_ifaddr_list == NULL) { + AT_IFADDR_RUNLOCK(); return (EADDRNOTAVAIL); + } sat->sat_addr = AA_SAT(at_ifaddr_list)->sat_addr; + AT_IFADDR_RUNLOCK(); } ddp->ddp_lsat = *sat; @@ -220,6 +227,7 @@ at_pcbconnect(struct ddpcb *ddp, struct else net = sat->sat_addr.s_net; aa = NULL; + AT_IFADDR_RLOCK(); if ((ifp = ro->ro_rt->rt_ifp) != NULL) { for (aa = at_ifaddr_list; aa != NULL; aa = aa->aa_next) { @@ -236,6 +244,7 @@ at_pcbconnect(struct ddpcb *ddp, struct RTFREE(ro->ro_rt); ro->ro_rt = NULL; } + AT_IFADDR_RUNLOCK(); } /* @@ -258,10 +267,12 @@ at_pcbconnect(struct ddpcb *ddp, struct */ aa = NULL; if (ro->ro_rt && (ifp = ro->ro_rt->rt_ifp)) { + AT_IFADDR_RLOCK(); for (aa = at_ifaddr_list; aa != NULL; aa = aa->aa_next) { if (aa->aa_ifp == ifp) break; } + AT_IFADDR_RUNLOCK(); } if (aa == NULL) return (ENETUNREACH); From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 10:27:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9113D106564A; Mon, 22 Jun 2009 10:27:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F99B8FC13; Mon, 22 Jun 2009 10:27:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MARK1T034426; Mon, 22 Jun 2009 10:27:20 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MARKmB034424; Mon, 22 Jun 2009 10:27:20 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200906221027.n5MARKmB034424@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 22 Jun 2009 10:27: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: r194620 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 10:27:21 -0000 Author: bz Date: Mon Jun 22 10:27:20 2009 New Revision: 194620 URL: http://svn.freebsd.org/changeset/base/194620 Log: After the update to fxp(4) in r194573 we should no longer need this DELAY(100) hack introduced in r56938. Thanks to: yongari MFC after: 6 weeks X-MFC note: not before the fxp(4) changes Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Jun 22 10:23:54 2009 (r194619) +++ head/sys/net/if.c Mon Jun 22 10:27:20 2009 (r194620) @@ -2465,7 +2465,6 @@ ifioctl(struct socket *so, u_long cmd, c if ((oif_flags ^ ifp->if_flags) & IFF_UP) { #ifdef INET6 - DELAY(100);/* XXX: temporary workaround for fxp issue*/ if (ifp->if_flags & IFF_UP) { int s = splimp(); in6_if_up(ifp); From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 10:56:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49D87106564A; Mon, 22 Jun 2009 10:56:09 +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 385208FC19; Mon, 22 Jun 2009 10:56:09 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MAu9Q0037399; Mon, 22 Jun 2009 10:56:09 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MAu9N1037396; Mon, 22 Jun 2009 10:56:09 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200906221056.n5MAu9N1037396@svn.freebsd.org> From: Ed Schouten Date: Mon, 22 Jun 2009 10:56: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: r194621 - head/lib/libc/i386/stdlib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 10:56:09 -0000 Author: ed Date: Mon Jun 22 10:56:08 2009 New Revision: 194621 URL: http://svn.freebsd.org/changeset/base/194621 Log: Remove unneeded stores back into the function arguments. Submitted by: Christoph Mallon Modified: head/lib/libc/i386/stdlib/div.S head/lib/libc/i386/stdlib/ldiv.S Modified: head/lib/libc/i386/stdlib/div.S ============================================================================== --- head/lib/libc/i386/stdlib/div.S Mon Jun 22 10:27:20 2009 (r194620) +++ head/lib/libc/i386/stdlib/div.S Mon Jun 22 10:56:08 2009 (r194621) @@ -33,7 +33,5 @@ ENTRY(div) movl 8(%esp),%ecx cdq idiv %ecx - movl %eax,4(%esp) - movl %edx,8(%esp) ret END(div) Modified: head/lib/libc/i386/stdlib/ldiv.S ============================================================================== --- head/lib/libc/i386/stdlib/ldiv.S Mon Jun 22 10:27:20 2009 (r194620) +++ head/lib/libc/i386/stdlib/ldiv.S Mon Jun 22 10:56:08 2009 (r194621) @@ -36,7 +36,5 @@ ENTRY(ldiv) movl 8(%esp),%ecx cdq idiv %ecx - movl %eax,4(%esp) - movl %edx,8(%esp) ret END(ldiv) From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 10:59:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2DB41065676; Mon, 22 Jun 2009 10:59:34 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A00B18FC17; Mon, 22 Jun 2009 10:59:34 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MAxYU6037570; Mon, 22 Jun 2009 10:59:34 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MAxYGd037562; Mon, 22 Jun 2009 10:59:34 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906221059.n5MAxYGd037562@svn.freebsd.org> From: Robert Watson Date: Mon, 22 Jun 2009 10:59:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194622 - in head/sys: dev/cxgb/ulp/iw_cxgb net netinet netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 10:59:35 -0000 Author: rwatson Date: Mon Jun 22 10:59:34 2009 New Revision: 194622 URL: http://svn.freebsd.org/changeset/base/194622 Log: Add a new function, ifa_ifwithaddr_check(), which rather than returning a pointer to an ifaddr matching the passed socket address, returns a boolean indicating whether one was present. In the (near) future, ifa_ifwithaddr() will return a referenced ifaddr rather than a raw ifaddr pointer, and the new wrapper will allow callers that care only about the boolean condition to avoid having to free that reference. MFC after: 3 weeks Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c head/sys/net/if.c head/sys/net/if_var.h head/sys/net/route.c head/sys/netinet/in_pcb.c head/sys/netinet/raw_ip.c head/sys/netipx/ipx_pcb.c Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c ============================================================================== --- head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c Mon Jun 22 10:56:08 2009 (r194621) +++ head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c Mon Jun 22 10:59:34 2009 (r194622) @@ -1337,12 +1337,13 @@ static int is_loopback_dst(struct iw_cm_id *cm_id) { uint16_t port = cm_id->remote_addr.sin_port; - struct ifaddr *ifa; + int ifa_present; cm_id->remote_addr.sin_port = 0; - ifa = ifa_ifwithaddr((struct sockaddr *)&cm_id->remote_addr); + ifa_present = ifa_ifwithaddr_check( + (struct sockaddr *)&cm_id->remote_addr); cm_id->remote_addr.sin_port = port; - return (ifa != NULL); + return (ifa_present); } int Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Jun 22 10:56:08 2009 (r194621) +++ head/sys/net/if.c Mon Jun 22 10:59:34 2009 (r194622) @@ -1466,8 +1466,8 @@ ifa_free(struct ifaddr *ifa) * Locate an interface based on a complete address. */ /*ARGSUSED*/ -struct ifaddr * -ifa_ifwithaddr(struct sockaddr *addr) +static struct ifaddr * +ifa_ifwithaddr_internal(struct sockaddr *addr) { INIT_VNET_NET(curvnet); struct ifnet *ifp; @@ -1500,6 +1500,20 @@ done: return (ifa); } +struct ifaddr * +ifa_ifwithaddr(struct sockaddr *addr) +{ + + return (ifa_ifwithaddr_internal(addr)); +} + +int +ifa_ifwithaddr_check(struct sockaddr *addr) +{ + + return (ifa_ifwithaddr_internal(addr) != NULL); +} + /* * Locate an interface based on the broadcast address. */ Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Mon Jun 22 10:56:08 2009 (r194621) +++ head/sys/net/if_var.h Mon Jun 22 10:59:34 2009 (r194622) @@ -820,6 +820,7 @@ void ifq_init(struct ifaltq *, struct if void ifq_delete(struct ifaltq *); struct ifaddr *ifa_ifwithaddr(struct sockaddr *); +int ifa_ifwithaddr_check(struct sockaddr *); struct ifaddr *ifa_ifwithbroadaddr(struct sockaddr *); struct ifaddr *ifa_ifwithdstaddr(struct sockaddr *); struct ifaddr *ifa_ifwithnet(struct sockaddr *); Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Mon Jun 22 10:56:08 2009 (r194621) +++ head/sys/net/route.c Mon Jun 22 10:59:34 2009 (r194622) @@ -547,7 +547,7 @@ rtredirect_fib(struct sockaddr *dst, if (!(flags & RTF_DONE) && rt && (!sa_equal(src, rt->rt_gateway) || rt->rt_ifa != ifa)) error = EINVAL; - else if (ifa_ifwithaddr(gateway)) + else if (ifa_ifwithaddr_check(gateway)) error = EHOSTUNREACH; if (error) goto done; Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Mon Jun 22 10:56:08 2009 (r194621) +++ head/sys/netinet/in_pcb.c Mon Jun 22 10:59:34 2009 (r194622) @@ -357,7 +357,7 @@ in_pcbbind_setup(struct inpcb *inp, stru * to any endpoint address, local or not. */ if ((inp->inp_flags & INP_BINDANY) == 0 && - ifa_ifwithaddr((struct sockaddr *)sin) == NULL) + ifa_ifwithaddr_check((struct sockaddr *)sin) == 0) return (EADDRNOTAVAIL); } laddr = sin->sin_addr; Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Mon Jun 22 10:56:08 2009 (r194621) +++ head/sys/netinet/raw_ip.c Mon Jun 22 10:59:34 2009 (r194622) @@ -875,7 +875,7 @@ rip_bind(struct socket *so, struct socka (addr->sin_family != AF_INET && addr->sin_family != AF_IMPLINK) || (addr->sin_addr.s_addr && (inp->inp_flags & INP_BINDANY) == 0 && - ifa_ifwithaddr((struct sockaddr *)addr) == NULL)) + ifa_ifwithaddr_check((struct sockaddr *)addr) == 0)) return (EADDRNOTAVAIL); INP_INFO_WLOCK(&V_ripcbinfo); Modified: head/sys/netipx/ipx_pcb.c ============================================================================== --- head/sys/netipx/ipx_pcb.c Mon Jun 22 10:56:08 2009 (r194621) +++ head/sys/netipx/ipx_pcb.c Mon Jun 22 10:59:34 2009 (r194622) @@ -121,7 +121,7 @@ ipx_pcbbind(struct ipxpcb *ipxp, struct int tport = sipx->sipx_port; sipx->sipx_port = 0; /* yech... */ - if (ifa_ifwithaddr((struct sockaddr *)sipx) == NULL) + if (ifa_ifwithaddr_check((struct sockaddr *)sipx) == 0) return (EADDRNOTAVAIL); sipx->sipx_port = tport; } From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 14:43:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77F8C106566C; Mon, 22 Jun 2009 14:43:48 +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 662358FC12; Mon, 22 Jun 2009 14:43:48 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MEhmi7043923; Mon, 22 Jun 2009 14:43:48 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MEhm0L043920; Mon, 22 Jun 2009 14:43:48 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200906221443.n5MEhm0L043920@svn.freebsd.org> From: Scott Long Date: Mon, 22 Jun 2009 14:43: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: r194627 - head/sys/cam X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 14:43:48 -0000 Author: scottl Date: Mon Jun 22 14:43:48 2009 New Revision: 194627 URL: http://svn.freebsd.org/changeset/base/194627 Log: Change cam_periph_ioctl() to take 'cmd' and a u_long instead of an int. All of its callers pass in cmd as a u_long, so this has always been a dangerous type demotion. It was spooted by clang/llvm trying to do a type promotion and sign extension within cam_periph_ioctl. Submitted by: rdivacky Modified: head/sys/cam/cam_periph.c head/sys/cam/cam_periph.h Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Mon Jun 22 14:42:14 2009 (r194626) +++ head/sys/cam/cam_periph.c Mon Jun 22 14:43:48 2009 (r194627) @@ -797,7 +797,7 @@ cam_periph_ccbwait(union ccb *ccb) } int -cam_periph_ioctl(struct cam_periph *periph, int cmd, caddr_t addr, +cam_periph_ioctl(struct cam_periph *periph, u_long cmd, caddr_t addr, int (*error_routine)(union ccb *ccb, cam_flags camflags, u_int32_t sense_flags)) Modified: head/sys/cam/cam_periph.h ============================================================================== --- head/sys/cam/cam_periph.h Mon Jun 22 14:42:14 2009 (r194626) +++ head/sys/cam/cam_periph.h Mon Jun 22 14:43:48 2009 (r194627) @@ -158,7 +158,7 @@ int cam_periph_runccb(union ccb *ccb, u_int32_t sense_flags), cam_flags camflags, u_int32_t sense_flags, struct devstat *ds); -int cam_periph_ioctl(struct cam_periph *periph, int cmd, +int cam_periph_ioctl(struct cam_periph *periph, u_long cmd, caddr_t addr, int (*error_routine)(union ccb *ccb, cam_flags camflags, From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 14:48:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF690106566C; Mon, 22 Jun 2009 14:48: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 A011B8FC17; Mon, 22 Jun 2009 14:48:18 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 4243A46B4C; Mon, 22 Jun 2009 10:48:18 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 30FEB8A07D; Mon, 22 Jun 2009 10:48:17 -0400 (EDT) From: John Baldwin To: Daniel Eischen Date: Mon, 22 Jun 2009 09:00:44 -0400 User-Agent: KMail/1.9.7 References: <200906201645.n5KGjEeG081301@svn.freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906220900.45042.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 22 Jun 2009 10:48:17 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Robert Noland Subject: Re: svn commit: r194540 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 14:48:19 -0000 On Saturday 20 June 2009 12:56:40 pm Daniel Eischen wrote: > On Sat, 20 Jun 2009, Robert Noland wrote: > > > Author: rnoland > > Date: Sat Jun 20 16:45:14 2009 > > New Revision: 194540 > > URL: http://svn.freebsd.org/changeset/base/194540 > > > > Log: > > The G45 docs indicate that all G4X chips use the new framecount register. > > > > Intel agrees with my reading of the docs, make it so for all G4X chips. > > > > The new register also has a 32 bit width as opposed to 24 bits. Fix > > things up so that the counters roll over properly. > > Could this possibly fix the problem I'm seeing with the screen being > garbage after a logout from KDE 3.x (using kdm)? Everything works > fine after logging in, but when you log out, the screen is left with > garbage/lots of vertical striping. This only happened after upgrading > my system (and all ports) to Xorg 7.4, worked just fine before that. > > agp0: on vgapci0 > agp0: detected 7932k stolen memory > agp0: aperture size is 256M > vgapci1: mem 0xdff80000-0xdfffffff at device 2.1 on pci0 I only started seeing this after enabling AIGLX and using if for desktop effects in KDE4. Ocassionally it doesn't trash the screen on exit even in that case. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 14:49:21 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8E377106566C; Mon, 22 Jun 2009 14:49:21 +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 259828FC12; Mon, 22 Jun 2009 14:49:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-107-126-113.carlnfd1.nsw.optusnet.com.au (c122-107-126-113.carlnfd1.nsw.optusnet.com.au [122.107.126.113]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n5MEnIk7024898 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 23 Jun 2009 00:49:19 +1000 Date: Tue, 23 Jun 2009 00:49:18 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Kostik Belousov In-Reply-To: <20090622102232.GM2884@deviant.kiev.zoral.com.ua> Message-ID: <20090623004356.W31449@delplex.bde.org> References: <200906211341.n5LDfWEx008281@svn.freebsd.org> <20090622133231.W31111@delplex.bde.org> <20090622102232.GM2884@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, src-committers@FreeBSD.org, Bruce Evans Subject: Re: svn commit: r194586 - in head/sys: cddl/compat/opensolaris/kern cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 14:49:22 -0000 On Mon, 22 Jun 2009, Kostik Belousov wrote: > On Mon, Jun 22, 2009 at 02:12:57PM +1000, Bruce Evans wrote: >> On Sun, 21 Jun 2009, Konstantin Belousov wrote: >> >>> Log: >>> Add another flags argument to vn_open_cred. Use it to specify that some >>> vn_open_cred invocations shall not audit namei path. >> >>> Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c >>> ============================================================================== >>> --- head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Sun Jun 21 >>> 13:15:56 2009 (r194585) >>> +++ head/sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c Sun Jun 21 >>> 13:41:32 2009 (r194586) >>> @@ -85,7 +85,8 @@ kobj_open_file_vnode(const char *file) >>> >>> flags = FREAD; >>> NDINIT(&nd, LOOKUP, MPSAFE, UIO_SYSSPACE, file, td); >>> - error = vn_open_cred(&nd, &flags, O_NOFOLLOW, curthread->td_ucred, >>> NULL); >>> + error = vn_open_cred(&nd, &flags, O_NOFOLLOW, 0, curthread->td_ucred, >>> + NULL); >> >> I was going to ask "why not put the flag in the existing flags arg, >> like O_NOFOLLOW here?", but it seems that there is no existing flags >> arg and the above O_NOFOLLOW is garbage. O_NOFOLLOW happens to be >> 0x100, so I think the above asks for mode S_IRUSR. > I fixed this, O_NOFOLLOW is set in flags. > >> >> Now I will ask "why not put O_NOFOLLOW here and the new flag in the >> existing pointer-to-flags arg?". > I do not quite understand what is named by "here". O_NOFOLLOW is defined > as a user-supplied flag for the mode argument of the open(2), that > determines that it must go in the flags. "here" is above. > I do not want to put kernel-only flags into the mode argument, at least > because it shrinks the space available for further additions of the open(2) > mode flags, that is periodically done by the standards freebsd tries to > follow. Not a problem, since the kernel flags can easily be moved later if necessary. Just don't repeat the mistake for F_HASLOCK, of putting them in the middle of user flags. Bruce From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 15:00:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C1E2210656B9; Mon, 22 Jun 2009 15:00:15 +0000 (UTC) (envelope-from rafan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF6648FC1E; Mon, 22 Jun 2009 15:00:15 +0000 (UTC) (envelope-from rafan@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MF0FFC044303; Mon, 22 Jun 2009 15:00:15 GMT (envelope-from rafan@svn.freebsd.org) Received: (from rafan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MF0F6v044301; Mon, 22 Jun 2009 15:00:15 GMT (envelope-from rafan@svn.freebsd.org) Message-Id: <200906221500.n5MF0F6v044301@svn.freebsd.org> From: Rong-En Fan Date: Mon, 22 Jun 2009 15:00: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: r194628 - head/lib/ncurses/ncurses X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 15:00:17 -0000 Author: rafan Date: Mon Jun 22 15:00:15 2009 New Revision: 194628 URL: http://svn.freebsd.org/changeset/base/194628 Log: - Fall-back to /etc/termcap.small if there is no /usr/share/misc/termcap (i.e. /etc/termcap). This can be useful when using /rescue/vi while /usr is not (or unable to be) mounted. The termcap.small can be found in src/etc/termcap.small. PR: bin/80256 (audit-trail) Submitted by: Brian Candler , Alex Kozlov MFC after: 1 month Modified: head/lib/ncurses/ncurses/pathnames.h Modified: head/lib/ncurses/ncurses/pathnames.h ============================================================================== --- head/lib/ncurses/ncurses/pathnames.h Mon Jun 22 14:43:48 2009 (r194627) +++ head/lib/ncurses/ncurses/pathnames.h Mon Jun 22 15:00:15 2009 (r194628) @@ -30,5 +30,5 @@ * $FreeBSD$ */ -#define _PATH_DEF ".termcap /usr/share/misc/termcap" +#define _PATH_DEF ".termcap /usr/share/misc/termcap /etc/termcap.small" #define _PATH_DEF_SEC "/usr/share/misc/termcap" From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 15:07:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98711106564A; Mon, 22 Jun 2009 15:07:12 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 86B728FC08; Mon, 22 Jun 2009 15:07:12 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MF7CCu044462; Mon, 22 Jun 2009 15:07:12 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MF7CIq044459; Mon, 22 Jun 2009 15:07:12 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200906221507.n5MF7CIq044459@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 22 Jun 2009 15:07:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194629 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 15:07:13 -0000 Author: bz Date: Mon Jun 22 15:07:12 2009 New Revision: 194629 URL: http://svn.freebsd.org/changeset/base/194629 Log: Collect all VIMAGE_GLOBALS variables in one place. No longer export rt_tables as all lookups go through rt_tables_get_rnh(). We cannot make rt_tables (and rtstat, rttrash[1]) static as netstat -r (-rs[1]) would stop working on a stripped VIMAGE_GLOBALS kernel. Reviewed by: zec Presumably broken by: phk 13.5y ago in r12820 [1] Modified: head/sys/net/route.c head/sys/net/route.h Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Mon Jun 22 15:00:15 2009 (r194628) +++ head/sys/net/route.c Mon Jun 22 15:07:12 2009 (r194629) @@ -90,10 +90,10 @@ SYSCTL_INT(_net, OID_AUTO, add_addr_allf TUNABLE_INT("net.add_addr_allfibs", &rt_add_addr_allfibs); #ifdef VIMAGE_GLOBALS -static struct rtstat rtstat; -struct radix_node_head *rt_tables; - -static int rttrash; /* routes not in table but not freed */ +struct radix_node_head *rt_tables; +static uma_zone_t rtzone; /* Routing table UMA zone. */ +int rttrash; /* routes not in table but not freed */ +struct rtstat rtstat; #endif static void rt_maskedcopy(struct sockaddr *, @@ -129,10 +129,6 @@ static const vnet_modinfo_t vnet_rtable_ */ #define RNTORT(p) ((struct rtentry *)(p)) -#ifdef VIMAGE_GLOBALS -static uma_zone_t rtzone; /* Routing table UMA zone. */ -#endif - #if 0 /* default fib for tunnels to use */ u_int tunnel_fib = 0; Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Mon Jun 22 15:00:15 2009 (r194628) +++ head/sys/net/route.h Mon Jun 22 15:07:12 2009 (r194629) @@ -373,7 +373,6 @@ struct rt_addrinfo { } \ } while (0) -extern struct radix_node_head *rt_tables; struct radix_node_head *rt_tables_get_rnh(int, int); struct ifmultiaddr; From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 15:09:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EF46E106564A; Mon, 22 Jun 2009 15:09:53 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from mail.netplex.net (mail.netplex.net [204.213.176.10]) by mx1.freebsd.org (Postfix) with ESMTP id 8F53E8FC12; Mon, 22 Jun 2009 15:09:53 +0000 (UTC) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.netplex.net (8.14.3/8.14.3/NETPLEX) with ESMTP id n5MF9pKe014784; Mon, 22 Jun 2009 11:09:52 -0400 (EDT) X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-4.0 (mail.netplex.net [204.213.176.10]); Mon, 22 Jun 2009 11:09:52 -0400 (EDT) Date: Mon, 22 Jun 2009 11:09:51 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: John Baldwin In-Reply-To: <200906220900.45042.jhb@freebsd.org> Message-ID: References: <200906201645.n5KGjEeG081301@svn.freebsd.org> <200906220900.45042.jhb@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, Robert Noland Subject: Re: svn commit: r194540 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Eischen List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 15:09:54 -0000 On Mon, 22 Jun 2009, John Baldwin wrote: > On Saturday 20 June 2009 12:56:40 pm Daniel Eischen wrote: >> On Sat, 20 Jun 2009, Robert Noland wrote: >> >>> Author: rnoland >>> Date: Sat Jun 20 16:45:14 2009 >>> New Revision: 194540 >>> URL: http://svn.freebsd.org/changeset/base/194540 >>> >>> Log: >>> The G45 docs indicate that all G4X chips use the new framecount register. >>> >>> Intel agrees with my reading of the docs, make it so for all G4X chips. >>> >>> The new register also has a 32 bit width as opposed to 24 bits. Fix >>> things up so that the counters roll over properly. >> >> Could this possibly fix the problem I'm seeing with the screen being >> garbage after a logout from KDE 3.x (using kdm)? Everything works >> fine after logging in, but when you log out, the screen is left with >> garbage/lots of vertical striping. This only happened after upgrading >> my system (and all ports) to Xorg 7.4, worked just fine before that. >> >> agp0: on vgapci0 >> agp0: detected 7932k stolen memory >> agp0: aperture size is 256M >> vgapci1: mem 0xdff80000-0xdfffffff at device 2.1 > on pci0 > > I only started seeing this after enabling AIGLX and using if for desktop > effects in KDE4. Ocassionally it doesn't trash the screen on exit even in > that case. I don't even know what AIGLX is, just using defaults ;-) My Xorg.log says AIGLX is disabled in one section, but then also says later on: ... (II) Initializing built-in extension COMPOSITE (II) Initializing built-in extension DAMAGE (II) AIGLX: Loaded and initialized /usr/local/lib/dri/swrast_dri.so (II) GLX: Initialized DRISWRAST GL provider for screen 0 (II) intel(0): Setting screen physical size to 303 x 190 ... Full xorg.conf and Xorg.log at: http://people.freebsd.org/~deischen/kde/xorg.conf http://people.freebsd.org/~deischen/kde/Xorg.0.log -- DE From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 15:15:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85B32106567B; Mon, 22 Jun 2009 15:15:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3]) by mx1.freebsd.org (Postfix) with ESMTP id 3D39C8FC1D; Mon, 22 Jun 2009 15:15:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 2E79741C734; Mon, 22 Jun 2009 17:15:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([195.88.108.3]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id 7OXLXd7f-h0m; Mon, 22 Jun 2009 17:15:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id C4D5F41C711; Mon, 22 Jun 2009 17:15:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 8C6734448E6; Mon, 22 Jun 2009 15:14:42 +0000 (UTC) Date: Mon, 22 Jun 2009 15:14:42 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <200906221507.n5MF7CIq044459@svn.freebsd.org> Message-ID: <20090622151017.H22887@maildrop.int.zabbadoz.net> References: <200906221507.n5MF7CIq044459@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Subject: Re: svn commit: r194629 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 15:15:08 -0000 On Mon, 22 Jun 2009, Bjoern A. Zeeb wrote: > Author: bz > Date: Mon Jun 22 15:07:12 2009 > New Revision: 194629 > URL: http://svn.freebsd.org/changeset/base/194629 > > Log: > Collect all VIMAGE_GLOBALS variables in one place. > > No longer export rt_tables as all lookups go through > rt_tables_get_rnh(). > > We cannot make rt_tables (and rtstat, rttrash[1]) static as > netstat -r (-rs[1]) would stop working on a stripped > VIMAGE_GLOBALS kernel. > > Reviewed by: zec > Presumably broken by: phk 13.5y ago in r12820 [1] Which seriously leads to the questions: 1) is this because we do not ship stripped kernels? 2) is the kvm_* interface to read them the wrong way? 3) those stats are useless and should be garbage collected entirely? I only tripped over this because I wanted to do the same to rt_tables as phk did 13.5 years back to rtstat,rttrash and Marko made me tripple check things. -- Bjoern A. Zeeb The greatest risk is not taking one. From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 15:19:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E41C7106566C; Mon, 22 Jun 2009 15:19:18 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 815EB8FC1E; Mon, 22 Jun 2009 15:19:18 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 3CAD51CC26; Mon, 22 Jun 2009 17:19:17 +0200 (CEST) Date: Mon, 22 Jun 2009 17:19:17 +0200 From: Ed Schouten To: Rong-En Fan Message-ID: <20090622151917.GC48776@hoeg.nl> References: <200906221500.n5MF0F6v044301@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="eZF+V2/LE/RsbcQg" Content-Disposition: inline In-Reply-To: <200906221500.n5MF0F6v044301@svn.freebsd.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194628 - head/lib/ncurses/ncurses X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 15:19:19 -0000 --eZF+V2/LE/RsbcQg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Rafan, * Rong-En Fan wrote: > Log: > - Fall-back to /etc/termcap.small if there is no /usr/share/misc/termcap > (i.e. /etc/termcap). This can be useful when using /rescue/vi while /= usr > is not (or unable to be) mounted. The termcap.small can be found in > src/etc/termcap.small. > =20 > PR: bin/80256 (audit-trail) > Submitted by: Brian Candler , Alex Kozlov > MFC after: 1 month I'm not familiar with termcap/terminfo/ncurses sources, but how hard would it be to compile a very small termcap file into the library itself, only containing cons25 and xterm/xterm-color? --=20 Ed Schouten WWW: http://80386.nl/ --eZF+V2/LE/RsbcQg Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAko/oPUACgkQ52SDGA2eCwX7mgCfYDqK1fSgybovX9wi4Pm1Otz9 olMAn0WuGFTUJSiV38UtWFSy3kLzdPn6 =X9TT -----END PGP SIGNATURE----- --eZF+V2/LE/RsbcQg-- From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 15:34:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4E6F41065672; Mon, 22 Jun 2009 15:34:33 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3AE388FC19; Mon, 22 Jun 2009 15:34:33 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MFYXgv045054; Mon, 22 Jun 2009 15:34:33 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MFYXdY045050; Mon, 22 Jun 2009 15:34:33 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200906221534.n5MFYXdY045050@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 22 Jun 2009 15:34: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: r194630 - in head/sys: conf powerpc/conf powerpc/mpc85xx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 15:34:33 -0000 Author: raj Date: Mon Jun 22 15:34:32 2009 New Revision: 194630 URL: http://svn.freebsd.org/changeset/base/194630 Log: Integrated I2C controller driver (found in MPC85xx and other SOC parts). Obtained from: Freescale, Semihalf Added: head/sys/powerpc/mpc85xx/i2c.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/powerpc/conf/MPC85XX Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Mon Jun 22 15:07:12 2009 (r194629) +++ head/sys/conf/files.powerpc Mon Jun 22 15:34:32 2009 (r194630) @@ -110,6 +110,7 @@ powerpc/fpu/fpu_sqrt.c optional fpu_emu powerpc/fpu/fpu_subr.c optional fpu_emu powerpc/mpc85xx/atpic.c optional mpc85xx isa powerpc/mpc85xx/isa.c optional mpc85xx isa +powerpc/mpc85xx/i2c.c optional iicbus mpc85xx powerpc/mpc85xx/lbc.c optional mpc85xx powerpc/mpc85xx/mpc85xx.c optional mpc85xx powerpc/mpc85xx/nexus.c optional mpc85xx Modified: head/sys/powerpc/conf/MPC85XX ============================================================================== --- head/sys/powerpc/conf/MPC85XX Mon Jun 22 15:07:12 2009 (r194629) +++ head/sys/powerpc/conf/MPC85XX Mon Jun 22 15:34:32 2009 (r194630) @@ -59,6 +59,8 @@ device da device em device ether device fxp +device iic +device iicbus device isa device loop device md Added: head/sys/powerpc/mpc85xx/i2c.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/mpc85xx/i2c.c Mon Jun 22 15:34:32 2009 (r194630) @@ -0,0 +1,440 @@ +/*- + * Copyright (C) 2008-2009 Semihalf, Michal Hajduk + * 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 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include "iicbus_if.h" + +#include + +#define I2C_ADDR_REG 0x00 /* I2C slave address register */ +#define I2C_FDR_REG 0x04 /* I2C frequency divider register */ +#define I2C_CONTROL_REG 0x08 /* I2C control register */ +#define I2C_STATUS_REG 0x0C /* I2C status register */ +#define I2C_DATA_REG 0x10 /* I2C data register */ +#define I2C_DFSRR_REG 0x14 /* I2C Digital Filter Sampling rate */ +#define I2C_ENABLE 0x80 /* Module enable - interrupt disable */ +#define I2CSR_RXAK 0x01 /* Received acknowledge */ +#define I2CSR_MCF (1<<7) /* Data transfer */ +#define I2CSR_MASS (1<<6) /* Addressed as a slave */ +#define I2CSR_MBB (1<<5) /* Bus busy */ +#define I2CSR_MAL (1<<4) /* Arbitration lost */ +#define I2CSR_SRW (1<<2) /* Slave read/write */ +#define I2CSR_MIF (1<<1) /* Module interrupt */ +#define I2CCR_MEN (1<<7) /* Module enable */ +#define I2CCR_MSTA (1<<5) /* Master/slave mode */ +#define I2CCR_MTX (1<<4) /* Transmit/receive mode */ +#define I2CCR_TXAK (1<<3) /* Transfer acknowledge */ +#define I2CCR_RSTA (1<<2) /* Repeated START */ + +#define I2C_BAUD_RATE_FAST 0x31 +#define I2C_BAUD_RATE_DEF 0x3F +#define I2C_DFSSR_DIV 0x10 + +#define DEBUG +#undef DEBUG + +#ifdef DEBUG +#define debugf(fmt, args...) do { printf("%s(): ", __func__); printf(fmt,##args); } while (0) +#else +#define debugf(fmt, args...) +#endif + +struct i2c_softc { + device_t dev; + device_t iicbus; + struct resource *res; + struct mtx mutex; + int rid; + bus_space_handle_t bsh; + bus_space_tag_t bst; +}; + +static int i2c_probe(device_t); +static int i2c_attach(device_t); + +static int i2c_repeated_start(device_t dev, u_char slave, int timeout); +static int i2c_start(device_t dev, u_char slave, int timeout); +static int i2c_stop(device_t dev); +static int i2c_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr); +static int i2c_read(device_t dev, char *buf, int len, int *read, int last, int delay); +static int i2c_write(device_t dev, const char *buf, int len, int *sent, int timeout); + +static device_method_t i2c_methods[] = { + DEVMETHOD(device_probe, i2c_probe), + DEVMETHOD(device_attach, i2c_attach), + + DEVMETHOD(iicbus_callback, iicbus_null_callback), + DEVMETHOD(iicbus_repeated_start, i2c_repeated_start), + DEVMETHOD(iicbus_start, i2c_start), + DEVMETHOD(iicbus_stop, i2c_stop), + DEVMETHOD(iicbus_reset, i2c_reset), + DEVMETHOD(iicbus_read, i2c_read), + DEVMETHOD(iicbus_write, i2c_write), + DEVMETHOD(iicbus_transfer, iicbus_transfer_gen), + + { 0, 0 } +}; + +static driver_t i2c_driver = { + "i2c", + i2c_methods, + sizeof(struct i2c_softc), +}; +static devclass_t i2c_devclass; + +DRIVER_MODULE(i2c, ocpbus, i2c_driver, i2c_devclass, 0, 0); +DRIVER_MODULE(iicbus, i2c, iicbus_driver, iicbus_devclass, 0, 0); + +static __inline void +i2c_write_reg(struct i2c_softc *sc, bus_size_t off, uint8_t val) +{ + + bus_space_write_1(sc->bst, sc->bsh, off, val); +} + +static __inline uint8_t +i2c_read_reg(struct i2c_softc *sc, bus_size_t off) +{ + + return (bus_space_read_1(sc->bst, sc->bsh, off)); +} + +static __inline void +i2c_flag_set(struct i2c_softc *sc, bus_size_t off, uint8_t mask) +{ + uint8_t status; + + status = i2c_read_reg(sc, off); + status |= mask; + i2c_write_reg(sc, off, status); +} + +static int +i2c_do_wait(device_t dev, struct i2c_softc *sc, int write, int start) +{ + int err; + uint8_t status; + + status = i2c_read_reg(sc,I2C_STATUS_REG); + if (status & I2CSR_MIF) { + if (write && start && (status & I2CSR_RXAK)) { + debugf("no ack %s", start ? + "after sending slave address" : ""); + err = IIC_ENOACK; + goto error; + } + if (status & I2CSR_MAL) { + debugf("arbitration lost"); + err = IIC_EBUSERR; + goto error; + } + if (!write && !(status & I2CSR_MCF)) { + debugf("transfer unfinished"); + err = IIC_EBUSERR; + goto error; + } + } + + return (IIC_NOERR); + +error: + i2c_write_reg(sc, I2C_STATUS_REG, 0x0); + i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | I2CCR_TXAK); + return (err); +} + +static int +i2c_probe(device_t dev) +{ + device_t parent; + struct i2c_softc *sc; + uintptr_t devtype; + int error; + + parent = device_get_parent(dev); + + error = BUS_READ_IVAR(parent, dev, OCPBUS_IVAR_DEVTYPE, &devtype); + + if (error) + return (error); + + if (devtype != OCPBUS_DEVTYPE_I2C) + return (ENXIO); + + sc = device_get_softc(dev); + sc->rid = 0; + + sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rid, + RF_ACTIVE); + if (sc->res == NULL) { + device_printf(dev, "could not allocate resources"); + return (ENXIO); + } + + sc->bst = rman_get_bustag(sc->res); + sc->bsh = rman_get_bushandle(sc->res); + + /* Enable I2C */ + i2c_write_reg(sc, I2C_CONTROL_REG, I2C_ENABLE); + bus_release_resource(dev, SYS_RES_MEMORY, sc->rid, sc->res); + device_set_desc(dev, "I2C bus controller"); + + return (BUS_PROBE_DEFAULT); +} + +static int +i2c_attach(device_t dev) +{ + struct i2c_softc *sc; + sc = device_get_softc(dev); + + sc->dev = dev; + sc->rid = 0; + + mtx_init(&sc->mutex, device_get_nameunit(dev), "I2C", MTX_DEF); + + sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rid, + RF_ACTIVE); + if (sc->res == NULL) { + device_printf(dev, "could not allocate resources"); + mtx_destroy(&sc->mutex); + return (ENXIO); + } + + sc->bst = rman_get_bustag(sc->res); + sc->bsh = rman_get_bushandle(sc->res); + + sc->iicbus = device_add_child(dev, "iicbus", -1); + if (sc->iicbus == NULL) { + device_printf(dev, "could not add iicbus child"); + mtx_destroy(&sc->mutex); + return (ENXIO); + } + + bus_generic_attach(dev); + return (IIC_NOERR); +} +static int +i2c_repeated_start(device_t dev, u_char slave, int timeout) +{ + struct i2c_softc *sc; + int error; + + sc = device_get_softc(dev); + + mtx_lock(&sc->mutex); + /* Set repeated start condition */ + i2c_flag_set(sc, I2C_CONTROL_REG ,I2CCR_RSTA); + /* Write target address - LSB is R/W bit */ + i2c_write_reg(sc, I2C_DATA_REG, slave); + DELAY(1250); + + error = i2c_do_wait(dev, sc, 1, 1); + mtx_unlock(&sc->mutex); + + if (error) + return (error); + + return (IIC_NOERR); +} + +static int +i2c_start(device_t dev, u_char slave, int timeout) +{ + struct i2c_softc *sc; + uint8_t status; + int error; + + sc = device_get_softc(dev); + DELAY(1000); + + mtx_lock(&sc->mutex); + status = i2c_read_reg(sc, I2C_STATUS_REG); + /* Check if bus is idle or busy */ + if (status & I2CSR_MBB) { + debugf("bus busy"); + mtx_unlock(&sc->mutex); + i2c_stop(dev); + return (IIC_EBUSBSY); + } + + /* Set start condition */ + i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | I2CCR_MSTA | I2CCR_MTX); + /* Write target address - LSB is R/W bit */ + i2c_write_reg(sc, I2C_DATA_REG, slave); + DELAY(1250); + + error = i2c_do_wait(dev, sc, 1, 1); + + mtx_unlock(&sc->mutex); + if (error) + return (error); + + return (IIC_NOERR); +} + +static int +i2c_stop(device_t dev) +{ + struct i2c_softc *sc; + + sc = device_get_softc(dev); + mtx_lock(&sc->mutex); + i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | I2CCR_TXAK); + DELAY(1000); + mtx_unlock(&sc->mutex); + + return (IIC_NOERR); +} + +static int +i2c_reset(device_t dev, u_char speed, u_char addr, u_char *oldadr) +{ + struct i2c_softc *sc; + uint8_t baud_rate; + + sc = device_get_softc(dev); + + switch (speed) { + case IIC_FAST: + baud_rate = I2C_BAUD_RATE_FAST; + break; + case IIC_SLOW: + case IIC_UNKNOWN: + case IIC_FASTEST: + default: + baud_rate = I2C_BAUD_RATE_DEF; + break; + } + + mtx_lock(&sc->mutex); + i2c_write_reg(sc, I2C_CONTROL_REG, 0x0); + i2c_write_reg(sc, I2C_STATUS_REG, 0x0); + DELAY(1000); + i2c_write_reg(sc, I2C_FDR_REG, baud_rate); + i2c_write_reg(sc, I2C_DFSRR_REG, I2C_DFSSR_DIV); + i2c_write_reg(sc, I2C_CONTROL_REG, I2C_ENABLE); + DELAY(1000); + mtx_unlock(&sc->mutex); + + return (IIC_NOERR); +} + +static int +i2c_read(device_t dev, char *buf, int len, int *read, int last, int delay) +{ + struct i2c_softc *sc; + int error; + + sc = device_get_softc(dev); + *read = 0; + + mtx_lock(&sc->mutex); + if (len) { + if (len == 1) + i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | + I2CCR_MSTA | I2CCR_TXAK); + + else + i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | + I2CCR_MSTA); + + /* dummy read */ + i2c_read_reg(sc, I2C_DATA_REG); + DELAY(1000); + } + + while (*read < len) { + DELAY(1000); + error = i2c_do_wait(dev, sc, 0, 0); + if (error) { + mtx_unlock(&sc->mutex); + return (error); + } + if ((*read == len - 2) && last) { + i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | + I2CCR_MSTA | I2CCR_TXAK); + } + + if ((*read == len - 1) && last) { + i2c_write_reg(sc, I2C_CONTROL_REG, I2CCR_MEN | + I2CCR_TXAK); + } + + *buf++ = i2c_read_reg(sc, I2C_DATA_REG); + (*read)++; + DELAY(1250); + } + mtx_unlock(&sc->mutex); + + return (IIC_NOERR); +} + +static int +i2c_write(device_t dev, const char *buf, int len, int *sent, int timeout) +{ + struct i2c_softc *sc; + int error; + + sc = device_get_softc(dev); + *sent = 0; + + mtx_lock(&sc->mutex); + while (*sent < len) { + i2c_write_reg(sc, I2C_DATA_REG, *buf++); + DELAY(1250); + + error = i2c_do_wait(dev, sc, 1, 0); + if (error) { + mtx_unlock(&sc->mutex); + return (error); + } + + (*sent)++; + } + mtx_unlock(&sc->mutex); + + return (IIC_NOERR); +} From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 15:45:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E53CE1065672; Mon, 22 Jun 2009 15:45:26 +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 B86108FC26; Mon, 22 Jun 2009 15:45:26 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MFjQKT045273; Mon, 22 Jun 2009 15:45:26 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MFjQXU045271; Mon, 22 Jun 2009 15:45:26 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200906221545.n5MFjQXU045271@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 22 Jun 2009 15:45: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: r194631 - head/release/picobsd/build X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 15:45:27 -0000 Author: luigi Date: Mon Jun 22 15:45:26 2009 New Revision: 194631 URL: http://svn.freebsd.org/changeset/base/194631 Log: Add code to generate a bootable ISO image, so we are finally free from the 2.88MB that we had using El Torito emulation. The --iso option was already there, just didn't do anything before. Submitted by: Marta Carbone MFC after: 3 days Modified: head/release/picobsd/build/picobsd Modified: head/release/picobsd/build/picobsd ============================================================================== --- head/release/picobsd/build/picobsd Mon Jun 22 15:34:32 2009 (r194630) +++ head/release/picobsd/build/picobsd Mon Jun 22 15:45:26 2009 (r194631) @@ -140,6 +140,7 @@ set_defaults() { # no arguments # mountpoint used to build memory filesystems c_fs=fs.PICOBSD # filename used for the memory filesystem c_img=picobsd.bin # filename used for the picobsd image + c_iso=picobsd.bin # filename used for the ISO image generate_iso="NO" # don't generate the iso image # select the right disklabel program @@ -276,15 +277,7 @@ set_msgs() { # OK \t3. Site-info: ${SITE}\n\t4. Full-path: ${MY_TREE}\n" } -# build the iso image -build_iso_image() { - log "build_iso_image()" - clear - set_msgs - printf "${MSG}---> Build the iso image not ready yet\n\n" -} - -# Main build procedure. +# Main build procedure. Builds both the disk image and the ISO build_image() { log "build_image() <${name}>" [ -n "${name}" ] || fail $? bad_type @@ -902,6 +895,16 @@ fill_floppy_image() { fi log "image used `du -s ${dst}` of ${blocks}k" + if [ "${generate_iso}" = "YES" ]; then + logverbose "generate_iso ${generate_iso}" + # build_iso_image # XXX not implemented yet + (cd ${BUILDDIR} + cp -p /boot/cdboot ${dst}/boot || fail $? no_space "copying cdboot" + mkisofs -b boot/cdboot -no-emul-boot -J -r -ldots -l -L \ + -o ${c_iso} ${dst} + ) + fi + (cd ${BUILDDIR} makefs -t ffs -o bsize=4096 -o fsize=512 \ -s ${blocks}k -f 50 ${c_img} ${dst} @@ -918,11 +921,6 @@ fill_floppy_image() { ) echo "BUILDDIR ${BUILDDIR}" - if [ "${generate_iso}" = "YES" ]; then - echo "generate_iso ${generate_iso}" - # build_iso_image # XXX not implemented yet - exit 1 - fi # dump the primary and secondary boot # XXX primary is 512 bytes From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 15:48:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E021710657F2; Mon, 22 Jun 2009 15:48:47 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C09A78FC17; Mon, 22 Jun 2009 15:48:47 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MFmlHB045371; Mon, 22 Jun 2009 15:48:47 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MFml0M045365; Mon, 22 Jun 2009 15:48:47 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200906221548.n5MFml0M045365@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 22 Jun 2009 15:48: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: r194632 - in head/sys: conf powerpc/conf powerpc/mpc85xx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 15:48:49 -0000 Author: raj Date: Mon Jun 22 15:48:47 2009 New Revision: 194632 URL: http://svn.freebsd.org/changeset/base/194632 Log: DS1553 RTC module driver. On the MPC8555CDS system it hangs off of the LBC bus. Obtained from: Semihalf Added: head/sys/powerpc/mpc85xx/ds1553_bus_lbc.c (contents, props changed) head/sys/powerpc/mpc85xx/ds1553_core.c (contents, props changed) head/sys/powerpc/mpc85xx/ds1553_reg.h (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/powerpc/conf/MPC85XX Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Mon Jun 22 15:45:26 2009 (r194631) +++ head/sys/conf/files.powerpc Mon Jun 22 15:48:47 2009 (r194632) @@ -109,6 +109,8 @@ powerpc/fpu/fpu_mul.c optional fpu_emu powerpc/fpu/fpu_sqrt.c optional fpu_emu powerpc/fpu/fpu_subr.c optional fpu_emu powerpc/mpc85xx/atpic.c optional mpc85xx isa +powerpc/mpc85xx/ds1553_bus_lbc.c optional ds1553 +powerpc/mpc85xx/ds1553_core.c optional ds1553 powerpc/mpc85xx/isa.c optional mpc85xx isa powerpc/mpc85xx/i2c.c optional iicbus mpc85xx powerpc/mpc85xx/lbc.c optional mpc85xx Modified: head/sys/powerpc/conf/MPC85XX ============================================================================== --- head/sys/powerpc/conf/MPC85XX Mon Jun 22 15:45:26 2009 (r194631) +++ head/sys/powerpc/conf/MPC85XX Mon Jun 22 15:48:47 2009 (r194632) @@ -56,6 +56,7 @@ device cfi device crypto device cryptodev device da +device ds1553 device em device ether device fxp Added: head/sys/powerpc/mpc85xx/ds1553_bus_lbc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/mpc85xx/ds1553_bus_lbc.c Mon Jun 22 15:48:47 2009 (r194632) @@ -0,0 +1,134 @@ +/*- + * Copyright (C) 2006-2008 Semihalf, Grzegorz Bernacki + * 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include "clock_if.h" + +static devclass_t rtc_devclass; + +static int rtc_attach(device_t dev); +static int rtc_probe(device_t dev); + +static device_method_t rtc_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, rtc_probe), + DEVMETHOD(device_attach, rtc_attach), + + /* clock interface */ + DEVMETHOD(clock_gettime, ds1553_gettime), + DEVMETHOD(clock_settime, ds1553_settime), + + { 0, 0 } +}; + +static driver_t rtc_driver = { + "rtc", + rtc_methods, + sizeof(struct ds1553_softc), +}; + +DRIVER_MODULE(rtc, lbc, rtc_driver, rtc_devclass, 0, 0); + +static int +rtc_probe(device_t dev) +{ + uintptr_t devtype; + int error; + + error = BUS_READ_IVAR(device_get_parent(dev), dev, LBC_IVAR_DEVTYPE, + &devtype); + if (error) + return (error); + + if (devtype != LBC_DEVTYPE_RTC) + return (EINVAL); + + device_set_desc(dev, "Real Time Clock"); + + return (0); +} + +static int +rtc_attach(device_t dev) +{ + struct timespec ts; + struct ds1553_softc *sc; + int error; + + sc = device_get_softc(dev); + bzero(sc, sizeof(struct ds1553_softc)); + + mtx_init(&sc->sc_mtx, "rtc_mtx", NULL, MTX_SPIN); + + sc->res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->rid, + RF_ACTIVE); + if (sc->res == NULL) { + device_printf(dev, "cannot allocate resources\n"); + mtx_destroy(&sc->sc_mtx); + return (ENXIO); + } + + sc->sc_bst = rman_get_bustag(sc->res); + sc->sc_bsh = rman_get_bushandle(sc->res); + + if ((error = ds1553_attach(dev)) != 0) { + device_printf(dev, "cannot attach time of day clock\n"); + bus_release_resource(dev, SYS_RES_MEMORY, sc->rid, sc->res); + mtx_destroy(&sc->sc_mtx); + return (error); + } + + clock_register(dev, 1000000); + + if (bootverbose) { + ds1553_gettime(dev, &ts); + device_printf(dev, "current time: %ld.%09ld\n", + (long)ts.tv_sec, ts.tv_nsec); + } + + return (0); +} Added: head/sys/powerpc/mpc85xx/ds1553_core.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/mpc85xx/ds1553_core.c Mon Jun 22 15:48:47 2009 (r194632) @@ -0,0 +1,194 @@ +/*- + * Copyright (C) 2006-2008 Semihalf, Grzegorz Bernacki + * 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include + +#include + +static uint8_t ds1553_direct_read(device_t, bus_size_t); +static void ds1553_direct_write(device_t, bus_size_t, uint8_t); + +int +ds1553_attach(device_t dev) +{ + struct ds1553_softc *sc; + uint8_t sec, flags; + + sc = device_get_softc(dev); + + if (mtx_initialized(&sc->sc_mtx) == 0) { + device_printf(dev, "%s: mutex not initialized\n", __func__); + return (ENXIO); + } + + if (sc->sc_read == NULL) + sc->sc_read = ds1553_direct_read; + if (sc->sc_write == NULL) + sc->sc_write = ds1553_direct_write; + + sc->year_offset = POSIX_BASE_YEAR; + + mtx_lock_spin(&sc->sc_mtx); + + /* Turn RTC on if it was not on */ + sec = (*sc->sc_read)(dev, DS1553_OFF_SECONDS); + if (sec & DS1553_BIT_OSC) { + sec &= ~(DS1553_BIT_OSC); + (*sc->sc_write)(dev, DS1553_OFF_SECONDS, sec); + } + + /* Low-battery check */ + flags = (*sc->sc_read)(dev, DS1553_OFF_FLAGS); + if (flags & DS1553_BIT_BLF) + device_printf(dev, "voltage-low detected.\n"); + + mtx_unlock_spin(&sc->sc_mtx); + + return (0); +} + +/* + * Get time of day and convert it to a struct timespec. + * Return 0 on success, an error number otherwise. + */ +int +ds1553_gettime(device_t dev, struct timespec *ts) +{ + struct clocktime ct; + struct ds1553_softc *sc; + uint8_t control; + + sc = device_get_softc(dev); + + mtx_lock_spin(&sc->sc_mtx); + + control = (*sc->sc_read)(dev, DS1553_OFF_CONTROL) | DS1553_BIT_READ; + (*sc->sc_write)(dev, DS1553_OFF_CONTROL, control); + + ct.nsec = 0; + ct.sec = FROMBCD((*sc->sc_read)(dev, DS1553_OFF_SECONDS) & + DS1553_MASK_SECONDS); + ct.min = FROMBCD((*sc->sc_read)(dev, DS1553_OFF_MINUTES) & + DS1553_MASK_MINUTES); + ct.hour = FROMBCD((*sc->sc_read)(dev, DS1553_OFF_HOURS) & + DS1553_MASK_HOUR); + ct.dow = FROMBCD((*sc->sc_read)(dev, DS1553_OFF_DAYOFWEEK) & + DS1553_MASK_DAYOFWEEK) - 1; + ct.day = FROMBCD((*sc->sc_read)(dev, DS1553_OFF_DATE) & + DS1553_MASK_DATE); + ct.mon = FROMBCD((*sc->sc_read)(dev, DS1553_OFF_MONTH) & + DS1553_MASK_MONTH); + ct.year = FROMBCD((*sc->sc_read)(dev, DS1553_OFF_YEAR)); + + control &= ~DS1553_BIT_READ; + (*sc->sc_write)(dev, DS1553_OFF_CONTROL, control); + + ct.year += sc->year_offset; + + mtx_unlock_spin(&sc->sc_mtx); + + return (clock_ct_to_ts(&ct, ts)); +} + +/* + * Set the time of day clock based on the value of the struct timespec arg. + * Return 0 on success, an error number otherwise. + */ +int +ds1553_settime(device_t dev, struct timespec *ts) +{ + struct clocktime ct; + struct ds1553_softc *sc; + uint8_t control; + + sc = device_get_softc(dev); + bzero(&ct, sizeof(struct clocktime)); + + /* Accuracy is only one second. */ + if (ts->tv_nsec >= 500000000) + ts->tv_sec++; + ts->tv_nsec = 0; + clock_ts_to_ct(ts, &ct); + + ct.year -= sc->year_offset; + + mtx_lock_spin(&sc->sc_mtx); + + /* Halt updates to external registers */ + control = (*sc->sc_read)(dev, DS1553_OFF_CONTROL) | DS1553_BIT_WRITE; + (*sc->sc_write)(dev, DS1553_OFF_CONTROL, control); + + (*sc->sc_write)(dev, DS1553_OFF_SECONDS, TOBCD(ct.sec) & + DS1553_MASK_SECONDS); + (*sc->sc_write)(dev, DS1553_OFF_MINUTES, TOBCD(ct.min) & + DS1553_MASK_MINUTES); + (*sc->sc_write)(dev, DS1553_OFF_HOURS, TOBCD(ct.hour) & + DS1553_MASK_HOUR); + (*sc->sc_write)(dev, DS1553_OFF_DAYOFWEEK, TOBCD(ct.dow + 1) & + DS1553_MASK_DAYOFWEEK); + (*sc->sc_write)(dev, DS1553_OFF_DATE, TOBCD(ct.day) & + DS1553_MASK_DATE); + (*sc->sc_write)(dev, DS1553_OFF_MONTH, TOBCD(ct.mon) & + DS1553_MASK_MONTH); + (*sc->sc_write)(dev, DS1553_OFF_YEAR, TOBCD(ct.year)); + + /* Resume updates to external registers */ + control &= ~DS1553_BIT_WRITE; + (*sc->sc_write)(dev, DS1553_OFF_CONTROL, control); + + mtx_unlock_spin(&sc->sc_mtx); + + return (0); +} + +static uint8_t +ds1553_direct_read(device_t dev, bus_size_t off) +{ + struct ds1553_softc *sc; + + sc = device_get_softc(dev); + return (bus_space_read_1(sc->sc_bst, sc->sc_bsh, off)); +} + +static void +ds1553_direct_write(device_t dev, bus_size_t off, uint8_t val) +{ + struct ds1553_softc *sc; + + sc = device_get_softc(dev); + bus_space_write_1(sc->sc_bst, sc->sc_bsh, off, val); +} Added: head/sys/powerpc/mpc85xx/ds1553_reg.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/mpc85xx/ds1553_reg.h Mon Jun 22 15:48:47 2009 (r194632) @@ -0,0 +1,107 @@ +/*- + * Copyright (C) 2006-2008 Semihalf, Grzegorz Bernacki + * 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 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$ + */ + +#ifndef _DEV_RTC_DS1553_H_ +#define _DEV_RTC_DS1553_H_ + +/* DS1553 registers */ +#define DS1553_NVRAM_SIZE 0x1ff0 +#define DS1553_OFF_FLAGS 0x1ff0 +#define DS1553_OFF_ALARM_SECONDS 0x1ff2 +#define DS1553_OFF_ALARM_MINUTES 0x1ff3 +#define DS1553_OFF_ALARM_HOURS 0x1ff4 +#define DS1553_OFF_ALARM_DATE 0x1ff5 +#define DS1553_OFF_INTERRUPTS 0x1ff6 +#define DS1553_OFF_WATCHDOG 0x1ff7 +#define DS1553_OFF_CONTROL 0x1ff8 +#define DS1553_OFF_SECONDS 0x1ff9 +#define DS1553_OFF_MINUTES 0x1ffa +#define DS1553_OFF_HOURS 0x1ffb +#define DS1553_OFF_DAYOFWEEK 0x1ffc +#define DS1553_OFF_DATE 0x1ffd +#define DS1553_OFF_MONTH 0x1ffe +#define DS1553_OFF_YEAR 0x1fff + +/* dayofweek register's bits */ +#define DS1553_BIT_FREQ_TEST 0x40 /* frequency test bit */ + +/* seconds register's bit */ +#define DS1553_BIT_OSC 0x80 /* oscillator start/stop bit */ + +/* control register's bits */ +#define DS1553_BIT_WRITE 0x80 /* write */ +#define DS1553_BIT_READ 0x40 /* read */ + +/* watchdog register's bits */ +#define DS1553_BIT_WATCHDOG 0x80 /* watchdog steering bit */ +#define DS1553_BIT_BMB4 0x40 /* watchdog multiplier bit4 */ +#define DS1553_BIT_BMB3 0x20 /* watchdog multiplier bit3 */ +#define DS1553_BIT_BMB2 0x10 /* watchdog multiplier bit2 */ +#define DS1553_BIT_BMB1 0x8 /* watchdog multiplier bit1 */ +#define DS1553_BIT_BMB0 0x4 /* watchdog multiplier bit0 */ +#define DS1553_BIT_RB1 0x2 /* watchdog resolution bit1 */ +#define DS1553_BIT_RB0 0x1 /* watchdog resolution bit0 */ + +/* alarm seconds/minutes/hours/date register's bit */ +#define DS1553_BIT_AM 0x80 /* alarm mask bit */ + +/* flag register's bits */ +#define DS1553_BIT_BLF 0x10 /* battery flag */ +#define DS1553_BIT_WF 0x80 /* watchdog flag */ + +/* register's mask */ +#define DS1553_MASK_MONTH 0x1f +#define DS1553_MASK_DATE 0x3f +#define DS1553_MASK_DAYOFWEEK 0x7 +#define DS1553_MASK_HOUR 0x3f +#define DS1553_MASK_MINUTES 0x7f +#define DS1553_MASK_SECONDS 0x7f + +struct ds1553_softc { + + bus_space_tag_t sc_bst; /* bus space tag */ + bus_space_handle_t sc_bsh; /* bus space handle */ + + int rid; /* resource id */ + struct resource *res; + struct mtx sc_mtx; /* hardware mutex */ + + uint32_t year_offset; + /* read/write functions */ + uint8_t (*sc_read)(device_t, bus_size_t); + void (*sc_write)(device_t, bus_size_t, uint8_t); +}; + +/* device interface */ +int ds1553_attach(device_t); + +/* clock interface */ +int ds1553_gettime(device_t, struct timespec *); +int ds1553_settime(device_t, struct timespec *); + +#endif /* _DEV_RTC_DS1553_H_ */ From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 15:53:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 194E31065713; Mon, 22 Jun 2009 15:53:42 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 07C8F8FC25; Mon, 22 Jun 2009 15:53:42 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MFrfJB045493; Mon, 22 Jun 2009 15:53:41 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MFrfQS045491; Mon, 22 Jun 2009 15:53:41 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200906221553.n5MFrfQS045491@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 22 Jun 2009 15:53: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: r194633 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 15:53:42 -0000 Author: raj Date: Mon Jun 22 15:53:41 2009 New Revision: 194633 URL: http://svn.freebsd.org/changeset/base/194633 Log: Keep file list sorted. Modified: head/sys/conf/files.powerpc Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Mon Jun 22 15:48:47 2009 (r194632) +++ head/sys/conf/files.powerpc Mon Jun 22 15:53:41 2009 (r194633) @@ -111,8 +111,8 @@ powerpc/fpu/fpu_subr.c optional fpu_emu powerpc/mpc85xx/atpic.c optional mpc85xx isa powerpc/mpc85xx/ds1553_bus_lbc.c optional ds1553 powerpc/mpc85xx/ds1553_core.c optional ds1553 -powerpc/mpc85xx/isa.c optional mpc85xx isa powerpc/mpc85xx/i2c.c optional iicbus mpc85xx +powerpc/mpc85xx/isa.c optional mpc85xx isa powerpc/mpc85xx/lbc.c optional mpc85xx powerpc/mpc85xx/mpc85xx.c optional mpc85xx powerpc/mpc85xx/nexus.c optional mpc85xx From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 15:57:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A326D1065670; Mon, 22 Jun 2009 15:57:12 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 919148FC17; Mon, 22 Jun 2009 15:57:12 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MFvC3E045609; Mon, 22 Jun 2009 15:57:12 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MFvCDV045607; Mon, 22 Jun 2009 15:57:12 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200906221557.n5MFvCDV045607@svn.freebsd.org> From: Rafal Jaworowski Date: Mon, 22 Jun 2009 15:57:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194634 - head/sys/boot/powerpc/uboot X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 15:57:13 -0000 Author: raj Date: Mon Jun 22 15:57:12 2009 New Revision: 194634 URL: http://svn.freebsd.org/changeset/base/194634 Log: Bump PowerPC loader(8) version to reflect extensions it has recently grown. Modified: head/sys/boot/powerpc/uboot/version Modified: head/sys/boot/powerpc/uboot/version ============================================================================== --- head/sys/boot/powerpc/uboot/version Mon Jun 22 15:53:41 2009 (r194633) +++ head/sys/boot/powerpc/uboot/version Mon Jun 22 15:57:12 2009 (r194634) @@ -3,6 +3,7 @@ $FreeBSD$ NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this file is important. Make sure the current version number is on line 6. +1.0: Added storage support. 0.6: Integrated with the new U-Boot API 0.5: Full network functionality. 0.2: Initial U-Boot/PowerPC version derived from the existing From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 16:06:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80E6D1065676; Mon, 22 Jun 2009 16:06:40 +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 6F3728FC16; Mon, 22 Jun 2009 16:06:40 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MG6drW045850; Mon, 22 Jun 2009 16:06:39 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MG6dqO045848; Mon, 22 Jun 2009 16:06:39 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200906221606.n5MG6dqO045848@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 22 Jun 2009 16:06: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: r194635 - head/release/picobsd/build X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 16:06:41 -0000 Author: luigi Date: Mon Jun 22 16:06:38 2009 New Revision: 194635 URL: http://svn.freebsd.org/changeset/base/194635 Log: fix wrong name for the iso! Modified: head/release/picobsd/build/picobsd Modified: head/release/picobsd/build/picobsd ============================================================================== --- head/release/picobsd/build/picobsd Mon Jun 22 15:57:12 2009 (r194634) +++ head/release/picobsd/build/picobsd Mon Jun 22 16:06:38 2009 (r194635) @@ -140,7 +140,7 @@ set_defaults() { # no arguments # mountpoint used to build memory filesystems c_fs=fs.PICOBSD # filename used for the memory filesystem c_img=picobsd.bin # filename used for the picobsd image - c_iso=picobsd.bin # filename used for the ISO image + c_iso=picobsd.iso # filename used for the ISO image generate_iso="NO" # don't generate the iso image # select the right disklabel program From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 17:00:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1838A1065670; Mon, 22 Jun 2009 17:00:21 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 065F78FC12; Mon, 22 Jun 2009 17:00:21 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MH0K81046931; Mon, 22 Jun 2009 17:00:20 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MH0KK9046928; Mon, 22 Jun 2009 17:00:20 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906221700.n5MH0KK9046928@svn.freebsd.org> From: Xin LI Date: Mon, 22 Jun 2009 17:00: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: r194637 - head/lib/libkiconv X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 17:00:21 -0000 Author: delphij Date: Mon Jun 22 17:00:20 2009 New Revision: 194637 URL: http://svn.freebsd.org/changeset/base/194637 Log: Add prototypes when the library is compiled static. Modified: head/lib/libkiconv/quirks.c head/lib/libkiconv/xlat16_sysctl.c Modified: head/lib/libkiconv/quirks.c ============================================================================== --- head/lib/libkiconv/quirks.c Mon Jun 22 16:11:34 2009 (r194636) +++ head/lib/libkiconv/quirks.c Mon Jun 22 17:00:20 2009 (r194637) @@ -183,9 +183,13 @@ quirk_unix2vendor(uint16_t c, struct qui #else /* statically linked */ +#include +#include + const char * -kiconv_quirkcs(const char* base, int vendor) +kiconv_quirkcs(const char* base __unused, int vendor __unused) { + return (base); } Modified: head/lib/libkiconv/xlat16_sysctl.c ============================================================================== --- head/lib/libkiconv/xlat16_sysctl.c Mon Jun 22 16:11:34 2009 (r194636) +++ head/lib/libkiconv/xlat16_sysctl.c Mon Jun 22 17:00:20 2009 (r194637) @@ -70,11 +70,15 @@ kiconv_add_xlat16_table(const char *to, #else /* statically linked */ +#include +#include #include int -kiconv_add_xlat16_table(const char *to, const char *from, const void *data, int datalen) +kiconv_add_xlat16_table(const char *to __unused, const char *from __unused, + const void *data __unused, int datalen __unused) { + return (EINVAL); } From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 17:09:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 742431065672; Mon, 22 Jun 2009 17:09:46 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 606EB8FC1B; Mon, 22 Jun 2009 17:09:46 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MH9kfH047145; Mon, 22 Jun 2009 17:09:46 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MH9krR047137; Mon, 22 Jun 2009 17:09:46 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906221709.n5MH9krR047137@svn.freebsd.org> From: Xin LI Date: Mon, 22 Jun 2009 17:09: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: r194638 - in head: lib/libkiconv sys/libkern sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 17:09:46 -0000 Author: delphij Date: Mon Jun 22 17:09:46 2009 New Revision: 194638 URL: http://svn.freebsd.org/changeset/base/194638 Log: Split tolower/toupper code from usual xlat16 kiconv table, and make it possible to do tolower/toupper independently without code conversion. Submitted by: imura (but bugs are mine) Obtained from: http://people.freebsd.org/~imura/kiconv/ (1_kiconv_wctype_kern.diff, 1_kiconv_wctype_user.diff) Added: head/lib/libkiconv/kiconv_sysctl.c (contents, props changed) Modified: head/lib/libkiconv/Makefile head/lib/libkiconv/xlat16_iconv.c head/sys/libkern/iconv.c head/sys/libkern/iconv_converter_if.m head/sys/libkern/iconv_xlat16.c head/sys/sys/iconv.h Modified: head/lib/libkiconv/Makefile ============================================================================== --- head/lib/libkiconv/Makefile Mon Jun 22 17:00:20 2009 (r194637) +++ head/lib/libkiconv/Makefile Mon Jun 22 17:09:46 2009 (r194638) @@ -2,7 +2,7 @@ LIB= kiconv SHLIBDIR?= /lib -SRCS= xlat16_iconv.c xlat16_sysctl.c +SRCS= kiconv_sysctl.c xlat16_iconv.c xlat16_sysctl.c SRCS+= quirks.c SHLIB_MAJOR= 3 Added: head/lib/libkiconv/kiconv_sysctl.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libkiconv/kiconv_sysctl.c Mon Jun 22 17:09:46 2009 (r194638) @@ -0,0 +1,93 @@ +/*- + * Copyright (c) 2005 Ryuichiro Imura + * 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 +#include + +#include +#include +#include +#include + +int +kiconv_lookupconv(const char *drvname) +{ + size_t size; + int error; + + if (sysctlbyname("kern.iconv.drvlist", NULL, &size, NULL, 0) == -1) + return (errno); + if (size > 0) { + char *drivers, *drvp; + + drivers = malloc(size); + if (drivers == NULL) + return (ENOMEM); + if (sysctlbyname("kern.iconv.drvlist", drivers, &size, NULL, 0) == -1) { + error = errno; + free(drivers); + return (errno); + } + for (drvp = drivers; *drvp != '\0'; drvp += strlen(drvp) + 1) + if (strcmp(drvp, drvname) == 0) { + free(drivers); + return (0); + } + } + return (ENOENT); +} + +int +kiconv_lookupcs(const char *tocode, const char *fromcode) +{ + size_t i, size; + struct iconv_cspair_info *csi, *csip; + int error; + + if (sysctlbyname("kern.iconv.cslist", NULL, &size, NULL, 0) == -1) + return (errno); + if (size > 0) { + csi = malloc(size); + if (csi == NULL) + return (ENOMEM); + if (sysctlbyname("kern.iconv.cslist", csi, &size, NULL, 0) == -1) { + error = errno; + free(csi); + return (error); + } + for (i = 0, csip = csi; i < (size/sizeof(*csi)); i++, csip++){ + if (strcmp(csip->cs_to, tocode) == 0 && + strcmp(csip->cs_from, fromcode) == 0) { + free(csi); + return (0); + } + } + } + return (ENOENT); +} Modified: head/lib/libkiconv/xlat16_iconv.c ============================================================================== --- head/lib/libkiconv/xlat16_iconv.c Mon Jun 22 17:00:20 2009 (r194637) +++ head/lib/libkiconv/xlat16_iconv.c Mon Jun 22 17:09:46 2009 (r194638) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2003 Ryuichiro Imura + * Copyright (c) 2003, 2005 Ryuichiro Imura * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -41,9 +41,11 @@ #include #include #include +#include #include #include #include +#include #include "quirks.h" @@ -56,6 +58,7 @@ struct xlat16_table { }; static struct xlat16_table kiconv_xlat16_open(const char *, const char *, int); +static int chklocale(int, const char *); static int my_iconv_init(void); static iconv_t (*my_iconv_open)(const char *, const char *); @@ -67,30 +70,18 @@ int kiconv_add_xlat16_cspair(const char *tocode, const char *fromcode, int flag) { int error; - size_t i, size, idxsize; - struct iconv_cspair_info *csi; + size_t idxsize; struct xlat16_table xt; void *data; char *p; - if (sysctlbyname("kern.iconv.cslist", NULL, &size, NULL, 0) == -1) - return (-1); - if (size > 0) { - csi = malloc(size); - if (csi == NULL) - return (-1); - if (sysctlbyname("kern.iconv.cslist", csi, &size, NULL, 0) == -1) { - free(csi); - return (-1); - } - for (i = 0; i < (size/sizeof(*csi)); i++, csi++){ - if (strcmp(csi->cs_to, tocode) == 0 && - strcmp(csi->cs_from, fromcode) == 0) - return (0); - } - } + if (kiconv_lookupcs(tocode, fromcode) == 0) + return (0); - xt = kiconv_xlat16_open(tocode, fromcode, flag); + if (flag & KICONV_WCTYPE) + xt = kiconv_xlat16_open(fromcode, fromcode, flag); + else + xt = kiconv_xlat16_open(tocode, fromcode, flag); if (xt.size == 0) return (-1); @@ -117,7 +108,7 @@ kiconv_add_xlat16_cspair(const char *toc int kiconv_add_xlat16_cspairs(const char *foreigncode, const char *localcode) { - int error; + int error, locale; error = kiconv_add_xlat16_cspair(foreigncode, localcode, KICONV_FROM_LOWER | KICONV_FROM_UPPER); @@ -127,7 +118,14 @@ kiconv_add_xlat16_cspairs(const char *fo KICONV_LOWER | KICONV_UPPER); if (error) return (error); - + locale = chklocale(LC_CTYPE, localcode); + if (locale == 0) { + error = kiconv_add_xlat16_cspair(KICONV_WCTYPE_NAME, localcode, + KICONV_WCTYPE); + if (error) + return (error); + } + return (0); } @@ -175,6 +173,31 @@ kiconv_xlat16_open(const char *tocode, c bzero(dst, outbytesleft); c = ((ls & 0x100 ? us | 0x80 : us) << 8) | (u_char)ls; + + if (lcase & KICONV_WCTYPE) { + if ((c & 0xff) == 0) + c >>= 8; + if (iswupper(c)) { + c = towlower(c); + if ((c & 0xff00) == 0) + c <<= 8; + table[us] = c | XLAT16_HAS_LOWER_CASE; + } else if (iswlower(c)) { + c = towupper(c); + if ((c & 0xff00) == 0) + c <<= 8; + table[us] = c | XLAT16_HAS_UPPER_CASE; + } else + table[us] = 0; + /* + * store not NULL + */ + if (table[us]) + xt.idx[ls] = table; + + continue; + } + c = quirk_vendor2unix(c, pre_q_list, pre_q_size); src[0] = (u_char)(c >> 8); src[1] = (u_char)c; @@ -258,6 +281,24 @@ kiconv_xlat16_open(const char *tocode, c } static int +chklocale(int category, const char *code) +{ + char *p; + int error = -1; + + p = strchr(setlocale(category, NULL), '.'); + if (p++) { + error = strcasecmp(code, p); + if (error) { + /* XXX - can't avoid calling quirk here... */ + error = strcasecmp(code, kiconv_quirkcs(p, + KICONV_VENDOR_MICSFT)); + } + } + return (error); +} + +static int my_iconv_init(void) { void *iconv_lib; @@ -380,17 +421,21 @@ my_iconv_char(iconv_t cd, const u_char * #else /* statically linked */ +#include +#include #include int -kiconv_add_xlat16_cspair(const char *tocode, const char *fromcode, int flag) +kiconv_add_xlat16_cspair(const char *tocode __unused, const char *fromcode __unused, + int flag __unused) { + errno = EINVAL; return (-1); } int -kiconv_add_xlat16_cspairs(const char *tocode, const char *fromcode) +kiconv_add_xlat16_cspairs(const char *tocode __unused, const char *fromcode __unused) { errno = EINVAL; return (-1); Modified: head/sys/libkern/iconv.c ============================================================================== --- head/sys/libkern/iconv.c Mon Jun 22 17:00:20 2009 (r194637) +++ head/sys/libkern/iconv.c Mon Jun 22 17:09:46 2009 (r194638) @@ -307,6 +307,18 @@ iconv_convchr_case(void *handle, const c return ICONV_CONVERTER_CONV(handle, inbuf, inbytesleft, outbuf, outbytesleft, 1, casetype); } +int +towlower(int c, void *handle) +{ + return ICONV_CONVERTER_TOLOWER(handle, c); +} + +int +towupper(int c, void *handle) +{ + return ICONV_CONVERTER_TOUPPER(handle, c); +} + /* * Give a list of loaded converters. Each name terminated with 0. * An empty string terminates the list. @@ -442,6 +454,12 @@ iconv_converter_donestub(struct iconv_co } int +iconv_converter_tolowerstub(int c, void *handle) +{ + return (c); +} + +int iconv_converter_handler(module_t mod, int type, void *data) { struct iconv_converter_class *dcp = data; Modified: head/sys/libkern/iconv_converter_if.m ============================================================================== --- head/sys/libkern/iconv_converter_if.m Mon Jun 22 17:00:20 2009 (r194637) +++ head/sys/libkern/iconv_converter_if.m Mon Jun 22 17:09:46 2009 (r194638) @@ -68,3 +68,13 @@ STATICMETHOD void done { STATICMETHOD const char * name { struct iconv_converter_class *dcp; }; + +METHOD int tolower { + void *handle; + int c; +} DEFAULT iconv_converter_tolowerstub; + +METHOD int toupper { + void *handle; + int c; +} DEFAULT iconv_converter_tolowerstub; Modified: head/sys/libkern/iconv_xlat16.c ============================================================================== --- head/sys/libkern/iconv_xlat16.c Mon Jun 22 17:00:20 2009 (r194637) +++ head/sys/libkern/iconv_xlat16.c Mon Jun 22 17:09:46 2009 (r194638) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2003, Ryuichiro Imura + * Copyright (c) 2003, 2005 Ryuichiro Imura * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,12 +43,17 @@ __FBSDID("$FreeBSD$"); MODULE_DEPEND(iconv_xlat16, libiconv, 2, 2, 2); #endif +#define C2I1(c) ((c) & 0x8000 ? ((c) & 0xff) | 0x100 : (c) & 0xff) +#define C2I2(c) ((c) & 0x8000 ? ((c) >> 8) & 0x7f : ((c) >> 8) & 0xff) + /* * XLAT16 converter instance */ struct iconv_xlat16 { KOBJ_FIELDS; uint32_t * d_table[0x200]; + void * f_ctp; + void * t_ctp; struct iconv_cspair * d_csp; }; @@ -72,6 +77,16 @@ iconv_xlat16_open(struct iconv_converter } idxp++; } + + if (strcmp(csp->cp_to, KICONV_WCTYPE_NAME) != 0) { + if (iconv_open(KICONV_WCTYPE_NAME, csp->cp_from, &dp->f_ctp) != 0) + dp->f_ctp = NULL; + if (iconv_open(KICONV_WCTYPE_NAME, csp->cp_to, &dp->t_ctp) != 0) + dp->t_ctp = NULL; + } else { + dp->f_ctp = dp->t_ctp = dp; + } + dp->d_csp = csp; csp->cp_refcount++; *dpp = (void*)dp; @@ -83,6 +98,10 @@ iconv_xlat16_close(void *data) { struct iconv_xlat16 *dp = data; + if (dp->f_ctp && dp->f_ctp != data) + iconv_close(dp->f_ctp); + if (dp->t_ctp && dp->t_ctp != data) + iconv_close(dp->t_ctp); dp->d_csp->cp_refcount--; kobj_delete((struct kobj*)data, M_ICONV); return (0); @@ -100,7 +119,7 @@ iconv_xlat16_conv(void *d2p, const char size_t in, on, ir, or, inlen; uint32_t code; u_char u, l; - uint16_t c1, c2; + uint16_t c1, c2, ctmp; if (inbuf == NULL || *inbuf == NULL || outbuf == NULL || *outbuf == NULL) return (0); @@ -112,21 +131,32 @@ iconv_xlat16_conv(void *d2p, const char while(ir > 0 && or > 0) { inlen = 0; - code = '\0'; + code = 0; c1 = ir > 1 ? *(src+1) & 0xff : 0; c2 = *src & 0xff; + ctmp = 0; c1 = c2 & 0x80 ? c1 | 0x100 : c1; c2 = c2 & 0x80 ? c2 & 0x7f : c2; - if (ir > 1 && dp->d_table[c1]) { + if (ir > 1 && dp->d_table[c1] && dp->d_table[c1][c2]) { /* * inbuf char is a double byte char */ - code = dp->d_table[c1][c2]; - if (code) - inlen = 2; + inlen = 2; + + /* toupper,tolower */ + if (casetype == KICONV_FROM_LOWER && dp->f_ctp) + ctmp = towlower(((u_char)*src << 8) | (u_char)*(src + 1), + dp->f_ctp); + else if (casetype == KICONV_FROM_UPPER && dp->f_ctp) + ctmp = towupper(((u_char)*src << 8) | (u_char)*(src + 1), + dp->f_ctp); + if (ctmp) { + c1 = C2I1(ctmp); + c2 = C2I2(ctmp); + } } if (inlen == 0) { @@ -139,13 +169,33 @@ iconv_xlat16_conv(void *d2p, const char * inbuf char is a single byte char */ inlen = 1; - code = dp->d_table[c1][c2]; - if (!code) { - ret = -1; - break; + + if (casetype & (KICONV_FROM_LOWER|KICONV_FROM_UPPER)) + code = dp->d_table[c1][c2]; + + if (casetype == KICONV_FROM_LOWER) { + if (dp->f_ctp) + ctmp = towlower((u_char)*src, dp->f_ctp); + else if (code & XLAT16_HAS_FROM_LOWER_CASE) + ctmp = (u_char)(code >> 16); + } else if (casetype == KICONV_FROM_UPPER) { + if (dp->f_ctp) + ctmp = towupper((u_char)*src, dp->f_ctp); + else if (code & XLAT16_HAS_FROM_UPPER_CASE) + ctmp = (u_char)(code >> 16); + } + if (ctmp) { + c1 = C2I1(ctmp << 8); + c2 = C2I2(ctmp << 8); } } + code = dp->d_table[c1][c2]; + if (!code) { + ret = -1; + break; + } + nullin = (code & XLAT16_ACCEPT_NULL_IN) ? 1 : 0; if (inlen == 1 && nullin) { /* @@ -158,14 +208,6 @@ iconv_xlat16_conv(void *d2p, const char /* * now start translation */ - if ((casetype == KICONV_FROM_LOWER && code & XLAT16_HAS_FROM_LOWER_CASE) || - (casetype == KICONV_FROM_UPPER && code & XLAT16_HAS_FROM_UPPER_CASE)) { - c2 = (u_char)(code >> 16); - c1 = c2 & 0x80 ? 0x100 : 0; - c2 = c2 & 0x80 ? c2 & 0x7f : c2; - code = dp->d_table[c1][c2]; - } - u = (u_char)(code >> 8); l = (u_char)code; @@ -186,15 +228,38 @@ iconv_xlat16_conv(void *d2p, const char ret = -1; break; } + + /* toupper,tolower */ + if (casetype == KICONV_LOWER && dp->t_ctp) { + code = towlower((uint16_t)code, dp->t_ctp); + u = (u_char)(code >> 8); + l = (u_char)code; + } + if (casetype == KICONV_UPPER && dp->t_ctp) { + code = towupper((uint16_t)code, dp->t_ctp); + u = (u_char)(code >> 8); + l = (u_char)code; + } + *dst++ = u; *dst++ = l; or -= 2; } else { - if ((casetype == KICONV_LOWER && code & XLAT16_HAS_LOWER_CASE) || - (casetype == KICONV_UPPER && code & XLAT16_HAS_UPPER_CASE)) - *dst++ = (u_char)(code >> 16); - else - *dst++ = l; + /* toupper,tolower */ + if (casetype == KICONV_LOWER) { + if (dp->t_ctp) + l = (u_char)towlower(l, dp->t_ctp); + else if (code & XLAT16_HAS_LOWER_CASE) + l = (u_char)(code >> 16); + } + if (casetype == KICONV_UPPER) { + if (dp->t_ctp) + l = (u_char)towupper(l, dp->t_ctp); + else if (code & XLAT16_HAS_UPPER_CASE) + l = (u_char)(code >> 16); + } + + *dst++ = l; or--; } @@ -232,6 +297,55 @@ iconv_xlat16_name(struct iconv_converter return ("xlat16"); } +static int +iconv_xlat16_tolower(void *d2p, register int c) +{ + struct iconv_xlat16 *dp = (struct iconv_xlat16*)d2p; + register int c1, c2, out; + + if (c < 0x100) { + c1 = C2I1(c << 8); + c2 = C2I2(c << 8); + } else if (c < 0x10000) { + c1 = C2I1(c); + c2 = C2I2(c); + } else + return (c); + + if (dp->d_table[c1] && dp->d_table[c1][c2] & XLAT16_HAS_LOWER_CASE) { + /*return (int)(dp->d_table[c1][c2] & 0xffff);*/ + out = dp->d_table[c1][c2] & 0xffff; + if ((out & 0xff) == 0) + out = (out >> 8) & 0xff; + return (out); + } else + return (c); +} + +static int +iconv_xlat16_toupper(void *d2p, register int c) +{ + struct iconv_xlat16 *dp = (struct iconv_xlat16*)d2p; + register int c1, c2, out; + + if (c < 0x100) { + c1 = C2I1(c << 8); + c2 = C2I2(c << 8); + } else if (c < 0x10000) { + c1 = C2I1(c); + c2 = C2I2(c); + } else + return (c); + + if (dp->d_table[c1] && dp->d_table[c1][c2] & XLAT16_HAS_UPPER_CASE) { + out = dp->d_table[c1][c2] & 0xffff; + if ((out & 0xff) == 0) + out = (out >> 8) & 0xff; + return (out); + } else + return (c); +} + static kobj_method_t iconv_xlat16_methods[] = { KOBJMETHOD(iconv_converter_open, iconv_xlat16_open), KOBJMETHOD(iconv_converter_close, iconv_xlat16_close), @@ -241,6 +355,8 @@ static kobj_method_t iconv_xlat16_method KOBJMETHOD(iconv_converter_done, iconv_xlat16_done), #endif KOBJMETHOD(iconv_converter_name, iconv_xlat16_name), + KOBJMETHOD(iconv_converter_tolower, iconv_xlat16_tolower), + KOBJMETHOD(iconv_converter_toupper, iconv_xlat16_toupper), {0, 0} }; Modified: head/sys/sys/iconv.h ============================================================================== --- head/sys/sys/iconv.h Mon Jun 22 17:00:20 2009 (r194637) +++ head/sys/sys/iconv.h Mon Jun 22 17:09:46 2009 (r194638) @@ -51,6 +51,9 @@ #define KICONV_UPPER 2 /* toupper converted character */ #define KICONV_FROM_LOWER 4 /* tolower source character, then convert */ #define KICONV_FROM_UPPER 8 /* toupper source character, then convert */ +#define KICONV_WCTYPE 16 /* towlower/towupper characters */ + +#define KICONV_WCTYPE_NAME "_wctype" /* * Entry for cslist sysctl @@ -95,6 +98,8 @@ int kiconv_add_xlat_table(const char * int kiconv_add_xlat16_cspair(const char *, const char *, int); int kiconv_add_xlat16_cspairs(const char *, const char *); int kiconv_add_xlat16_table(const char *, const char *, const void *, int); +int kiconv_lookupconv(const char *drvname); +int kiconv_lookupcs(const char *tocode, const char *fromcode); const char *kiconv_quirkcs(const char *, int); __END_DECLS @@ -128,7 +133,7 @@ struct iconv_cspair { TAILQ_ENTRY(iconv_cspair) cp_link; }; -#define KICONV_CONVERTER(name,size) \ +#define KICONV_CONVERTER(name,size) \ static struct iconv_converter_class iconv_ ## name ## _class = { \ "iconv_"#name, iconv_ ## name ## _methods, size, NULL \ }; \ @@ -138,7 +143,7 @@ struct iconv_cspair { }; \ DECLARE_MODULE(iconv_ ## name, iconv_ ## name ## _mod, SI_SUB_DRIVERS, SI_ORDER_ANY); -#define KICONV_CES(name,size) \ +#define KICONV_CES(name,size) \ static DEFINE_CLASS(iconv_ces_ ## name, iconv_ces_ ## name ## _methods, (size)); \ static moduledata_t iconv_ces_ ## name ## _mod = { \ "iconv_ces_"#name, iconv_cesmod_handler, \ @@ -167,6 +172,9 @@ char* iconv_convstr(void *handle, char * void* iconv_convmem(void *handle, void *dst, const void *src, int size); int iconv_vfs_refcount(const char *fsname); +int towlower(int c, void *handle); +int towupper(int c, void *handle); + /* * Bridge struct of iconv functions */ @@ -233,6 +241,7 @@ int iconv_lookupcp(char **cpp, const cha int iconv_converter_initstub(struct iconv_converter_class *dp); int iconv_converter_donestub(struct iconv_converter_class *dp); +int iconv_converter_tolowerstub(int c, void *handle); int iconv_converter_handler(module_t mod, int type, void *data); #ifdef ICONV_DEBUG From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 17:46:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1303A1065670; Mon, 22 Jun 2009 17:46:56 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0151A8FC13; Mon, 22 Jun 2009 17:46:56 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MHktuW047915; Mon, 22 Jun 2009 17:46:55 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MHktMF047913; Mon, 22 Jun 2009 17:46:55 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <200906221746.n5MHktMF047913@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 22 Jun 2009 17:46: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: r194639 - head/sys/dev/acpica/Osd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 17:46:56 -0000 Author: jkim Date: Mon Jun 22 17:46:55 2009 New Revision: 194639 URL: http://svn.freebsd.org/changeset/base/194639 Log: Add a missing return in NULL mutex case. Submitted by: Pawel Worach (pawel dot worach at gmail dot com) Modified: head/sys/dev/acpica/Osd/OsdSynch.c Modified: head/sys/dev/acpica/Osd/OsdSynch.c ============================================================================== --- head/sys/dev/acpica/Osd/OsdSynch.c Mon Jun 22 17:09:46 2009 (r194638) +++ head/sys/dev/acpica/Osd/OsdSynch.c Mon Jun 22 17:46:55 2009 (r194639) @@ -417,9 +417,11 @@ AcpiOsReleaseMutex(ACPI_MUTEX Handle) ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); - if (am == NULL) + if (am == NULL) { ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "cannot release null mutex\n")); + return_VOID; + } mtx_lock(&am->am_lock); From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 17:48:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86DED1065672; Mon, 22 Jun 2009 17:48:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73D888FC1F; Mon, 22 Jun 2009 17:48:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MHmGC0047991; Mon, 22 Jun 2009 17:48:16 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MHmGMB047984; Mon, 22 Jun 2009 17:48:16 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200906221748.n5MHmGMB047984@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 22 Jun 2009 17:48:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194640 - in head: . sys/net sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 17:48:17 -0000 Author: bz Date: Mon Jun 22 17:48:16 2009 New Revision: 194640 URL: http://svn.freebsd.org/changeset/base/194640 Log: Move virtualization of routing related variables into their own Vimage module, which had been there already but now is stateful. All variables are now file local; so this further limits the global spreading of routing related things throughout the kernel. Add a missing function local variable in case of MPATHing. Reviewed by: zec Modified: head/UPDATING head/sys/net/if.c head/sys/net/route.c head/sys/net/vnet.h head/sys/sys/param.h head/sys/sys/vimage.h Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Jun 22 17:46:55 2009 (r194639) +++ head/UPDATING Mon Jun 22 17:48:16 2009 (r194640) @@ -22,6 +22,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20090622: + Layout of struct vnet has changed as routing related variables + were moved to their own Vimage module. Modules need to be + recompiled. Bump __FreeBSD_version to 800099. + 20090619: NGROUPS_MAX and NGROUPS have been increased from 16 to 1023 and 1024 respectively. As long as no more than 16 groups per Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Jun 22 17:46:55 2009 (r194639) +++ head/sys/net/if.c Mon Jun 22 17:48:16 2009 (r194640) @@ -182,9 +182,6 @@ static struct filterops netdev_filtops = #ifndef VIMAGE_GLOBALS static struct vnet_symmap vnet_net_symmap[] = { VNET_SYMMAP(net, ifnet), - VNET_SYMMAP(net, rt_tables), - VNET_SYMMAP(net, rtstat), - VNET_SYMMAP(net, rttrash), VNET_SYMMAP_END }; Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Mon Jun 22 17:46:55 2009 (r194639) +++ head/sys/net/route.c Mon Jun 22 17:48:16 2009 (r194640) @@ -60,7 +60,6 @@ #ifdef RADIX_MPATH #include #endif -#include #include #include @@ -96,6 +95,35 @@ int rttrash; /* routes not in table bu struct rtstat rtstat; #endif +#ifndef VIMAGE_GLOBALS +struct vnet_rtable { + struct radix_node_head *_rt_tables; + uma_zone_t _rtzone; + int _rttrash; + struct rtstat _rtstat; +}; + +/* Size guard. See sys/vimage.h. */ +VIMAGE_CTASSERT(SIZEOF_vnet_rtable, sizeof(struct vnet_rtable)); + +#ifndef VIMAGE +static struct vnet_rtable vnet_rtable_0; +#endif +#endif + +/* + * Symbol translation macros + */ +#define INIT_VNET_RTABLE(vnet) \ + INIT_FROM_VNET(vnet, VNET_MOD_RTABLE, struct vnet_rtable, vnet_rtable) + +#define VNET_RTABLE(sym) VSYM(vnet_rtable, sym) + +#define V_rt_tables VNET_RTABLE(rt_tables) +#define V_rtstat VNET_RTABLE(rtstat) +#define V_rttrash VNET_RTABLE(rttrash) +#define V_rtzone VNET_RTABLE(rtzone) + static void rt_maskedcopy(struct sockaddr *, struct sockaddr *, struct sockaddr *); static int vnet_route_iattach(const void *); @@ -104,9 +132,18 @@ static int vnet_route_idetach(const void #endif #ifndef VIMAGE_GLOBALS +static struct vnet_symmap vnet_rtable_symmap[] = { + VNET_SYMMAP(rtable, rt_tables), + VNET_SYMMAP(rtable, rtstat), + VNET_SYMMAP(rtable, rttrash), + VNET_SYMMAP_END +}; + static const vnet_modinfo_t vnet_rtable_modinfo = { .vmi_id = VNET_MOD_RTABLE, .vmi_name = "rtable", + .vmi_size = sizeof(struct vnet_rtable), + .vmi_symmap = vnet_rtable_symmap, .vmi_iattach = vnet_route_iattach, #ifdef VIMAGE .vmi_idetach = vnet_route_idetach @@ -155,7 +192,7 @@ SYSCTL_PROC(_net, OID_AUTO, my_fibnum, C static __inline struct radix_node_head ** rt_tables_get_rnh_ptr(int table, int fam) { - INIT_VNET_NET(curvnet); + INIT_VNET_RTABLE(curvnet); struct radix_node_head **rnh; KASSERT(table >= 0 && table < rt_numfibs, ("%s: table out of bounds.", @@ -199,7 +236,7 @@ route_init(void) static int vnet_route_iattach(const void *unused __unused) { - INIT_VNET_NET(curvnet); + INIT_VNET_RTABLE(curvnet); struct domain *dom; struct radix_node_head **rnh; int table; @@ -345,7 +382,7 @@ struct rtentry * rtalloc1_fib(struct sockaddr *dst, int report, u_long ignflags, u_int fibnum) { - INIT_VNET_NET(curvnet); + INIT_VNET_RTABLE(curvnet); struct radix_node_head *rnh; struct rtentry *rt; struct radix_node *rn; @@ -415,7 +452,7 @@ done: void rtfree(struct rtentry *rt) { - INIT_VNET_NET(curvnet); + INIT_VNET_RTABLE(curvnet); struct radix_node_head *rnh; KASSERT(rt != NULL,("%s: NULL rt", __func__)); @@ -514,7 +551,7 @@ rtredirect_fib(struct sockaddr *dst, struct sockaddr *src, u_int fibnum) { - INIT_VNET_NET(curvnet); + INIT_VNET_RTABLE(curvnet); struct rtentry *rt, *rt0 = NULL; int error = 0; short *stat = NULL; @@ -827,7 +864,7 @@ rt_getifa_fib(struct rt_addrinfo *info, int rtexpunge(struct rtentry *rt) { - INIT_VNET_NET(curvnet); + INIT_VNET_RTABLE(curvnet); struct radix_node *rn; struct radix_node_head *rnh; struct ifaddr *ifa; @@ -955,6 +992,8 @@ rn_mpath_update(int req, struct rt_addri RT_LOCK(rt); RT_ADDREF(rt); if (req == RTM_DELETE) { + INIT_VNET_RTABLE(curvnet); + rt->rt_flags &= ~RTF_UP; /* * One more rtentry floating around that is not @@ -989,7 +1028,7 @@ int rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt, u_int fibnum) { - INIT_VNET_NET(curvnet); + INIT_VNET_RTABLE(curvnet); int error = 0, needlock = 0; register struct rtentry *rt; register struct radix_node *rn; Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Mon Jun 22 17:46:55 2009 (r194639) +++ head/sys/net/vnet.h Mon Jun 22 17:48:16 2009 (r194640) @@ -44,11 +44,6 @@ struct vnet_net { int _if_indexlim; struct knlist _ifklist; - struct rtstat _rtstat; - struct radix_node_head *_rt_tables; - int _rttrash; - uma_zone_t _rtzone; - struct ifnet * _loif; struct if_clone * _lo_cloner; struct ifc_simple_data *_lo_cloner_data; Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Jun 22 17:46:55 2009 (r194639) +++ head/sys/sys/param.h Mon Jun 22 17:48:16 2009 (r194640) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 800098 /* Master, propagated to newvers */ +#define __FreeBSD_version 800099 /* Master, propagated to newvers */ #ifndef LOCORE #include Modified: head/sys/sys/vimage.h ============================================================================== --- head/sys/sys/vimage.h Mon Jun 22 17:46:55 2009 (r194639) +++ head/sys/sys/vimage.h Mon Jun 22 17:48:16 2009 (r194640) @@ -122,6 +122,7 @@ struct vnet_modlink { #define VNET_MOD_ACCF_HTTP 11 #define VNET_MOD_IGMP 12 #define VNET_MOD_MLD 13 +#define VNET_MOD_RTABLE 14 /* Stateless modules. */ #define VNET_MOD_IF_CLONE 19 @@ -134,7 +135,7 @@ struct vnet_modlink { #define VNET_MOD_IPCOMP 26 #define VNET_MOD_GIF 27 #define VNET_MOD_ARP 28 -#define VNET_MOD_RTABLE 29 + /* 29 */ #define VNET_MOD_LOIF 30 #define VNET_MOD_DOMAIN 31 #define VNET_MOD_DYNAMIC_START 32 @@ -154,6 +155,7 @@ struct vnet_modlink { #define V_MOD_vnet_pf VNET_MOD_PF #define V_MOD_vnet_gif VNET_MOD_GIF #define V_MOD_vnet_ipsec VNET_MOD_IPSEC +#define V_MOD_vnet_rtable VNET_MOD_RTABLE #define V_MOD_vprocg 0 /* no minor module ids like in vnet */ From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 17:56:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B221F1065670; Mon, 22 Jun 2009 17:56:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 862708FC15; Mon, 22 Jun 2009 17:56:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MHu79H048229; Mon, 22 Jun 2009 17:56:07 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MHu7fE048226; Mon, 22 Jun 2009 17:56:07 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200906221756.n5MHu7fE048226@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Mon, 22 Jun 2009 17:56: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: r194641 - in head/sys: net sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 17:56:08 -0000 Author: bz Date: Mon Jun 22 17:56:07 2009 New Revision: 194641 URL: http://svn.freebsd.org/changeset/base/194641 Log: Updates after r194640: - shrink size guards for vnet_net. vnet_rtable does not need size guards as it is self-contained. - remove a bunch of defines from vnet.h no longer valid. Modified: head/sys/net/vnet.h head/sys/sys/vimage.h Modified: head/sys/net/vnet.h ============================================================================== --- head/sys/net/vnet.h Mon Jun 22 17:48:16 2009 (r194640) +++ head/sys/net/vnet.h Mon Jun 22 17:56:07 2009 (r194641) @@ -86,9 +86,5 @@ extern struct vnet_net vnet_net_0; #define V_lo_cloner_data VNET_NET(lo_cloner_data) #define V_loif VNET_NET(loif) #define V_rawcb_list VNET_NET(rawcb_list) -#define V_rt_tables VNET_NET(rt_tables) -#define V_rtstat VNET_NET(rtstat) -#define V_rttrash VNET_NET(rttrash) -#define V_rtzone VNET_NET(rtzone) #endif /* !_NET_VNET_H_ */ Modified: head/sys/sys/vimage.h ============================================================================== --- head/sys/sys/vimage.h Mon Jun 22 17:48:16 2009 (r194640) +++ head/sys/sys/vimage.h Mon Jun 22 17:56:07 2009 (r194641) @@ -369,43 +369,43 @@ extern struct vprocg_list_head vprocg_he * See description further down to see how to get the new values. */ #ifdef __amd64__ -#define SIZEOF_vnet_net 192 +#define SIZEOF_vnet_net 156 #define SIZEOF_vnet_inet 4424 #define SIZEOF_vnet_inet6 8808 #define SIZEOF_vnet_ipsec 31160 #endif #ifdef __arm__ -#define SIZEOF_vnet_net 104 +#define SIZEOF_vnet_net 72 #define SIZEOF_vnet_inet 2616 #define SIZEOF_vnet_inet6 8524 #define SIZEOF_vnet_ipsec 1 #endif #ifdef __i386__ /* incl. pc98 */ -#define SIZEOF_vnet_net 104 +#define SIZEOF_vnet_net 72 #define SIZEOF_vnet_inet 2612 #define SIZEOF_vnet_inet6 8512 #define SIZEOF_vnet_ipsec 31024 #endif #ifdef __ia64__ -#define SIZEOF_vnet_net 192 +#define SIZEOF_vnet_net 156 #define SIZEOF_vnet_inet 4424 #define SIZEOF_vnet_inet6 8808 #define SIZEOF_vnet_ipsec 31160 #endif #ifdef __mips__ -#define SIZEOF_vnet_net 104 +#define SIZEOF_vnet_net 72 #define SIZEOF_vnet_inet 2648 #define SIZEOF_vnet_inet6 8544 #define SIZEOF_vnet_ipsec 1 #endif #ifdef __powerpc__ -#define SIZEOF_vnet_net 104 +#define SIZEOF_vnet_net 72 #define SIZEOF_vnet_inet 2640 #define SIZEOF_vnet_inet6 8520 #define SIZEOF_vnet_ipsec 31048 #endif #ifdef __sparc64__ /* incl. sun4v */ -#define SIZEOF_vnet_net 192 +#define SIZEOF_vnet_net 156 #define SIZEOF_vnet_inet 4424 #define SIZEOF_vnet_inet6 8808 #define SIZEOF_vnet_ipsec 31160 From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 19:09:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4BC41065670; Mon, 22 Jun 2009 19:09:48 +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 D35568FC16; Mon, 22 Jun 2009 19:09:48 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MJ9mqQ049719; Mon, 22 Jun 2009 19:09:48 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MJ9mDZ049717; Mon, 22 Jun 2009 19:09:48 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200906221909.n5MJ9mDZ049717@svn.freebsd.org> From: Alan Cox Date: Mon, 22 Jun 2009 19:09: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: r194642 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 19:09:49 -0000 Author: alc Date: Mon Jun 22 19:09:48 2009 New Revision: 194642 URL: http://svn.freebsd.org/changeset/base/194642 Log: Validate the page in one place, dev_pager_getpages(), rather than doing it in two places, dev_pager_getfake() and dev_pager_updatefake(). Compare a pointer to "NULL" rather than "0". Modified: head/sys/vm/device_pager.c Modified: head/sys/vm/device_pager.c ============================================================================== --- head/sys/vm/device_pager.c Mon Jun 22 17:56:07 2009 (r194641) +++ head/sys/vm/device_pager.c Mon Jun 22 19:09:48 2009 (r194642) @@ -194,7 +194,7 @@ dev_pager_dealloc(object) /* * Free up our fake pages. */ - while ((m = TAILQ_FIRST(&object->un_pager.devp.devp_pglist)) != 0) { + while ((m = TAILQ_FIRST(&object->un_pager.devp.devp_pglist)) != NULL) { TAILQ_REMOVE(&object->un_pager.devp.devp_pglist, m, pageq); dev_pager_putfake(m); } @@ -219,7 +219,8 @@ dev_pager_getpages(object, m, count, req VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); dev = object->handle; - offset = m[reqpage]->pindex; + page = m[reqpage]; + offset = page->pindex; VM_OBJECT_UNLOCK(object); csw = dev_refthread(dev); if (csw == NULL) @@ -234,13 +235,13 @@ dev_pager_getpages(object, m, count, req td->td_fpop = fpop; dev_relthread(dev); - if ((m[reqpage]->flags & PG_FICTITIOUS) != 0) { + if ((page->flags & PG_FICTITIOUS) != 0) { /* * If the passed in reqpage page is a fake page, update it with * the new physical address. */ VM_OBJECT_LOCK(object); - dev_pager_updatefake(m[reqpage], paddr); + dev_pager_updatefake(page, paddr); if (count > 1) { vm_page_lock_queues(); for (i = 0; i < count; i++) { @@ -264,7 +265,7 @@ dev_pager_getpages(object, m, count, req vm_page_insert(page, object, offset); m[reqpage] = page; } - + page->valid = VM_PAGE_BITS_ALL; return (VM_PAGER_OK); } @@ -308,7 +309,6 @@ dev_pager_getfake(paddr) m->flags = PG_FICTITIOUS; m->oflags = VPO_BUSY; /* Fictitious pages don't use "act_count". */ - m->valid = VM_PAGE_BITS_ALL; m->dirty = 0; m->busy = 0; m->queue = PQ_NONE; @@ -338,5 +338,4 @@ dev_pager_updatefake(m, paddr) if (!(m->flags & PG_FICTITIOUS)) panic("dev_pager_updatefake: bad page"); m->phys_addr = paddr; - m->valid = VM_PAGE_BITS_ALL; } From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 19:35:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FEB51065670; Mon, 22 Jun 2009 19:35:39 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4E7AE8FC08; Mon, 22 Jun 2009 19:35:39 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MJZdon050268; Mon, 22 Jun 2009 19:35:39 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MJZdLJ050266; Mon, 22 Jun 2009 19:35:39 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <200906221935.n5MJZdLJ050266@svn.freebsd.org> From: Andre Oppermann Date: Mon, 22 Jun 2009 19:35: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: r194643 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 19:35:39 -0000 Author: andre Date: Mon Jun 22 19:35:39 2009 New Revision: 194643 URL: http://svn.freebsd.org/changeset/base/194643 Log: Update m_demote: - remove HT_HEADER test (MT_HEADER == MT_DATA for some time now) - be more pedantic about m_nextpkt in other than first mbuf - update m_flags to be retained Modified: head/sys/kern/uipc_mbuf.c Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Mon Jun 22 19:09:48 2009 (r194642) +++ head/sys/kern/uipc_mbuf.c Mon Jun 22 19:35:39 2009 (r194643) @@ -320,11 +320,13 @@ m_demote(struct mbuf *m0, int all) m->m_flags &= ~M_PKTHDR; bzero(&m->m_pkthdr, sizeof(struct pkthdr)); } - if (m->m_type == MT_HEADER) - m->m_type = MT_DATA; - if (m != m0 && m->m_nextpkt != NULL) + if (m != m0 && m->m_nextpkt != NULL) { + KASSERT(m->m_nextpkt == NULL, + ("%s: m_nextpkt not NULL", __func__)); + m_freem(m->m_nextpkt); m->m_nextpkt = NULL; - m->m_flags = m->m_flags & (M_EXT|M_EOR|M_RDONLY|M_FREELIST); + } + m->m_flags = m->m_flags & (M_EXT|M_RDONLY|M_FREELIST|M_NOFREE); } } From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 20:08:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39053106564A; Mon, 22 Jun 2009 20:08:07 +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 276AE8FC1B; Mon, 22 Jun 2009 20:08:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MK87Xh050930; Mon, 22 Jun 2009 20:08:07 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MK87qh050928; Mon, 22 Jun 2009 20:08:07 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906222008.n5MK87qh050928@svn.freebsd.org> From: John Baldwin Date: Mon, 22 Jun 2009 20:08: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: r194644 - head/sys/dev/pci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:08:07 -0000 Author: jhb Date: Mon Jun 22 20:08:06 2009 New Revision: 194644 URL: http://svn.freebsd.org/changeset/base/194644 Log: Enable MSI in the MSI capability registers any time that the first message in an MSI group is enabled, not just if the address/data pair are not initialized. Reported by: rnoland MFC after: 1 week Modified: head/sys/dev/pci/pci.c Modified: head/sys/dev/pci/pci.c ============================================================================== --- head/sys/dev/pci/pci.c Mon Jun 22 19:35:39 2009 (r194643) +++ head/sys/dev/pci/pci.c Mon Jun 22 20:08:06 2009 (r194644) @@ -2883,8 +2883,10 @@ pci_setup_intr(device_t dev, device_t ch goto bad; dinfo->cfg.msi.msi_addr = addr; dinfo->cfg.msi.msi_data = data; - pci_enable_msi(child, addr, data); } + if (dinfo->cfg.msi.msi_handlers == 0) + pci_enable_msi(child, dinfo->cfg.msi.msi_addr, + dinfo->cfg.msi.msi_data); dinfo->cfg.msi.msi_handlers++; } else { KASSERT(dinfo->cfg.msix.msix_alloc > 0, From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 20:12:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85867106568E; Mon, 22 Jun 2009 20:12:40 +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 738AF8FC14; Mon, 22 Jun 2009 20:12:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MKCe89051054; Mon, 22 Jun 2009 20:12:40 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MKCeFk051051; Mon, 22 Jun 2009 20:12:40 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906222012.n5MKCeFk051051@svn.freebsd.org> From: John Baldwin Date: Mon, 22 Jun 2009 20:12: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: r194645 - in head/sys: compat/freebsd32 kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:12:41 -0000 Author: jhb Date: Mon Jun 22 20:12:40 2009 New Revision: 194645 URL: http://svn.freebsd.org/changeset/base/194645 Log: Fix a typo in a comment. Modified: head/sys/compat/freebsd32/syscalls.master head/sys/kern/syscalls.master Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Mon Jun 22 20:08:06 2009 (r194644) +++ head/sys/compat/freebsd32/syscalls.master Mon Jun 22 20:12:40 2009 (r194645) @@ -27,7 +27,7 @@ ; STD always included ; COMPAT included on COMPAT #ifdef ; COMPAT4 included on COMPAT4 #ifdef (FreeBSD 4 compat) -; COMPAT6 included on COMPAT4 #ifdef (FreeBSD 6 compat) +; COMPAT6 included on COMPAT6 #ifdef (FreeBSD 6 compat) ; LIBCOMPAT included on COMPAT #ifdef, and placed in syscall.h ; OBSOL obsolete, not included in system, only specifies name ; UNIMPL not implemented, placeholder only Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Mon Jun 22 20:08:06 2009 (r194644) +++ head/sys/kern/syscalls.master Mon Jun 22 20:12:40 2009 (r194645) @@ -26,7 +26,7 @@ ; STD always included ; COMPAT included on COMPAT #ifdef ; COMPAT4 included on COMPAT4 #ifdef (FreeBSD 4 compat) -; COMPAT6 included on COMPAT4 #ifdef (FreeBSD 6 compat) +; COMPAT6 included on COMPAT6 #ifdef (FreeBSD 6 compat) ; LIBCOMPAT included on COMPAT #ifdef, and placed in syscall.h ; OBSOL obsolete, not included in system, only specifies name ; UNIMPL not implemented, placeholder only From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 20:14:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53AD21065670; Mon, 22 Jun 2009 20:14:00 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195]) by mx1.freebsd.org (Postfix) with ESMTP id EF5938FC08; Mon, 22 Jun 2009 20:13:59 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from [192.168.1.4] (adsl-19-252-27.bna.bellsouth.net [68.19.252.27]) (authenticated bits=0) by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id n5MKDvIR071659 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 22 Jun 2009 16:13:57 -0400 (EDT) (envelope-from rnoland@FreeBSD.org) From: Robert Noland To: John Baldwin In-Reply-To: <200906222008.n5MK87qh050928@svn.freebsd.org> References: <200906222008.n5MK87qh050928@svn.freebsd.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-b6nYufckr34JTA/TVGss" Organization: FreeBSD Date: Mon, 22 Jun 2009 15:13:51 -0500 Message-Id: <1245701631.1761.22.camel@balrog.2hip.net> Mime-Version: 1.0 X-Mailer: Evolution 2.26.2 FreeBSD GNOME Team Port X-Spam-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,RDNS_DYNAMIC, SPF_SOFTFAIL autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194644 - head/sys/dev/pci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:14:00 -0000 --=-b6nYufckr34JTA/TVGss Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, 2009-06-22 at 20:08 +0000, John Baldwin wrote: > Author: jhb > Date: Mon Jun 22 20:08:06 2009 > New Revision: 194644 > URL: http://svn.freebsd.org/changeset/base/194644 >=20 > Log: > Enable MSI in the MSI capability registers any time that the first mess= age > in an MSI group is enabled, not just if the address/data pair are not > initialized. This should fix the issues with broken interrupts with drm on Intel graphics chips using msi. That is the slow windows after VT Switch issue. It however is still currently broken on HEAD due to another issue, which will hopefully be resolved soon. robert. =20 > Reported by: rnoland > MFC after: 1 week >=20 > Modified: > head/sys/dev/pci/pci.c >=20 > Modified: head/sys/dev/pci/pci.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/pci/pci.c Mon Jun 22 19:35:39 2009 (r194643) > +++ head/sys/dev/pci/pci.c Mon Jun 22 20:08:06 2009 (r194644) > @@ -2883,8 +2883,10 @@ pci_setup_intr(device_t dev, device_t ch > goto bad; > dinfo->cfg.msi.msi_addr =3D addr; > dinfo->cfg.msi.msi_data =3D data; > - pci_enable_msi(child, addr, data); > } > + if (dinfo->cfg.msi.msi_handlers =3D=3D 0) > + pci_enable_msi(child, dinfo->cfg.msi.msi_addr, > + dinfo->cfg.msi.msi_data); > dinfo->cfg.msi.msi_handlers++; > } else { > KASSERT(dinfo->cfg.msix.msix_alloc > 0, --=20 Robert Noland FreeBSD --=-b6nYufckr34JTA/TVGss Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEABECAAYFAko/5f8ACgkQM4TrQ4qfROMU8ACeOZviG8vpOiACUm0FQ3+79aUI hY8AmgNs3BqY1XVF+77KJ4J75PkRtTz1 =tFqk -----END PGP SIGNATURE----- --=-b6nYufckr34JTA/TVGss-- From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 20:14:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59A3A106564A; Mon, 22 Jun 2009 20:14:10 +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 4868B8FC13; Mon, 22 Jun 2009 20:14:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MKEA5l051114; Mon, 22 Jun 2009 20:14:10 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MKEARV051112; Mon, 22 Jun 2009 20:14:10 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906222014.n5MKEARV051112@svn.freebsd.org> From: John Baldwin Date: Mon, 22 Jun 2009 20:14: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: r194646 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:14:10 -0000 Author: jhb Date: Mon Jun 22 20:14:10 2009 New Revision: 194646 URL: http://svn.freebsd.org/changeset/base/194646 Log: Include definitions for the audit identifiers for compat system calls in sysproto.h. This makes it possible to use SYSCALL_MODULE() for compat system calls that live in kernel modules. Modified: head/sys/kern/makesyscalls.sh Modified: head/sys/kern/makesyscalls.sh ============================================================================== --- head/sys/kern/makesyscalls.sh Mon Jun 22 20:12:40 2009 (r194645) +++ head/sys/kern/makesyscalls.sh Mon Jun 22 20:14:10 2009 (r194646) @@ -448,6 +448,8 @@ s/\$//g if (!flag("NOPROTO") && !flag("NODEF")) { printf("%s\t%s%s(struct thread *, struct %s *);\n", rettype, prefix, funcname, argalias) > outdcl + printf("#define\t%sAUE_%s%s\t%s\n", syscallprefix, + prefix, funcname, auditev) > sysaue } if (flag("NOSTD")) { printf("\t{ %s, (sy_call_t *)%s, %s, NULL, 0, 0, 0 },", From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 20:19:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23AE8106568B; Mon, 22 Jun 2009 20:19:49 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195]) by mx1.freebsd.org (Postfix) with ESMTP id BF6258FC1A; Mon, 22 Jun 2009 20:19:48 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from [192.168.1.4] (adsl-19-252-27.bna.bellsouth.net [68.19.252.27]) (authenticated bits=0) by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id n5MKJk1u071699 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 22 Jun 2009 16:19:47 -0400 (EDT) (envelope-from rnoland@FreeBSD.org) From: Robert Noland To: John Baldwin In-Reply-To: <1245701631.1761.22.camel@balrog.2hip.net> References: <200906222008.n5MK87qh050928@svn.freebsd.org> <1245701631.1761.22.camel@balrog.2hip.net> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-fbMZGfMTmUqzWQSDLiaR" Organization: FreeBSD Date: Mon, 22 Jun 2009 15:19:41 -0500 Message-Id: <1245701981.1761.25.camel@balrog.2hip.net> Mime-Version: 1.0 X-Mailer: Evolution 2.26.2 FreeBSD GNOME Team Port X-Spam-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,RDNS_DYNAMIC, SPF_SOFTFAIL autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194644 - head/sys/dev/pci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:19:49 -0000 --=-fbMZGfMTmUqzWQSDLiaR Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, 2009-06-22 at 15:13 -0500, Robert Noland wrote: > On Mon, 2009-06-22 at 20:08 +0000, John Baldwin wrote: > > Author: jhb > > Date: Mon Jun 22 20:08:06 2009 > > New Revision: 194644 > > URL: http://svn.freebsd.org/changeset/base/194644 > >=20 > > Log: > > Enable MSI in the MSI capability registers any time that the first me= ssage > > in an MSI group is enabled, not just if the address/data pair are not > > initialized. >=20 > This should fix the issues with broken interrupts with drm on Intel > graphics chips using msi. That is the slow windows after VT Switch > issue. It however is still currently broken on HEAD due to another > issue, which will hopefully be resolved soon. It may actually work now on non-SMP, though I haven't tested that case. robert. > =20 > > Reported by: rnoland > > MFC after: 1 week > >=20 > > Modified: > > head/sys/dev/pci/pci.c > >=20 > > Modified: head/sys/dev/pci/pci.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/pci/pci.c Mon Jun 22 19:35:39 2009 (r194643) > > +++ head/sys/dev/pci/pci.c Mon Jun 22 20:08:06 2009 (r194644) > > @@ -2883,8 +2883,10 @@ pci_setup_intr(device_t dev, device_t ch > > goto bad; > > dinfo->cfg.msi.msi_addr =3D addr; > > dinfo->cfg.msi.msi_data =3D data; > > - pci_enable_msi(child, addr, data); > > } > > + if (dinfo->cfg.msi.msi_handlers =3D=3D 0) > > + pci_enable_msi(child, dinfo->cfg.msi.msi_addr, > > + dinfo->cfg.msi.msi_data); > > dinfo->cfg.msi.msi_handlers++; > > } else { > > KASSERT(dinfo->cfg.msix.msix_alloc > 0, --=20 Robert Noland FreeBSD --=-fbMZGfMTmUqzWQSDLiaR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEABECAAYFAko/510ACgkQM4TrQ4qfROOR2gCfR+TJJ3yQr82lIN2au+tOHSv7 XL4AnjGk3Q2PleTrMK91e1hpLc3rovNY =H3oi -----END PGP SIGNATURE----- --=-fbMZGfMTmUqzWQSDLiaR-- From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 20:24:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD428106566C; Mon, 22 Jun 2009 20:24:03 +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 A9EE78FC12; Mon, 22 Jun 2009 20:24:03 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MKO3qG051443; Mon, 22 Jun 2009 20:24:03 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MKO3T4051433; Mon, 22 Jun 2009 20:24:03 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906222024.n5MKO3T4051433@svn.freebsd.org> From: John Baldwin Date: Mon, 22 Jun 2009 20:24: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: r194647 - in head/sys: compat/freebsd32 kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:24:04 -0000 Author: jhb Date: Mon Jun 22 20:24:03 2009 New Revision: 194647 URL: http://svn.freebsd.org/changeset/base/194647 Log: Regen. Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Mon Jun 22 20:14:10 2009 (r194646) +++ head/sys/compat/freebsd32/freebsd32_proto.h Mon Jun 22 20:24:03 2009 (r194647) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194390 2009-06-17 19:50:38Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194645 2009-06-22 20:12:40Z jhb */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -683,15 +683,24 @@ int freebsd6_freebsd32_ftruncate(struct #endif /* COMPAT_FREEBSD6 */ #define FREEBSD32_SYS_AUE_freebsd32_wait4 AUE_WAIT4 +#define FREEBSD32_SYS_AUE_freebsd4_freebsd32_getfsstat AUE_GETFSSTAT #define FREEBSD32_SYS_AUE_freebsd32_recvmsg AUE_RECVMSG #define FREEBSD32_SYS_AUE_freebsd32_sendmsg AUE_SENDMSG #define FREEBSD32_SYS_AUE_freebsd32_recvfrom AUE_RECVFROM +#define FREEBSD32_SYS_AUE_ofreebsd32_sigaction AUE_SIGACTION +#define FREEBSD32_SYS_AUE_ofreebsd32_sigprocmask AUE_SIGPROCMASK +#define FREEBSD32_SYS_AUE_ofreebsd32_sigpending AUE_SIGPENDING #define FREEBSD32_SYS_AUE_freebsd32_sigaltstack AUE_SIGALTSTACK #define FREEBSD32_SYS_AUE_freebsd32_ioctl AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_execve AUE_EXECVE #define FREEBSD32_SYS_AUE_freebsd32_setitimer AUE_SETITIMER #define FREEBSD32_SYS_AUE_freebsd32_getitimer AUE_GETITIMER #define FREEBSD32_SYS_AUE_freebsd32_select AUE_SELECT +#define FREEBSD32_SYS_AUE_ofreebsd32_sigvec AUE_O_SIGVEC +#define FREEBSD32_SYS_AUE_ofreebsd32_sigblock AUE_O_SIGBLOCK +#define FREEBSD32_SYS_AUE_ofreebsd32_sigsetmask AUE_O_SIGSETMASK +#define FREEBSD32_SYS_AUE_ofreebsd32_sigsuspend AUE_SIGSUSPEND +#define FREEBSD32_SYS_AUE_ofreebsd32_sigstack AUE_O_SIGSTACK #define FREEBSD32_SYS_AUE_freebsd32_gettimeofday AUE_GETTIMEOFDAY #define FREEBSD32_SYS_AUE_freebsd32_getrusage AUE_GETRUSAGE #define FREEBSD32_SYS_AUE_freebsd32_readv AUE_READV @@ -699,14 +708,22 @@ int freebsd6_freebsd32_ftruncate(struct #define FREEBSD32_SYS_AUE_freebsd32_settimeofday AUE_SETTIMEOFDAY #define FREEBSD32_SYS_AUE_freebsd32_utimes AUE_UTIMES #define FREEBSD32_SYS_AUE_freebsd32_adjtime AUE_ADJTIME +#define FREEBSD32_SYS_AUE_freebsd4_freebsd32_statfs AUE_STATFS +#define FREEBSD32_SYS_AUE_freebsd4_freebsd32_fstatfs AUE_FSTATFS #define FREEBSD32_SYS_AUE_freebsd32_sysarch AUE_SYSARCH #define FREEBSD32_SYS_AUE_freebsd32_semsys AUE_SEMSYS #define FREEBSD32_SYS_AUE_freebsd32_msgsys AUE_MSGSYS #define FREEBSD32_SYS_AUE_freebsd32_shmsys AUE_SHMSYS +#define FREEBSD32_SYS_AUE_freebsd6_freebsd32_pread AUE_PREAD +#define FREEBSD32_SYS_AUE_freebsd6_freebsd32_pwrite AUE_PWRITE #define FREEBSD32_SYS_AUE_freebsd32_stat AUE_STAT #define FREEBSD32_SYS_AUE_freebsd32_fstat AUE_FSTAT #define FREEBSD32_SYS_AUE_freebsd32_lstat AUE_LSTAT #define FREEBSD32_SYS_AUE_freebsd32_getdirentries AUE_GETDIRENTRIES +#define FREEBSD32_SYS_AUE_freebsd6_freebsd32_mmap AUE_MMAP +#define FREEBSD32_SYS_AUE_freebsd6_freebsd32_lseek AUE_LSEEK +#define FREEBSD32_SYS_AUE_freebsd6_freebsd32_truncate AUE_TRUNCATE +#define FREEBSD32_SYS_AUE_freebsd6_freebsd32_ftruncate AUE_FTRUNCATE #define FREEBSD32_SYS_AUE_freebsd32_sysctl AUE_SYSCTL #define FREEBSD32_SYS_AUE_freebsd32_futimes AUE_FUTIMES #define FREEBSD32_SYS_AUE_freebsd32_semctl AUE_SEMCTL @@ -724,6 +741,7 @@ int freebsd6_freebsd32_ftruncate(struct #define FREEBSD32_SYS_AUE_freebsd32_lutimes AUE_LUTIMES #define FREEBSD32_SYS_AUE_freebsd32_preadv AUE_PREADV #define FREEBSD32_SYS_AUE_freebsd32_pwritev AUE_PWRITEV +#define FREEBSD32_SYS_AUE_freebsd4_freebsd32_fhstatfs AUE_FHSTATFS #define FREEBSD32_SYS_AUE_freebsd32_modstat AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_aio_return AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_aio_suspend AUE_NULL @@ -732,7 +750,10 @@ int freebsd6_freebsd32_ftruncate(struct #define FREEBSD32_SYS_AUE_freebsd32_oaio_read AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_oaio_write AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_olio_listio AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd4_freebsd32_sendfile AUE_SENDFILE #define FREEBSD32_SYS_AUE_freebsd32_jail AUE_JAIL +#define FREEBSD32_SYS_AUE_freebsd4_freebsd32_sigaction AUE_SIGACTION +#define FREEBSD32_SYS_AUE_freebsd4_freebsd32_sigreturn AUE_SIGRETURN #define FREEBSD32_SYS_AUE_freebsd32_sigtimedwait AUE_SIGWAIT #define FREEBSD32_SYS_AUE_freebsd32_sigwaitinfo AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_aio_waitcomplete AUE_NULL Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Mon Jun 22 20:14:10 2009 (r194646) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Mon Jun 22 20:24:03 2009 (r194647) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194390 2009-06-17 19:50:38Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194645 2009-06-22 20:12:40Z jhb */ #define FREEBSD32_SYS_syscall 0 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Mon Jun 22 20:14:10 2009 (r194646) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Mon Jun 22 20:24:03 2009 (r194647) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194390 2009-06-17 19:50:38Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194645 2009-06-22 20:12:40Z jhb */ const char *freebsd32_syscallnames[] = { Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Mon Jun 22 20:14:10 2009 (r194646) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Mon Jun 22 20:24:03 2009 (r194647) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194390 2009-06-17 19:50:38Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194645 2009-06-22 20:12:40Z jhb */ #include "opt_compat.h" Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Mon Jun 22 20:14:10 2009 (r194646) +++ head/sys/kern/init_sysent.c Mon Jun 22 20:24:03 2009 (r194647) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 194390 2009-06-17 19:50:38Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 194645 2009-06-22 20:12:40Z jhb */ #include "opt_compat.h" Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Mon Jun 22 20:14:10 2009 (r194646) +++ head/sys/kern/syscalls.c Mon Jun 22 20:24:03 2009 (r194647) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 194390 2009-06-17 19:50:38Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 194645 2009-06-22 20:12:40Z jhb */ const char *syscallnames[] = { Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Mon Jun 22 20:14:10 2009 (r194646) +++ head/sys/sys/syscall.h Mon Jun 22 20:24:03 2009 (r194647) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 194390 2009-06-17 19:50:38Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 194645 2009-06-22 20:12:40Z jhb */ #define SYS_syscall 0 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Mon Jun 22 20:14:10 2009 (r194646) +++ head/sys/sys/syscall.mk Mon Jun 22 20:24:03 2009 (r194647) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 194390 2009-06-17 19:50:38Z jhb +# created from FreeBSD: head/sys/kern/syscalls.master 194645 2009-06-22 20:12:40Z jhb MIASM = \ syscall.o \ exit.o \ Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Mon Jun 22 20:14:10 2009 (r194646) +++ head/sys/sys/sysproto.h Mon Jun 22 20:24:03 2009 (r194647) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 194390 2009-06-17 19:50:38Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 194645 2009-06-22 20:12:40Z jhb */ #ifndef _SYS_SYSPROTO_H_ @@ -2241,6 +2241,7 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_open AUE_OPEN_RWTC #define SYS_AUE_close AUE_CLOSE #define SYS_AUE_wait4 AUE_WAIT4 +#define SYS_AUE_ocreat AUE_CREAT #define SYS_AUE_link AUE_LINK #define SYS_AUE_unlink AUE_UNLINK #define SYS_AUE_chdir AUE_CHDIR @@ -2249,6 +2250,8 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_chmod AUE_CHMOD #define SYS_AUE_chown AUE_CHOWN #define SYS_AUE_break AUE_NULL +#define SYS_AUE_freebsd4_getfsstat AUE_GETFSSTAT +#define SYS_AUE_olseek AUE_LSEEK #define SYS_AUE_getpid AUE_GETPID #define SYS_AUE_mount AUE_MOUNT #define SYS_AUE_unmount AUE_UMOUNT @@ -2267,16 +2270,21 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_fchflags AUE_FCHFLAGS #define SYS_AUE_sync AUE_SYNC #define SYS_AUE_kill AUE_KILL +#define SYS_AUE_ostat AUE_STAT #define SYS_AUE_getppid AUE_GETPPID +#define SYS_AUE_olstat AUE_LSTAT #define SYS_AUE_dup AUE_DUP #define SYS_AUE_pipe AUE_PIPE #define SYS_AUE_getegid AUE_GETEGID #define SYS_AUE_profil AUE_PROFILE #define SYS_AUE_ktrace AUE_KTRACE +#define SYS_AUE_osigaction AUE_SIGACTION #define SYS_AUE_getgid AUE_GETGID +#define SYS_AUE_osigprocmask AUE_SIGPROCMASK #define SYS_AUE_getlogin AUE_GETLOGIN #define SYS_AUE_setlogin AUE_SETLOGIN #define SYS_AUE_acct AUE_ACCT +#define SYS_AUE_osigpending AUE_SIGPENDING #define SYS_AUE_sigaltstack AUE_SIGALTSTACK #define SYS_AUE_ioctl AUE_IOCTL #define SYS_AUE_reboot AUE_REBOOT @@ -2286,10 +2294,14 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_execve AUE_EXECVE #define SYS_AUE_umask AUE_UMASK #define SYS_AUE_chroot AUE_CHROOT +#define SYS_AUE_ofstat AUE_FSTAT +#define SYS_AUE_ogetkerninfo AUE_NULL +#define SYS_AUE_ogetpagesize AUE_NULL #define SYS_AUE_msync AUE_MSYNC #define SYS_AUE_vfork AUE_VFORK #define SYS_AUE_sbrk AUE_SBRK #define SYS_AUE_sstk AUE_SSTK +#define SYS_AUE_ommap AUE_MMAP #define SYS_AUE_vadvise AUE_O_VADVISE #define SYS_AUE_munmap AUE_MUNMAP #define SYS_AUE_mprotect AUE_MPROTECT @@ -2300,8 +2312,11 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_getpgrp AUE_GETPGRP #define SYS_AUE_setpgid AUE_SETPGRP #define SYS_AUE_setitimer AUE_SETITIMER +#define SYS_AUE_owait AUE_WAIT4 #define SYS_AUE_swapon AUE_SWAPON #define SYS_AUE_getitimer AUE_GETITIMER +#define SYS_AUE_ogethostname AUE_SYSCTL +#define SYS_AUE_osethostname AUE_SYSCTL #define SYS_AUE_getdtablesize AUE_GETDTABLESIZE #define SYS_AUE_dup2 AUE_DUP2 #define SYS_AUE_fcntl AUE_FCNTL @@ -2310,10 +2325,21 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_setpriority AUE_SETPRIORITY #define SYS_AUE_socket AUE_SOCKET #define SYS_AUE_connect AUE_CONNECT +#define SYS_AUE_oaccept AUE_ACCEPT #define SYS_AUE_getpriority AUE_GETPRIORITY +#define SYS_AUE_osend AUE_SEND +#define SYS_AUE_orecv AUE_RECV +#define SYS_AUE_osigreturn AUE_SIGRETURN #define SYS_AUE_bind AUE_BIND #define SYS_AUE_setsockopt AUE_SETSOCKOPT #define SYS_AUE_listen AUE_LISTEN +#define SYS_AUE_osigvec AUE_NULL +#define SYS_AUE_osigblock AUE_NULL +#define SYS_AUE_osigsetmask AUE_NULL +#define SYS_AUE_osigsuspend AUE_NULL +#define SYS_AUE_osigstack AUE_NULL +#define SYS_AUE_orecvmsg AUE_RECVMSG +#define SYS_AUE_osendmsg AUE_SENDMSG #define SYS_AUE_gettimeofday AUE_GETTIMEOFDAY #define SYS_AUE_getrusage AUE_GETRUSAGE #define SYS_AUE_getsockopt AUE_GETSOCKOPT @@ -2322,9 +2348,12 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_settimeofday AUE_SETTIMEOFDAY #define SYS_AUE_fchown AUE_FCHOWN #define SYS_AUE_fchmod AUE_FCHMOD +#define SYS_AUE_orecvfrom AUE_RECVFROM #define SYS_AUE_setreuid AUE_SETREUID #define SYS_AUE_setregid AUE_SETREGID #define SYS_AUE_rename AUE_RENAME +#define SYS_AUE_otruncate AUE_TRUNCATE +#define SYS_AUE_oftruncate AUE_FTRUNCATE #define SYS_AUE_flock AUE_FLOCK #define SYS_AUE_mkfifo AUE_MKFIFO #define SYS_AUE_sendto AUE_SENDTO @@ -2334,12 +2363,26 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_rmdir AUE_RMDIR #define SYS_AUE_utimes AUE_UTIMES #define SYS_AUE_adjtime AUE_ADJTIME +#define SYS_AUE_ogetpeername AUE_GETPEERNAME +#define SYS_AUE_ogethostid AUE_SYSCTL +#define SYS_AUE_osethostid AUE_SYSCTL +#define SYS_AUE_ogetrlimit AUE_GETRLIMIT +#define SYS_AUE_osetrlimit AUE_SETRLIMIT +#define SYS_AUE_okillpg AUE_KILLPG #define SYS_AUE_setsid AUE_SETSID #define SYS_AUE_quotactl AUE_QUOTACTL +#define SYS_AUE_oquota AUE_O_QUOTA +#define SYS_AUE_ogetsockname AUE_GETSOCKNAME #define SYS_AUE_nlm_syscall AUE_NULL #define SYS_AUE_nfssvc AUE_NFS_SVC +#define SYS_AUE_ogetdirentries AUE_GETDIRENTRIES +#define SYS_AUE_freebsd4_statfs AUE_STATFS +#define SYS_AUE_freebsd4_fstatfs AUE_FSTATFS #define SYS_AUE_lgetfh AUE_LGETFH #define SYS_AUE_getfh AUE_NFS_GETFH +#define SYS_AUE_freebsd4_getdomainname AUE_SYSCTL +#define SYS_AUE_freebsd4_setdomainname AUE_SYSCTL +#define SYS_AUE_freebsd4_uname AUE_NULL #define SYS_AUE_sysarch AUE_SYSARCH #define SYS_AUE_rtprio AUE_RTPRIO #define SYS_AUE_semsys AUE_SEMSYS @@ -2408,6 +2451,7 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_nlstat AUE_LSTAT #define SYS_AUE_preadv AUE_PREADV #define SYS_AUE_pwritev AUE_PWRITEV +#define SYS_AUE_freebsd4_fhstatfs AUE_FHSTATFS #define SYS_AUE_fhopen AUE_FHOPEN #define SYS_AUE_fhstat AUE_FHSTAT #define SYS_AUE_modnext AUE_NULL @@ -2443,11 +2487,14 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_sched_get_priority_min AUE_NULL #define SYS_AUE_sched_rr_get_interval AUE_NULL #define SYS_AUE_utrace AUE_NULL +#define SYS_AUE_freebsd4_sendfile AUE_SENDFILE #define SYS_AUE_kldsym AUE_NULL #define SYS_AUE_jail AUE_JAIL #define SYS_AUE_sigprocmask AUE_SIGPROCMASK #define SYS_AUE_sigsuspend AUE_SIGSUSPEND +#define SYS_AUE_freebsd4_sigaction AUE_SIGACTION #define SYS_AUE_sigpending AUE_SIGPENDING +#define SYS_AUE_freebsd4_sigreturn AUE_SIGRETURN #define SYS_AUE_sigtimedwait AUE_SIGWAIT #define SYS_AUE_sigwaitinfo AUE_NULL #define SYS_AUE___acl_get_file AUE_NULL From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 20:30:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED0031065674; Mon, 22 Jun 2009 20:30:02 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAEA78FC1E; Mon, 22 Jun 2009 20:30:02 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MKU2nt051582; Mon, 22 Jun 2009 20:30:02 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MKU2ci051580; Mon, 22 Jun 2009 20:30:02 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906222030.n5MKU2ci051580@svn.freebsd.org> From: Sam Leffler Date: Mon, 22 Jun 2009 20:30: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: r194648 - head/sys/arm/xscale/ixp425 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:30:04 -0000 Author: sam Date: Mon Jun 22 20:30:02 2009 New Revision: 194648 URL: http://svn.freebsd.org/changeset/base/194648 Log: make type use consistent Modified: head/sys/arm/xscale/ixp425/ixp425.c Modified: head/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 20:24:03 2009 (r194647) +++ head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 20:30:02 2009 (r194648) @@ -113,7 +113,7 @@ static const uint8_t int2gpio[32] __attr 0xff, 0xff /* INT#30 -> INT#31 */ }; -static __inline u_int32_t +static __inline uint32_t ixp425_irq2gpio_bit(int irq) { return (1U << int2gpio[irq]); From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 20:31:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FA4C106567D; Mon, 22 Jun 2009 20:31:07 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2CD308FC12; Mon, 22 Jun 2009 20:31:07 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MKV7mv051641; Mon, 22 Jun 2009 20:31:07 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MKV7qM051639; Mon, 22 Jun 2009 20:31:07 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906222031.n5MKV7qM051639@svn.freebsd.org> From: Sam Leffler Date: Mon, 22 Jun 2009 20:31: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: r194649 - head/sys/arm/xscale/ixp425 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:31:08 -0000 Author: sam Date: Mon Jun 22 20:31:06 2009 New Revision: 194649 URL: http://svn.freebsd.org/changeset/base/194649 Log: swap order in ddb show gpio printf Modified: head/sys/arm/xscale/ixp425/ixp425.c Modified: head/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 20:30:02 2009 (r194648) +++ head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 20:31:06 2009 (r194649) @@ -139,8 +139,8 @@ DB_SHOW_COMMAND(gpio, db_show_gpio) uint32_t gpit2r = GPIO_CONF_READ_4(ixp425_softc, IXP425_GPIO_GPIT2R); int i, j; - db_printf("GPOUTR %08x GPOER %08x GPINR %08x GPISR %08x\n", - gpoutr, gpoer, gpinr, + db_printf("GPOUTR %08x GPINR %08x GPOER %08x GPISR %08x\n", + gpoutr, gpinr, gpoer, GPIO_CONF_READ_4(ixp425_softc, IXP425_GPIO_GPISR)); db_printf("GPIT1R %08x GPIT2R %08x GPCLKR %08x\n", gpit1r, gpit2r, GPIO_CONF_READ_4(ixp425_softc, IXP425_GPIO_GPCLKR)); From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 20:34:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 419201065674; Mon, 22 Jun 2009 20:34:00 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 302288FC18; Mon, 22 Jun 2009 20:34:00 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MKY0db051736; Mon, 22 Jun 2009 20:34:00 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MKY0fB051734; Mon, 22 Jun 2009 20:34:00 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906222034.n5MKY0fB051734@svn.freebsd.org> From: Sam Leffler Date: Mon, 22 Jun 2009 20:34: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: r194650 - head/sys/arm/xscale/ixp425 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:34:00 -0000 Author: sam Date: Mon Jun 22 20:33:59 2009 New Revision: 194650 URL: http://svn.freebsd.org/changeset/base/194650 Log: move logic to ACK a GPIO to a separate function Modified: head/sys/arm/xscale/ixp425/ixp425.c Modified: head/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 20:31:06 2009 (r194649) +++ head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 20:33:59 2009 (r194650) @@ -159,6 +159,14 @@ DB_SHOW_COMMAND(gpio, db_show_gpio) } #endif +static __inline void +ixp425_gpio_ack(int irq) +{ + if (irq < 32 && ((1 << irq) & IXP425_INT_GPIOMASK)) + IXPREG(IXP425_GPIO_VBASE + IXP425_GPIO_GPISR) = + ixp425_irq2gpio_bit(irq); +} + void arm_mask_irq(uintptr_t nb) { @@ -174,9 +182,7 @@ arm_mask_irq(uintptr_t nb) } restore_interrupts(i); /*XXX; If it's a GPIO interrupt, ACK it know. Can it be a problem ?*/ - if (nb < 32 && ((1 << nb) & IXP425_INT_GPIOMASK)) - IXPREG(IXP425_GPIO_VBASE + IXP425_GPIO_GPISR) = - ixp425_irq2gpio_bit(nb); + ixp425_gpio_ack(nb); } void From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 20:34:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57BE9106564A; Mon, 22 Jun 2009 20:34:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 464C38FC16; Mon, 22 Jun 2009 20:34:50 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MKYoRT051787; Mon, 22 Jun 2009 20:34:50 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MKYoEA051785; Mon, 22 Jun 2009 20:34:50 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906222034.n5MKYoEA051785@svn.freebsd.org> From: Sam Leffler Date: Mon, 22 Jun 2009 20:34: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: r194651 - head/sys/arm/xscale/ixp425 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:34:50 -0000 Author: sam Date: Mon Jun 22 20:34:50 2009 New Revision: 194651 URL: http://svn.freebsd.org/changeset/base/194651 Log: kill stray whitespace Modified: head/sys/arm/xscale/ixp425/ixp425.c Modified: head/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 20:33:59 2009 (r194650) +++ head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 20:34:50 2009 (r194651) @@ -171,7 +171,7 @@ void arm_mask_irq(uintptr_t nb) { int i; - + i = disable_interrupts(I32_bit); if (nb < 32) { intr_enabled &= ~(1 << nb); @@ -189,7 +189,7 @@ void arm_unmask_irq(uintptr_t nb) { int i; - + i = disable_interrupts(I32_bit); if (nb < 32) { intr_enabled |= (1 << nb); From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 20:36:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1598F1065670; Mon, 22 Jun 2009 20:36:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0417F8FC12; Mon, 22 Jun 2009 20:36:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MKaMEv051859; Mon, 22 Jun 2009 20:36:22 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MKaMAZ051857; Mon, 22 Jun 2009 20:36:22 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906222036.n5MKaMAZ051857@svn.freebsd.org> From: Sam Leffler Date: Mon, 22 Jun 2009 20:36: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: r194652 - head/sys/arm/xscale/ixp425 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:36:23 -0000 Author: sam Date: Mon Jun 22 20:36:22 2009 New Revision: 194652 URL: http://svn.freebsd.org/changeset/base/194652 Log: rewrite arm_get_next_irq to always make forward progress (should be optimized) Modified: head/sys/arm/xscale/ixp425/ixp425.c Modified: head/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 20:34:50 2009 (r194651) +++ head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 20:36:22 2009 (r194652) @@ -214,15 +214,27 @@ ixp435_irq_read(void) } int -arm_get_next_irq(int last __unused) +arm_get_next_irq(int last) { - uint32_t irq; + uint32_t mask; - if ((irq = ixp425_irq_read())) - return (ffs(irq) - 1); - if (cpu_is_ixp43x() && (irq = ixp435_irq_read())) - return (32 + ffs(irq) - 1); - return (-1); + last += 1; /* always advance fwd, NB: handles -1 */ + if (last < 32) { + mask = ixp425_irq_read() >> last; + for (; mask != 0; mask >>= 1, last += 1) { + if (mask & 1) + return last; + } + last = 32; + } + if (cpu_is_ixp43x()) { + mask = ixp435_irq_read() >> (32-last); + for (; mask != 0; mask >>= 1, last++) { + if (mask & 1) + return last; + } + } + return -1; } void From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 20:38:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33602106566C; Mon, 22 Jun 2009 20:38:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 076118FC08; Mon, 22 Jun 2009 20:38:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MKct9h051942; Mon, 22 Jun 2009 20:38:55 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MKctca051938; Mon, 22 Jun 2009 20:38:55 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906222038.n5MKctca051938@svn.freebsd.org> From: Sam Leffler Date: Mon, 22 Jun 2009 20:38: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: r194653 - head/sys/arm/xscale/ixp425 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:38:56 -0000 Author: sam Date: Mon Jun 22 20:38:55 2009 New Revision: 194653 URL: http://svn.freebsd.org/changeset/base/194653 Log: add ixp425_set_gpio to program the gpio interrupt type Modified: head/sys/arm/xscale/ixp425/avila_ata.c head/sys/arm/xscale/ixp425/ixp425.c head/sys/arm/xscale/ixp425/ixp425var.h Modified: head/sys/arm/xscale/ixp425/avila_ata.c ============================================================================== --- head/sys/arm/xscale/ixp425/avila_ata.c Mon Jun 22 20:36:22 2009 (r194652) +++ head/sys/arm/xscale/ixp425/avila_ata.c Mon Jun 22 20:38:55 2009 (r194653) @@ -218,16 +218,7 @@ ata_avila_attach(device_t dev) rman_set_bustag(&sc->sc_alt_ata, &sc->sc_expbus_tag); rman_set_bushandle(&sc->sc_alt_ata, sc->sc_alt_ioh); - GPIO_CONF_WRITE_4(sa, IXP425_GPIO_GPOER, - GPIO_CONF_READ_4(sa, IXP425_GPIO_GPOER) | (1<gpin)); - /* set interrupt type */ - GPIO_CONF_WRITE_4(sa, GPIO_TYPE_REG(config->gpin), - (GPIO_CONF_READ_4(sa, GPIO_TYPE_REG(config->gpin)) &~ - GPIO_TYPE(config->gpin, GPIO_TYPE_MASK)) | - GPIO_TYPE(config->gpin, GPIO_TYPE_EDG_RISING)); - - /* clear ISR */ - GPIO_CONF_WRITE_4(sa, IXP425_GPIO_GPISR, (1<gpin)); + ixp425_set_gpio(sa, config->gpin, GPIO_TYPE_EDG_RISING); /* configure CS1/3 window, leaving timing unchanged */ EXP_BUS_WRITE_4(sc, sc->sc_16bit_off, Modified: head/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 20:36:22 2009 (r194652) +++ head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 20:38:55 2009 (r194653) @@ -159,6 +159,25 @@ DB_SHOW_COMMAND(gpio, db_show_gpio) } #endif +void +ixp425_set_gpio(struct ixp425_softc *sc, int pin, int type) +{ + uint32_t gpiotr = GPIO_CONF_READ_4(sc, GPIO_TYPE_REG(pin)); + + /* clear interrupt type */ + GPIO_CONF_WRITE_4(sc, GPIO_TYPE_REG(pin), + gpiotr &~ GPIO_TYPE(pin, GPIO_TYPE_MASK)); + /* clear any pending interrupt */ + GPIO_CONF_WRITE_4(sc, IXP425_GPIO_GPISR, (1< Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 982F6106566C; Mon, 22 Jun 2009 20:41:02 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 868A88FC15; Mon, 22 Jun 2009 20:41:02 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MKf2fR052028; Mon, 22 Jun 2009 20:41:02 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MKf28c052025; Mon, 22 Jun 2009 20:41:02 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906222041.n5MKf28c052025@svn.freebsd.org> From: Sam Leffler Date: Mon, 22 Jun 2009 20:41: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: r194654 - head/sys/arm/xscale/ixp425 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:41:03 -0000 Author: sam Date: Mon Jun 22 20:41:02 2009 New Revision: 194654 URL: http://svn.freebsd.org/changeset/base/194654 Log: map the optional GPS and RS485 uart's on the Gateworks Cambria board (may want to make these conditional) Modified: head/sys/arm/xscale/ixp425/avila_machdep.c head/sys/arm/xscale/ixp425/ixp425reg.h Modified: head/sys/arm/xscale/ixp425/avila_machdep.c ============================================================================== --- head/sys/arm/xscale/ixp425/avila_machdep.c Mon Jun 22 20:38:55 2009 (r194653) +++ head/sys/arm/xscale/ixp425/avila_machdep.c Mon Jun 22 20:41:02 2009 (r194654) @@ -183,14 +183,9 @@ static const struct pmap_devmap ixp435_d { IXP425_IO_VBASE, IXP425_IO_HWBASE, IXP425_IO_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - /* Expansion Bus */ { IXP425_EXP_VBASE, IXP425_EXP_HWBASE, IXP425_EXP_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - /* CFI Flash on the Expansion Bus */ - { IXP425_EXP_BUS_CS0_VBASE, IXP425_EXP_BUS_CS0_HWBASE, - IXP425_EXP_BUS_CS0_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, - /* IXP425 PCI Configuration */ { IXP425_PCI_VBASE, IXP425_PCI_HWBASE, IXP425_PCI_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, @@ -207,6 +202,10 @@ static const struct pmap_devmap ixp435_d { IXP425_QMGR_VBASE, IXP425_QMGR_HWBASE, IXP425_QMGR_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + /* CFI Flash on the Expansion Bus */ + { IXP425_EXP_BUS_CS0_VBASE, IXP425_EXP_BUS_CS0_HWBASE, + IXP425_EXP_BUS_CS0_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + /* USB1 Memory Space */ { IXP435_USB1_VBASE, IXP435_USB1_HWBASE, IXP435_USB1_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, @@ -214,6 +213,14 @@ static const struct pmap_devmap ixp435_d { IXP435_USB2_VBASE, IXP435_USB2_HWBASE, IXP435_USB2_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + /* GPS Memory Space */ + { CAMBRIA_GPS_VBASE, CAMBRIA_GPS_HWBASE, CAMBRIA_GPS_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + + /* RS485 Memory Space */ + { CAMBRIA_RS485_VBASE, CAMBRIA_RS485_HWBASE, CAMBRIA_RS485_SIZE, + VM_PROT_READ|VM_PROT_WRITE, PTE_NOCACHE, }, + { 0 } }; @@ -456,8 +463,8 @@ initarm(void *arg, void *arg2) phys_avail[i++] = PHYSADDR; phys_avail[i++] = PHYSADDR + PAGE_SIZE; /* *XXX: Gross hack to get our - * pages in the vm_page_array - . */ + * pages in the vm_page_array. + */ #endif phys_avail[i++] = round_page(virtual_avail - KERNBASE + PHYSADDR); phys_avail[i++] = trunc_page(PHYSADDR + memsize - 1); Modified: head/sys/arm/xscale/ixp425/ixp425reg.h ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425reg.h Mon Jun 22 20:38:55 2009 (r194653) +++ head/sys/arm/xscale/ixp425/ixp425reg.h Mon Jun 22 20:41:02 2009 (r194654) @@ -88,10 +88,10 @@ * SDRAM/DDR Memory Controller * F020 0000 --------------------------- IXP425_MCU_VBASE * - * EHCI USB 2 (IXP435) - * F001 D000 --------------------------- IXP435_USB2_VBASE - * EHCI USB 1 (IXP435) - * F001 C000 --------------------------- IXP435_USB1_VBASE + * F001 F000 RS485 (Cambria) CAMBRIA_RS485_VBASE + * F001 E000 GPS (Cambria) CAMBRIA_GPS_VBASE + * F001 D000 EHCI USB 2 (IXP435) IXP435_USB2_VBASE + * F001 C000 EHCI USB 1 (IXP435) IXP435_USB1_VBASE * Queue manager * F001 8000 --------------------------- IXP425_QMGR_VBASE * PCI Configuration and Status @@ -686,10 +686,22 @@ /* * IXP435/Gateworks Cambria */ +#define IXP435_USB1_HWBASE 0xCD000000UL /* USB host controller 1 */ +#define IXP435_USB1_VBASE 0xF001C000UL +#define IXP435_USB1_SIZE 0x1000 /* NB: only uses 0x300 */ + +#define IXP435_USB2_HWBASE 0xCE000000UL /* USB host controller 2 */ +#define IXP435_USB2_VBASE 0xF001D000UL +#define IXP435_USB2_SIZE 0x1000 /* NB: only uses 0x300 */ + #define CAMBRIA_GPS_HWBASE 0x53FC0000UL /* optional GPS Serial Port */ -#define CAMBRIA_GPS_SIZE 0x40000 +#define CAMBRIA_GPS_VBASE 0xF001E000UL +#define CAMBRIA_GPS_SIZE 0x1000 #define CAMBRIA_RS485_HWBASE 0x53F80000UL /* optional RS485 Serial Port */ -#define CAMBRIA_RS485_SIZE 0x40000 +#define CAMBRIA_RS485_VBASE 0xF001F000UL +#define CAMBRIA_RS485_SIZE 0x1000 + +/* NB: these are mapped on the fly, so no fixed virtual addresses */ #define CAMBRIA_OCTAL_LED_HWBASE 0x53F40000UL /* Octal Status LED Latch */ #define CAMBRIA_OCTAL_LED_SIZE 0x1000 #define CAMBRIA_CFSEL1_HWBASE 0x53E40000UL /* Compact Flash Socket Sel 0 */ @@ -697,12 +709,4 @@ #define CAMBRIA_CFSEL0_HWBASE 0x53E00000UL /* Compact Flash Socket Sel 1 */ #define CAMBRIA_CFSEL0_SIZE 0x40000 -#define IXP435_USB1_HWBASE 0xcd000000UL /* USB host controller 1 */ -#define IXP435_USB1_VBASE 0xf001C000UL -#define IXP435_USB1_SIZE 0x1000 /* NB: only uses 0x300 */ - -#define IXP435_USB2_HWBASE 0xce000000UL /* USB host controller 2 */ -#define IXP435_USB2_VBASE 0xf001D000UL -#define IXP435_USB2_SIZE 0x1000 /* NB: only uses 0x300 */ - #endif /* _IXP425REG_H_ */ From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 20:42:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A51ED1065673; Mon, 22 Jun 2009 20:42:28 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 930108FC30; Mon, 22 Jun 2009 20:42:28 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MKgSgS052086; Mon, 22 Jun 2009 20:42:28 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MKgSci052084; Mon, 22 Jun 2009 20:42:28 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906222042.n5MKgSci052084@svn.freebsd.org> From: Sam Leffler Date: Mon, 22 Jun 2009 20:42: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: r194655 - head/sys/arm/xscale/ixp425 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:42:29 -0000 Author: sam Date: Mon Jun 22 20:42:28 2009 New Revision: 194655 URL: http://svn.freebsd.org/changeset/base/194655 Log: always define Cambria GPS+RS485 mappings as they are no longer conditional Modified: head/sys/arm/xscale/ixp425/ixp425.c Modified: head/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 20:41:02 2009 (r194654) +++ head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 20:42:28 2009 (r194655) @@ -443,16 +443,12 @@ gethwvtrans(uint32_t hwbase, uint32_t si { .hwbase = IXP435_USB2_HWBASE, .size = IXP435_USB2_SIZE, .vbase = IXP435_USB2_VBASE }, -#ifdef CAMBRIA_GPS_VBASE { .hwbase = CAMBRIA_GPS_HWBASE, .size = CAMBRIA_GPS_SIZE, .vbase = CAMBRIA_GPS_VBASE }, -#endif -#ifdef CAMBRIA_RS485_VBASE { .hwbase = CAMBRIA_RS485_HWBASE, .size = CAMBRIA_RS485_SIZE, .vbase = CAMBRIA_RS485_VBASE }, -#endif }; int i; From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 20:56:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D2641065672; Mon, 22 Jun 2009 20:56:42 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from gizmo.2hip.net (gizmo.2hip.net [64.74.207.195]) by mx1.freebsd.org (Postfix) with ESMTP id B8A5B8FC0A; Mon, 22 Jun 2009 20:56:41 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from [192.168.1.4] (adsl-19-252-27.bna.bellsouth.net [68.19.252.27]) (authenticated bits=0) by gizmo.2hip.net (8.14.3/8.14.3) with ESMTP id n5MKudtX071981 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 22 Jun 2009 16:56:39 -0400 (EDT) (envelope-from rnoland@FreeBSD.org) From: Robert Noland To: John Baldwin In-Reply-To: <1245701981.1761.25.camel@balrog.2hip.net> References: <200906222008.n5MK87qh050928@svn.freebsd.org> <1245701631.1761.22.camel@balrog.2hip.net> <1245701981.1761.25.camel@balrog.2hip.net> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-BZfM55gm9yB2H150TmS8" Organization: FreeBSD Date: Mon, 22 Jun 2009 15:56:34 -0500 Message-Id: <1245704194.1761.27.camel@balrog.2hip.net> Mime-Version: 1.0 X-Mailer: Evolution 2.26.2 FreeBSD GNOME Team Port X-Spam-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,RDNS_DYNAMIC, SPF_SOFTFAIL autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gizmo.2hip.net Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194644 - head/sys/dev/pci X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:56:42 -0000 --=-BZfM55gm9yB2H150TmS8 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, 2009-06-22 at 15:19 -0500, Robert Noland wrote: > On Mon, 2009-06-22 at 15:13 -0500, Robert Noland wrote: > > On Mon, 2009-06-22 at 20:08 +0000, John Baldwin wrote: > > > Author: jhb > > > Date: Mon Jun 22 20:08:06 2009 > > > New Revision: 194644 > > > URL: http://svn.freebsd.org/changeset/base/194644 > > >=20 > > > Log: > > > Enable MSI in the MSI capability registers any time that the first = message > > > in an MSI group is enabled, not just if the address/data pair are n= ot > > > initialized. > >=20 > > This should fix the issues with broken interrupts with drm on Intel > > graphics chips using msi. That is the slow windows after VT Switch > > issue. It however is still currently broken on HEAD due to another > > issue, which will hopefully be resolved soon. >=20 > It may actually work now on non-SMP, though I haven't tested that case. Ok, I have confirmed that this alone fixes things on UP. SMP is still broken. robert. > > =20 > > > Reported by: rnoland > > > MFC after: 1 week > > >=20 > > > Modified: > > > head/sys/dev/pci/pci.c > > >=20 > > > Modified: head/sys/dev/pci/pci.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/pci/pci.c Mon Jun 22 19:35:39 2009 (r194643) > > > +++ head/sys/dev/pci/pci.c Mon Jun 22 20:08:06 2009 (r194644) > > > @@ -2883,8 +2883,10 @@ pci_setup_intr(device_t dev, device_t ch > > > goto bad; > > > dinfo->cfg.msi.msi_addr =3D addr; > > > dinfo->cfg.msi.msi_data =3D data; > > > - pci_enable_msi(child, addr, data); > > > } > > > + if (dinfo->cfg.msi.msi_handlers =3D=3D 0) > > > + pci_enable_msi(child, dinfo->cfg.msi.msi_addr, > > > + dinfo->cfg.msi.msi_data); > > > dinfo->cfg.msi.msi_handlers++; > > > } else { > > > KASSERT(dinfo->cfg.msix.msix_alloc > 0, --=20 Robert Noland FreeBSD --=-BZfM55gm9yB2H150TmS8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEABECAAYFAko/8AIACgkQM4TrQ4qfRON80wCfeHupeauhuxjfqDu6wmIxKBN7 42sAniRHBpU8a8lyNdh1XiATpr5dEKID =2ozu -----END PGP SIGNATURE----- --=-BZfM55gm9yB2H150TmS8-- From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 20:57:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A07E3106566C; Mon, 22 Jun 2009 20:57:51 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8EDAE8FC15; Mon, 22 Jun 2009 20:57:51 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MKvpgo052403; Mon, 22 Jun 2009 20:57:51 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MKvp7L052401; Mon, 22 Jun 2009 20:57:51 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906222057.n5MKvp7L052401@svn.freebsd.org> From: Sam Leffler Date: Mon, 22 Jun 2009 20:57: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: r194656 - head/sys/arm/xscale/ixp425 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 20:57:52 -0000 Author: sam Date: Mon Jun 22 20:57:51 2009 New Revision: 194656 URL: http://svn.freebsd.org/changeset/base/194656 Log: hook arm_post_filter to ACK GPIO interrupts; this fixes the interrupt storm observed on the GPS+RS485 uarts on Gateworks Cambria boards Reviewed by: cognet Modified: head/sys/arm/xscale/ixp425/ixp425.c Modified: head/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 20:42:28 2009 (r194655) +++ head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 20:57:51 2009 (r194656) @@ -186,6 +186,13 @@ ixp425_gpio_ack(int irq) ixp425_irq2gpio_bit(irq); } +static void +ixp425_post_filter(void *arg) +{ + uintptr_t irq = (uintptr_t) arg; + ixp425_gpio_ack(irq); +} + void arm_mask_irq(uintptr_t nb) { @@ -304,6 +311,7 @@ ixp425_attach(device_t dev) ixp435_set_intrmask(); ixp435_set_intrsteer(); } + arm_post_filter = ixp425_post_filter; if (bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 0xffffffff, 0xff, 0xffffffff, 0, From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 21:09:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0300E106566C; Mon, 22 Jun 2009 21:09:53 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E54DF8FC0A; Mon, 22 Jun 2009 21:09:52 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5ML9qw2052814; Mon, 22 Jun 2009 21:09:52 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5ML9qXl052812; Mon, 22 Jun 2009 21:09:52 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200906222109.n5ML9qXl052812@svn.freebsd.org> From: Andrew Thompson Date: Mon, 22 Jun 2009 21:09: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: r194659 - head/sys/dev/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 21:09:53 -0000 Author: thompsa Date: Mon Jun 22 21:09:52 2009 New Revision: 194659 URL: http://svn.freebsd.org/changeset/base/194659 Log: Fix length check for ugen control transfer. Submitted by: Sylvestre Gallon, HPS Modified: head/sys/dev/usb/usb_generic.c Modified: head/sys/dev/usb/usb_generic.c ============================================================================== --- head/sys/dev/usb/usb_generic.c Mon Jun 22 20:58:56 2009 (r194658) +++ head/sys/dev/usb/usb_generic.c Mon Jun 22 21:09:52 2009 (r194659) @@ -1070,7 +1070,7 @@ ugen_fs_copy_in(struct usb_fifo *f, uint if (error) { return (error); } - if (length >= sizeof(*req)) { + if (length != sizeof(*req)) { xfer->error = USB_ERR_INVAL; goto complete; } From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 21:19:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D8BE106566C; Mon, 22 Jun 2009 21:19:25 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29CD48FC16; Mon, 22 Jun 2009 21:19:25 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MLJPvE053042; Mon, 22 Jun 2009 21:19:25 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MLJPrE053035; Mon, 22 Jun 2009 21:19:25 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <200906222119.n5MLJPrE053035@svn.freebsd.org> From: Marko Zec Date: Mon, 22 Jun 2009 21:19: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: r194660 - in head/sys: net netinet sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 21:19:25 -0000 Author: zec Date: Mon Jun 22 21:19:24 2009 New Revision: 194660 URL: http://svn.freebsd.org/changeset/base/194660 Log: V_irtualize flowtable state. This change should make options VIMAGE kernel builds usable again, to some extent at least. Note that the size of struct vnet_inet has changed, though in accordance with one-bump-per-day policy we didn't update the __FreeBSD_version number, given that it has already been touched by r194640 a few hours ago. Reviewed by: bz Approved by: julian (mentor) Modified: head/sys/net/flowtable.c head/sys/net/flowtable.h head/sys/netinet/ip_input.c head/sys/netinet/ip_output.c head/sys/netinet/vinet.h head/sys/sys/vimage.h Modified: head/sys/net/flowtable.c ============================================================================== --- head/sys/net/flowtable.c Mon Jun 22 21:09:52 2009 (r194659) +++ head/sys/net/flowtable.c Mon Jun 22 21:19:24 2009 (r194660) @@ -54,10 +54,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include - #include #include #include @@ -66,6 +64,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -165,10 +164,29 @@ struct flowtable { }; static struct proc *flowcleanerproc; +#ifdef VIMAGE_GLOBALS static struct flowtable *flow_list_head; -static uint32_t hashjitter; -static uma_zone_t ipv4_zone; -static uma_zone_t ipv6_zone; +static uint32_t flow_hashjitter; +static uma_zone_t flow_ipv4_zone; +static uma_zone_t flow_ipv6_zone; +#endif + +static int flowtable_iattach(const void *); +#ifdef VIMAGE +static int flowtable_idetach(const void *); +#endif + +#ifndef VIMAGE_GLOBALS +static const vnet_modinfo_t flowtable_modinfo = { + .vmi_id = VNET_MOD_FLOWTABLE, + .vmi_name = "flowtable", + .vmi_dependson = VNET_MOD_INET, + .vmi_iattach = flowtable_iattach, +#ifdef VIMAGE + .vmi_idetach = flowtable_idetach +#endif +}; +#endif /* !VIMAGE_GLOBALS */ /* * TODO: @@ -185,49 +203,57 @@ static uma_zone_t ipv6_zone; * of flows with flag to indicate that a flow was imported so should * not be considered for auto-cleaning * - support explicit connection state (currently only ad-hoc for DSR) + * - idetach() cleanup for options VIMAGE builds. */ +#ifdef VIMAGE_GLOBALS +int flowtable_enable; +static int flowtable_hits; +static int flowtable_lookups; +static int flowtable_misses; +static int flowtable_frees; +static int flowtable_free_checks; +static int flowtable_max_depth; +static int flowtable_collisions; +static int flowtable_syn_expire; +static int flowtable_udp_expire; +static int flowtable_fin_wait_expire; +static int flowtable_tcp_expire; +static int flowtable_nmbflows; +#endif SYSCTL_NODE(_net_inet, OID_AUTO, flowtable, CTLFLAG_RD, NULL, "flowtable"); -int flowtable_enable = 1; -SYSCTL_INT(_net_inet_flowtable, OID_AUTO, enable, CTLFLAG_RW, - &flowtable_enable, 0, "enable flowtable caching."); -static int flowtable_hits = 0; -SYSCTL_INT(_net_inet_flowtable, OID_AUTO, hits, CTLFLAG_RD, - &flowtable_hits, 0, "# flowtable hits."); -static int flowtable_lookups = 0; -SYSCTL_INT(_net_inet_flowtable, OID_AUTO, lookups, CTLFLAG_RD, - &flowtable_lookups, 0, "# flowtable lookups."); -static int flowtable_misses = 0; -SYSCTL_INT(_net_inet_flowtable, OID_AUTO, misses, CTLFLAG_RD, - &flowtable_misses, 0, "#flowtable misses."); -static int flowtable_frees = 0; -SYSCTL_INT(_net_inet_flowtable, OID_AUTO, frees, CTLFLAG_RD, - &flowtable_frees, 0, "#flows freed."); -static int flowtable_free_checks = 0; -SYSCTL_INT(_net_inet_flowtable, OID_AUTO, free_checks, CTLFLAG_RD, - &flowtable_free_checks, 0, "#flows free checks."); -static int flowtable_max_depth = 0; -SYSCTL_INT(_net_inet_flowtable, OID_AUTO, max_depth, CTLFLAG_RD, - &flowtable_max_depth, 0, "max collision list length."); -static int flowtable_collisions = 0; -SYSCTL_INT(_net_inet_flowtable, OID_AUTO, collisions, CTLFLAG_RD, - &flowtable_collisions, 0, "#flowtable collisions."); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, enable, + CTLFLAG_RW, flowtable_enable, 0, "enable flowtable caching."); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, hits, + CTLFLAG_RD, flowtable_hits, 0, "# flowtable hits."); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, lookups, + CTLFLAG_RD, flowtable_lookups, 0, "# flowtable lookups."); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, misses, + CTLFLAG_RD, flowtable_misses, 0, "#flowtable misses."); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, frees, + CTLFLAG_RD, flowtable_frees, 0, "#flows freed."); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, free_checks, + CTLFLAG_RD, flowtable_free_checks, 0, "#flows free checks."); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, max_depth, + CTLFLAG_RD, flowtable_max_depth, 0, "max collision list length."); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, collisions, + CTLFLAG_RD, flowtable_collisions, 0, "#flowtable collisions."); /* * XXX This does not end up updating timeouts at runtime * and only reflects the value for the last table added :-/ */ -static int flowtable_syn_expire = SYN_IDLE; -SYSCTL_INT(_net_inet_flowtable, OID_AUTO, syn_expire, CTLFLAG_RW, - &flowtable_syn_expire, 0, "seconds after which to remove syn allocated flow."); -static int flowtable_udp_expire = UDP_IDLE; -SYSCTL_INT(_net_inet_flowtable, OID_AUTO, udp_expire, CTLFLAG_RW, - &flowtable_udp_expire, 0, "seconds after which to remove flow allocated to UDP."); -static int flowtable_fin_wait_expire = FIN_WAIT_IDLE; -SYSCTL_INT(_net_inet_flowtable, OID_AUTO, fin_wait_expire, CTLFLAG_RW, - &flowtable_fin_wait_expire, 0, "seconds after which to remove a flow in FIN_WAIT."); -static int flowtable_tcp_expire = TCP_IDLE; -SYSCTL_INT(_net_inet_flowtable, OID_AUTO, tcp_expire, CTLFLAG_RW, - &flowtable_tcp_expire, 0, "seconds after which to remove flow allocated to a TCP connection."); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, syn_expire, + CTLFLAG_RW, flowtable_syn_expire, 0, + "seconds after which to remove syn allocated flow."); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, udp_expire, + CTLFLAG_RW, flowtable_udp_expire, 0, + "seconds after which to remove flow allocated to UDP."); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, fin_wait_expire, + CTLFLAG_RW, flowtable_fin_wait_expire, 0, + "seconds after which to remove a flow in FIN_WAIT."); +SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, tcp_expire, + CTLFLAG_RW, flowtable_tcp_expire, 0, + "seconds after which to remove flow allocated to a TCP connection."); /* @@ -237,27 +263,29 @@ SYSCTL_INT(_net_inet_flowtable, OID_AUTO * there is no reason why this could not be changed at runtime) * and thus (currently) needs to be set with a tunable. */ -static int nmbflows = 4096; - static int sysctl_nmbflows(SYSCTL_HANDLER_ARGS) { + INIT_VNET_INET(curvnet); int error, newnmbflows; - newnmbflows = nmbflows; + newnmbflows = V_flowtable_nmbflows; error = sysctl_handle_int(oidp, &newnmbflows, 0, req); if (error == 0 && req->newptr) { - if (newnmbflows > nmbflows) { - nmbflows = newnmbflows; - uma_zone_set_max(ipv4_zone, nmbflows); - uma_zone_set_max(ipv6_zone, nmbflows); + if (newnmbflows > V_flowtable_nmbflows) { + V_flowtable_nmbflows = newnmbflows; + uma_zone_set_max(V_flow_ipv4_zone, + V_flowtable_nmbflows); + uma_zone_set_max(V_flow_ipv6_zone, + V_flowtable_nmbflows); } else error = EINVAL; } return (error); } -SYSCTL_PROC(_net_inet_flowtable, OID_AUTO, nmbflows, CTLTYPE_INT|CTLFLAG_RW, - &nmbflows, 0, sysctl_nmbflows, "IU", "Maximum number of flows allowed"); +SYSCTL_V_PROC(V_NET, vnet_inet, _net_inet_flowtable, OID_AUTO, nmbflows, + CTLTYPE_INT|CTLFLAG_RW, flowtable_nmbflows, 0, sysctl_nmbflows, "IU", + "Maximum number of flows allowed"); #ifndef RADIX_MPATH static void @@ -310,6 +338,7 @@ static uint32_t ipv4_flow_lookup_hash_internal(struct mbuf *m, struct route *ro, uint32_t *key, uint16_t *flags, uint8_t *protop) { + INIT_VNET_INET(curvnet); uint16_t sport = 0, dport = 0; struct ip *ip = NULL; uint8_t proto = 0; @@ -320,7 +349,7 @@ ipv4_flow_lookup_hash_internal(struct mb struct udphdr *uh; struct sctphdr *sh; - if (flowtable_enable == 0) + if (V_flowtable_enable == 0) return (0); key[1] = key[0] = 0; @@ -382,7 +411,7 @@ ipv4_flow_lookup_hash_internal(struct mb ((uint16_t *)key)[1] = dport; skipports: - hash = jenkins_hashword(key, 3, hashjitter + proto); + hash = jenkins_hashword(key, 3, V_flow_hashjitter + proto); if (m != NULL && (m->m_flags & M_FLOWID) == 0) { m->m_flags |= M_FLOWID; m->m_pkthdr.flowid = hash; @@ -476,12 +505,13 @@ static int flowtable_insert(struct flowtable *ft, uint32_t hash, uint32_t *key, uint8_t proto, struct route *ro, uint16_t flags) { + INIT_VNET_INET(curvnet); struct flentry *fle, *fletail, *newfle, **flep; int depth; uma_zone_t flezone; bitstr_t *mask; - flezone = (flags & FL_IPV6) ? ipv6_zone : ipv4_zone; + flezone = (flags & FL_IPV6) ? V_flow_ipv6_zone : V_flow_ipv4_zone; newfle = uma_zalloc(flezone, M_NOWAIT | M_ZERO); if (newfle == NULL) return (ENOMEM); @@ -500,7 +530,7 @@ flowtable_insert(struct flowtable *ft, u } depth = 0; - flowtable_collisions++; + V_flowtable_collisions++; /* * find end of list and make sure that we were not * preempted by another thread handling this flow @@ -513,7 +543,7 @@ flowtable_insert(struct flowtable *ft, u */ FL_ENTRY_UNLOCK(ft, hash); uma_zfree((newfle->f_flags & FL_IPV6) ? - ipv6_zone : ipv4_zone, newfle); + V_flow_ipv6_zone : V_flow_ipv4_zone, newfle); return (EEXIST); } /* @@ -526,8 +556,8 @@ flowtable_insert(struct flowtable *ft, u fle = fle->f_next; } - if (depth > flowtable_max_depth) - flowtable_max_depth = depth; + if (depth > V_flowtable_max_depth) + V_flowtable_max_depth = depth; fletail->f_next = newfle; fle = newfle; skip: @@ -566,6 +596,7 @@ flowtable_key_equal(struct flentry *fle, int flowtable_lookup(struct flowtable *ft, struct mbuf *m, struct route *ro) { + INIT_VNET_INET(curvnet); uint32_t key[9], hash; struct flentry *fle; uint16_t flags; @@ -600,7 +631,7 @@ flowtable_lookup(struct flowtable *ft, s if (hash == 0 || (key[0] == 0 && (ft->ft_flags & FL_HASH_PORTS))) return (ENOENT); - flowtable_lookups++; + V_flowtable_lookups++; FL_ENTRY_LOCK(ft, hash); if ((fle = FL_ENTRY(ft, hash)) == NULL) { FL_ENTRY_UNLOCK(ft, hash); @@ -615,7 +646,7 @@ keycheck: && (proto == fle->f_proto) && (rt->rt_flags & RTF_UP) && (rt->rt_ifp != NULL)) { - flowtable_hits++; + V_flowtable_hits++; fle->f_uptime = time_uptime; fle->f_flags |= flags; ro->ro_rt = rt; @@ -629,7 +660,7 @@ keycheck: FL_ENTRY_UNLOCK(ft, hash); uncached: - flowtable_misses++; + V_flowtable_misses++; /* * This bit of code ends up locking the * same route 3 times (just like ip_output + ether_output) @@ -687,11 +718,12 @@ uncached: struct flowtable * flowtable_alloc(int nentry, int flags) { + INIT_VNET_INET(curvnet); struct flowtable *ft, *fttail; int i; - if (hashjitter == 0) - hashjitter = arc4random(); + if (V_flow_hashjitter == 0) + V_flow_hashjitter = arc4random(); KASSERT(nentry > 0, ("nentry must be > 0, is %d\n", nentry)); @@ -739,10 +771,10 @@ flowtable_alloc(int nentry, int flags) * replacement after 5s of non-use */ if (flags & FL_HASH_PORTS) { - ft->ft_udp_idle = flowtable_udp_expire; - ft->ft_syn_idle = flowtable_syn_expire; - ft->ft_fin_wait_idle = flowtable_fin_wait_expire; - ft->ft_tcp_idle = flowtable_fin_wait_expire; + ft->ft_udp_idle = V_flowtable_udp_expire; + ft->ft_syn_idle = V_flowtable_syn_expire; + ft->ft_fin_wait_idle = V_flowtable_fin_wait_expire; + ft->ft_tcp_idle = V_flowtable_fin_wait_expire; } else { ft->ft_udp_idle = ft->ft_fin_wait_idle = ft->ft_syn_idle = ft->ft_tcp_idle = 30; @@ -752,10 +784,10 @@ flowtable_alloc(int nentry, int flags) /* * hook in to the cleaner list */ - if (flow_list_head == NULL) - flow_list_head = ft; + if (V_flow_list_head == NULL) + V_flow_list_head = ft; else { - fttail = flow_list_head; + fttail = V_flow_list_head; while (fttail->ft_next != NULL) fttail = fttail->ft_next; fttail->ft_next = ft; @@ -768,14 +800,53 @@ static void flowtable_setup(void *arg) { - ipv4_zone = uma_zcreate("ip4flow", sizeof(struct flentry_v4), NULL, - NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET); - ipv6_zone = uma_zcreate("ip6flow", sizeof(struct flentry_v6), NULL, - NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET); - uma_zone_set_max(ipv4_zone, nmbflows); - uma_zone_set_max(ipv6_zone, nmbflows); +#ifndef VIMAGE_GLOBALS + vnet_mod_register(&flowtable_modinfo); +#else + flowtable_iattach(NULL); +#endif } +static int +flowtable_iattach(const void *unused __unused) +{ + INIT_VNET_INET(curvnet); + + V_flowtable_enable = 1; + V_flowtable_hits = 0; + V_flowtable_lookups = 0; + V_flowtable_misses = 0; + V_flowtable_frees = 0; + V_flowtable_free_checks = 0; + V_flowtable_max_depth = 0; + V_flowtable_collisions = 0; + V_flowtable_syn_expire = SYN_IDLE; + V_flowtable_udp_expire = UDP_IDLE; + V_flowtable_fin_wait_expire = FIN_WAIT_IDLE; + V_flowtable_tcp_expire = TCP_IDLE; + V_flowtable_nmbflows = 4096; + + V_flow_ipv4_zone = uma_zcreate("ip4flow", sizeof(struct flentry_v4), + NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET); + V_flow_ipv6_zone = uma_zcreate("ip6flow", sizeof(struct flentry_v6), + NULL, NULL, NULL, NULL, 64, UMA_ZONE_MAXBUCKET); + uma_zone_set_max(V_flow_ipv4_zone, V_flowtable_nmbflows); + uma_zone_set_max(V_flow_ipv6_zone, V_flowtable_nmbflows); + return (0); +} + +#ifdef VIMAGE +static int +flowtable_idetach(const void *unused __unused) +{ + INIT_VNET_INET(curvnet); + + uma_zdestroy(V_flow_ipv4_zone); + uma_zdestroy(V_flow_ipv6_zone); + return (0); +} +#endif + SYSINIT(flowtable_setup, SI_SUB_KTHREAD_INIT, SI_ORDER_ANY, flowtable_setup, NULL); /* @@ -787,6 +858,7 @@ SYSINIT(flowtable_setup, SI_SUB_KTHREAD_ static void fle_free(struct flentry *fle) { + INIT_VNET_INET(curvnet); struct rtentry *rt; struct llentry *lle; @@ -794,12 +866,14 @@ fle_free(struct flentry *fle) lle = __DEVOLATILE(struct llentry *, fle->f_lle); RTFREE(rt); LLE_FREE(lle); - uma_zfree((fle->f_flags & FL_IPV6) ? ipv6_zone : ipv4_zone, fle); + uma_zfree((fle->f_flags & FL_IPV6) ? + V_flow_ipv6_zone : V_flow_ipv4_zone, fle); } static void flowtable_free_stale(struct flowtable *ft) { + INIT_VNET_INET(curvnet); int curbit = 0, count; struct flentry *fle, **flehead, *fleprev; struct flentry *flefreehead, *flefreetail, *fletmp; @@ -826,7 +900,7 @@ flowtable_free_stale(struct flowtable *f flehead = flowtable_entry(ft, curbit); fle = fleprev = *flehead; - flowtable_free_checks++; + V_flowtable_free_checks++; #ifdef DIAGNOSTIC if (fle == NULL && curbit > 0) { log(LOG_ALERT, @@ -877,7 +951,7 @@ flowtable_free_stale(struct flowtable *f while ((fle = flefreehead) != NULL) { flefreehead = fle->f_next; count++; - flowtable_frees++; + V_flowtable_frees++; fle_free(fle); } if (bootverbose && count) @@ -885,36 +959,52 @@ flowtable_free_stale(struct flowtable *f } static void -flowtable_cleaner(void) +flowtable_clean_vnet(void) { + INIT_VNET_INET(curvnet); struct flowtable *ft; int i; + ft = V_flow_list_head; + while (ft != NULL) { + if (ft->ft_flags & FL_PCPU) { + for (i = 0; i <= mp_maxid; i++) { + if (CPU_ABSENT(i)) + continue; + + thread_lock(curthread); + sched_bind(curthread, i); + thread_unlock(curthread); + + flowtable_free_stale(ft); + + thread_lock(curthread); + sched_unbind(curthread); + thread_unlock(curthread); + } + } else { + flowtable_free_stale(ft); + } + ft = ft->ft_next; + } +} + +static void +flowtable_cleaner(void) +{ + VNET_ITERATOR_DECL(vnet_iter); + if (bootverbose) log(LOG_INFO, "flowtable cleaner started\n"); while (1) { - ft = flow_list_head; - while (ft != NULL) { - if (ft->ft_flags & FL_PCPU) { - for (i = 0; i <= mp_maxid; i++) { - if (CPU_ABSENT(i)) - continue; - - thread_lock(curthread); - sched_bind(curthread, i); - thread_unlock(curthread); - - flowtable_free_stale(ft); - - thread_lock(curthread); - sched_unbind(curthread); - thread_unlock(curthread); - } - } else { - flowtable_free_stale(ft); - } - ft = ft->ft_next; + VNET_LIST_RLOCK(); + VNET_FOREACH(vnet_iter) { + CURVNET_SET(vnet_iter); + flowtable_clean_vnet(); + CURVNET_RESTORE(); } + VNET_LIST_RUNLOCK(); + /* * The 20 second interval between cleaning checks * is arbitrary Modified: head/sys/net/flowtable.h ============================================================================== --- head/sys/net/flowtable.h Mon Jun 22 21:09:52 2009 (r194659) +++ head/sys/net/flowtable.h Mon Jun 22 21:19:24 2009 (r194660) @@ -38,7 +38,9 @@ $FreeBSD$ #define FL_PCPU (1<<1) /* pcpu cache */ struct flowtable; +#ifdef VIMAGE_GLOBALS extern struct flowtable *ip_ft; +#endif struct flowtable *flowtable_alloc(int nentry, int flags); Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Mon Jun 22 21:09:52 2009 (r194659) +++ head/sys/netinet/ip_input.c Mon Jun 22 21:19:24 2009 (r194660) @@ -207,13 +207,13 @@ SYSCTL_V_INT(V_NET, vnet_inet, _net_inet ipstealth, 0, "IP stealth mode, no TTL decrementation on forwarding"); #endif #ifdef FLOWTABLE -static int ip_output_flowtable_size = 2048; -TUNABLE_INT("net.inet.ip.output_flowtable_size", &ip_output_flowtable_size); +#ifdef VIMAGE_GLOBALS +static int ip_output_flowtable_size; +struct flowtable *ip_ft; +#endif SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, OID_AUTO, output_flowtable_size, CTLFLAG_RDTUN, ip_output_flowtable_size, 2048, "number of entries in the per-cpu output flow caches"); - -struct flowtable *ip_ft; #endif #ifdef VIMAGE_GLOBALS @@ -335,6 +335,13 @@ ip_init(void) NULL, UMA_ALIGN_PTR, 0); maxnipq_update(); +#ifdef FLOWTABLE + V_ip_output_flowtable_size = 2048; + TUNABLE_INT_FETCH("net.inet.ip.output_flowtable_size", + &V_ip_output_flowtable_size); + V_ip_ft = flowtable_alloc(V_ip_output_flowtable_size, FL_PCPU); +#endif + /* Skip initialization of globals for non-default instances. */ if (!IS_DEFAULT_VNET(curvnet)) return; @@ -377,9 +384,6 @@ ip_init(void) /* Initialize various other remaining things. */ IPQ_LOCK_INIT(); netisr_register(&ip_nh); -#ifdef FLOWTABLE - ip_ft = flowtable_alloc(ip_output_flowtable_size, FL_PCPU); -#endif } void Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Mon Jun 22 21:09:52 2009 (r194659) +++ head/sys/netinet/ip_output.c Mon Jun 22 21:19:24 2009 (r194660) @@ -162,7 +162,7 @@ ip_output(struct mbuf *m, struct mbuf *o * longer than that long for the stability of ro_rt. The * flow ID assignment must have happened before this point. */ - if (flowtable_lookup(ip_ft, m, ro) == 0) + if (flowtable_lookup(V_ip_ft, m, ro) == 0) nortfree = 1; #endif } Modified: head/sys/netinet/vinet.h ============================================================================== --- head/sys/netinet/vinet.h Mon Jun 22 21:09:52 2009 (r194659) +++ head/sys/netinet/vinet.h Mon Jun 22 21:19:24 2009 (r194660) @@ -212,6 +212,25 @@ struct vnet_inet { int _icmpbmcastecho; int _fw_one_pass; + + struct flowtable * _ip_ft; + struct flowtable * _flow_list_head; + uint32_t _flow_hashjitter; + uma_zone_t _flow_ipv4_zone; + uma_zone_t _flow_ipv6_zone; + int _flowtable_enable; + int _flowtable_hits; + int _flowtable_lookups; + int _flowtable_misses; + int _flowtable_frees; + int _flowtable_free_checks; + int _flowtable_max_depth; + int _flowtable_collisions; + int _flowtable_syn_expire; + int _flowtable_udp_expire; + int _flowtable_fin_wait_expire; + int _flowtable_tcp_expire; + int _flowtable_nmbflows; }; /* Size guard. See sys/vimage.h. */ @@ -240,6 +259,23 @@ extern struct vnet_inet vnet_inet_0; #define V_drop_redirect VNET_INET(drop_redirect) #define V_drop_synfin VNET_INET(drop_synfin) #define V_fw_one_pass VNET_INET(fw_one_pass) +#define V_flow_hashjitter VNET_INET(flow_hashjitter) +#define V_flow_ipv4_zone VNET_INET(flow_ipv4_zone) +#define V_flow_ipv6_zone VNET_INET(flow_ipv6_zone) +#define V_flow_list_head VNET_INET(flow_list_head) +#define V_flowtable_collisions VNET_INET(flowtable_collisions) +#define V_flowtable_enable VNET_INET(flowtable_enable) +#define V_flowtable_fin_wait_expire VNET_INET(flowtable_fin_wait_expire) +#define V_flowtable_free_checks VNET_INET(flowtable_free_checks) +#define V_flowtable_frees VNET_INET(flowtable_frees) +#define V_flowtable_hits VNET_INET(flowtable_hits) +#define V_flowtable_lookups VNET_INET(flowtable_lookups) +#define V_flowtable_max_depth VNET_INET(flowtable_max_depth) +#define V_flowtable_misses VNET_INET(flowtable_misses) +#define V_flowtable_nmbflows VNET_INET(flowtable_nmbflows) +#define V_flowtable_syn_expire VNET_INET(flowtable_syn_expire) +#define V_flowtable_tcp_expire VNET_INET(flowtable_tcp_expire) +#define V_flowtable_udp_expire VNET_INET(flowtable_udp_expire) #define V_icmp_may_rst VNET_INET(icmp_may_rst) #define V_icmp_quotelen VNET_INET(icmp_quotelen) #define V_icmp_rfi VNET_INET(icmp_rfi) @@ -272,9 +308,11 @@ extern struct vnet_inet vnet_inet_0; #define V_ip_checkinterface VNET_INET(ip_checkinterface) #define V_ip_defttl VNET_INET(ip_defttl) #define V_ip_do_randomid VNET_INET(ip_do_randomid) +#define V_ip_ft VNET_INET(ip_ft) #define V_ip_id VNET_INET(ip_id) #define V_ip_keepfaith VNET_INET(ip_keepfaith) #define V_ip_mrouter VNET_INET(ip_mrouter) +#define V_ip_output_flowtable_size VNET_INET(ip_output_flowtable_size) #define V_ip_rsvp_on VNET_INET(ip_rsvp_on) #define V_ip_rsvpd VNET_INET(ip_rsvpd) #define V_ip_sendsourcequench VNET_INET(ip_sendsourcequench) Modified: head/sys/sys/vimage.h ============================================================================== --- head/sys/sys/vimage.h Mon Jun 22 21:09:52 2009 (r194659) +++ head/sys/sys/vimage.h Mon Jun 22 21:19:24 2009 (r194660) @@ -135,7 +135,7 @@ struct vnet_modlink { #define VNET_MOD_IPCOMP 26 #define VNET_MOD_GIF 27 #define VNET_MOD_ARP 28 - /* 29 */ +#define VNET_MOD_FLOWTABLE 29 #define VNET_MOD_LOIF 30 #define VNET_MOD_DOMAIN 31 #define VNET_MOD_DYNAMIC_START 32 From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 21:36:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86DFC1065672; Mon, 22 Jun 2009 21:36:03 +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 5706C8FC15; Mon, 22 Jun 2009 21:36:03 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id E7F3F46B2A; Mon, 22 Jun 2009 17:36:02 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id C26028A079; Mon, 22 Jun 2009 17:36:01 -0400 (EDT) From: John Baldwin To: Daniel Eischen Date: Mon, 22 Jun 2009 16:05:45 -0400 User-Agent: KMail/1.9.7 References: <200906201645.n5KGjEeG081301@svn.freebsd.org> <200906220900.45042.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906221605.45908.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 22 Jun 2009 17:36:01 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Robert Noland Subject: Re: svn commit: r194540 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 21:36:04 -0000 On Monday 22 June 2009 11:09:51 am Daniel Eischen wrote: > On Mon, 22 Jun 2009, John Baldwin wrote: > > > On Saturday 20 June 2009 12:56:40 pm Daniel Eischen wrote: > >> On Sat, 20 Jun 2009, Robert Noland wrote: > >> > >>> Author: rnoland > >>> Date: Sat Jun 20 16:45:14 2009 > >>> New Revision: 194540 > >>> URL: http://svn.freebsd.org/changeset/base/194540 > >>> > >>> Log: > >>> The G45 docs indicate that all G4X chips use the new framecount register. > >>> > >>> Intel agrees with my reading of the docs, make it so for all G4X chips. > >>> > >>> The new register also has a 32 bit width as opposed to 24 bits. Fix > >>> things up so that the counters roll over properly. > >> > >> Could this possibly fix the problem I'm seeing with the screen being > >> garbage after a logout from KDE 3.x (using kdm)? Everything works > >> fine after logging in, but when you log out, the screen is left with > >> garbage/lots of vertical striping. This only happened after upgrading > >> my system (and all ports) to Xorg 7.4, worked just fine before that. > >> > >> agp0: on vgapci0 > >> agp0: detected 7932k stolen memory > >> agp0: aperture size is 256M > >> vgapci1: mem 0xdff80000-0xdfffffff at device 2.1 > > on pci0 > > > > I only started seeing this after enabling AIGLX and using if for desktop > > effects in KDE4. Ocassionally it doesn't trash the screen on exit even in > > that case. > > I don't even know what AIGLX is, just using defaults ;-) > My Xorg.log says AIGLX is disabled in one section, but then > also says later on: > > ... > (II) Initializing built-in extension COMPOSITE > (II) Initializing built-in extension DAMAGE > (II) AIGLX: Loaded and initialized /usr/local/lib/dri/swrast_dri.so > (II) GLX: Initialized DRISWRAST GL provider for screen 0 > (II) intel(0): Setting screen physical size to 303 x 190 > ... It is off for you then. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 21:42:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D792D1065672; Mon, 22 Jun 2009 21:42:57 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C62A48FC0A; Mon, 22 Jun 2009 21:42:57 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MLgvtO053593; Mon, 22 Jun 2009 21:42:57 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MLgvES053591; Mon, 22 Jun 2009 21:42:57 GMT (envelope-from np@svn.freebsd.org) Message-Id: <200906222142.n5MLgvES053591@svn.freebsd.org> From: Navdeep Parhar Date: Mon, 22 Jun 2009 21:42: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: r194661 - head/sys/dev/cxgb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 21:42:58 -0000 Author: np Date: Mon Jun 22 21:42:57 2009 New Revision: 194661 URL: http://svn.freebsd.org/changeset/base/194661 Log: Fix cxgb's ifmedia ioctl handling. Also fixed a comment. Reviewed by: kmacy Approved by: gnn (mentor) Modified: head/sys/dev/cxgb/cxgb_main.c Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Mon Jun 22 21:19:24 2009 (r194660) +++ head/sys/dev/cxgb/cxgb_main.c Mon Jun 22 21:42:57 2009 (r194661) @@ -2178,8 +2178,7 @@ cxgb_ioctl(struct ifnet *ifp, unsigned l /* * We don't want to call anything outside the driver while inside a * begin-op/end-op block. If it calls us back (eg. ether_ioctl may - * call cxgb_init), which is cxgb_init), we may deadlock if the state is - * already marked busy. + * call cxgb_init) we may deadlock if the state is already marked busy. * * XXX: this probably opens a small race window with kldunload... */ @@ -2187,13 +2186,10 @@ cxgb_ioctl(struct ifnet *ifp, unsigned l /* The IS_DOOMED check is racy, we're clutching at straws here */ if (handle_unsynchronized && !IS_DOOMED(p)) { - switch (command) { - case SIOCSIFMEDIA: - case SIOCGIFMEDIA: + if (command == SIOCSIFMEDIA || command == SIOCGIFMEDIA) error = ifmedia_ioctl(ifp, ifr, &p->media, command); - default: + else error = ether_ioctl(ifp, command, data); - } } return (error); From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 21:46:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0EF5C106566C; Mon, 22 Jun 2009 21:46:41 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F15DA8FC23; Mon, 22 Jun 2009 21:46:40 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MLke4N053724; Mon, 22 Jun 2009 21:46:40 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MLkep4053722; Mon, 22 Jun 2009 21:46:40 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <200906222146.n5MLkep4053722@svn.freebsd.org> From: Andre Oppermann Date: Mon, 22 Jun 2009 21:46: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: r194662 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 21:46:41 -0000 Author: andre Date: Mon Jun 22 21:46:40 2009 New Revision: 194662 URL: http://svn.freebsd.org/changeset/base/194662 Log: In sbappendstream_locked() demote all incoming packet mbufs (and chains) to pure data mbufs using m_demote(). This removes the packet header and all m_tag information as they are not meaningful anymore on a stream socket where mbufs are linked through m->m_next. Strictly speaking a packet header can be only ever valid on the first mbuf in an m_next chain. sbcompress() was doing this already when the mbuf chain layout lent itself to it (e.g. header splitting or merge-append), just not consistently. This frees resources at socket buffer append time instead of at sbdrop_internal() time after data has been read from the socket. For MAC the per packet information has done its duty and during socket buffer appending the policy of the socket itself takes over. With the append the packet boundaries disappear naturally and with it any context that was based on it. None of the residual information from mbuf headers in the socket buffer on stream sockets was looked at. Modified: head/sys/kern/uipc_sockbuf.c Modified: head/sys/kern/uipc_sockbuf.c ============================================================================== --- head/sys/kern/uipc_sockbuf.c Mon Jun 22 21:42:57 2009 (r194661) +++ head/sys/kern/uipc_sockbuf.c Mon Jun 22 21:46:40 2009 (r194662) @@ -528,6 +528,9 @@ sbappendstream_locked(struct sockbuf *sb SBLASTMBUFCHK(sb); + /* Remove all packet headers and mbuf tags to get a pure data chain. */ + m_demote(m, 1); + sbcompress(sb, m, sb->sb_mbtail); sb->sb_lastrecord = sb->sb_mb; From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 21:49:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39D73106566C; Mon, 22 Jun 2009 21:49:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27AC98FC17; Mon, 22 Jun 2009 21:49:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MLnuEP053826; Mon, 22 Jun 2009 21:49:56 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MLnuoI053824; Mon, 22 Jun 2009 21:49:56 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906222149.n5MLnuoI053824@svn.freebsd.org> From: Xin LI Date: Mon, 22 Jun 2009 21:49: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: r194663 - head/lib/libkiconv X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 21:49:56 -0000 Author: delphij Date: Mon Jun 22 21:49:55 2009 New Revision: 194663 URL: http://svn.freebsd.org/changeset/base/194663 Log: free(3) won't mess with errno so return it as-is. Submitted by: Jaakko Heinonen Modified: head/lib/libkiconv/kiconv_sysctl.c Modified: head/lib/libkiconv/kiconv_sysctl.c ============================================================================== --- head/lib/libkiconv/kiconv_sysctl.c Mon Jun 22 21:46:40 2009 (r194662) +++ head/lib/libkiconv/kiconv_sysctl.c Mon Jun 22 21:49:55 2009 (r194663) @@ -39,7 +39,6 @@ int kiconv_lookupconv(const char *drvname) { size_t size; - int error; if (sysctlbyname("kern.iconv.drvlist", NULL, &size, NULL, 0) == -1) return (errno); @@ -50,7 +49,6 @@ kiconv_lookupconv(const char *drvname) if (drivers == NULL) return (ENOMEM); if (sysctlbyname("kern.iconv.drvlist", drivers, &size, NULL, 0) == -1) { - error = errno; free(drivers); return (errno); } @@ -68,7 +66,6 @@ kiconv_lookupcs(const char *tocode, cons { size_t i, size; struct iconv_cspair_info *csi, *csip; - int error; if (sysctlbyname("kern.iconv.cslist", NULL, &size, NULL, 0) == -1) return (errno); @@ -77,9 +74,8 @@ kiconv_lookupcs(const char *tocode, cons if (csi == NULL) return (ENOMEM); if (sysctlbyname("kern.iconv.cslist", csi, &size, NULL, 0) == -1) { - error = errno; free(csi); - return (error); + return (errno); } for (i = 0, csip = csi; i < (size/sizeof(*csi)); i++, csip++){ if (strcmp(csip->cs_to, tocode) == 0 && From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 21:51:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 146071065670; Mon, 22 Jun 2009 21:51:30 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01BCF8FC17; Mon, 22 Jun 2009 21:51:30 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MLpTEZ053949; Mon, 22 Jun 2009 21:51:29 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MLpTmD053947; Mon, 22 Jun 2009 21:51:29 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <200906222151.n5MLpTmD053947@svn.freebsd.org> From: Joel Dahl Date: Mon, 22 Jun 2009 21:51:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194664 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 21:51:30 -0000 Author: joel (doc committer) Date: Mon Jun 22 21:51:29 2009 New Revision: 194664 URL: http://svn.freebsd.org/changeset/base/194664 Log: Start documenting some of the new sound stuff. More is on the way. Probably also needs some more mdoc love. Reviewed by: ariff Modified: head/share/man/man4/pcm.4 Modified: head/share/man/man4/pcm.4 ============================================================================== --- head/share/man/man4/pcm.4 Mon Jun 22 21:49:55 2009 (r194663) +++ head/share/man/man4/pcm.4 Mon Jun 22 21:51:29 2009 (r194664) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 1, 2009 +.Dd June 22, 2009 .Dt SOUND 4 .Os .Sh NAME @@ -178,6 +178,12 @@ Equivalent to a symlink from .Pa /dev/dsp to .Pa /dev/dsp Ns Va ${hw.snd.default_unit} . +.It Va hw.snd.feeder_eq_exact_rate +Only certain rates are allowed for precise processing. +The default behavior is however to allow sloppy processing for all rates, +even the unsupported ones. +Enable to toggle this requirement and only allow processing for supported +rates. .It Va hw.snd.feeder_rate_max Maximum allowable sample rate. .It Va hw.snd.feeder_rate_min @@ -188,6 +194,40 @@ cost of accuracy. All requested sample rates will be rounded to the nearest threshold value. Possible values range between 0 (disabled) and 500. Default is 25. +.It Va hw.snd.feeder_polyphase_max +Adjust to set the maximum number of allowed polyphase entries during the +process of building resampling filters. +Only applicable when the SINC interpolator is used. +Default value is 183040. +Set to 0 to disable polyphase resampling. +.It Va hw.snd.feeder_quality +Sample rate converter quality. +Default value is 1, linear interpolation. +Available options include: +.Bl -tag -width 2n +.It 0 +Zero Order Hold, ZOH. +Very fast, but with poor quality. +.It 1 +Linear interpolation. +Fast, quality is subject to personal preference. +Technically the quality is poor however, due to the lack of anti-aliasing +filtering. +.It 2 +Bandlimited SINC interpolator. +Implements polyphase banking to boost the conversion speed, at the cost of +memory usage, with multiple high quality polynomial interpolators to improve +the conversion accuracy. +100% fixed point, 64bit accumulator with 32bit coefficients and high precision +sample buffering. +Quality values are 100dB stopband, 8 taps and 85% bandwidth. +.It 3 +Continuation of the bandlimited SINC interpolator, with 100dB stopband, 36 +taps and 90% bandwidth as quality values. +.It 4 +Continuation of the bandlimited SINC inteprolator, with 100dB stopband, 164 +taps and 97% bandwidth as quality values. +.El .It Va hw.snd.latency Configure the buffering latency. Only affects applications that do not explicitly request @@ -208,7 +248,7 @@ The default value is 1, which is conside Global .Tn VCHAN setting that only affects devices with at least one playback or recording channel available. -The sound system will dynamically create up this many +The sound system will dynamically create up to this many .Tn VCHANs . Set to .Dq 0 @@ -221,6 +261,10 @@ Controls the internal format conversion available transparently to the application software. When disabled or not available, the application will only be able to select formats the device natively supports. +.It Va hw.snd.report_soft_matrix +Enable seamless channel matrixing even if the hardware does not support it. +Makes it possible to play multichannel streams even with a simple stereo +sound card. .It Va hw.snd.verbose Level of verbosity for the .Pa /dev/sndstat @@ -243,6 +287,38 @@ File names and versions of the currently .It 4 Various messages intended for debugging. .El +.It Va hw.snd.vpc_0db +Default value for pcm volume. +Increase to give more room for attenuation control. +Decrease for more amplification, with the possible cost of sound clipping. +.It Va hw.snd.vpc_autoreset +When a channel is closed the channel volume will be reset to 0db. +This means that any changes to the volume will be lost. +Enabling this will preserve the volume, at the cost of possible confusion +when applications tries to re-open the same device. +.It Va hw.snd.vpc_mixer_bypass +The recommended way to use the vpc feature is to teach applications to use +the correct ioctl(): SNDCTL_DSP_GETPLAYVOL, SNDCTL_DSP_SETPLAYVOL, +SNDCTL_DSP_SETRECVOL, SNDCTL_DSP_SETRECVOL. +This is however not always possible. +Enable this to allow applications to use their own existing mixer logic +to control their own channel volume. +.It Va hw.snd.vpc_reset +Enable to restore all channel volumes back to the default value of 0db. +.It Va dev.pcm.%d.bitperfect +Enable or disable bitperfect mode. +When enabled, channels will skip all dsp processing, such as channel +matrixing, rate converting and equalizing. +The pure pcm stream will be fed directly to the hardware. +If +.Tn VCHANs +are enabled, the bitperfect mode will use the +.Tn VCHAN +format/rate as the definitive format/rate target. +The recommended way to use bitperfect mode is to disable +.Tn VCHANs +and enable this sysctl. +Default is disabled. .It Va dev.pcm.%d.[play|rec].vchans The current number of .Tn VCHANs @@ -260,6 +336,36 @@ Format for mixing. All playback paths will be converted to this format before the mixing process begins. +.It Va dev.pcm.%d.[play|rec].vchanmode +.Tn VCHAN +format/rate selection. +Available options include: +.Bl -tag -width 2n +.It fixed / 0 +Channel mixing is done using fixed format/rate. +Advanced operations such as digital passthrough will not work. +Can be considered as a 'legacy' mode. +This is the default mode for hardware channels which lack support for digital +formats. +.It passthrough / 1 +Channel mixing is done using fixed format/rate, but advanced operations such +as digital passthrough also works. +All channels will produce sound as usual until a digital format playback is +requested. +When this happens all other channels will be muted and the latest incoming +digital format will be allowed to pass through undisturbed. +Multiple concurrent digital streams are supported, but the latest stream will +take precedence and mute all other streams. +.It adaptive / 2 +Works like the 'passthrough' mode, but is a bit smarter, especially for +multiple pcm channels with different format/rate. +When a new channel is about to start, the entire list of virtual channels will +be scanned and the channel with the best format/rate (usuallay the +highest/biggest) will be selected. +This ensures that mixing quality depends on the best channel. +The downside is that the hardware DMA mode needs to be restarted, which may +cause annoying pops or clicks. +.El .It Va dev.pcm.%d.[play|rec].vchanrate Sample rate speed for .Tn VCHAN @@ -401,6 +507,14 @@ A device node is not created properly. .%T "The OSS API" .%O "http://www.opensound.com/pguide/oss.pdf" .Re +.Rs +.%T "Julius O'Smith's Digital Audio Resampling" +.%O "http://ccrma.stanford.edu/~jos/resample/" +.Re +.Rs +.%T "Polynomial Interpolators for High-Quality Resampling of Oversampled Audio, by Olli Niemitalo" +.%O "http://www.student.oulu.fi/~oniemita/dsp/deip.pdf" +.Re .Sh HISTORY The .Nm From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 22:09:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37B6F10656FE; Mon, 22 Jun 2009 22:09:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 258588FC1A; Mon, 22 Jun 2009 22:09:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MM9I7c054351; Mon, 22 Jun 2009 22:09:18 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MM9IV6054349; Mon, 22 Jun 2009 22:09:18 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906222209.n5MM9IV6054349@svn.freebsd.org> From: Xin LI Date: Mon, 22 Jun 2009 22:09: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: r194665 - head/sys/libkern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 22:09:20 -0000 Author: delphij Date: Mon Jun 22 22:09:18 2009 New Revision: 194665 URL: http://svn.freebsd.org/changeset/base/194665 Log: done method is supposed to return int. Modified: head/sys/libkern/iconv_converter_if.m Modified: head/sys/libkern/iconv_converter_if.m ============================================================================== --- head/sys/libkern/iconv_converter_if.m Mon Jun 22 21:51:29 2009 (r194664) +++ head/sys/libkern/iconv_converter_if.m Mon Jun 22 22:09:18 2009 (r194665) @@ -61,7 +61,7 @@ STATICMETHOD int init { struct iconv_converter_class *dcp; } DEFAULT iconv_converter_initstub; -STATICMETHOD void done { +STATICMETHOD int done { struct iconv_converter_class *dcp; } DEFAULT iconv_converter_donestub; From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 22:11:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAE39106564A; Mon, 22 Jun 2009 22:11:11 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from mail-yx0-f200.google.com (mail-yx0-f200.google.com [209.85.210.200]) by mx1.freebsd.org (Postfix) with ESMTP id A5A688FC12; Mon, 22 Jun 2009 22:11:07 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by yxe38 with SMTP id 38so2531873yxe.3 for ; Mon, 22 Jun 2009 15:11:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=hxtO4GBJsKX6g2tNNXz2FoHCD8UN1+rZj1ukLcVKdmI=; b=NE3+zR47sIx68oqDGlSyIArGHR2cr1BUlpjGyIgWJ0kgD9amlyjWbwOoXVlL6FAdiX zeHLsItZR//punQ3dbj8qTmxm7CVR+yd28k9WxBQ4DqniTHI7taz6Ifi2uxG/iEAkcXH U/nZ+P9i5JtaeSIxdCcQZ5k1k4NL5hCfWWXK4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=SL2Lo6jchPW0YvzQBVUe/WM3kjW1Bua8OWzCALXa2W20Q2uDfm/UVfPP5POMLCO3Oj nn64nfDQmutlWgdYJ4gfNbVHpx95q0W/w2ZNI3S1H1+8SfZgyCEQVLZmrg7J3K/jX3xU 9qrRTlHF1RjlzxB6x5O/YqaX8BXtk4E6L5xS0= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.100.195.15 with SMTP id s15mr8750486anf.18.1245708657554; Mon, 22 Jun 2009 15:10:57 -0700 (PDT) In-Reply-To: <200906221935.n5MJZdLJ050266@svn.freebsd.org> References: <200906221935.n5MJZdLJ050266@svn.freebsd.org> Date: Mon, 22 Jun 2009 15:10:57 -0700 X-Google-Sender-Auth: 04c869c0f1c0201b Message-ID: <3c1674c90906221510s9b62e25w3a5d41c21bd512e1@mail.gmail.com> From: Kip Macy To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Sam Leffler Subject: Re: svn commit: r194643 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 22:11:12 -0000 On Mon, Jun 22, 2009 at 12:35 PM, Andre Oppermann wrote: > Author: andre > Date: Mon Jun 22 19:35:39 2009 > New Revision: 194643 > URL: http://svn.freebsd.org/changeset/base/194643 > > Log: > =A0Update m_demote: > =A0- remove HT_HEADER test (MT_HEADER =3D=3D MT_DATA for some time now) > =A0- be more pedantic about m_nextpkt in other than first mbuf > =A0- update m_flags to be retained > > Modified: > =A0head/sys/kern/uipc_mbuf.c > > Modified: head/sys/kern/uipc_mbuf.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/uipc_mbuf.c =A0 Mon Jun 22 19:09:48 2009 =A0 =A0 =A0 = =A0(r194642) > +++ head/sys/kern/uipc_mbuf.c =A0 Mon Jun 22 19:35:39 2009 =A0 =A0 =A0 = =A0(r194643) > @@ -320,11 +320,13 @@ m_demote(struct mbuf *m0, int all) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0m->m_flags &=3D ~M_PKTHDR; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bzero(&m->m_pkthdr, sizeof= (struct pkthdr)); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (m->m_type =3D=3D MT_HEADER) > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 m->m_type =3D MT_DATA; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (m !=3D m0 && m->m_nextpkt !=3D NULL) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (m !=3D m0 && m->m_nextpkt !=3D NULL) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 KASSERT(m->m_nextpkt =3D=3D= NULL, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ("%s: m_nextpkt not= NULL", __func__)); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 m_freem(m->m_nextpkt); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0m->m_nextpkt =3D NULL; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 m->m_flags =3D m->m_flags & (M_EXT|M_EOR|M_= RDONLY|M_FREELIST); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 m->m_flags =3D m->m_flags & (M_EXT|M_RDONLY= |M_FREELIST|M_NOFREE); > =A0 =A0 =A0 =A0} > Freeing an mbuf that shouldn't be there is not a safe change. You don't know that m_nextpkt isn't pointing at some random value in memory and that doing so isn't going to lead to some inexplicable crash some time later. This is not a good strategy from a support standpoint. I've cc'd sam in case he feels differently. Cheers, Kip From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 22:20:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C6E861065670; Mon, 22 Jun 2009 22:20:38 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9AA308FC16; Mon, 22 Jun 2009 22:20:38 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MMKckZ054624; Mon, 22 Jun 2009 22:20:38 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MMKcWg054621; Mon, 22 Jun 2009 22:20:38 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <200906222220.n5MMKcWg054621@svn.freebsd.org> From: Andre Oppermann Date: Mon, 22 Jun 2009 22:20: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: r194667 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 22:20:39 -0000 Author: andre Date: Mon Jun 22 22:20:38 2009 New Revision: 194667 URL: http://svn.freebsd.org/changeset/base/194667 Log: Add m_mbuftouio() helper function to copy(out) an arbitrary long mbuf chain into an arbitrary large uio in a single step. It is a functional mirror image of m_uiotombuf(). This function is supposed to be used instead of hand rolled code with the same purpose and to concentrate it into one place for potential further optimization or hardware assistance. Modified: head/sys/kern/uipc_mbuf.c head/sys/sys/mbuf.h Modified: head/sys/kern/uipc_mbuf.c ============================================================================== --- head/sys/kern/uipc_mbuf.c Mon Jun 22 22:09:19 2009 (r194666) +++ head/sys/kern/uipc_mbuf.c Mon Jun 22 22:20:38 2009 (r194667) @@ -1770,6 +1770,34 @@ m_uiotombuf(struct uio *uio, int how, in } /* + * Copy an mbuf chain into a uio limited by len if set. + */ +int +m_mbuftouio(struct uio *uio, struct mbuf *m, int len) +{ + int error, length, total; + int progress = 0; + + if (len > 0) + total = min(uio->uio_resid, len); + else + total = uio->uio_resid; + + /* Fill the uio with data from the mbufs. */ + for (; m != NULL; m = m->m_next) { + length = min(m->m_len, total - progress); + + error = uiomove(mtod(m, void *), length, uio); + if (error) + return (error); + + progress += length; + } + + return (0); +} + +/* * Set the m_data pointer of a newly-allocated mbuf * to place an object of the specified size at the * end of the mbuf, longword aligned. Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Mon Jun 22 22:09:19 2009 (r194666) +++ head/sys/sys/mbuf.h Mon Jun 22 22:20:38 2009 (r194667) @@ -813,6 +813,7 @@ void m_freem(struct mbuf *); struct mbuf *m_getm2(struct mbuf *, int, int, short, int); struct mbuf *m_getptr(struct mbuf *, int, int *); u_int m_length(struct mbuf *, struct mbuf **); +int m_mbuftouio(struct uio *, struct mbuf *, int); void m_move_pkthdr(struct mbuf *, struct mbuf *); struct mbuf *m_prepend(struct mbuf *, int, int); void m_print(const struct mbuf *, int); From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 22:46:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72C441065676; Mon, 22 Jun 2009 22:46:37 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56ECE8FC14; Mon, 22 Jun 2009 22:46:37 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MMkb1V055112; Mon, 22 Jun 2009 22:46:37 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MMkban055108; Mon, 22 Jun 2009 22:46:37 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906222246.n5MMkban055108@svn.freebsd.org> From: Sam Leffler Date: Mon, 22 Jun 2009 22:46: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: r194668 - in head/sys/arm: conf xscale/ixp425 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 22:46:38 -0000 Author: sam Date: Mon Jun 22 22:46:37 2009 New Revision: 194668 URL: http://svn.freebsd.org/changeset/base/194668 Log: o remove hack to write UUE+RTOIE in the uart's IER; force them with hints o honor hints for the rclk Modified: head/sys/arm/conf/AVILA.hints head/sys/arm/conf/CAMBRIA.hints head/sys/arm/xscale/ixp425/uart_bus_ixp425.c Modified: head/sys/arm/conf/AVILA.hints ============================================================================== --- head/sys/arm/conf/AVILA.hints Mon Jun 22 22:20:38 2009 (r194667) +++ head/sys/arm/conf/AVILA.hints Mon Jun 22 22:46:37 2009 (r194668) @@ -9,10 +9,12 @@ hint.uart.0.at="ixp0" hint.uart.0.addr=0xc8000000 hint.uart.0.irq=15 hint.uart.0.flags=0x10 +hint.uart.0.ier_rxbits=0x5d # NB: need UUE+RTOIE # USART0 is unit 1 hint.uart.1.at="ixp0" hint.uart.1.addr=0xc8001000 hint.uart.1.irq=13 +hint.uart.1.ier_rxbits=0x5d # NB: need UUE+RTOIE # NPE Hardware Queue Manager hint.ixpqmgr.0.at="ixp0" Modified: head/sys/arm/conf/CAMBRIA.hints ============================================================================== --- head/sys/arm/conf/CAMBRIA.hints Mon Jun 22 22:20:38 2009 (r194667) +++ head/sys/arm/conf/CAMBRIA.hints Mon Jun 22 22:46:37 2009 (r194668) @@ -9,6 +9,7 @@ hint.uart.0.at="ixp0" hint.uart.0.addr=0xc8000000 hint.uart.0.irq=15 hint.uart.0.flags=0x10 +hint.uart.0.ier_rxbits=0x5d # NB: need UUE+RTOIE # NB: no UART1 on ixp436 Modified: head/sys/arm/xscale/ixp425/uart_bus_ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/uart_bus_ixp425.c Mon Jun 22 22:20:38 2009 (r194667) +++ head/sys/arm/xscale/ixp425/uart_bus_ixp425.c Mon Jun 22 22:46:37 2009 (r194668) @@ -68,29 +68,15 @@ static int uart_ixp425_probe(device_t dev) { struct uart_softc *sc; + int unit = device_get_unit(dev); + u_int rclk; sc = device_get_softc(dev); sc->sc_class = &uart_ns8250_class; - sc->sc_rrid = 0; - sc->sc_rtype = SYS_RES_MEMORY; - sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype, &sc->sc_rrid, - 0, ~0, uart_getrange(sc->sc_class), RF_ACTIVE); - if (sc->sc_rres == NULL) { - return (ENXIO); - } - sc->sc_bas.bsh = rman_get_bushandle(sc->sc_rres); - sc->sc_bas.bst = rman_get_bustag(sc->sc_rres); - /* - * XXX set UART Unit Enable (0x40) AND - * receiver timeout int enable (0x10). - * The first turns on the UART. The second is necessary to get - * interrupts when the FIFO has data but is not full. Note that - * uart_ns8250 carefully avoids touching these bits so we can - * just set them here and proceed. But this is fragile... - */ - bus_space_write_4(sc->sc_bas.bst, sc->sc_bas.bsh, IXP425_UART_IER, - IXP425_UART_IER_UUE | IXP425_UART_IER_RTOIE); - bus_release_resource(dev, sc->sc_rtype, sc->sc_rrid, sc->sc_rres); + if (resource_int_value("uart", unit, "rclk", &rclk)) + rclk = IXP425_UART_FREQ; + if (bootverbose) + device_printf(dev, "rclk %u\n", rclk); - return uart_bus_probe(dev, 0, IXP425_UART_FREQ, 0, 0); + return uart_bus_probe(dev, 0, rclk, 0, 0); } From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 22:47:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC02410656B3; Mon, 22 Jun 2009 22:47:06 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 99CDA8FC12; Mon, 22 Jun 2009 22:47:06 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MMl6Z6055158; Mon, 22 Jun 2009 22:47:06 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MMl6RX055156; Mon, 22 Jun 2009 22:47:06 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906222247.n5MMl6RX055156@svn.freebsd.org> From: Sam Leffler Date: Mon, 22 Jun 2009 22:47: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: r194669 - head/sys/arm/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 22:47:07 -0000 Author: sam Date: Mon Jun 22 22:47:06 2009 New Revision: 194669 URL: http://svn.freebsd.org/changeset/base/194669 Log: fix typo Modified: head/sys/arm/conf/CAMBRIA.hints Modified: head/sys/arm/conf/CAMBRIA.hints ============================================================================== --- head/sys/arm/conf/CAMBRIA.hints Mon Jun 22 22:46:37 2009 (r194668) +++ head/sys/arm/conf/CAMBRIA.hints Mon Jun 22 22:47:06 2009 (r194669) @@ -11,7 +11,7 @@ hint.uart.0.irq=15 hint.uart.0.flags=0x10 hint.uart.0.ier_rxbits=0x5d # NB: need UUE+RTOIE -# NB: no UART1 on ixp436 +# NB: no UART1 on ixp435 # NPE Hardware Queue Manager hint.ixpqmgr.0.at="ixp0" From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 22:54:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7EDD4106564A; Mon, 22 Jun 2009 22:54:13 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BD818FC17; Mon, 22 Jun 2009 22:54:13 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MMsDSx055310; Mon, 22 Jun 2009 22:54:13 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MMsDYZ055305; Mon, 22 Jun 2009 22:54:13 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906222254.n5MMsDYZ055305@svn.freebsd.org> From: Sam Leffler Date: Mon, 22 Jun 2009 22:54: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: r194670 - head/sys/arm/xscale/ixp425 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 22:54:14 -0000 Author: sam Date: Mon Jun 22 22:54:13 2009 New Revision: 194670 URL: http://svn.freebsd.org/changeset/base/194670 Log: o add a bus space tag that forces a 2usec delay between r/w ops; this is used for the optional GPS+RS485 uarts on the Gateworks Cambria boards which otherwise are unreliable o setup the hack bus space tag for the GPS+RS485 uarts o program the gpio interrupts for the uarts to be edge-rising o force timing on the expansion bus for the uarts to be "slow" Thanks to Chris Lang of Gateworks for these tips. Added: head/sys/arm/xscale/ixp425/cambria_exp_space.c (contents, props changed) Modified: head/sys/arm/xscale/ixp425/files.avila head/sys/arm/xscale/ixp425/ixp425.c head/sys/arm/xscale/ixp425/ixp425var.h Added: head/sys/arm/xscale/ixp425/cambria_exp_space.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/xscale/ixp425/cambria_exp_space.c Mon Jun 22 22:54:13 2009 (r194670) @@ -0,0 +1,95 @@ +/*- + * Copyright (c) 2009 Sam Leffler. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Hack bus space tag for slow devices on the Cambria expansion bus; + * we slow the timing and add a 2us delay between r/w ops. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include + +#include +#include + +/* Prototypes for all the bus_space structure functions */ +bs_protos(exp); +bs_protos(generic); +bs_protos(generic_armv4); + +static uint8_t +cambria_bs_r_1(void *t, bus_space_handle_t h, bus_size_t o) +{ + DELAY(2); + return bus_space_read_1((struct bus_space *)t, h, o); +} + +static void +cambria_bs_w_1(void *t, bus_space_handle_t h, bus_size_t o, u_int8_t v) +{ + DELAY(2); + bus_space_write_1((struct bus_space *)t, h, o, v); +} + +/* NB: we only define what's needed by uart */ +struct bus_space cambria_exp_bs_tag = { + /* mapping/unmapping */ + .bs_map = generic_bs_map, + .bs_unmap = generic_bs_unmap, + + /* barrier */ + .bs_barrier = generic_bs_barrier, + + /* read (single) */ + .bs_r_1 = cambria_bs_r_1, + + /* write (single) */ + .bs_w_1 = cambria_bs_w_1, +}; + +void +cambria_exp_bus_init(struct ixp425_softc *sc) +{ + uint32_t cs3; + + KASSERT(cpu_is_ixp43x(), ("wrong cpu type")); + + cambria_exp_bs_tag.bs_cookie = sc->sc_iot; + + cs3 = EXP_BUS_READ_4(sc, EXP_TIMING_CS3_OFFSET); + /* XXX force slowest possible timings and byte mode */ + EXP_BUS_WRITE_4(sc, EXP_TIMING_CS3_OFFSET, + cs3 | (EXP_T1|EXP_T2|EXP_T3|EXP_T4|EXP_T5) | EXP_BYTE_EN); + + /* XXX force GPIO 3+4 for GPS+RS485 uarts */ + ixp425_set_gpio(sc, 3, GPIO_TYPE_EDG_RISING); + ixp425_set_gpio(sc, 4, GPIO_TYPE_EDG_RISING); +} Modified: head/sys/arm/xscale/ixp425/files.avila ============================================================================== --- head/sys/arm/xscale/ixp425/files.avila Mon Jun 22 22:47:06 2009 (r194669) +++ head/sys/arm/xscale/ixp425/files.avila Mon Jun 22 22:54:13 2009 (r194670) @@ -2,6 +2,7 @@ arm/xscale/ixp425/avila_machdep.c standard arm/xscale/ixp425/avila_ata.c optional avila_ata arm/xscale/ixp425/avila_led.c optional avila_led -arm/xscale/ixp425/cambria_led.c optional cambria_led +arm/xscale/ixp425/cambria_exp_space.c standard arm/xscale/ixp425/cambria_fled.c optional cambria_fled +arm/xscale/ixp425/cambria_led.c optional cambria_led arm/xscale/ixp425/ixdp425_pci.c optional pci Modified: head/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 22:47:06 2009 (r194669) +++ head/sys/arm/xscale/ixp425/ixp425.c Mon Jun 22 22:54:13 2009 (r194670) @@ -313,6 +313,17 @@ ixp425_attach(device_t dev) } arm_post_filter = ixp425_post_filter; + if (bus_space_map(sc->sc_iot, IXP425_GPIO_HWBASE, IXP425_GPIO_SIZE, + 0, &sc->sc_gpio_ioh)) + panic("%s: unable to map GPIO registers", __func__); + if (bus_space_map(sc->sc_iot, IXP425_EXP_HWBASE, IXP425_EXP_SIZE, + 0, &sc->sc_exp_ioh)) + panic("%s: unable to map Expansion Bus registers", __func__); + + /* XXX belongs in platform init */ + if (cpu_is_ixp43x()) + cambria_exp_bus_init(sc); + if (bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 0xffffffff, 0xff, 0xffffffff, 0, NULL, NULL, &sc->sc_dmat)) @@ -339,13 +350,6 @@ ixp425_attach(device_t dev) /* attach wired devices via hints */ bus_enumerate_hinted_children(dev); - if (bus_space_map(sc->sc_iot, IXP425_GPIO_HWBASE, IXP425_GPIO_SIZE, - 0, &sc->sc_gpio_ioh)) - panic("%s: unable to map GPIO registers", __func__); - if (bus_space_map(sc->sc_iot, IXP425_EXP_HWBASE, IXP425_EXP_SIZE, - 0, &sc->sc_exp_ioh)) - panic("%s: unable to map Expansion Bus registers", __func__); - bus_generic_probe(dev); bus_generic_attach(dev); @@ -420,6 +424,7 @@ struct hwvtrans { uint32_t size; uint32_t vbase; int isa4x; /* XXX needs special bus space tag */ + int isslow; /* XXX needs special bus space tag */ }; static const struct hwvtrans * @@ -453,10 +458,12 @@ gethwvtrans(uint32_t hwbase, uint32_t si .vbase = IXP435_USB2_VBASE }, { .hwbase = CAMBRIA_GPS_HWBASE, .size = CAMBRIA_GPS_SIZE, - .vbase = CAMBRIA_GPS_VBASE }, + .vbase = CAMBRIA_GPS_VBASE, + .isslow = 1 }, { .hwbase = CAMBRIA_RS485_HWBASE, .size = CAMBRIA_RS485_SIZE, - .vbase = CAMBRIA_RS485_VBASE }, + .vbase = CAMBRIA_RS485_VBASE, + .isslow = 1 }, }; int i; @@ -522,7 +529,8 @@ ixp425_alloc_resource(device_t dev, devi device_printf(child, "%s: assign 0x%lx:0x%lx%s\n", __func__, start, end - start, - vtrans->isa4x ? " A4X" : ""); + vtrans->isa4x ? " A4X" : + vtrans->isslow ? " SLOW" : ""); } } else vtrans = gethwvtrans(start, end - start); @@ -578,6 +586,8 @@ ixp425_activate_resource(device_t dev, d } if (vtrans->isa4x) rman_set_bustag(r, &ixp425_a4x_bs_tag); + else if (vtrans->isslow) + rman_set_bustag(r, &cambria_exp_bs_tag); else rman_set_bustag(r, sc->sc_iot); rman_set_bushandle(r, vtrans->vbase); Modified: head/sys/arm/xscale/ixp425/ixp425var.h ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425var.h Mon Jun 22 22:47:06 2009 (r194669) +++ head/sys/arm/xscale/ixp425/ixp425var.h Mon Jun 22 22:54:13 2009 (r194670) @@ -97,6 +97,9 @@ struct ixppcib_softc { extern struct bus_space ixp425_bs_tag; extern struct bus_space ixp425_a4x_bs_tag; +extern struct bus_space cambria_exp_bs_tag; +void cambria_exp_bus_init(struct ixp425_softc *); + void ixp425_io_bs_init(bus_space_tag_t, void *); void ixp425_mem_bs_init(bus_space_tag_t, void *); From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 22:54:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A63B11065680 for ; Mon, 22 Jun 2009 22:54:43 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 78F2D8FC1D for ; Mon, 22 Jun 2009 22:54:40 +0000 (UTC) (envelope-from andre@freebsd.org) Received: (qmail 19697 invoked from network); 22 Jun 2009 22:15:25 -0000 Received: from localhost (HELO [127.0.0.1]) ([127.0.0.1]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 22 Jun 2009 22:15:25 -0000 Message-ID: <4A40056F.4000207@freebsd.org> Date: Tue, 23 Jun 2009 00:27:59 +0200 From: Andre Oppermann User-Agent: Thunderbird 1.5.0.14 (Windows/20071210) MIME-Version: 1.0 To: Kip Macy References: <200906221935.n5MJZdLJ050266@svn.freebsd.org> <3c1674c90906221510s9b62e25w3a5d41c21bd512e1@mail.gmail.com> In-Reply-To: <3c1674c90906221510s9b62e25w3a5d41c21bd512e1@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Sam Leffler Subject: Re: svn commit: r194643 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 22:54:44 -0000 Kip Macy wrote: > On Mon, Jun 22, 2009 at 12:35 PM, Andre Oppermann wrote: >> Author: andre >> Date: Mon Jun 22 19:35:39 2009 >> New Revision: 194643 >> URL: http://svn.freebsd.org/changeset/base/194643 >> >> Log: >> Update m_demote: >> - remove HT_HEADER test (MT_HEADER == MT_DATA for some time now) >> - be more pedantic about m_nextpkt in other than first mbuf >> - update m_flags to be retained >> >> Modified: >> head/sys/kern/uipc_mbuf.c >> >> Modified: head/sys/kern/uipc_mbuf.c >> ============================================================================== >> --- head/sys/kern/uipc_mbuf.c Mon Jun 22 19:09:48 2009 (r194642) >> +++ head/sys/kern/uipc_mbuf.c Mon Jun 22 19:35:39 2009 (r194643) >> @@ -320,11 +320,13 @@ m_demote(struct mbuf *m0, int all) >> m->m_flags &= ~M_PKTHDR; >> bzero(&m->m_pkthdr, sizeof(struct pkthdr)); >> } >> - if (m->m_type == MT_HEADER) >> - m->m_type = MT_DATA; >> - if (m != m0 && m->m_nextpkt != NULL) >> + if (m != m0 && m->m_nextpkt != NULL) { >> + KASSERT(m->m_nextpkt == NULL, >> + ("%s: m_nextpkt not NULL", __func__)); >> + m_freem(m->m_nextpkt); >> m->m_nextpkt = NULL; >> - m->m_flags = m->m_flags & (M_EXT|M_EOR|M_RDONLY|M_FREELIST); >> + } >> + m->m_flags = m->m_flags & (M_EXT|M_RDONLY|M_FREELIST|M_NOFREE); >> } >> > > > Freeing an mbuf that shouldn't be there is not a safe change. You > don't know that m_nextpkt isn't pointing at some random value in > memory and that doing so isn't going to lead to some inexplicable > crash some time later. This is not a good strategy from a support > standpoint. If m_nextpkt is a random value we will crash anyway at the next place where it is being looked at. If it is not being looked at we just get by by chance. If m_nextpkt is valid we either yank it from someone else who will crash later on or if we just NULL it out we may have a memory leak. IMHO the latter is worse as a slowly building memory leak is much harder to track down than a crash which provides kernel dumps and backtraces. As soon as INVARIANTS are enable the KASSERT will catch the offender red handed. This is my opinion on it. Other views are welcome. -- Andre From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 22:54:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97BA51065688; Mon, 22 Jun 2009 22:54:44 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8636D8FC1E; Mon, 22 Jun 2009 22:54:44 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MMsixO055353; Mon, 22 Jun 2009 22:54:44 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MMsiLK055351; Mon, 22 Jun 2009 22:54:44 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906222254.n5MMsiLK055351@svn.freebsd.org> From: Sam Leffler Date: Mon, 22 Jun 2009 22: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: r194671 - head/sys/arm/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 22:54:45 -0000 Author: sam Date: Mon Jun 22 22:54:44 2009 New Revision: 194671 URL: http://svn.freebsd.org/changeset/base/194671 Log: enable optional GPS+RS485 uarts Modified: head/sys/arm/conf/CAMBRIA.hints Modified: head/sys/arm/conf/CAMBRIA.hints ============================================================================== --- head/sys/arm/conf/CAMBRIA.hints Mon Jun 22 22:54:13 2009 (r194670) +++ head/sys/arm/conf/CAMBRIA.hints Mon Jun 22 22:54:44 2009 (r194671) @@ -13,6 +13,20 @@ hint.uart.0.ier_rxbits=0x5d # NB: need U # NB: no UART1 on ixp435 +# optional GPS serial port +hint.uart.1.at="ixp0" +hint.uart.1.addr=0x53fc0000 +hint.uart.1.irq=20 +hint.uart.1.ier_rxbits=0x1 +hint.uart.1.rclk=1843200 +hint.uart.1.rwdelay=20 +# optional RS485 serial port +hint.uart.2.at="ixp0" +hint.uart.2.addr=0x53f80000 +hint.uart.2.irq=21 +hint.uart.2.rclk=1843200 +hint.uart.2.rwdelay=2 + # NPE Hardware Queue Manager hint.ixpqmgr.0.at="ixp0" From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 22:59:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1545B106567B; Mon, 22 Jun 2009 22:59:38 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.28]) by mx1.freebsd.org (Postfix) with ESMTP id 737CC8FC23; Mon, 22 Jun 2009 22:59:37 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by yw-out-2324.google.com with SMTP id 9so1582607ywe.13 for ; Mon, 22 Jun 2009 15:59:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=bvNVWBLzgvAN3N6k7ZillFGjG+Jw/3mBZqUxuK/8aAQ=; b=m9ObylLkFFZ/sWMz1zAuRKoq/NF9qz3AKpPkUxwWNBkqZe4gkE3cD4ttiJu6g47dkb fbPFArLqoY4uTr4psZ/InUud5eWY6NcSW+9iPX91VCraY2oHfAruQ/IEIqd5EDtz+0tw EGLOALd7Kiw8I3HZ8+PONkwTZ+EKh0LwE2wNU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=rIUdEULu69aI784d4eWi2oHBXOldni8jS2vF/PPPSGqpfYHKwZZCkd12po7kHf9x13 i8v/XkfE6eTCdWxCAgI0BO6uonC9fNhuTSS0m5c9KjrdwjtexAmlK97sJHVLk65vP51j 8WKa/Xc++bYNkNrGvDXuEsMponMwRX54qpCW0= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.100.205.15 with SMTP id c15mr8885850ang.5.1245711576836; Mon, 22 Jun 2009 15:59:36 -0700 (PDT) In-Reply-To: <4A40056F.4000207@freebsd.org> References: <200906221935.n5MJZdLJ050266@svn.freebsd.org> <3c1674c90906221510s9b62e25w3a5d41c21bd512e1@mail.gmail.com> <4A40056F.4000207@freebsd.org> Date: Mon, 22 Jun 2009 15:59:36 -0700 X-Google-Sender-Auth: 72e52da48045eab9 Message-ID: <3c1674c90906221559q66fe3934ued99694c30aa3a81@mail.gmail.com> From: Kip Macy To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Sam Leffler Subject: Re: svn commit: r194643 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 22:59:38 -0000 =A0As soon as > INVARIANTS are enable the KASSERT will catch the offender red handed. The INVARIANTS check DTRT. i.e. fail-fast. If you're double-freeing a valid mbuf you'll get a random crash elsewhere. -Kip From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 23:08:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 29DFE106564A; Mon, 22 Jun 2009 23:08:06 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 16CD38FC0C; Mon, 22 Jun 2009 23:08:06 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MN85iO055715; Mon, 22 Jun 2009 23:08:05 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MN856I055711; Mon, 22 Jun 2009 23:08:05 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <200906222308.n5MN856I055711@svn.freebsd.org> From: Andre Oppermann Date: Mon, 22 Jun 2009 23:08: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: r194672 - in head/sys: kern netinet sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 23:08:06 -0000 Author: andre Date: Mon Jun 22 23:08:05 2009 New Revision: 194672 URL: http://svn.freebsd.org/changeset/base/194672 Log: Add soreceive_stream(), an optimized version of soreceive() for stream (TCP) sockets. It is functionally identical to generic soreceive() but has a number stream specific optimizations: o does only one sockbuf unlock/lock per receive independent of the length of data to be moved into the uio compared to soreceive() which unlocks/locks per *mbuf*. o uses m_mbuftouio() instead of its own copy(out) variant. o much more compact code flow as a large number of special cases is removed. o much improved reability. It offers significantly reduced CPU usage and lock contention when receiving fast TCP streams. Additional gains are obtained when the receiving application is using SO_RCVLOWAT to batch up some data before a read (and wakeup) is done. This function was written by "reverse engineering" and is not just a stripped down variant of soreceive(). It is not yet enabled by default on TCP sockets. Instead it is commented out in the protocol initialization in tcp_usrreq.c until more widespread testing has been done. Testers, especially with 10GigE gear, are welcome. MFP4: r164817 //depot/user/andre/soreceive_stream/ Modified: head/sys/kern/uipc_socket.c head/sys/netinet/tcp_usrreq.c head/sys/sys/socketvar.h Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Mon Jun 22 22:54:44 2009 (r194671) +++ head/sys/kern/uipc_socket.c Mon Jun 22 23:08:05 2009 (r194672) @@ -1857,6 +1857,202 @@ release: } /* + * Optimized version of soreceive() for stream (TCP) sockets. + */ +int +soreceive_stream(struct socket *so, struct sockaddr **psa, struct uio *uio, + struct mbuf **mp0, struct mbuf **controlp, int *flagsp) +{ + int len = 0, error = 0, flags, oresid; + struct sockbuf *sb; + struct mbuf *m, *n = NULL; + + /* We only do stream sockets. */ + if (so->so_type != SOCK_STREAM) + return (EINVAL); + if (psa != NULL) + *psa = NULL; + if (controlp != NULL) + return (EINVAL); + if (flagsp != NULL) + flags = *flagsp &~ MSG_EOR; + else + flags = 0; + if (flags & MSG_OOB) + return (soreceive_rcvoob(so, uio, flags)); + if (mp0 != NULL) + *mp0 = NULL; + + sb = &so->so_rcv; + + /* Prevent other readers from entering the socket. */ + error = sblock(sb, SBLOCKWAIT(flags)); + if (error) + goto out; + SOCKBUF_LOCK(sb); + + /* Easy one, no space to copyout anything. */ + if (uio->uio_resid == 0) { + error = EINVAL; + goto out; + } + oresid = uio->uio_resid; + + /* We will never ever get anything unless we are connected. */ + if (!(so->so_state & (SS_ISCONNECTED|SS_ISDISCONNECTED))) { + /* When disconnecting there may be still some data left. */ + if (sb->sb_cc > 0) + goto deliver; + if (!(so->so_state & SS_ISDISCONNECTED)) + error = ENOTCONN; + goto out; + } + + /* Socket buffer is empty and we shall not block. */ + if (sb->sb_cc == 0 && + ((sb->sb_flags & SS_NBIO) || (flags & (MSG_DONTWAIT|MSG_NBIO)))) { + error = EAGAIN; + goto out; + } + +restart: + SOCKBUF_LOCK_ASSERT(&so->so_rcv); + + /* Abort if socket has reported problems. */ + if (so->so_error) { + if (sb->sb_cc > 0) + goto deliver; + if (oresid > uio->uio_resid) + goto out; + error = so->so_error; + if (!(flags & MSG_PEEK)) + so->so_error = 0; + goto out; + } + + /* Door is closed. Deliver what is left, if any. */ + if (sb->sb_state & SBS_CANTRCVMORE) { + if (sb->sb_cc > 0) + goto deliver; + else + goto out; + } + + /* Socket buffer got some data that we shall deliver now. */ + if (sb->sb_cc > 0 && !(flags & MSG_WAITALL) && + ((sb->sb_flags & SS_NBIO) || + (flags & (MSG_DONTWAIT|MSG_NBIO)) || + sb->sb_cc >= sb->sb_lowat || + sb->sb_cc >= uio->uio_resid || + sb->sb_cc >= sb->sb_hiwat) ) { + goto deliver; + } + + /* On MSG_WAITALL we must wait until all data or error arrives. */ + if ((flags & MSG_WAITALL) && + (sb->sb_cc >= uio->uio_resid || sb->sb_cc >= sb->sb_lowat)) + goto deliver; + + /* + * Wait and block until (more) data comes in. + * NB: Drops the sockbuf lock during wait. + */ + error = sbwait(sb); + if (error) + goto out; + goto restart; + +deliver: + SOCKBUF_LOCK_ASSERT(&so->so_rcv); + KASSERT(sb->sb_cc > 0, ("%s: sockbuf empty", __func__)); + KASSERT(sb->sb_mb != NULL, ("%s: sb_mb == NULL", __func__)); + + /* Statistics. */ + if (uio->uio_td) + uio->uio_td->td_ru.ru_msgrcv++; + + /* Fill uio until full or current end of socket buffer is reached. */ + len = min(uio->uio_resid, sb->sb_cc); + if (mp0 != NULL) { + /* Dequeue as many mbufs as possible. */ + if (!(flags & MSG_PEEK) && len >= sb->sb_mb->m_len) { + for (*mp0 = m = sb->sb_mb; + m != NULL && m->m_len <= len; + m = m->m_next) { + len -= m->m_len; + uio->uio_resid -= m->m_len; + sbfree(sb, m); + n = m; + } + sb->sb_mb = m; + if (sb->sb_mb == NULL) + SB_EMPTY_FIXUP(sb); + n->m_next = NULL; + } + /* Copy the remainder. */ + if (len > 0) { + KASSERT(sb->sb_mb != NULL, + ("%s: len > 0 && sb->sb_mb empty", __func__)); + + m = m_copym(sb->sb_mb, 0, len, M_DONTWAIT); + if (m == NULL) + len = 0; /* Don't flush data from sockbuf. */ + else + uio->uio_resid -= m->m_len; + if (*mp0 != NULL) + n->m_next = m; + else + *mp0 = m; + if (*mp0 == NULL) { + error = ENOBUFS; + goto out; + } + } + } else { + /* NB: Must unlock socket buffer as uiomove may sleep. */ + SOCKBUF_UNLOCK(sb); + error = m_mbuftouio(uio, sb->sb_mb, len); + SOCKBUF_LOCK(sb); + if (error) + goto out; + } + SBLASTRECORDCHK(sb); + SBLASTMBUFCHK(sb); + + /* + * Remove the delivered data from the socket buffer unless we + * were only peeking. + */ + if (!(flags & MSG_PEEK)) { + if (len > 0) + sbdrop_locked(sb, len); + + /* Notify protocol that we drained some data. */ + if ((so->so_proto->pr_flags & PR_WANTRCVD) && + (((flags & MSG_WAITALL) && uio->uio_resid > 0) || + !(flags & MSG_SOCALLBCK))) { + SOCKBUF_UNLOCK(sb); + (*so->so_proto->pr_usrreqs->pru_rcvd)(so, flags); + SOCKBUF_LOCK(sb); + } + } + + /* + * For MSG_WAITALL we may have to loop again and wait for + * more data to come in. + */ + if ((flags & MSG_WAITALL) && uio->uio_resid > 0) + goto restart; +out: + SOCKBUF_LOCK_ASSERT(sb); + SBLASTRECORDCHK(sb); + SBLASTMBUFCHK(sb); + SOCKBUF_UNLOCK(sb); + sbunlock(sb); + return (error); +} + +/* * Optimized version of soreceive() for simple datagram cases from userspace. * Unlike in the stream case, we're able to drop a datagram if copyout() * fails, and because we handle datagrams atomically, we don't need to use a Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Mon Jun 22 22:54:44 2009 (r194671) +++ head/sys/netinet/tcp_usrreq.c Mon Jun 22 23:08:05 2009 (r194672) @@ -1032,6 +1032,9 @@ struct pr_usrreqs tcp_usrreqs = { .pru_send = tcp_usr_send, .pru_shutdown = tcp_usr_shutdown, .pru_sockaddr = in_getsockaddr, +#if 0 + .pru_soreceive = soreceive_stream, +#endif .pru_sosetlabel = in_pcbsosetlabel, .pru_close = tcp_usr_close, }; @@ -1053,6 +1056,9 @@ struct pr_usrreqs tcp6_usrreqs = { .pru_send = tcp_usr_send, .pru_shutdown = tcp_usr_shutdown, .pru_sockaddr = in6_mapped_sockaddr, +#if 0 + .pru_soreceive = soreceive_stream, +#endif .pru_sosetlabel = in_pcbsosetlabel, .pru_close = tcp_usr_close, }; Modified: head/sys/sys/socketvar.h ============================================================================== --- head/sys/sys/socketvar.h Mon Jun 22 22:54:44 2009 (r194671) +++ head/sys/sys/socketvar.h Mon Jun 22 23:08:05 2009 (r194672) @@ -345,6 +345,9 @@ int sopoll_generic(struct socket *so, in struct ucred *active_cred, struct thread *td); int soreceive(struct socket *so, struct sockaddr **paddr, struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp); +int soreceive_stream(struct socket *so, struct sockaddr **paddr, + struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, + int *flagsp); int soreceive_dgram(struct socket *so, struct sockaddr **paddr, struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp); From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 23:22:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E39A1106568D; Mon, 22 Jun 2009 23:22:38 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1EFE8FC2C; Mon, 22 Jun 2009 23:22:38 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5MNMcLQ056094; Mon, 22 Jun 2009 23:22:38 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5MNMcpk056092; Mon, 22 Jun 2009 23:22:38 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906222322.n5MNMcpk056092@svn.freebsd.org> From: Sam Leffler Date: Mon, 22 Jun 2009 23:22: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: r194673 - head/sys/arm/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 23:22:39 -0000 Author: sam Date: Mon Jun 22 23:22:38 2009 New Revision: 194673 URL: http://svn.freebsd.org/changeset/base/194673 Log: kill left over cruft Modified: head/sys/arm/conf/CAMBRIA.hints Modified: head/sys/arm/conf/CAMBRIA.hints ============================================================================== --- head/sys/arm/conf/CAMBRIA.hints Mon Jun 22 23:08:05 2009 (r194672) +++ head/sys/arm/conf/CAMBRIA.hints Mon Jun 22 23:22:38 2009 (r194673) @@ -19,13 +19,11 @@ hint.uart.1.addr=0x53fc0000 hint.uart.1.irq=20 hint.uart.1.ier_rxbits=0x1 hint.uart.1.rclk=1843200 -hint.uart.1.rwdelay=20 # optional RS485 serial port hint.uart.2.at="ixp0" hint.uart.2.addr=0x53f80000 hint.uart.2.irq=21 hint.uart.2.rclk=1843200 -hint.uart.2.rwdelay=2 # NPE Hardware Queue Manager hint.ixpqmgr.0.at="ixp0" From owner-svn-src-head@FreeBSD.ORG Mon Jun 22 23:56:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22D32106566C; Mon, 22 Jun 2009 23:56:47 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 810FF8FC13; Mon, 22 Jun 2009 23:56:46 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by an-out-0708.google.com with SMTP id c3so1571565ana.13 for ; Mon, 22 Jun 2009 16:56:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=nZYie0iytPG/iC6KYhZPnY3RxG60IGvhYUPd+IyQWKE=; b=QE1XJUCtZBhIsSSiTT01IbGgo/9zkqa1/gQE1/q2a6+Ns3FCdGS0SKVMjuu47r10bc rv1FQeP+h0WXR/Qth/67OZtIyBXmbk0yyGS16nfre/8gjzUKjxs6VYZYtlVFPhnM0PHc 6FDYLH1c/hKPlAYccXnavVhL3PGRYaP2RMjjw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=Ia8UJgwdkH57VACYijYPL7A+PQ0JjPxKXiQfgQvSsq2EHXcnNv850wXskqTc65y3xG g9JWy2WQ0NMEeKVkpRUjkC7zM/CM6MCOyixwzIt7GJy6nWBqyyy6nbiccx5Gz7osbWfF qI+F/jIxcLH119xQV/mXmWGkMMhc0w24+8k7k= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.100.195.15 with SMTP id s15mr8873296anf.18.1245715005102; Mon, 22 Jun 2009 16:56:45 -0700 (PDT) In-Reply-To: <200906222308.n5MN856I055711@svn.freebsd.org> References: <200906222308.n5MN856I055711@svn.freebsd.org> Date: Mon, 22 Jun 2009 16:56:45 -0700 X-Google-Sender-Auth: c389e4944f9ca1f6 Message-ID: <3c1674c90906221656n63aff4ddo2080bfac55496ca9@mail.gmail.com> From: Kip Macy To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194672 - in head/sys: kern netinet sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jun 2009 23:56:47 -0000 Who is reviewing and testing these changes? -Kip On Mon, Jun 22, 2009 at 4:08 PM, Andre Oppermann wrote: > Author: andre > Date: Mon Jun 22 23:08:05 2009 > New Revision: 194672 > URL: http://svn.freebsd.org/changeset/base/194672 > > Log: > =A0Add soreceive_stream(), an optimized version of soreceive() for > =A0stream (TCP) sockets. > > =A0It is functionally identical to generic soreceive() but has a > =A0number stream specific optimizations: > =A0o does only one sockbuf unlock/lock per receive independent of > =A0 =A0the length of data to be moved into the uio compared to > =A0 =A0soreceive() which unlocks/locks per *mbuf*. > =A0o uses m_mbuftouio() instead of its own copy(out) variant. > =A0o much more compact code flow as a large number of special > =A0 =A0cases is removed. > =A0o much improved reability. > > =A0It offers significantly reduced CPU usage and lock contention > =A0when receiving fast TCP streams. =A0Additional gains are obtained > =A0when the receiving application is using SO_RCVLOWAT to batch up > =A0some data before a read (and wakeup) is done. > > =A0This function was written by "reverse engineering" and is not > =A0just a stripped down variant of soreceive(). > > =A0It is not yet enabled by default on TCP sockets. =A0Instead it is > =A0commented out in the protocol initialization in tcp_usrreq.c > =A0until more widespread testing has been done. > > =A0Testers, especially with 10GigE gear, are welcome. > > =A0MFP4: r164817 //depot/user/andre/soreceive_stream/ > > Modified: > =A0head/sys/kern/uipc_socket.c > =A0head/sys/netinet/tcp_usrreq.c > =A0head/sys/sys/socketvar.h > > Modified: head/sys/kern/uipc_socket.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/kern/uipc_socket.c Mon Jun 22 22:54:44 2009 =A0 =A0 =A0 =A0(= r194671) > +++ head/sys/kern/uipc_socket.c Mon Jun 22 23:08:05 2009 =A0 =A0 =A0 =A0(= r194672) > @@ -1857,6 +1857,202 @@ release: > =A0} > > =A0/* > + * Optimized version of soreceive() for stream (TCP) sockets. > + */ > +int > +soreceive_stream(struct socket *so, struct sockaddr **psa, struct uio *u= io, > + =A0 =A0struct mbuf **mp0, struct mbuf **controlp, int *flagsp) > +{ > + =A0 =A0 =A0 int len =3D 0, error =3D 0, flags, oresid; > + =A0 =A0 =A0 struct sockbuf *sb; > + =A0 =A0 =A0 struct mbuf *m, *n =3D NULL; > + > + =A0 =A0 =A0 /* We only do stream sockets. */ > + =A0 =A0 =A0 if (so->so_type !=3D SOCK_STREAM) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (EINVAL); > + =A0 =A0 =A0 if (psa !=3D NULL) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *psa =3D NULL; > + =A0 =A0 =A0 if (controlp !=3D NULL) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (EINVAL); > + =A0 =A0 =A0 if (flagsp !=3D NULL) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 flags =3D *flagsp &~ MSG_EOR; > + =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 flags =3D 0; > + =A0 =A0 =A0 if (flags & MSG_OOB) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (soreceive_rcvoob(so, uio, flags)); > + =A0 =A0 =A0 if (mp0 !=3D NULL) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 *mp0 =3D NULL; > + > + =A0 =A0 =A0 sb =3D &so->so_rcv; > + > + =A0 =A0 =A0 /* Prevent other readers from entering the socket. */ > + =A0 =A0 =A0 error =3D sblock(sb, SBLOCKWAIT(flags)); > + =A0 =A0 =A0 if (error) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out; > + =A0 =A0 =A0 SOCKBUF_LOCK(sb); > + > + =A0 =A0 =A0 /* Easy one, no space to copyout anything. */ > + =A0 =A0 =A0 if (uio->uio_resid =3D=3D 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D EINVAL; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out; > + =A0 =A0 =A0 } > + =A0 =A0 =A0 oresid =3D uio->uio_resid; > + > + =A0 =A0 =A0 /* We will never ever get anything unless we are connected.= */ > + =A0 =A0 =A0 if (!(so->so_state & (SS_ISCONNECTED|SS_ISDISCONNECTED))) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* When disconnecting there may be still so= me data left. */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sb->sb_cc > 0) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto deliver; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!(so->so_state & SS_ISDISCONNECTED)) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D ENOTCONN; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out; > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* Socket buffer is empty and we shall not block. */ > + =A0 =A0 =A0 if (sb->sb_cc =3D=3D 0 && > + =A0 =A0 =A0 =A0 =A0 ((sb->sb_flags & SS_NBIO) || (flags & (MSG_DONTWAIT= |MSG_NBIO)))) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D EAGAIN; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out; > + =A0 =A0 =A0 } > + > +restart: > + =A0 =A0 =A0 SOCKBUF_LOCK_ASSERT(&so->so_rcv); > + > + =A0 =A0 =A0 /* Abort if socket has reported problems. */ > + =A0 =A0 =A0 if (so->so_error) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sb->sb_cc > 0) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto deliver; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (oresid > uio->uio_resid) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D so->so_error; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!(flags & MSG_PEEK)) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 so->so_error =3D 0; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out; > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* Door is closed. =A0Deliver what is left, if any. */ > + =A0 =A0 =A0 if (sb->sb_state & SBS_CANTRCVMORE) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sb->sb_cc > 0) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto deliver; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out; > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* Socket buffer got some data that we shall deliver now. *= / > + =A0 =A0 =A0 if (sb->sb_cc > 0 && !(flags & MSG_WAITALL) && > + =A0 =A0 =A0 =A0 =A0 ((sb->sb_flags & SS_NBIO) || > + =A0 =A0 =A0 =A0 =A0 =A0(flags & (MSG_DONTWAIT|MSG_NBIO)) || > + =A0 =A0 =A0 =A0 =A0 =A0sb->sb_cc >=3D sb->sb_lowat || > + =A0 =A0 =A0 =A0 =A0 =A0sb->sb_cc >=3D uio->uio_resid || > + =A0 =A0 =A0 =A0 =A0 =A0sb->sb_cc >=3D sb->sb_hiwat) ) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto deliver; > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* On MSG_WAITALL we must wait until all data or error arri= ves. */ > + =A0 =A0 =A0 if ((flags & MSG_WAITALL) && > + =A0 =A0 =A0 =A0 =A0 (sb->sb_cc >=3D uio->uio_resid || sb->sb_cc >=3D sb= ->sb_lowat)) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto deliver; > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* Wait and block until (more) data comes in. > + =A0 =A0 =A0 =A0* NB: Drops the sockbuf lock during wait. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 error =3D sbwait(sb); > + =A0 =A0 =A0 if (error) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out; > + =A0 =A0 =A0 goto restart; > + > +deliver: > + =A0 =A0 =A0 SOCKBUF_LOCK_ASSERT(&so->so_rcv); > + =A0 =A0 =A0 KASSERT(sb->sb_cc > 0, ("%s: sockbuf empty", __func__)); > + =A0 =A0 =A0 KASSERT(sb->sb_mb !=3D NULL, ("%s: sb_mb =3D=3D NULL", __fu= nc__)); > + > + =A0 =A0 =A0 /* Statistics. */ > + =A0 =A0 =A0 if (uio->uio_td) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 uio->uio_td->td_ru.ru_msgrcv++; > + > + =A0 =A0 =A0 /* Fill uio until full or current end of socket buffer is r= eached. */ > + =A0 =A0 =A0 len =3D min(uio->uio_resid, sb->sb_cc); > + =A0 =A0 =A0 if (mp0 !=3D NULL) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Dequeue as many mbufs as possible. */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!(flags & MSG_PEEK) && len >=3D sb->sb_= mb->m_len) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for (*mp0 =3D m =3D sb->sb_= mb; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0m !=3D NULL && m= ->m_len <=3D len; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0m =3D m->m_next)= { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 len -=3D m-= >m_len; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 uio->uio_re= sid -=3D m->m_len; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sbfree(sb, = m); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 n =3D m; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sb->sb_mb =3D m; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sb->sb_mb =3D=3D NULL) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 SB_EMPTY_FI= XUP(sb); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 n->m_next =3D NULL; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Copy the remainder. */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (len > 0) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 KASSERT(sb->sb_mb !=3D NULL= , > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ("%s: len > 0 && sb= ->sb_mb empty", __func__)); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 m =3D m_copym(sb->sb_mb, 0,= len, M_DONTWAIT); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (m =3D=3D NULL) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 len =3D 0; = =A0 =A0 =A0 =A0/* Don't flush data from sockbuf. */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 uio->uio_re= sid -=3D m->m_len; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (*mp0 !=3D NULL) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 n->m_next = =3D m; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 else > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *mp0 =3D m; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (*mp0 =3D=3D NULL) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D E= NOBUFS; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } else { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* NB: Must unlock socket buffer as uiomove= may sleep. */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 SOCKBUF_UNLOCK(sb); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D m_mbuftouio(uio, sb->sb_mb, len); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 SOCKBUF_LOCK(sb); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (error) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out; > + =A0 =A0 =A0 } > + =A0 =A0 =A0 SBLASTRECORDCHK(sb); > + =A0 =A0 =A0 SBLASTMBUFCHK(sb); > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* Remove the delivered data from the socket buffer unles= s we > + =A0 =A0 =A0 =A0* were only peeking. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 if (!(flags & MSG_PEEK)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (len > 0) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sbdrop_locked(sb, len); > + > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* Notify protocol that we drained some dat= a. */ > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((so->so_proto->pr_flags & PR_WANTRCVD) = && > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (((flags & MSG_WAITALL) && uio->uio= _resid > 0) || > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0!(flags & MSG_SOCALLBCK))) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 SOCKBUF_UNLOCK(sb); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (*so->so_proto->pr_usrreqs-= >pru_rcvd)(so, flags); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 SOCKBUF_LOCK(sb); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > + =A0 =A0 =A0 } > + > + =A0 =A0 =A0 /* > + =A0 =A0 =A0 =A0* For MSG_WAITALL we may have to loop again and wait for > + =A0 =A0 =A0 =A0* more data to come in. > + =A0 =A0 =A0 =A0*/ > + =A0 =A0 =A0 if ((flags & MSG_WAITALL) && uio->uio_resid > 0) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto restart; > +out: > + =A0 =A0 =A0 SOCKBUF_LOCK_ASSERT(sb); > + =A0 =A0 =A0 SBLASTRECORDCHK(sb); > + =A0 =A0 =A0 SBLASTMBUFCHK(sb); > + =A0 =A0 =A0 SOCKBUF_UNLOCK(sb); > + =A0 =A0 =A0 sbunlock(sb); > + =A0 =A0 =A0 return (error); > +} > + > +/* > =A0* Optimized version of soreceive() for simple datagram cases from user= space. > =A0* Unlike in the stream case, we're able to drop a datagram if copyout(= ) > =A0* fails, and because we handle datagrams atomically, we don't need to = use a > > Modified: head/sys/netinet/tcp_usrreq.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/tcp_usrreq.c =A0 =A0 =A0 Mon Jun 22 22:54:44 2009 = =A0 =A0 =A0 =A0(r194671) > +++ head/sys/netinet/tcp_usrreq.c =A0 =A0 =A0 Mon Jun 22 23:08:05 2009 = =A0 =A0 =A0 =A0(r194672) > @@ -1032,6 +1032,9 @@ struct pr_usrreqs tcp_usrreqs =3D { > =A0 =A0 =A0 =A0.pru_send =3D =A0 =A0 =A0 =A0 =A0 =A0 tcp_usr_send, > =A0 =A0 =A0 =A0.pru_shutdown =3D =A0 =A0 =A0 =A0 tcp_usr_shutdown, > =A0 =A0 =A0 =A0.pru_sockaddr =3D =A0 =A0 =A0 =A0 in_getsockaddr, > +#if 0 > + =A0 =A0 =A0 .pru_soreceive =3D =A0 =A0 =A0 =A0soreceive_stream, > +#endif > =A0 =A0 =A0 =A0.pru_sosetlabel =3D =A0 =A0 =A0 in_pcbsosetlabel, > =A0 =A0 =A0 =A0.pru_close =3D =A0 =A0 =A0 =A0 =A0 =A0tcp_usr_close, > =A0}; > @@ -1053,6 +1056,9 @@ struct pr_usrreqs tcp6_usrreqs =3D { > =A0 =A0 =A0 =A0.pru_send =3D =A0 =A0 =A0 =A0 =A0 =A0 tcp_usr_send, > =A0 =A0 =A0 =A0.pru_shutdown =3D =A0 =A0 =A0 =A0 tcp_usr_shutdown, > =A0 =A0 =A0 =A0.pru_sockaddr =3D =A0 =A0 =A0 =A0 in6_mapped_sockaddr, > +#if 0 > + =A0 =A0 =A0 .pru_soreceive =3D =A0 =A0 =A0 =A0soreceive_stream, > +#endif > =A0 =A0 =A0 =A0.pru_sosetlabel =3D =A0 =A0 =A0 in_pcbsosetlabel, > =A0 =A0 =A0 =A0.pru_close =3D =A0 =A0 =A0 =A0 =A0 =A0tcp_usr_close, > =A0}; > > Modified: head/sys/sys/socketvar.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/sys/socketvar.h =A0 =A0Mon Jun 22 22:54:44 2009 =A0 =A0 =A0 = =A0(r194671) > +++ head/sys/sys/socketvar.h =A0 =A0Mon Jun 22 23:08:05 2009 =A0 =A0 =A0 = =A0(r194672) > @@ -345,6 +345,9 @@ int sopoll_generic(struct socket *so, in > =A0 =A0 =A0 =A0 =A0 =A0struct ucred *active_cred, struct thread *td); > =A0int =A0 =A0soreceive(struct socket *so, struct sockaddr **paddr, struc= t uio *uio, > =A0 =A0 =A0 =A0 =A0 =A0struct mbuf **mp0, struct mbuf **controlp, int *fl= agsp); > +int =A0 =A0soreceive_stream(struct socket *so, struct sockaddr **paddr, > + =A0 =A0 =A0 =A0 =A0 struct uio *uio, struct mbuf **mp0, struct mbuf **c= ontrolp, > + =A0 =A0 =A0 =A0 =A0 int *flagsp); > =A0int =A0 =A0soreceive_dgram(struct socket *so, struct sockaddr **paddr, > =A0 =A0 =A0 =A0 =A0 =A0struct uio *uio, struct mbuf **mp0, struct mbuf **= controlp, > =A0 =A0 =A0 =A0 =A0 =A0int *flagsp); > --=20 When bad men combine, the good must associate; else they will fall one by one, an unpitied sacrifice in a contemptible struggle. Edmund Burke From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 00:43:02 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A33F81065686; Tue, 23 Jun 2009 00:43:02 +0000 (UTC) (envelope-from kensmith@cse.Buffalo.EDU) Received: from phoebe.cse.buffalo.edu (phoebe.cse.buffalo.edu [128.205.32.89]) by mx1.freebsd.org (Postfix) with ESMTP id 60B468FC2D; Tue, 23 Jun 2009 00:43:02 +0000 (UTC) (envelope-from kensmith@cse.Buffalo.EDU) Received: from [128.205.32.76] (bauer.cse.buffalo.edu [128.205.32.76]) (authenticated bits=0) by phoebe.cse.buffalo.edu (8.14.1/8.13.7) with ESMTP id n5N0gxTb012705 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 22 Jun 2009 20:43:02 -0400 (EDT) (envelope-from kensmith@cse.buffalo.edu) From: Ken Smith To: Andre Oppermann In-Reply-To: <200906222308.n5MN856I055711@svn.freebsd.org> References: <200906222308.n5MN856I055711@svn.freebsd.org> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-/kHhM7wMMzw3OTCbG9zP" Organization: U. Buffalo CSE Department Date: Mon, 22 Jun 2009 20:42:59 -0400 Message-Id: <1245717779.7070.39.camel@bauer.cse.buffalo.edu> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 FreeBSD GNOME Team Port X-DCC-Buffalo.EDU-Metrics: phoebe.cse.buffalo.edu 1029; Body=0 Fuz1=0 Fuz2=0 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r194672 - in head/sys: kern netinet sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 00:43:03 -0000 --=-/kHhM7wMMzw3OTCbG9zP Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Mon, 2009-06-22 at 23:08 +0000, Andre Oppermann wrote: > Author: andre > Date: Mon Jun 22 23:08:05 2009 > New Revision: 194672 > URL: http://svn.freebsd.org/changeset/base/194672 >=20 > Log: > Add soreceive_stream(), an optimized version of soreceive() for > stream (TCP) sockets. > =20 > It is functionally identical to generic soreceive() but has a > number stream specific optimizations: > o does only one sockbuf unlock/lock per receive independent of > the length of data to be moved into the uio compared to > soreceive() which unlocks/locks per *mbuf*. > o uses m_mbuftouio() instead of its own copy(out) variant. > o much more compact code flow as a large number of special > cases is removed. > o much improved reability. > =20 > It offers significantly reduced CPU usage and lock contention > when receiving fast TCP streams. Additional gains are obtained > when the receiving application is using SO_RCVLOWAT to batch up > some data before a read (and wakeup) is done. > =20 > This function was written by "reverse engineering" and is not > just a stripped down variant of soreceive(). > =20 > It is not yet enabled by default on TCP sockets. Instead it is > commented out in the protocol initialization in tcp_usrreq.c > until more widespread testing has been done. > =20 > Testers, especially with 10GigE gear, are welcome. > =20 > MFP4: r164817 //depot/user/andre/soreceive_stream/ >=20 > Modified: > head/sys/kern/uipc_socket.c > head/sys/netinet/tcp_usrreq.c > head/sys/sys/socketvar.h >=20 Can you please explain why you committed this during Code Slush 3 days before Code Freeze started? It looks like something that should be committed after we do the branch for 8.0, it doesn't look like something ready to be part of a release even in its #ifdef-ed-out form. I certainly don't mind it going in after the branch as long as it's had some level of reasonable review. I just think it's too late to be adding this given the stage we're at in the 8.0 release. Thanks. --=20 Ken Smith - From there to here, from here to | kensmith@cse.buffalo.edu there, funny things are everywhere. | - Theodore Geisel | --=-/kHhM7wMMzw3OTCbG9zP Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEABECAAYFAkpAJRMACgkQ/G14VSmup/ZwaQCfV0OxtSRrTJzglQnW45u/4oic sRUAnjBqLfVj7WK/5M6HKXup1Zj1rajK =VkW6 -----END PGP SIGNATURE----- --=-/kHhM7wMMzw3OTCbG9zP-- From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 01:00:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86C951065673; Tue, 23 Jun 2009 01:00:26 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 72B208FC08; Tue, 23 Jun 2009 01:00:26 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5N10QoD059360; Tue, 23 Jun 2009 01:00:26 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5N10QSi059356; Tue, 23 Jun 2009 01:00:26 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200906230100.n5N10QSi059356@svn.freebsd.org> From: Andrew Thompson Date: Tue, 23 Jun 2009 01:00: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: r194674 - head/lib/libusb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 01:00:27 -0000 Author: thompsa Date: Tue Jun 23 01:00:26 2009 New Revision: 194674 URL: http://svn.freebsd.org/changeset/base/194674 Log: Add libusb 1.0 support which is compatible with the latest revision on Sourceforge. Libusb 1.0 is a portable usb api released December 2008 and supersedes the original libusb released 10 years ago, it supports isochronous endpoints and asynchronous I/O. Many applications have already started using the interfaces. This has been developed as part of Google Summer of Code this year by Sylvestre Gallon and has been cribbed early due to it being desirable in FreeBSD 8.0 Submitted by: Sylvestre Gallon Sponsored by: Google Summer of Code 2009 Reviewed by: Hans Petter Selasky Added: head/lib/libusb/libusb20.3 (contents, props changed) - copied, changed from r194270, head/lib/libusb/libusb.3 Deleted: head/lib/libusb/libusb20_compat10.c head/lib/libusb/libusb20_compat10.h Modified: head/lib/libusb/Makefile head/lib/libusb/libusb.3 Modified: head/lib/libusb/Makefile ============================================================================== --- head/lib/libusb/Makefile Mon Jun 22 23:22:38 2009 (r194673) +++ head/lib/libusb/Makefile Tue Jun 23 01:00:26 2009 (r194674) @@ -10,19 +10,23 @@ SHLIB_MINOR= 0 SRCS= libusb20.c SRCS+= libusb20_desc.c SRCS+= libusb20_ugen20.c -SRCS+= libusb20_compat01.c -SRCS+= libusb20_compat10.c INCS+= libusb20.h INCS+= libusb20_desc.h -MAN= libusb.3 +MAN= libusb.3 libusb20.3 MKLINT= no NOGCCERROR= -MLINKS+= libusb.3 usb.3 \ - libusb.3 libusb20.3 +MLINKS+= libusb.3 usb.3 # libusb 0.1 compat INCS+= usb.h +SRCS+= libusb20_compat01.c + +# libusb 1.0 compat +INCS+= libusb.h +SRCS+= libusb10.c +SRCS+= libusb10_desc.c +SRCS+= libusb10_io.c .include Modified: head/lib/libusb/libusb.3 ============================================================================== --- head/lib/libusb/libusb.3 Mon Jun 22 23:22:38 2009 (r194673) +++ head/lib/libusb/libusb.3 Tue Jun 23 01:00:26 2009 (r194674) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2008 Hans Petter Selasky +.\" Copyright (c) 2009 Sylvestre Gallon .\" .\" All rights reserved. .\" @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 28, 2009 +.Dd June 22, 2009 .Dt LIBUSB 3 .Os .Sh NAME @@ -41,882 +41,424 @@ USB access library (libusb -lusb) . . -. .Sh SYNOPSIS -.In libusb20.h -.Ft int -.Fn libusb20_tr_close "struct libusb20_transfer *xfer" -.Ft int -.Fn libusb20_tr_open "struct libusb20_transfer *xfer" "uint32_t max_buf_size" "uint32_t max_frame_count" "uint8_t ep_no" -.Ft struct libusb20_transfer* -.Fn libusb20_tr_get_pointer "struct libusb20_device *pdev" "uint16_t tr_index" -.Ft uint16_t -.Fn libusb20_tr_get_time_complete "struct libusb20_transfer *xfer" -.Ft uint32_t -.Fn libusb20_tr_get_actual_frames "struct libusb20_transfer *xfer" -.Ft uint32_t -.Fn libusb20_tr_get_actual_length "struct libusb20_transfer *xfer" -.Ft uint32_t -.Fn libusb20_tr_get_max_frames "struct libusb20_transfer *xfer" -.Ft uint32_t -.Fn libusb20_tr_get_max_packet_length "struct libusb20_transfer *xfer" -.Ft uint32_t -.Fn libusb20_tr_get_max_total_length "struct libusb20_transfer *xfer" -.Ft uint8_t -.Fn libusb20_tr_get_status "struct libusb20_transfer *xfer" -.Ft uint8_t -.Fn libusb20_tr_pending "struct libusb20_transfer *xfer" -.Ft void -.Fn libusb20_tr_callback_wrapper "struct libusb20_transfer *xfer" -.Ft void -.Fn libusb20_tr_clear_stall_sync "struct libusb20_transfer *xfer" -.Ft void -.Fn libusb20_tr_drain "struct libusb20_transfer *xfer" -.Ft void -.Fn libusb20_tr_set_buffer "struct libusb20_transfer *xfer" "void *buffer" "uint16_t fr_index" -.Ft void -.Fn libusb20_tr_set_callback "struct libusb20_transfer *xfer" "libusb20_tr_callback_t *cb" -.Ft void -.Fn libusb20_tr_set_flags "struct libusb20_transfer *xfer" "uint8_t flags" -.Ft uint32_t -.Fn libusb20_tr_get_length "struct libusb20_transfer *xfer" "uint16_t fr_index" -.Ft void -.Fn libusb20_tr_set_length "struct libusb20_transfer *xfer" "uint32_t length" "uint16_t fr_index" -.Ft void -.Fn libusb20_tr_set_priv_sc0 "struct libusb20_transfer *xfer" "void *sc0" -.Ft void -.Fn libusb20_tr_set_priv_sc1 "struct libusb20_transfer *xfer" "void *sc1" -.Ft void -.Fn libusb20_tr_set_timeout "struct libusb20_transfer *xfer" "uint32_t timeout" -.Ft void -.Fn libusb20_tr_set_total_frames "struct libusb20_transfer *xfer" "uint32_t nframes" -.Ft void -.Fn libusb20_tr_setup_bulk "struct libusb20_transfer *xfer" "void *pbuf" "uint32_t length" "uint32_t timeout" -.Ft void -.Fn libusb20_tr_setup_control "struct libusb20_transfer *xfer" "void *psetup" "void *pbuf" "uint32_t timeout" -.Ft void -.Fn libusb20_tr_setup_intr "struct libusb20_transfer *xfer" "void *pbuf" "uint32_t length" "uint32_t timeout" -.Ft void -.Fn libusb20_tr_setup_isoc "struct libusb20_transfer *xfer" "void *pbuf" "uint32_t length" "uint61_t fr_index" -.Ft void -.Fn libusb20_tr_start "struct libusb20_transfer *xfer" -.Ft void -.Fn libusb20_tr_stop "struct libusb20_transfer *xfer" -.Ft void -.Fn libusb20_tr_submit "struct libusb20_transfer *xfer" -.Ft void * -.Fn libusb20_tr_get_priv_sc0 "struct libusb20_transfer *xfer" -.Ft void * -.Fn libusb20_tr_get_priv_sc1 "struct libusb20_transfer *xfer" -.Ft const char * -.Fn libusb20_dev_get_backend_name "struct libusb20_device *" -.Ft int -.Fn libusb20_dev_get_info "struct libusb20_device *pdev" "struct usb_device_info *pinfo" -.Ft int -.Fn libusb20_dev_get_iface_desc "struct libusb20_device *pdev" "uint8_t iface_index" "char *buf" "uint8_t len" -.Ft const char * -.Fn libusb20_dev_get_desc "struct libusb20_device *pdev" -.Ft int -.Fn libusb20_dev_close "struct libusb20_device *pdev" -.Ft int -.Fn libusb20_dev_detach_kernel_driver "struct libusb20_device *pdev" "uint8_t iface_index" -.Ft int -.Fn libusb20_dev_set_config_index "struct libusb20_device *pdev" "uint8_t configIndex" -.Ft int -.Fn libusb20_dev_get_debug "struct libusb20_device *pdev" -.Ft int -.Fn libusb20_dev_get_fd "struct libusb20_device *pdev" -.Ft int -.Fn libusb20_dev_kernel_driver_active "struct libusb20_device *pdev" "uint8_t iface_index" -.Ft int -.Fn libusb20_dev_open "struct libusb20_device *pdev" "uint16_t transfer_max" -.Ft int -.Fn libusb20_dev_process "struct libusb20_device *pdev" -.Ft int -.Fn libusb20_dev_request_sync "struct libusb20_device *pdev" "struct LIBUSB20_CONTROL_SETUP_DECODED *setup" "void *data" "uint16_t *pactlen" "uint32_t timeout" "uint8_t flags" -.Ft int -.Fn libusb20_dev_req_string_sync "struct libusb20_device *pdev" "uint8_t index" "uint16_t langid" "void *ptr" "uint16_t len" -.Ft int -.Fn libusb20_dev_req_string_simple_sync "struct libusb20_device *pdev" "uint8_t index" "void *ptr" "uint16_t len" -.Ft int -.Fn libusb20_dev_reset "struct libusb20_device *pdev" -.Ft int -.Fn libusb20_dev_set_power_mode "struct libusb20_device *pdev" "uint8_t power_mode" -.Ft uint8_t -.Fn libusb20_dev_get_power_mode "struct libusb20_device *pdev" -.Ft int -.Fn libusb20_dev_set_alt_index "struct libusb20_device *pdev" "uint8_t iface_index" "uint8_t alt_index" -.Ft struct LIBUSB20_DEVICE_DESC_DECODED * -.Fn libusb20_dev_get_device_desc "struct libusb20_device *pdev" -.Ft struct libusb20_config * -.Fn libusb20_dev_alloc_config "struct libusb20_device *pdev" "uint8_t config_index" -.Ft struct libusb20_device * -.Fn libusb20_dev_alloc "void" -.Ft uint8_t -.Fn libusb20_dev_get_address "struct libusb20_device *pdev" -.Ft uint8_t -.Fn libusb20_dev_get_bus_number "struct libusb20_device *pdev" -.Ft uint8_t -.Fn libusb20_dev_get_mode "struct libusb20_device *pdev" -.Ft uint8_t -.Fn libusb20_dev_get_speed "struct libusb20_device *pdev" -.Ft uint8_t -.Fn libusb20_dev_get_config_index "struct libusb20_device *pdev" -.Ft void -.Fn libusb20_dev_free "struct libusb20_device *pdev" -.Ft void -.Fn libusb20_dev_set_debug "struct libusb20_device *pdev" "int debug" -.Ft void -.Fn libusb20_dev_wait_process "struct libusb20_device *pdev" "int timeout" -.Ft int -.Fn libusb20_be_get_template "struct libusb20_backend *pbe" "int *ptemp" -.Ft int -.Fn libusb20_be_set_template "struct libusb20_backend *pbe" "int temp" -.Ft int -.Fn libusb20_be_get_dev_quirk "struct libusb20_backend *pber", "uint16_t index" "struct libusb20_quirk *pq" -.Ft int -.Fn libusb20_be_get_quirk_name "struct libusb20_backend *pbe" "uint16_t index" "struct libusb20_quirk *pq" -.Ft int -.Fn libusb20_be_add_dev_quirk "struct libusb20_backend *pbe" "struct libusb20_quirk *pq" -.Ft int -.Fn libusb20_be_remove_dev_quirk "struct libusb20_backend *pbe" "struct libusb20_quirk *pq" -.Ft struct libusb20_backend * -.Fn libusb20_be_alloc_default "void" -.Ft struct libusb20_backend * -.Fn libusb20_be_alloc_freebsd "void" -.Ft struct libusb20_backend * -.Fn libusb20_be_alloc_linux "void" -.Ft struct libusb20_device * -.Fn libusb20_be_device_foreach "struct libusb20_backend *pbe" "struct libusb20_device *pdev" -.Ft void -.Fn libusb20_be_dequeue_device "struct libusb20_backend *pbe" "struct libusb20_device *pdev" -.Ft void -.Fn libusb20_be_enqueue_device "struct libusb20_backend *pbe" "struct libusb20_device *pdev" -.Ft void -.Fn libusb20_be_free "struct libusb20_backend *pbe" -.Ft uint8_t -.Fn libusb20_me_get_1 "const struct libusb20_me_struct *me" "uint16_t off" -.Ft uint16_t -.Fn libusb20_me_get_2 "const struct libusb20_me_struct *me" "uint16_t off" -.Ft uint16_t -.Fn libusb20_me_encode "void *pdata" "uint16_t len" "const void *pdecoded" -.Ft uint16_t -.Fn libusb20_me_decode "const void *pdata" "uint16_t len" "void *pdecoded" -.Ft "const uint8_t *" -.Fn libusb20_desc_foreach "const struct libusb20_me_struct *me" "const uint8_t *pdesc" -. -. -.Sh DESCRIPTION -. -The -.Nm -library implements functions to be able to easily access and control -USB through the USB file system interface. -. -. -.Sh USB TRANSFER OPERATIONS -. -.Pp . -.Fn libusb20_tr_close -will release all kernel resources associated with an USB -.Fa xfer . . -This function returns zero upon success. +.In libusb.h . -Non-zero return values indicate a LIBUSB20_ERROR value. . -.Pp -. -.Fn libusb20_tr_open -will allocate kernel buffer resources according to -.Fa max_buf_size -and -.Fa max_frame_count -associated with an USB -.Fa pxfer -and bind the transfer to the specified -.Fa ep_no . -.Fa max_buf_size -is the minimum buffer size which the data transport layer has to support. -If -.Fa max_buf_size -is zero, the +.Sh DESCRIPTION +The .Nm -library will use wMaxPacketSize to compute the buffer size. -This can be useful for isochronous transfers. -The actual buffer size can be greater than -.Fa max_buf_size -and is returned by -.Fn libusb20_tr_get_max_total_length . -. -This function returns zero upon success. -. -Non-zero return values indicate a LIBUSB20_ERROR value. -. -.Pp -. -.Fn libusb20_tr_get_pointer -will return a pointer to the allocated USB transfer according to the -.Fa pdev -and -.Fa tr_index -arguments. -. -This function returns NULL in case of failure. -. -.Pp -. -.Fn libusb20_tr_get_time_complete -will return the completion time of an USB transfer in -millisecond units. This function is most useful for isochronous USB -transfers when doing echo cancelling. -. -.Pp -. -.Fn libusb20_tr_get_actual_frames -will return the actual number of USB frames after an USB -transfer completed. A value of zero means that no data was transferred. -. -.Pp -. -.Fn libusb20_tr_get_actual_length -will return the sum of the actual length for all -transferred USB frames for the given USB transfer. -. -.Pp -. -.Fn libusb20_tr_get_max_frames -will return the maximum number of USB frames that were -allocated when an USB transfer was setup for the given USB transfer. -. -.Pp -. -.Fn libusb20_tr_get_max_packet_length -will return the maximum packet length in bytes -associated with the given USB transfer. -. -The packet length can be used round up buffer sizes so that short USB -packets are avoided for proxy buffers. -. -. -.Pp -. -.Fn libusb20_tr_get_max_total_length -function will return the maximum value for the length sum of all -USB frames associated with an USB transfer. -. -.Pp -. -.Fn libusb20_tr_get_status -will return the status of an USB transfer. -. -Status values are defined by a set of LIBUSB20_TRANSFER_XXX enums. +library contains interfaces for directly managing a usb device. +The current implementation supports v1.0 of the libusb API. . -.Pp -. -.Fn libusb20_tr_pending -will return non-zero if the given USB transfer is -pending for completion. -. -Else this function returns zero. -. -.Pp -. -.Fn libusb20_tr_callback_wrapper -This is an internal function used to wrap asynchronous USB callbacks. -. -.Pp -. -.Fn libusb20_tr_clear_stall_sync -This is an internal function used to synchronously clear the stall on -the given USB transfer. -. -Please see the USB specification for more information on stall -clearing. -. -If the given USB transfer is pending when this function is called, the -USB transfer will complete with an error after that this function has -been called. -. -.Pp -. -.Fn libusb20_tr_drain -will stop the given USB transfer and will not return -until the USB transfer has been stopped in hardware. -. -.Pp -. -.Fn libusb20_tr_set_buffer -is used to set the -.Fa buffer -pointer for the given USB transfer and -.Fa fr_index . . -Typically the frame index is zero. -. -. -.Pp -. -.Fn libusb20_tr_set_callback -is used to set the USB callback for asynchronous USB -transfers. -. -The callback type is defined by libusb20_tr_callback_t. +.Sh LIBRARY INITIALISATION / DEINITIALISATION . .Pp . -.Fn libusb20_tr_set_flags -is used to set various USB flags for the given USB transfer. -.Bl -tag -.It LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK -Report a short frame as error. -.It LIBUSB20_TRANSFER_MULTI_SHORT_NOT_OK -Multiple short frames are not allowed. -.It LIBUSB20_TRANSFER_FORCE_SHORT -All transmitted frames are short terminated. -.It LIBUSB20_TRANSFER_DO_CLEAR_STALL -Will do a clear-stall before starting the transfer. -.El -. -.Pp -. -.Fn libusb20_tr_get_length -returns the length of the given USB frame by index. -After an USB transfer is complete the USB frame length will get updated to the actual transferred length. -. -.Pp -. -.Fn libusb20_tr_set_length -sets the length of the given USB frame by index. -. +.Ft int +.Fn libusb_init libusb_context **ctx +This function initialises libusb. Must be called at the beginning +of the program. This function returns 0 on success or LIBUSB_ERROR on +failure. +. .Pp . -.Fn libusb20_tr_set_priv_sc0 -sets private driver pointer number zero. +.Ft void +.Fn libusb_exit "libusb_context *ctx" +Deinitialise libusb. Must be called at the end of the application. . .Pp . -.Fn libusb20_tr_set_priv_sc1 -sets private driver pointer number one. +.Ft void +.Fn libusb_set_debug "libusb_context *ctx" "int level" +Set debug to the +.Fa level +level. . .Pp . -.Fn libusb20_tr_set_timeout -sets the timeout for the given USB transfer. -. -A timeout value of zero means no timeout. -. -The timeout is given in milliseconds. +.Ft ssize_t +.Fn libusb_get_device_list "libusb_context *ctx" "libusb_device ***list" +Fill into +.Fa list +the list of usb device available. All the device created by this +function must be unref and free when you are done with them. This +function returns the number of devices in list or a LIBUSB_ERROR code. . .Pp . -.Fn libusb20_tr_set_total_frames -sets the total number of frames that should be executed when the USB transfer is submitted. -. -The total number of USB frames must be less than the maximum number of USB frames associated with the given USB transfer. +.Ft void +.Fn libusb_free_device_list "libusb_device **list" "int unref_devices" +Free the list of devices discovered by libusb_get_device_list. If +.Fa unref_device +is set to 1 all devices are unref one time. . .Pp . -.Fn libusb20_tr_setup_bulk -is a helper function for setting up a single frame USB BULK transfer. +.Ft uint8_t +.Fn libusb_get_bus_number "libusb_device *dev" +Returns the number of the bus contained by the device +.Fa dev. . .Pp . -.Fn libusb20_tr_setup_control -is a helper function for setting up a single or dual -frame USB CONTROL transfer depending on the control transfer length. +.Ft uint8_t +.Fn libusb_get_device_address "libusb_device *dev" +Return the device_address contained by the device +.Fa dev. . .Pp . -.Fn libusb20_tr_setup_intr -is a helper function for setting up a single frame USB INTERRUPT transfer. +.Ft int +.Fn libusb_get_max_packet_size "libusb_device *dev" "unsigned char endpoint" +Return the wMaxPacketSize value on success, LIBUSB_ERROR_NOT_FOUND if the +endpoint does not exist and LIBUSB_ERROR_OTHERS on other failure. . .Pp . -.Fn libusb20_tr_setup_isoc -is a helper function for setting up a multi frame USB ISOCHRONOUS transfer. +.Ft libusb_device * +.Fn libusb_ref_device "libusb_device *dev" +Increment the reference counter of the device +.Fa dev. . .Pp . -.Fn libusb20_tr_start -will get the USB transfer started, if not already -started. -. -This function will not get the transfer queued in hardware. -. -This function is non-blocking. +.Ft void +.Fn libusb_unref_device "libusb_device *dev" +Decrement the reference counter of the device +.Fa dev. . .Pp . -.Fn libusb20_tr_stop -will get the USB transfer stopped, if not already stopped. -. -This function is non-blocking, which means that the actual stop can -happen after the return of this function. +.Ft int +.Fn libusb_open "libusb_device *dev" "libusb_device_handle **devh" +Open a device and obtain a device_handle. Return 0 on success, +LIBUSB_ERROR_NO_MEM on memory allocation problem, LIBUSB_ERROR_ACCESS +on permission problem, LIBUSB_ERROR_NO_DEVICE if the device has been +disconnected and a LIBUSB_ERROR code on error. . .Pp . -.Fn libusb20_tr_submit -will get the USB transfer queued in hardware. -. +.Ft libusb_device_handle * +.Fn libusb_open_device_with_vid_pid "libusb_context *ctx" "uint16_t vid" "uint16_t pid" +Conveniance function to open a device with is +.Fa vid +and +.Fa pid. +Return NULL on error. . .Pp . -.Fn libusb20_tr_get_priv_sc0 -returns private driver pointer number zero associated -with an USB transfer. -. +.Ft void +.Fn libusb_close "libusb_device_handle *devh" +Close a device handle. . .Pp . -.Fn libusb20_tr_get_priv_sc1 -returns private driver pointer number one associated -with an USB transfer. -. -. -.Sh USB DEVICE OPERATIONS +.Ft libusb_device * +.Fn libusb_get_device(libusb_device_handle *devh) +Get the device contained by devh. Return NULL on error. . .Pp . -.Fn libusb20_dev_get_backend_name -returns a zero terminated string describing the backend used. +.Ft int +.Fn libusb_get_configuration "libusb_device_handle *devh" "int *config" +Return the bConfiguration value of the current configuration. return 0 +on success, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected +and a LIBUSB_ERROR code on error. . .Pp . -.Fn libusb20_dev_get_info -retrives the BSD specific usb_device_info structure into the memory location given by -.Fa pinfo . -The USB device given by -.Fa pdev -must be opened before this function will succeed. -This function returns zero on success else a LIBUSB20_ERROR value is returned. +.Ft int +.Fn libusb_set_configuration "libusb_device_handle *devh" "int config" +Set the active configuration +.Fa config +for the device contained by +.Fa devh. +This function return 0 on success, LIBUSB_ERROR_NOT_FOUND if the requested +configuration does not exist, LIBUSB_ERROR_BUSY if the interfaces are currently +claimed, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a +LIBUSB_ERROR code on failure. . .Pp . -.Fn libusb20_dev_get_iface_desc -retrieves the kernel interface description for the given USB -.Fa iface_index . -The format of the USB interface description is: "drivername: " -The description string is always zero terminated. -A zero length string is written in case no driver is attached to the given interface. -The USB device given by -.Fa pdev -must be opened before this function will succeed. -This function returns zero on success else a LIBUSB20_ERROR value is returned. +.Ft int +.Fn libusb_claim_interface "libusb_device_handle *devh" "int interface_number" +Claim an interface in a given libusb_handle +.Fa devh. +This is a non-blocking function. It return 0 success, LIBUSB_ERROR_NOT_FOUND +if the requested interface does not exist, LIBUSB_ERROR_BUSY if a program or +driver has claimed the interface, LIBUSB_ERROR_NO_DEVICE if the device has +been disconnected and a LIBUSB_ERROR code on failure. . .Pp . -.Fn libusb20_dev_get_desc -returns a zero terminated string describing the given USB device. -The format of the string is: "drivername: " +.Ft int +.Fn libusb_release_interface "libusb_device_handle *devh" "int interface_number" +This function release an interface. All the claimed interface must be released +before closing a device. Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the +interafce was not claimed, LIBUSB_ERROR_NO_DEVICE if the device has been +disconnected and LIBUSB_ERROR on failure. . .Pp . -.Fn libusb20_dev_close -will close the given USB device. -. -This function returns zero on success else a LIBUSB20_ERROR value is -returned. +.Ft int +.Fn libusb_set_interface_alt_setting "libusb_device_handle *dev" "int interface_number" "int alternate_setting" +Activate an alternate setting for an interface. Returns 0 on success, +LIBUSB_ERROR_NOT_FOUND if the interface was not claimed or the requested +setting does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been +disconnected and LIBUSB_ERROR code on failure. . .Pp . -.Fn libusb20_dev_detach_kernel_driver -will try to detach the kernel driver for the USB interface given by -.Fa iface_index . -. -This function returns zero on success else a LIBUSB20_ERROR value is -returned. +.Ft int +.Fn libusb_clear_halt "libusb_device_handle *devh" "unsigned char endpoint" +Clear an halt/stall for a endpoint. Returns 0 on success, LIBUSB_ERROR_NOT_FOUND +if the endpoint does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been +disconnected and a LIBUSB_ERROR code on failure. . .Pp . -.Fn libusb20_dev_set_config_index -will try to set the configuration index on an USB -device. -. -The first configuration index is zero. -. -The un-configure index is 255. -. -This function returns zero on success else a LIBUSB20_ERROR value is returned. +.Ft int +.Fn libusb_reset_device "libusb_device_handle *devh" +Perform an USB port reset for an usb device. Returns 0 on success, +LIBUSB_ERROR_NOT_FOUND if re-enumeration is required or if the device has +been disconnected and a LIBUSB_ERROR code on failure. . .Pp . -.Fn libusb20_dev_get_debug -returns the debug level of an USB device. +.Ft int +.Fn libusb_kernel_driver_active "libusb_device_handle *devh" "int interface" +Determine if a driver is active on a interface. Returns 0 if no kernel driver +is active, returns 1 if a kernel driver is active, returns LIBUSB_ERROR_NO_DEVICE +if the device has been disconnected and return a LIBUSB_ERROR code on failure. . .Pp . -.Fn libusb20_dev_get_fd -returns the file descriptor of the given USB device. -. -A negative value is returned when no file descriptor is present. -. -The file descriptor can be used for polling purposes. +.Ft int +.Fn libusb_detach_kernel_driver "libusb_device_handle *devh" "int interface" +Detach a kernel driver from an interface. This is needed to claim an interface +required by a kernel driver. Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if +no kernel driver was active, LIBUSB_ERROR_INVALID_PARAM if the interface does not +exist, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a +LIBUSB_ERROR code on failure. . .Pp . -.Fn libusb20_dev_kernel_driver_active -returns a non-zero value if a kernel driver is active on -the given USB interface. -. -Else zero is returned. +.Ft int +.Fn libusb_attach_kernel_driver "libusb_device_handle *devh" "int interface" +Re-attach an interface kernel driver previously detached. Returns 0 on success, +LIBUSB_ERROR_INVALID_PARAM if the interface does not exist, LIBUSB_ERROR_NO_DEVICE +if the device has been disconnect, LIBUSB_ERROR_BUSY if the driver cannot be +attached because the interface is claimed by a program or driver and a +LIBUSB_ERROR code on failure. . .Pp . -.Fn libusb20_dev_open -opens an USB device so that setting up USB transfers -becomes possible. -. -The number of USB transfers can be zero which means only control -transfers are allowed. -. -This function returns zero on success else a LIBUSB20_ERROR value is -returned. -. -A return value of LIBUSB20_ERROR_BUSY means that the device is already -opened. +.Sh USB DESCRIPTORS . .Pp . -.Fn libusb20_dev_process -is called to sync kernel USB transfers with userland USB -transfers. -. -This function returns zero on success else a LIBUSB20_ERROR value is -returned typically indicating that the given USB device has been -detached. +.Ft int +.Fn libusb_get_device_descriptor "libusb_device *dev" "libusb_device_descriptor *desc" +Get the USB device descriptor for the device +.Fa dev. +This is a non-blocking function. Returns 0 on success and a LIBUSB_ERROR code on +failure. . .Pp -. -.Fn libusb20_dev_request_sync -will perform a synchronous control request on the given -USB device. -. -Before this call will succeed the USB device must be opened. -. -.Fa setup -is a pointer to a decoded and host endian SETUP packet. -.Fa data -is a pointer to a data transfer buffer associated with the control transaction. This argument can be NULL. -.Fa pactlen -is a pointer to a variable that will hold the actual transfer length after the control transaction is complete. -.Fa timeout -is the transaction timeout given in milliseconds. -A timeout of zero means no timeout. -.Fa flags -is used to specify transaction flags, for example LIBUSB20_TRANSFER_SINGLE_SHORT_NOT_OK. -. -This function returns zero on success else a LIBUSB20_ERROR value is -returned. +.Ft int +.Fn libsub_get_active_config_descriptor "libusb_device *dev" "libusb_device_descriptor **config" +Get the USB configuration descriptor for the active configuration. Returns 0 on +success, returns LIBUSB_ERROR_NOT_FOUND if the device is in unconfigured state +and return another LIBUSB_ERROR code on error. . .Pp -. -.Fn libusb20_dev_req_string_sync -will synchronously request an USB string by language ID -and string index into the given buffer limited by a maximum length. -. -This function returns zero on success else a LIBUSB20_ERROR value is -returned. +.Ft int +.Fn libusb_get_config_descriptor "libusb_device *dev" "uint8_t config_index" "libusb_config_descriptor **config" +Get USB configuration descriptor based on its index +.Fa idx. +Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the configuration does not exist +and returns another LIBUSB_ERROR code on error. . .Pp -. -.Fn libusb20_dev_req_string_simple_sync -will synchronously request an USB string using the -default language ID and convert the string into ASCII before storing -the string into the given buffer limited by a maximum length which -includes the terminating zero. -. -This function returns zero on success else a LIBUSB20_ERROR value is -returned. -. +.Ft int +.Fn libusb_get_config_descriptor_by_value "libusb_device *dev" "uint8 bConfigurationValue" "libusb_config_descriptor **config" +Get a USB configuration descriptor with a specific bConfigurationValue. This is +a non-blocking function which does not send request through the device. Returns 0 +on success, LIBUSB_ERROR_NOT_FOUND if the configuration does not exist and another +LIBUSB_ERROR code on failure. . .Pp -. -.Fn libusb20_dev_reset -will try to BUS reset the given USB device and restore -the last set USB configuration. -. -This function returns zero on success else a LIBUSB20_ERROR value is -returned. +.Ft void +.Fn libusb_free_config_descriptor "libusb_config_descriptor *config`" +Free a configuration descriptor. . .Pp -. -.Fn libusb20_dev_set_power_mode -sets the power mode of the USB device. -. -Valid power modes: -.Bl -tag -.It LIBUSB20_POWER_OFF -.It LIBUSB20_POWER_ON -.It LIBUSB20_POWER_SAVE -.It LIBUSB20_POWER_SUSPEND -.It LIBUSB20_POWER_RESUME -.El -. -This function returns zero on success else a LIBUSB20_ERROR value is -returned. +.Ft int +.Fn libusb_get_string_descriptor_ascii "libusb_device_handle *devh" "uint8_t desc_idx" "unsigned char *data" "int length" +Retrieve a string descriptor in C style ascii. Returns a number of byte on success +and a LIBUSB_ERROR code on failure. . .Pp . -.Fn libusb20_dev_get_power_mode -returns the currently selected power mode for the given -USB device. +.Sh USB ASYNCHRONOUS I/O . .Pp -. -.Fn libusb20_dev_set_alt_index -will try to set the given alternate index for the given -USB interface index. -. -This function returns zero on success else a LIBUSB20_ERROR value is -returned. +.Ft struct libusb_transfer * +.Fn libusb_alloc_transfer "int iso_packets" +Allocate a transfer with +.Fa iso_packets +numbers of isochronous packet descriptors. Returns NULL on error. . .Pp -. -.Fn libusb20_dev_get_device_desc -returns a pointer to the decoded and host endian version -of the device descriptor. -. -The USB device need not be opened when calling this function. +.Ft void +.Fn libusb_free_transfer "struct libusb_transfer *tr" +Free a transfer. . .Pp -. -.Fn libusb20_dev_alloc_config -will read out and decode the USB config descriptor for -the given USB device and config index. This function returns a pointer -to the decoded configuration which must eventually be passed to -free(). NULL is returned in case of failure. +.Ft int +.Fn libusb_submit_transfer "struct libusb_transfer *tr" +This function will submit a transfer and returns immediately. Returns 0 on +success, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and +LIBUSB_ERROR code on other failure. . .Pp -. -.Fn libusb20_dev_alloc -is an internal function to allocate a new USB device. +.Ft int +.Fn libusb_cancel_transfer "struct libusb_transfer *tr" +This function asynchronously cancel a transfer. Returns 0 on success and +LIBUSB_ERROR code on failure. . .Pp -. -.Fn libusb20_dev_get_address -returns the internal and not necessarily the real -hardware address of the given USB device. +.Sh USB SYNCHRONOUS I/O . .Pp -. -.Fn libusb20_dev_get_bus_number -returns the internal bus number which the given USB -device belongs to. +.Ft int +.Fn libusb_control_transfer "libusb_device_handle *devh" "uint8_t bmRequestType" "uint16_t wIndex" "unsigned char *data" "uint16_t wLength" "unsigned int timeout" +Perform a USB control transfer. Returns 0 on success, LIBUSB_ERROR_TIMEOUT +if the transfer timeout, LIBUSB_ERROR_PIPE if the control request was not +supported, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and +LIBUSB_ERROR code on other failure. . .Pp -. -.Fn libusb20_dev_get_mode -returns the current operation mode of the USB entity. -. -Valid return values are: -.Bl -tag -.It LIBUSB20_MODE_HOST -.It LIBUSB20_MODE_DEVICE -.El +.Ft int +.Fn libusb_bulk_transfer "struct libusb_device_handle *devh" "unsigned char endpoint" "unsigned char *data" "int length" "int *transferred" "unsigned int timeout" +Perform an USB bulk transfer. Returns 0 on success, LIBUSB_ERROR_TIMEOUT +if the transfer timeout, LIBUSB_ERROR_PIPE if the control request was not +supported, LIBUSB_ERROR_OVERFLOW if the device offered more data, +LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and +LIBUSB_ERROR code on other failure. . .Pp -. -.Fn libusb20_dev_get_speed -returns the current speed of the given USB device. -. -.Bl -tag -.It LIBUSB20_SPEED_UNKNOWN -.It LIBUSB20_SPEED_LOW -.It LIBUSB20_SPEED_FULL -.It LIBUSB20_SPEED_HIGH -.It LIBUSB20_SPEED_VARIABLE -.It LIBUSB20_SPEED_SUPER -.El +.Ft int +.Fn libusb_interrupt_transfer "struct libusb_device_handle *devh" "unsigned char endpoint" "unsigned char *data" "int length" "int *transferred" "unsigned int timeout" +Perform an USB Interrupt transfer. Returns 0 on success, LIBUSB_ERROR_TIMEOUT +if the transfer timeout, LIBUSB_ERROR_PIPE if the control request was not +supported, LIBUSB_ERROR_OVERFLOW if the device offered more data, +LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and +LIBUSB_ERROR code on other failure. . .Pp -. -.Fn libusb20_dev_get_config_index -This function returns the currently select config index for the given -USB device. +.Sh USB EVENTS . .Pp -. -.Fn libusb20_dev_free -will free the given USB device and all associated USB -transfers. +.Ft int +.Fn libusb_try_lock_events "libusb_context *ctx" +Try to acquire the event handling lock. Returns 0 if the lock was obtained and 1 +if not. . .Pp -. -.Fn libusb20_dev_set_debug -will set the debug level for the given USB device. +.Ft void +.Fn libusb_lock_events "libusb_context *ctx" +Acquire the event handling lock. This function is blocking. . .Pp -. -.Fn libusb20_dev_wait_process -function will wait until a pending USB transfer has completed on -the given USB device. -. -A timeout value can be specified which is passed on to the -.Xr poll 2 -function. -. -.Sh USB BACKEND OPERATIONS -. -.Fn libusb20_be_get_template -will return the currently selected global USB device -side mode template into the integer pointer -.Fa ptemp . -This function returns zero on success else a LIBUSB20_ERROR value is -returned. +.Ft void +.Fn libusb_unlock_events "libusb_context *ctx" +Release the event handling lock. This will wake up any thread blocked +on libusb_wait_for_event(). . .Pp -. -.Fn libusb20_be_set_template -will set the global USB device side mode template to -.Fa temp . *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 01:03:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3468106564A; Tue, 23 Jun 2009 01:03:09 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A62F8FC19; Tue, 23 Jun 2009 01:03:09 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5N1393x059643; Tue, 23 Jun 2009 01:03:09 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5N139Nw059641; Tue, 23 Jun 2009 01:03:09 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200906230103.n5N139Nw059641@svn.freebsd.org> From: Ken Smith Date: Tue, 23 Jun 2009 01:03: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: r194675 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 01:03:10 -0000 Author: kensmith Date: Tue Jun 23 01:03:09 2009 New Revision: 194675 URL: http://svn.freebsd.org/changeset/base/194675 Log: Describe the new algorithm for handling __FreeBSD_version, specifically the 'R' value now being allowed to take on more values than 0 or 1 and permitting more than 100 version bumps in pre-release branches. Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Tue Jun 23 01:00:26 2009 (r194674) +++ head/sys/sys/param.h Tue Jun 23 01:03:09 2009 (r194675) @@ -53,8 +53,9 @@ * doc/en_US.ISO8859-1/books/porters-handbook/book.sgml * * scheme is: Rxx - * 'R' is 0 if release branch or x.0-CURRENT before RELENG_*_0 - * is created, otherwise 1. + * 'R' is in the range 0 to 4 if this is a release branch or + * x.0-CURRENT before RELENG_*_0 is created, otherwise 'R' is + * in the range 5 to 9. */ #undef __FreeBSD_version #define __FreeBSD_version 800099 /* Master, propagated to newvers */ From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 01:04:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B54B71065674; Tue, 23 Jun 2009 01:04:58 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A25AA8FC14; Tue, 23 Jun 2009 01:04:58 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5N14wFR059743; Tue, 23 Jun 2009 01:04:58 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5N14w2q059740; Tue, 23 Jun 2009 01:04:58 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200906230104.n5N14w2q059740@svn.freebsd.org> From: Andrew Thompson Date: Tue, 23 Jun 2009 01:04: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: r194676 - head/lib/libusb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 01:04:59 -0000 Author: thompsa Date: Tue Jun 23 01:04:58 2009 New Revision: 194676 URL: http://svn.freebsd.org/changeset/base/194676 Log: Add files missed in r194674. Add libusb 1.0 support which is compatible with the latest revision on Sourceforge. Libusb 1.0 is a portable usb api released December 2008 and supersedes the original libusb released 10 years ago, it supports isochronous endpoints and asynchronous I/O. Many applications have already started using the interfaces. This has been developed as part of Google Summer of Code this year by Sylvestre Gallon and has been cribbed early due to it being desirable in FreeBSD 8.0 Submitted by: Sylvestre Gallon Sponsored by: Google Summer of Code 2009 Reviewed by: Hans Petter Selasky Added: head/lib/libusb/libusb.h (contents, props changed) head/lib/libusb/libusb10.c (contents, props changed) head/lib/libusb/libusb10.h (contents, props changed) head/lib/libusb/libusb10_desc.c (contents, props changed) head/lib/libusb/libusb10_io.c (contents, props changed) Added: head/lib/libusb/libusb.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libusb/libusb.h Tue Jun 23 01:04:58 2009 (r194676) @@ -0,0 +1,427 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2009 Sylvestre Gallon. 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. + */ + +#ifndef __LIBUSB_H__ +#define __LIBUSB_H__ + +#include +#include +#include +#include + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif +#if 0 +} /* indent fix */ + +#endif + +struct list_head { + struct list_head *prev, *next; +}; + +/* libusb enums */ + +enum libusb_class_code { + LIBUSB_CLASS_PER_INTERFACE = 0, + LIBUSB_CLASS_AUDIO = 1, + LIBUSB_CLASS_COMM = 2, + LIBUSB_CLASS_HID = 3, + LIBUSB_CLASS_PTP = 6, + LIBUSB_CLASS_PRINTER = 7, + LIBUSB_CLASS_MASS_STORAGE = 8, + LIBUSB_CLASS_HUB = 9, + LIBUSB_CLASS_DATA = 10, + LIBUSB_CLASS_VENDOR_SPEC = 0xff, +}; + +enum libusb_descriptor_type { + LIBUSB_DT_DEVICE = 0x01, + LIBUSB_DT_CONFIG = 0x02, + LIBUSB_DT_STRING = 0x03, + LIBUSB_DT_INTERFACE = 0x04, + LIBUSB_DT_ENDPOINT = 0x05, + LIBUSB_DT_HID = 0x21, + LIBUSB_DT_REPORT = 0x22, + LIBUSB_DT_PHYSICAL = 0x23, + LIBUSB_DT_HUB = 0x29, +}; + +#define LIBUSB_DT_DEVICE_SIZE 18 +#define LIBUSB_DT_CONFIG_SIZE 9 +#define LIBUSB_DT_INTERFACE_SIZE 9 +#define LIBUSB_DT_ENDPOINT_SIZE 7 +#define LIBUSB_DT_ENDPOINT_AUDIO_SIZE 9 +#define LIBUSB_DT_HUB_NONVAR_SIZE 7 + +#define LIBUSB_ENDPOINT_ADDRESS_MASK 0x0f +#define LIBUSB_ENDPOINT_DIR_MASK 0x80 + +enum libusb_endpoint_direction { + LIBUSB_ENDPOINT_IN = 0x80, + LIBUSB_ENDPOINT_OUT = 0x00, +}; + +#define LIBUSB_TRANSFER_TYPE_MASK 0x03 + +enum libusb_transfer_type { + LIBUSB_TRANSFER_TYPE_CONTROL = 0, + LIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1, + LIBUSB_TRANSFER_TYPE_BULK = 2, + LIBUSB_TRANSFER_TYPE_INTERRUPT = 3, +}; + +enum libusb_standard_request { + LIBUSB_REQUEST_GET_STATUS = 0x00, + LIBUSB_REQUEST_CLEAR_FEATURE = 0x01, + LIBUSB_REQUEST_SET_FEATURE = 0x03, + LIBUSB_REQUEST_SET_ADDRESS = 0x05, + LIBUSB_REQUEST_GET_DESCRIPTOR = 0x06, + LIBUSB_REQUEST_SET_DESCRIPTOR = 0x07, + LIBUSB_REQUEST_GET_CONFIGURATION = 0x08, + LIBUSB_REQUEST_SET_CONFIGURATION = 0x09, + LIBUSB_REQUEST_GET_INTERFACE = 0x0A, + LIBUSB_REQUEST_SET_INTERFACE = 0x0B, + LIBUSB_REQUEST_SYNCH_FRAME = 0x0C, +}; + +enum libusb_request_type { + LIBUSB_REQUEST_TYPE_STANDARD = (0x00 << 5), + LIBUSB_REQUEST_TYPE_CLASS = (0x01 << 5), + LIBUSB_REQUEST_TYPE_VENDOR = (0x02 << 5), + LIBUSB_REQUEST_TYPE_RESERVED = (0x03 << 5), +}; + +enum libusb_request_recipient { + LIBUSB_RECIPIENT_DEVICE = 0x00, + LIBUSB_RECIPIENT_INTERFACE = 0x01, + LIBUSB_RECIPIENT_ENDPOINT = 0x02, + LIBUSB_RECIPIENT_OTHER = 0x03, +}; + +#define LIBUSB_ISO_SYNC_TYPE_MASK 0x0C + +enum libusb_iso_sync_type { + LIBUSB_ISO_SYNC_TYPE_NONE = 0, + LIBUSB_ISO_SYNC_TYPE_ASYNC = 1, + LIBUSB_ISO_SYNC_TYPE_ADAPTIVE = 2, + LIBUSB_ISO_SYNC_TYPE_SYNC = 3, +}; + +#define LIBUSB_ISO_USAGE_TYPE_MASK 0x30 + +enum libusb_iso_usage_type { + LIBUSB_ISO_USAGE_TYPE_DATA = 0, + LIBUSB_ISO_USAGE_TYPE_FEEDBACK = 1, + LIBUSB_ISO_USAGE_TYPE_IMPLICIT = 2, +}; + +enum libusb_error { + LIBUSB_SUCCESS = 0, + LIBUSB_ERROR_IO = -1, + LIBUSB_ERROR_INVALID_PARAM = -2, + LIBUSB_ERROR_ACCESS = -3, + LIBUSB_ERROR_NO_DEVICE = -4, + LIBUSB_ERROR_NOT_FOUND = -5, + LIBUSB_ERROR_BUSY = -6, + LIBUSB_ERROR_TIMEOUT = -7, + LIBUSB_ERROR_OVERFLOW = -8, + LIBUSB_ERROR_PIPE = -9, + LIBUSB_ERROR_INTERRUPTED = -10, + LIBUSB_ERROR_NO_MEM = -11, + LIBUSB_ERROR_NOT_SUPPORTED = -12, + LIBUSB_ERROR_OTHER = -99, +}; + +enum libusb_transfer_status { + LIBUSB_TRANSFER_COMPLETED, + LIBUSB_TRANSFER_ERROR, + LIBUSB_TRANSFER_TIMED_OUT, + LIBUSB_TRANSFER_CANCELLED, + LIBUSB_TRANSFER_STALL, + LIBUSB_TRANSFER_NO_DEVICE, + LIBUSB_TRANSFER_OVERFLOW, +}; + +enum libusb_transfer_flags { + LIBUSB_TRANSFER_SHORT_NOT_OK = 1 << 0, + LIBUSB_TRANSFER_FREE_BUFFER = 1 << 1, + LIBUSB_TRANSFER_FREE_TRANSFER = 1 << 2, +}; + +enum libusb_debug_level { + LIBUSB_DEBUG_NO=0, + LIBUSB_DEBUG_FUNCTION=1, + LIBUSB_DEBUG_TRANSFER=2, +}; + +/* libusb structures */ + +typedef void (*libusb_pollfd_added_cb) (int fd, short events, void *user_data); +typedef void (*libusb_pollfd_removed_cb) (int fd, void *user_data); + +typedef struct libusb_context { + int debug; + int debug_fixed; + + int ctrl_pipe[2]; + + struct list_head usb_devs; + pthread_mutex_t usb_devs_lock; + + struct list_head open_devs; + pthread_mutex_t open_devs_lock; + + struct list_head flying_transfers; + pthread_mutex_t flying_transfers_lock; + + struct list_head pollfds; + pthread_mutex_t pollfds_lock; + + unsigned int pollfd_modify; + pthread_mutex_t pollfd_modify_lock; + + libusb_pollfd_added_cb fd_added_cb; + libusb_pollfd_removed_cb fd_removed_cb; + void *fd_cb_user_data; + + pthread_mutex_t events_lock; + int event_handler_active; + + pthread_mutex_t event_waiters_lock; + pthread_cond_t event_waiters_cond; +} libusb_context; + +typedef struct libusb_device { + pthread_mutex_t lock; + int refcnt; + + struct libusb_context *ctx; + + uint8_t bus_number; + uint8_t device_address; + uint8_t num_configurations; + + struct list_head list; + unsigned long session_data; + void *os_priv; +} libusb_device; + +typedef struct libusb_device_handle { + pthread_mutex_t lock; + unsigned long claimed_interfaces; + + struct list_head list; + struct libusb_device *dev; + void *os_priv; +} libusb_device_handle; + +typedef struct libusb_device_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t bcdUSB; + uint8_t bDeviceClass; + uint8_t bDeviceSubClass; + uint8_t bDeviceProtocol; + uint8_t bMaxPacketSize0; + uint16_t idVendor; + uint16_t idProduct; + uint16_t bcdDevice; + uint8_t iManufacturer; + uint8_t iProduct; + uint8_t iSerialNumber; + uint8_t bNumConfigurations; +} libusb_device_descriptor; + +typedef struct libusb_endpoint_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bEndpointAddress; + uint8_t bmAttributes; + uint16_t wMaxPacketSize; + uint8_t bInterval; + uint8_t bRefresh; + uint8_t bSynchAddress; + unsigned char *extra; + int extra_length; +} libusb_endpoint_descriptor __aligned(sizeof(void *)); + +typedef struct libusb_interface_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint8_t bInterfaceNumber; + uint8_t bAlternateSetting; + uint8_t bNumEndpoints; + uint8_t bInterfaceClass; + uint8_t bInterfaceSubClass; + uint8_t bInterfaceProtocol; + uint8_t iInterface; + struct libusb_endpoint_descriptor *endpoint; + unsigned char *extra; + int extra_length; +} libusb_interface_descriptor __aligned(sizeof(void *)); + +typedef struct libusb_interface { + struct libusb_interface_descriptor *altsetting; + int num_altsetting; +} libusb_interface __aligned(sizeof(void *)); + +typedef struct libusb_config_descriptor { + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t wTotalLength; + uint8_t bNumInterfaces; + uint8_t bConfigurationValue; + uint8_t iConfiguration; + uint8_t bmAttributes; + uint8_t MaxPower; + struct libusb_interface *interface; + unsigned char *extra; + int extra_length; +} libusb_config_descriptor __aligned(sizeof(void *)); + +typedef struct libusb_control_setup { + uint8_t bmRequestType; + uint8_t bRequest; + uint16_t wValue; + uint16_t wIndex; + uint16_t wLength; +} libusb_control_setup; + +typedef struct libusb_iso_packet_descriptor { + unsigned int length; + unsigned int actual_length; + enum libusb_transfer_status status; +} libusb_iso_packet_descriptor __aligned(sizeof(void *)); + +struct libusb_transfer; + +typedef void (*libusb_transfer_cb_fn) (struct libusb_transfer *transfer); + +typedef struct libusb_transfer { + libusb_device_handle *dev_handle; + uint8_t flags; + unsigned int endpoint; + unsigned char type; + unsigned int timeout; + enum libusb_transfer_status status; + int length; + int actual_length; + libusb_transfer_cb_fn callback; + void *user_data; + unsigned char *buffer; + void *os_priv; + int num_iso_packets; + struct libusb_iso_packet_descriptor iso_packet_desc[0]; +} libusb_transfer __aligned(sizeof(void *)); + +typedef struct libusb_pollfd { + int fd; + short events; +} libusb_pollfd; + +/* Library initialisation */ + +void libusb_set_debug(libusb_context * ctx, int level); +int libusb_init(libusb_context ** context); +void libusb_exit(struct libusb_context *ctx); + +/* Device handling and enumeration */ + +ssize_t libusb_get_device_list(libusb_context * ctx, libusb_device *** list); +void libusb_free_device_list(libusb_device ** list, int unref_devices); +uint8_t libusb_get_bus_number(libusb_device * dev); +uint8_t libusb_get_device_address(libusb_device * dev); +int libusb_get_max_packet_size(libusb_device * dev, unsigned char endpoint); +libusb_device *libusb_ref_device(libusb_device * dev); +void libusb_unref_device(libusb_device * dev); +int libusb_open(libusb_device * dev, libusb_device_handle ** devh); +libusb_device_handle *libusb_open_device_with_vid_pid(libusb_context * ctx, uint16_t vendor_id, uint16_t product_id); +void libusb_close(libusb_device_handle * devh); +libusb_device *libusb_get_device(libusb_device_handle * devh); +int libusb_get_configuration(libusb_device_handle * devh, int *config); +int libusb_set_configuration(libusb_device_handle * devh, int configuration); +int libusb_claim_interface(libusb_device_handle * devh, int interface_number); +int libusb_release_interface(libusb_device_handle * devh, int interface_number); +int libusb_kernel_driver_active(libusb_device_handle * devh, int interface); +int libusb_detach_kernel_driver(libusb_device_handle * devh, int interface); +int libusb_attach_kernel_driver(libusb_device_handle * devh, int interface); +int libusb_set_interface_alt_setting(libusb_device_handle * devh, int interface_number, int alternate_setting); + +/* USB Descriptors */ + +int libusb_get_device_descriptor(libusb_device * dev, struct libusb_device_descriptor *desc); +int libusb_get_active_config_descriptor(libusb_device * dev, struct libusb_config_descriptor **config); +int libusb_get_config_descriptor(libusb_device * dev, uint8_t config_index, struct libusb_config_descriptor **config); +int libusb_get_config_descriptor_by_value(libusb_device * dev, uint8_t bConfigurationValue, struct libusb_config_descriptor **config); +void libusb_free_config_descriptor(struct libusb_config_descriptor *config); +int libusb_get_string_descriptor_ascii(libusb_device_handle * dev, uint8_t desc_index, unsigned char *data, int length); + +/* Asynchronous device I/O*/ + +struct libusb_transfer *libusb_alloc_transfer(int iso_packets); +void libusb_free_transfer(struct libusb_transfer *transfer); +int libusb_submit_transfer(struct libusb_transfer *transfer); +int libusb_cancel_transfer(struct libusb_transfer *transfer); +unsigned char *libusb_get_iso_packet_buffer_simple(struct libusb_transfer *transfer, unsigned int packet); + +/* Polling and timing */ + +int libusb_try_lock_events(libusb_context * ctx); +void libusb_lock_events(libusb_context * ctx); +void libusb_unlock_events(libusb_context * ctx); +int libusb_event_handling_ok(libusb_context * ctx); +int libusb_event_handler_active(libusb_context * ctx); +void libusb_lock_event_waiters(libusb_context * ctx); +void libusb_unlock_event_waiters(libusb_context * ctx); +int libusb_wait_for_event(libusb_context * ctx, struct timeval *tv); +int libusb_handle_events_timeout(libusb_context * ctx, struct timeval *tv); +int libusb_handle_events(libusb_context * ctx); +int libusb_handle_events_locked(libusb_context * ctx, struct timeval *tv); +int libusb_get_next_timeout(libusb_context * ctx, struct timeval *tv); +void libusb_set_pollfd_notifiers(libusb_context * ctx, libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb, void *user_data); +struct libusb_pollfd **libusb_get_pollfds(libusb_context * ctx); + +/* Synchronous device I/O */ + +int libusb_control_transfer(libusb_device_handle * devh, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, unsigned char *data, uint16_t wLength, unsigned int timeout); +int libusb_bulk_transfer(struct libusb_device_handle *devh, unsigned char endpoint, unsigned char *data, int length, int *transferred, unsigned int timeout); +int libusb_interrupt_transfer(struct libusb_device_handle *devh, unsigned char endpoint, unsigned char *data, int length, int *transferred, unsigned int timeout); + +#if 0 +{ /* indent fix */ +#endif +#ifdef __cplusplus +} + +#endif + +#endif /* __LIBUSB_H__ */ Added: head/lib/libusb/libusb10.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libusb/libusb10.c Tue Jun 23 01:04:58 2009 (r194676) @@ -0,0 +1,1140 @@ +/* $FreeBSD$ */ +/*- + * Copyright (c) 2009 Sylvestre Gallon. 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libusb20.h" +#include "libusb20_desc.h" +#include "libusb20_int.h" +#include "libusb.h" +#include "libusb10.h" + +static pthread_mutex_t default_context_lock = PTHREAD_MUTEX_INITIALIZER; +struct libusb_context *usbi_default_context = NULL; +pthread_mutex_t libusb20_lock = PTHREAD_MUTEX_INITIALIZER; + +/* Library initialisation / deinitialisation */ + +void +libusb_set_debug(libusb_context * ctx, int level) +{ + GET_CONTEXT(ctx); + if (ctx) + ctx->debug = level; +} + +int +libusb_init(libusb_context ** context) +{ + struct libusb_context *ctx; + char * debug; + int ret; + + ctx = malloc(sizeof(*ctx)); + if (!ctx) + return (LIBUSB_ERROR_INVALID_PARAM); + + memset(ctx, 0, sizeof(*ctx)); + + debug = getenv("LIBUSB_DEBUG"); + if (debug != NULL) { + ctx->debug = atoi(debug); + if (ctx->debug != 0) + ctx->debug_fixed = 1; + } + + pthread_mutex_init(&ctx->usb_devs_lock, NULL); + pthread_mutex_init(&ctx->open_devs_lock, NULL); + USB_LIST_INIT(&ctx->usb_devs); + USB_LIST_INIT(&ctx->open_devs); + + pthread_mutex_init(&ctx->flying_transfers_lock, NULL); + pthread_mutex_init(&ctx->pollfds_lock, NULL); + pthread_mutex_init(&ctx->pollfd_modify_lock, NULL); + pthread_mutex_init(&ctx->events_lock, NULL); + pthread_mutex_init(&ctx->event_waiters_lock, NULL); + pthread_cond_init(&ctx->event_waiters_cond, NULL); + + USB_LIST_INIT(&ctx->flying_transfers); + USB_LIST_INIT(&ctx->pollfds); + + ret = pipe(ctx->ctrl_pipe); + if (ret < 0) { + usb_remove_pollfd(ctx, ctx->ctrl_pipe[0]); + close(ctx->ctrl_pipe[0]); + close(ctx->ctrl_pipe[1]); + free(ctx); + return (LIBUSB_ERROR_OTHER); + } + + ret = usb_add_pollfd(ctx, ctx->ctrl_pipe[0], POLLIN); + if (ret < 0) { + usb_remove_pollfd(ctx, ctx->ctrl_pipe[0]); + close(ctx->ctrl_pipe[0]); + close(ctx->ctrl_pipe[1]); + free(ctx); + return ret; + } + + pthread_mutex_lock(&default_context_lock); + if (usbi_default_context == NULL) { + usbi_default_context = ctx; + } + pthread_mutex_unlock(&default_context_lock); + + if (context) + *context = ctx; + + return (0); +} + +void +libusb_exit(libusb_context * ctx) +{ + GET_CONTEXT(ctx); + + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_exit enter"); + usb_remove_pollfd(ctx, ctx->ctrl_pipe[0]); + close(ctx->ctrl_pipe[0]); + close(ctx->ctrl_pipe[1]); + + pthread_mutex_lock(&default_context_lock); + if (ctx == usbi_default_context) { + usbi_default_context = NULL; + } + pthread_mutex_unlock(&default_context_lock); + + free(ctx); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_exit leave"); +} + +/* Device handling and initialisation. */ + +ssize_t +libusb_get_device_list(libusb_context * ctx, libusb_device *** list) +{ + struct libusb20_device *pdev; + struct LIBUSB20_DEVICE_DESC_DECODED *ddesc; + struct libusb_device *dev; + struct libusb20_backend *usb_backend; + int i; + + GET_CONTEXT(ctx); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device_list enter"); + + usb_backend = libusb20_be_alloc_default(); + if (usb_backend == NULL) + return (-1); + + pdev = NULL; + i = 0; + while ((pdev = libusb20_be_device_foreach(usb_backend, pdev))) + i++; + + if (list == NULL) { + libusb20_be_free(usb_backend); + return (LIBUSB_ERROR_INVALID_PARAM); + } + *list = malloc((i + 1) * sizeof(void *)); + if (*list == NULL) { + libusb20_be_free(usb_backend); + return (LIBUSB_ERROR_NO_MEM); + } + i = 0; + while ((pdev = libusb20_be_device_foreach(usb_backend, NULL))) { + /* get device into libUSB v1.0 list */ + libusb20_be_dequeue_device(usb_backend, pdev); + + ddesc = libusb20_dev_get_device_desc(pdev); + dev = malloc(sizeof(*dev)); + if (dev == NULL) { + free(*list); + libusb20_be_free(usb_backend); + return (LIBUSB_ERROR_NO_MEM); + } + memset(dev, 0, sizeof(*dev)); + + pthread_mutex_init(&dev->lock, NULL); + dev->ctx = ctx; + dev->bus_number = pdev->bus_number; + dev->device_address = pdev->device_address; + dev->num_configurations = ddesc->bNumConfigurations; + + /* link together the two structures */ + dev->os_priv = pdev; + + pthread_mutex_lock(&ctx->usb_devs_lock); + LIST_ADD(&dev->list, &ctx->usb_devs); + pthread_mutex_unlock(&ctx->usb_devs_lock); + + (*list)[i] = libusb_ref_device(dev); + i++; + } + (*list)[i] = NULL; + + libusb20_be_free(usb_backend); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device_list leave"); + return (i); +} + +/* + * In this function we cant free all the device contained into list because + * open_with_pid_vid use some node of list after the free_device_list. + */ +void +libusb_free_device_list(libusb_device **list, int unref_devices) +{ + int i; + libusb_context *ctx; + + ctx = NULL; + GET_CONTEXT(ctx); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_free_device_list enter"); + + if (list == NULL) + return ; + + if (unref_devices) { + for (i = 0; list[i] != NULL; i++) + libusb_unref_device(list[i]); + } + free(list); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_free_device_list leave"); +} + +uint8_t +libusb_get_bus_number(libusb_device * dev) +{ + libusb_context *ctx; + + ctx = NULL; + GET_CONTEXT(ctx); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_bus_number enter"); + + if (dev == NULL) + return (LIBUSB_ERROR_NO_DEVICE); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_bus_number leave"); + return (dev->bus_number); +} + +uint8_t +libusb_get_device_address(libusb_device * dev) +{ + libusb_context *ctx; + + ctx = NULL; + GET_CONTEXT(ctx); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device_address enter"); + + if (dev == NULL) + return (LIBUSB_ERROR_NO_DEVICE); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device_address leave"); + return (dev->device_address); +} + +int +libusb_get_max_packet_size(libusb_device *dev, unsigned char endpoint) +{ + struct libusb_config_descriptor *pdconf; + struct libusb_interface *pinf; + struct libusb_interface_descriptor *pdinf; + struct libusb_endpoint_descriptor *pdend; + libusb_context *ctx; + int i, j, k, ret; + + ctx = NULL; + GET_CONTEXT(ctx); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_max_packet_size enter"); + + if (dev == NULL) + return (LIBUSB_ERROR_NO_DEVICE); + + if (libusb_get_active_config_descriptor(dev, &pdconf) < 0) + return (LIBUSB_ERROR_OTHER); + + ret = LIBUSB_ERROR_NOT_FOUND; + for (i = 0 ; i < pdconf->bNumInterfaces ; i++) { + pinf = &pdconf->interface[i]; + for (j = 0 ; j < pinf->num_altsetting ; j++) { + pdinf = &pinf->altsetting[j]; + for (k = 0 ; k < pdinf->bNumEndpoints ; k++) { + pdend = &pdinf->endpoint[k]; + if (pdend->bEndpointAddress == endpoint) { + ret = pdend->wMaxPacketSize; + goto out; + } + } + } + } + +out: + libusb_free_config_descriptor(pdconf); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_max_packet_size leave"); + return (ret); +} + +libusb_device * +libusb_ref_device(libusb_device * dev) +{ + libusb_context *ctx; + + ctx = NULL; + GET_CONTEXT(ctx); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_ref_device enter"); + + if (dev == NULL) + return (NULL); + + pthread_mutex_lock(&dev->lock); + dev->refcnt++; + pthread_mutex_unlock(&dev->lock); + + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_ref_device leave"); + return (dev); +} + +void +libusb_unref_device(libusb_device * dev) +{ + libusb_context *ctx; + + ctx = NULL; + GET_CONTEXT(ctx); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_unref_device enter"); + + if (dev == NULL) + return; + + pthread_mutex_lock(&dev->lock); + dev->refcnt--; + pthread_mutex_unlock(&dev->lock); + + if (dev->refcnt == 0) { + pthread_mutex_lock(&dev->ctx->usb_devs_lock); + LIST_DEL(&dev->list); + pthread_mutex_unlock(&dev->ctx->usb_devs_lock); + + libusb20_dev_free(dev->os_priv); + free(dev); + } + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_unref_device leave"); +} + +int +libusb_open(libusb_device * dev, libusb_device_handle **devh) +{ + libusb_context *ctx = dev->ctx; + struct libusb20_device *pdev = dev->os_priv; + libusb_device_handle *hdl; + unsigned char dummy; + int err; + + GET_CONTEXT(ctx); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open enter"); + + dummy = 1; + if (devh == NULL) + return (LIBUSB_ERROR_INVALID_PARAM); + + hdl = malloc(sizeof(*hdl)); + if (hdl == NULL) + return (LIBUSB_ERROR_NO_MEM); + + err = libusb20_dev_open(pdev, 16 * 4 /* number of endpoints */ ); + if (err) { + free(hdl); + return (LIBUSB_ERROR_NO_MEM); + } + memset(hdl, 0, sizeof(*hdl)); + pthread_mutex_init(&hdl->lock, NULL); + + hdl->dev = libusb_ref_device(dev); + hdl->claimed_interfaces = 0; + hdl->os_priv = dev->os_priv; + err = usb_add_pollfd(ctx, libusb20_dev_get_fd(pdev), POLLIN | + POLLOUT | POLLRDNORM | POLLWRNORM); + if (err < 0) { + libusb_unref_device(dev); + free(hdl); + return (err); + } + + pthread_mutex_lock(&ctx->open_devs_lock); + LIST_ADD(&hdl->list, &ctx->open_devs); + pthread_mutex_unlock(&ctx->open_devs_lock); + + *devh = hdl; + + pthread_mutex_lock(&ctx->pollfd_modify_lock); + ctx->pollfd_modify++; + pthread_mutex_unlock(&ctx->pollfd_modify_lock); + + err = write(ctx->ctrl_pipe[1], &dummy, sizeof(dummy)); + if (err <= 0) { + pthread_mutex_lock(&ctx->pollfd_modify_lock); + ctx->pollfd_modify--; + pthread_mutex_unlock(&ctx->pollfd_modify_lock); + return 0; + } + + libusb_lock_events(ctx); + read(ctx->ctrl_pipe[0], &dummy, sizeof(dummy)); + pthread_mutex_lock(&ctx->pollfd_modify_lock); + ctx->pollfd_modify--; + pthread_mutex_unlock(&ctx->pollfd_modify_lock); + libusb_unlock_events(ctx); + + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open leave"); + return (0); +} + +libusb_device_handle * +libusb_open_device_with_vid_pid(libusb_context * ctx, uint16_t vendor_id, + uint16_t product_id) +{ + struct libusb_device **devs; + struct libusb_device_handle *devh; + struct libusb20_device *pdev; + struct LIBUSB20_DEVICE_DESC_DECODED *pdesc; + int i, j; + + GET_CONTEXT(ctx); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open_device_width_vid_pid enter"); + + devh = NULL; + + if ((i = libusb_get_device_list(ctx, &devs)) < 0) + return (NULL); + + for (j = 0; j < i; j++) { + pdev = (struct libusb20_device *)devs[j]->os_priv; + pdesc = libusb20_dev_get_device_desc(pdev); + if (pdesc->idVendor == vendor_id && + pdesc->idProduct == product_id) + if (libusb_open(devs[j], &devh) < 0) + devh = NULL; + } + + libusb_free_device_list(devs, 1); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_open_device_width_vid_pid leave"); + return (devh); +} + +void +libusb_close(libusb_device_handle * devh) +{ + libusb_context *ctx; + struct libusb20_device *pdev; + unsigned char dummy = 1; + int err; + + if (devh == NULL) + return ; + + ctx = devh->dev->ctx; + pdev = devh->os_priv; + + GET_CONTEXT(ctx); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_close enter"); + + pthread_mutex_lock(&ctx->pollfd_modify_lock); + ctx->pollfd_modify++; + pthread_mutex_unlock(&ctx->pollfd_modify_lock); + + err = write(ctx->ctrl_pipe[1], &dummy, sizeof(dummy)); + + if (err <= 0) { + pthread_mutex_lock(&ctx->open_devs_lock); + LIST_DEL(&devh->list); + pthread_mutex_unlock(&ctx->open_devs_lock); + + usb_remove_pollfd(ctx, libusb20_dev_get_fd(pdev)); + libusb_unref_device(devh->dev); + libusb20_dev_close(pdev); + free(devh); + + pthread_mutex_lock(&ctx->pollfd_modify_lock); + ctx->pollfd_modify--; + pthread_mutex_unlock(&ctx->pollfd_modify_lock); + return ; + } + libusb_lock_events(ctx); + + read(ctx->ctrl_pipe[0], &dummy, sizeof(dummy)); + pthread_mutex_lock(&ctx->open_devs_lock); + LIST_DEL(&devh->list); + pthread_mutex_unlock(&ctx->open_devs_lock); + + usb_remove_pollfd(ctx, libusb20_dev_get_fd(pdev)); + libusb_unref_device(devh->dev); + libusb20_dev_close(pdev); + free(devh); + + pthread_mutex_lock(&ctx->pollfd_modify_lock); + ctx->pollfd_modify--; + pthread_mutex_unlock(&ctx->pollfd_modify_lock); + + libusb_unlock_events(ctx); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_close leave"); +} + +libusb_device * +libusb_get_device(libusb_device_handle * devh) +{ + libusb_context *ctx; + + ctx = NULL; + GET_CONTEXT(ctx); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device enter"); + + if (devh == NULL) + return (NULL); + + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_device leave"); + return (devh->dev); +} + +int +libusb_get_configuration(libusb_device_handle * devh, int *config) +{ + libusb_context *ctx; + + ctx = NULL; + GET_CONTEXT(ctx); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_configuration enter"); + + if (devh == NULL || config == NULL) + return (LIBUSB_ERROR_INVALID_PARAM); + + *config = libusb20_dev_get_config_index((struct libusb20_device *) + devh->dev->os_priv); + + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_get_configuration leave"); + return (0); +} + +/* + * XXX this code is wrong. need update. + */ + +int +libusb_set_configuration(libusb_device_handle * devh, int configuration) +{ + struct libusb20_device *pdev; + libusb_context *ctx; + + ctx = NULL; + GET_CONTEXT(ctx); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_set_configuration enter"); + + if (devh == NULL) + return (LIBUSB_ERROR_INVALID_PARAM); + + pdev = (struct libusb20_device *)devh->dev->os_priv; + + libusb20_dev_set_alt_index(pdev, libusb20_dev_get_config_index(pdev), + configuration); + dprintf(ctx, LIBUSB_DEBUG_FUNCTION, "libusb_set_configuration leave"); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 02:10:19 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36E211065673; Tue, 23 Jun 2009 02:10:19 +0000 (UTC) (envelope-from rafan@svm.csie.ntu.edu.tw) Received: from svm.csie.ntu.edu.tw (svm.csie.ntu.edu.tw [140.112.90.75]) by mx1.freebsd.org (Postfix) with ESMTP id D01818FC21; Tue, 23 Jun 2009 02:10:18 +0000 (UTC) (envelope-from rafan@svm.csie.ntu.edu.tw) Received: from svm.csie.ntu.edu.tw (localhost [127.0.0.1]) by svm.csie.ntu.edu.tw (8.14.3/8.14.3) with ESMTP id n5N1r6UB071395; Tue, 23 Jun 2009 09:53:06 +0800 (CST) (envelope-from rafan@svm.csie.ntu.edu.tw) Received: (from rafan@localhost) by svm.csie.ntu.edu.tw (8.14.3/8.14.3/Submit) id n5N1r6ck079166; Tue, 23 Jun 2009 09:53:06 +0800 (CST) (envelope-from rafan) Date: Tue, 23 Jun 2009 09:53:06 +0800 From: Rong-En Fan To: Ed Schouten Message-ID: <20090623015306.GB27380@svm.csie.ntu.edu.tw> References: <200906221500.n5MF0F6v044301@svn.freebsd.org> <20090622151917.GC48776@hoeg.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="dTy3Mrz/UPE2dbVg" Content-Disposition: inline In-Reply-To: <20090622151917.GC48776@hoeg.nl> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Rong-En Fan Subject: Re: svn commit: r194628 - head/lib/ncurses/ncurses X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 02:10:19 -0000 --dTy3Mrz/UPE2dbVg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Ed, On Mon, Jun 22, 2009 at 05:19:17PM +0200, Ed Schouten wrote: > Hi Rafan, >=20 > * Rong-En Fan wrote: > > Log: > > - Fall-back to /etc/termcap.small if there is no /usr/share/misc/term= cap > > (i.e. /etc/termcap). This can be useful when using /rescue/vi while= /usr > > is not (or unable to be) mounted. The termcap.small can be found in > > src/etc/termcap.small. > > =20 > > PR: bin/80256 (audit-trail) > > Submitted by: Brian Candler , Alex Kozlov > > MFC after: 1 month >=20 > I'm not familiar with termcap/terminfo/ncurses sources, but how hard > would it be to compile a very small termcap file into the library > itself, only containing cons25 and xterm/xterm-color? There is a --with-fallbacks in ncurses, let me check if we can use that. We don't really use the termcap/terminfo entries from ncurses, but instead we have our own version. So, not sure if we should provide a=20 small /etc/termcap.small or we should use the entries from ncurses. Regards, Rong-En Fan --dTy3Mrz/UPE2dbVg Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEARECAAYFAkpANYEACgkQ144QkYb9jGgWegCfa7ZEQlBNGoPAy6AaTda9afld DkgAnjqLjzB15t4YnvzwIzZwpeB3qgXJ =Auex -----END PGP SIGNATURE----- --dTy3Mrz/UPE2dbVg-- From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 02:20:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 527BD1065672; Tue, 23 Jun 2009 02:20:00 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B3F88FC08; Tue, 23 Jun 2009 02:20:00 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5N2K0fq061203; Tue, 23 Jun 2009 02:20:00 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5N2K0Yn061191; Tue, 23 Jun 2009 02:20:00 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200906230220.n5N2K0Yn061191@svn.freebsd.org> From: Andrew Thompson Date: Tue, 23 Jun 2009 02:20: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: r194677 - in head: lib/libusb sys/compat/ndis sys/dev/ata sys/dev/if_ndis sys/dev/sound/usb sys/dev/usb sys/dev/usb/controller sys/dev/usb/input sys/dev/usb/misc sys/dev/usb/net sys/dev... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 02:20:00 -0000 Author: thompsa Date: Tue Jun 23 02:19:59 2009 New Revision: 194677 URL: http://svn.freebsd.org/changeset/base/194677 Log: - Make struct usb_xfer opaque so that drivers can not access the internals - Reduce the number of headers needed for a usb driver, the common case is just usb.h and usbdi.h Added: head/sys/dev/usb/usb_freebsd.h (contents, props changed) head/sys/dev/usb/usbdi.h (contents, props changed) head/sys/dev/usb/usbdi_util.h (contents, props changed) Deleted: head/sys/dev/usb/usb_defs.h head/sys/dev/usb/usb_error.h head/sys/dev/usb/usb_handle_request.h head/sys/dev/usb/usb_hid.h head/sys/dev/usb/usb_lookup.h head/sys/dev/usb/usb_mfunc.h head/sys/dev/usb/usb_parse.h head/sys/dev/usb/usb_revision.h Modified: head/lib/libusb/libusb20_ugen20.c head/sys/compat/ndis/kern_ndis.c head/sys/compat/ndis/subr_ndis.c head/sys/compat/ndis/subr_usbd.c head/sys/dev/ata/ata-usb.c head/sys/dev/if_ndis/if_ndis.c head/sys/dev/if_ndis/if_ndis_pccard.c head/sys/dev/if_ndis/if_ndis_pci.c head/sys/dev/if_ndis/if_ndis_usb.c head/sys/dev/sound/usb/uaudio.c head/sys/dev/usb/controller/at91dci.c head/sys/dev/usb/controller/at91dci_atmelarm.c head/sys/dev/usb/controller/atmegadci.c head/sys/dev/usb/controller/atmegadci_atmelarm.c head/sys/dev/usb/controller/avr32dci.c head/sys/dev/usb/controller/ehci.c head/sys/dev/usb/controller/ehci_ixp4xx.c head/sys/dev/usb/controller/ehci_mbus.c head/sys/dev/usb/controller/ehci_pci.c head/sys/dev/usb/controller/musb_otg.c head/sys/dev/usb/controller/musb_otg_atmelarm.c head/sys/dev/usb/controller/ohci.c head/sys/dev/usb/controller/ohci_atmelarm.c head/sys/dev/usb/controller/ohci_pci.c head/sys/dev/usb/controller/uhci.c head/sys/dev/usb/controller/uhci_pci.c head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/controller/uss820dci.c head/sys/dev/usb/controller/uss820dci_atmelarm.c head/sys/dev/usb/input/uhid.c head/sys/dev/usb/input/ukbd.c head/sys/dev/usb/input/ums.c head/sys/dev/usb/misc/udbp.c head/sys/dev/usb/misc/ufm.c head/sys/dev/usb/net/if_aue.c head/sys/dev/usb/net/if_axe.c head/sys/dev/usb/net/if_cdce.c head/sys/dev/usb/net/if_cue.c head/sys/dev/usb/net/if_kue.c head/sys/dev/usb/net/if_rue.c head/sys/dev/usb/net/if_udav.c head/sys/dev/usb/net/usb_ethernet.c head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/quirk/usb_quirk.h head/sys/dev/usb/serial/u3g.c head/sys/dev/usb/serial/uark.c head/sys/dev/usb/serial/ubsa.c head/sys/dev/usb/serial/ubser.c head/sys/dev/usb/serial/uchcom.c head/sys/dev/usb/serial/ucycom.c head/sys/dev/usb/serial/ufoma.c head/sys/dev/usb/serial/uftdi.c head/sys/dev/usb/serial/ugensa.c head/sys/dev/usb/serial/uipaq.c head/sys/dev/usb/serial/ulpt.c head/sys/dev/usb/serial/umct.c head/sys/dev/usb/serial/umodem.c head/sys/dev/usb/serial/umoscom.c head/sys/dev/usb/serial/uplcom.c head/sys/dev/usb/serial/usb_serial.c head/sys/dev/usb/serial/uslcom.c head/sys/dev/usb/serial/uvisor.c head/sys/dev/usb/serial/uvscom.c head/sys/dev/usb/storage/umass.c head/sys/dev/usb/storage/urio.c head/sys/dev/usb/storage/ustorage_fs.c head/sys/dev/usb/template/usb_template.c head/sys/dev/usb/template/usb_template_cdce.c head/sys/dev/usb/template/usb_template_msc.c head/sys/dev/usb/template/usb_template_mtp.c head/sys/dev/usb/usb.h head/sys/dev/usb/usb_busdma.c head/sys/dev/usb/usb_busdma.h head/sys/dev/usb/usb_compat_linux.c head/sys/dev/usb/usb_compat_linux.h head/sys/dev/usb/usb_controller.h head/sys/dev/usb/usb_core.c head/sys/dev/usb/usb_core.h head/sys/dev/usb/usb_debug.c head/sys/dev/usb/usb_debug.h head/sys/dev/usb/usb_dev.c head/sys/dev/usb/usb_dev.h head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_device.h head/sys/dev/usb/usb_dynamic.c head/sys/dev/usb/usb_dynamic.h head/sys/dev/usb/usb_error.c head/sys/dev/usb/usb_generic.c head/sys/dev/usb/usb_handle_request.c head/sys/dev/usb/usb_hid.c head/sys/dev/usb/usb_hub.c head/sys/dev/usb/usb_ioctl.h head/sys/dev/usb/usb_lookup.c head/sys/dev/usb/usb_mbuf.c head/sys/dev/usb/usb_mbuf.h head/sys/dev/usb/usb_msctest.c head/sys/dev/usb/usb_parse.c head/sys/dev/usb/usb_process.c head/sys/dev/usb/usb_process.h head/sys/dev/usb/usb_request.c head/sys/dev/usb/usb_request.h head/sys/dev/usb/usb_transfer.c head/sys/dev/usb/usb_transfer.h head/sys/dev/usb/usb_util.c head/sys/dev/usb/usb_util.h head/sys/dev/usb/usbhid.h head/sys/dev/usb/wlan/if_rum.c head/sys/dev/usb/wlan/if_uath.c head/sys/dev/usb/wlan/if_upgt.c head/sys/dev/usb/wlan/if_ural.c head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_zyd.c head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c head/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c Modified: head/lib/libusb/libusb20_ugen20.c ============================================================================== --- head/lib/libusb/libusb20_ugen20.c Tue Jun 23 01:04:58 2009 (r194676) +++ head/lib/libusb/libusb20_ugen20.c Tue Jun 23 02:19:59 2009 (r194677) @@ -40,10 +40,8 @@ #include "libusb20_int.h" #include +#include #include -#include -#include -#include static libusb20_init_backend_t ugen20_init_backend; static libusb20_open_device_t ugen20_open_device; Modified: head/sys/compat/ndis/kern_ndis.c ============================================================================== --- head/sys/compat/ndis/kern_ndis.c Tue Jun 23 01:04:58 2009 (r194676) +++ head/sys/compat/ndis/kern_ndis.c Tue Jun 23 02:19:59 2009 (r194677) @@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include Modified: head/sys/compat/ndis/subr_ndis.c ============================================================================== --- head/sys/compat/ndis/subr_ndis.c Tue Jun 23 01:04:58 2009 (r194676) +++ head/sys/compat/ndis/subr_ndis.c Tue Jun 23 02:19:59 2009 (r194677) @@ -96,7 +96,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include Modified: head/sys/compat/ndis/subr_usbd.c ============================================================================== --- head/sys/compat/ndis/subr_usbd.c Tue Jun 23 01:04:58 2009 (r194676) +++ head/sys/compat/ndis/subr_usbd.c Tue Jun 23 02:19:59 2009 (r194677) @@ -42,6 +42,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -57,13 +59,10 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include +#include #include -#include -#include #include -#include -#include #include #include @@ -616,7 +615,7 @@ usbd_setup_endpoint_one(ip, ifidx, ne, e return (status); } xfer = ne->ne_xfer[0]; - xfer->priv_fifo = ne; + usbd_xfer_set_priv(xfer, ne); return (status); } @@ -688,14 +687,14 @@ usbd_setup_endpoint(ip, ifidx, ep) return (status); } xfer = ne->ne_xfer[0]; - xfer->priv_fifo = ne; + usbd_xfer_set_priv(xfer, ne); if (UE_GET_DIR(ep->bEndpointAddress) == UE_DIR_IN) - xfer->timeout = NDISUSB_NO_TIMEOUT; + usbd_xfer_set_timeout(xfer, NDISUSB_NO_TIMEOUT); else { if (UE_GET_XFERTYPE(ep->bmAttributes) == UE_BULK) - xfer->timeout = NDISUSB_TX_TIMEOUT; + usbd_xfer_set_timeout(xfer, NDISUSB_TX_TIMEOUT); else - xfer->timeout = NDISUSB_INTR_TIMEOUT; + usbd_xfer_set_timeout(xfer, NDISUSB_INTR_TIMEOUT); } return (status); @@ -853,34 +852,38 @@ usbd_aq_getfirst(struct ndis_softc *sc, } static void -usbd_non_isoc_callback(struct usb_xfer *xfer) +usbd_non_isoc_callback(struct usb_xfer *xfer, usb_error_t error) { irp *ip; - struct ndis_softc *sc = xfer->priv_sc; - struct ndisusb_ep *ne = xfer->priv_fifo; + struct ndis_softc *sc = usbd_xfer_softc(xfer); + struct ndisusb_ep *ne = usbd_xfer_get_priv(xfer); struct ndisusb_xfer *nx; struct usbd_urb_bulk_or_intr_transfer *ubi; + struct usb_page_cache *pc; uint8_t irql; uint32_t len; union usbd_urb *urb; usb_endpoint_descriptor_t *ep; + int actlen, sumlen; + + usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL); switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: nx = usbd_aq_getfirst(sc, ne); + pc = usbd_xfer_get_frame(xfer, 0); if (nx == NULL) return; /* copy in data with regard to the URB */ if (ne->ne_dirin != 0) - usbd_copy_out(xfer->frbuffers, 0, nx->nx_urbbuf, - xfer->frlengths[0]); - nx->nx_urbbuf += xfer->frlengths[0]; - nx->nx_urbactlen += xfer->frlengths[0]; - nx->nx_urblen -= xfer->frlengths[0]; + usbd_copy_out(pc, 0, nx->nx_urbbuf, actlen); + nx->nx_urbbuf += actlen; + nx->nx_urbactlen += actlen; + nx->nx_urblen -= actlen; /* check for short transfer */ - if (xfer->actlen < xfer->sumlen) + if (actlen < sumlen) nx->nx_urblen = 0; else { /* check remainder */ @@ -897,7 +900,7 @@ usbd_non_isoc_callback(struct usb_xfer * } } usbd_xfer_complete(sc, ne, nx, - ((xfer->actlen < xfer->sumlen) && (nx->nx_shortxfer == 0)) ? + ((actlen < sumlen) && (nx->nx_shortxfer == 0)) ? USB_ERR_SHORT_XFER : USB_ERR_NORMAL_COMPLETION); /* fall through */ @@ -927,41 +930,44 @@ next: nx->nx_shortxfer = (ubi->ubi_trans_flags & USBD_SHORT_TRANSFER_OK) ? 1 : 0; extra: - len = MIN(xfer->max_data_length, nx->nx_urblen); + len = MIN(usbd_xfer_max_len(xfer), nx->nx_urblen); + pc = usbd_xfer_get_frame(xfer, 0); if (UE_GET_DIR(ep->bEndpointAddress) == UE_DIR_OUT) - usbd_copy_in(xfer->frbuffers, 0, nx->nx_urbbuf, len); - xfer->frlengths[0] = len; - xfer->nframes = 1; + usbd_copy_in(pc, 0, nx->nx_urbbuf, len); + usbd_xfer_set_frame_len(xfer, 0, len); + usbd_xfer_set_frames(xfer, 1); usbd_transfer_submit(xfer); break; default: nx = usbd_aq_getfirst(sc, ne); if (nx == NULL) return; - if (xfer->error != USB_ERR_CANCELLED) { - xfer->flags.stall_pipe = 1; + if (error != USB_ERR_CANCELLED) { + usbd_xfer_set_stall(xfer); device_printf(sc->ndis_dev, "usb xfer warning (%s)\n", - usbd_errstr(xfer->error)); + usbd_errstr(error)); } - usbd_xfer_complete(sc, ne, nx, xfer->error); - if (xfer->error != USB_ERR_CANCELLED) + usbd_xfer_complete(sc, ne, nx, error); + if (error != USB_ERR_CANCELLED) goto next; break; } } static void -usbd_ctrl_callback(struct usb_xfer *xfer) +usbd_ctrl_callback(struct usb_xfer *xfer, usb_error_t error) { irp *ip; - struct ndis_softc *sc = xfer->priv_sc; - struct ndisusb_ep *ne = xfer->priv_fifo; + struct ndis_softc *sc = usbd_xfer_softc(xfer); + struct ndisusb_ep *ne = usbd_xfer_get_priv(xfer); struct ndisusb_xfer *nx; uint8_t irql; union usbd_urb *urb; struct usbd_urb_vendor_or_class_request *vcreq; + struct usb_page_cache *pc; uint8_t type = 0; struct usb_device_request req; + int len; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -974,9 +980,10 @@ usbd_ctrl_callback(struct usb_xfer *xfer vcreq = &urb->uu_vcreq; if (vcreq->uvc_trans_flags & USBD_TRANSFER_DIRECTION_IN) { - usbd_copy_out(xfer->frbuffers + 1, 0, - vcreq->uvc_trans_buf, xfer->frlengths[1]); - nx->nx_urbactlen += xfer->frlengths[1]; + pc = usbd_xfer_get_frame(xfer, 1); + len = usbd_xfer_get_framelen(xfer, 1); + usbd_copy_out(pc, 0, vcreq->uvc_trans_buf, len); + nx->nx_urbactlen += len; } usbd_xfer_complete(sc, ne, nx, USB_ERR_NORMAL_COMPLETION); @@ -1044,17 +1051,19 @@ next: nx->nx_urblen = vcreq->uvc_trans_buflen; nx->nx_urbactlen = 0; - usbd_copy_in(xfer->frbuffers, 0, &req, sizeof(req)); - xfer->frlengths[0] = sizeof(req); - xfer->nframes = 1; + pc = usbd_xfer_get_frame(xfer, 0); + usbd_copy_in(pc, 0, &req, sizeof(req)); + usbd_xfer_set_frame_len(xfer, 0, sizeof(req)); + usbd_xfer_set_frames(xfer, 1); if (vcreq->uvc_trans_flags & USBD_TRANSFER_DIRECTION_IN) { if (vcreq->uvc_trans_buflen >= USBD_CTRL_READ_BUFFER_SP) device_printf(sc->ndis_dev, "warning: not enough buffer space (%d).\n", vcreq->uvc_trans_buflen); - xfer->frlengths[1] = MIN(xfer->max_data_length, - vcreq->uvc_trans_buflen); - xfer->nframes = 2; + usbd_xfer_set_frame_len(xfer, 1, + MIN(usbd_xfer_max_len(xfer), + vcreq->uvc_trans_buflen)); + usbd_xfer_set_frames(xfer, 2); } else { if (nx->nx_urblen > 0) device_printf(sc->ndis_dev, @@ -1066,10 +1075,11 @@ next: * the future if it needs to be. */ if (nx->nx_urblen > 0) { - usbd_copy_in(xfer->frbuffers + 1 , 0, - nx->nx_urbbuf, nx->nx_urblen); - xfer->frlengths[1] = nx->nx_urblen; - xfer->nframes = 2; + pc = usbd_xfer_get_frame(xfer, 1); + usbd_copy_in(pc, 0, nx->nx_urbbuf, + nx->nx_urblen); + usbd_xfer_set_frame_len(xfer, 1, nx->nx_urblen); + usbd_xfer_set_frames(xfer, 2); } } usbd_transfer_submit(xfer); @@ -1078,13 +1088,13 @@ next: nx = usbd_aq_getfirst(sc, ne); if (nx == NULL) return; - if (xfer->error != USB_ERR_CANCELLED) { - xfer->flags.stall_pipe = 1; + if (error != USB_ERR_CANCELLED) { + usbd_xfer_set_stall(xfer); device_printf(sc->ndis_dev, "usb xfer warning (%s)\n", - usbd_errstr(xfer->error)); + usbd_errstr(error)); } - usbd_xfer_complete(sc, ne, nx, xfer->error); - if (xfer->error != USB_ERR_CANCELLED) + usbd_xfer_complete(sc, ne, nx, error); + if (error != USB_ERR_CANCELLED) goto next; break; } Modified: head/sys/dev/ata/ata-usb.c ============================================================================== --- head/sys/dev/ata/ata-usb.c Tue Jun 23 01:04:58 2009 (r194676) +++ head/sys/dev/ata/ata-usb.c Tue Jun 23 02:19:59 2009 (r194677) @@ -30,18 +30,30 @@ #include __FBSDID("$FreeBSD$"); +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "usbdevs.h" #include -#include -#include - -#include -#include -#include -#include -#include -#include -#include +#include #include #include @@ -145,7 +157,8 @@ static usb_callback_t atausb2_tr_error; static void atausb2_cancel_request(struct atausb2_softc *sc); static void atausb2_transfer_start(struct atausb2_softc *sc, uint8_t xfer_no); -static void atausb2_t_bbb_data_clear_stall_callback(struct usb_xfer *xfer, uint8_t next_xfer, uint8_t stall_xfer); +static void atausb2_t_bbb_data_clear_stall_callback(struct usb_xfer *xfer, + uint8_t next_xfer, uint8_t stall_xfer, usb_error_t error); static int ata_usbchannel_begin_transaction(struct ata_request *request); static int ata_usbchannel_end_transaction(struct ata_request *request); @@ -467,10 +480,11 @@ atausb2_transfer_start(struct atausb2_so } static void -atausb2_t_bbb_reset1_callback(struct usb_xfer *xfer) +atausb2_t_bbb_reset1_callback(struct usb_xfer *xfer, usb_error_t error) { - struct atausb2_softc *sc = xfer->priv_sc; + struct atausb2_softc *sc = usbd_xfer_softc(xfer); struct usb_device_request req; + struct usb_page_cache *pc; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -485,40 +499,40 @@ atausb2_t_bbb_reset1_callback(struct usb req.wIndex[1] = 0; USETW(req.wLength, 0); - usbd_copy_in(xfer->frbuffers, 0, &req, sizeof(req)); + pc = usbd_xfer_get_frame(xfer, 0); + usbd_copy_in(pc, 0, &req, sizeof(req)); - xfer->frlengths[0] = sizeof(req); - xfer->nframes = 1; + usbd_xfer_set_frame_len(xfer, 0, sizeof(req)); + usbd_xfer_set_frames(xfer, 1); usbd_transfer_submit(xfer); return; default: /* Error */ - atausb2_tr_error(xfer); + atausb2_tr_error(xfer, error); return; } } static void -atausb2_t_bbb_reset2_callback(struct usb_xfer *xfer) +atausb2_t_bbb_reset2_callback(struct usb_xfer *xfer, usb_error_t error) { atausb2_t_bbb_data_clear_stall_callback(xfer, ATAUSB_T_BBB_RESET3, - ATAUSB_T_BBB_DATA_READ); + ATAUSB_T_BBB_DATA_READ, error); } static void -atausb2_t_bbb_reset3_callback(struct usb_xfer *xfer) +atausb2_t_bbb_reset3_callback(struct usb_xfer *xfer, usb_error_t error) { atausb2_t_bbb_data_clear_stall_callback(xfer, ATAUSB_T_BBB_COMMAND, - ATAUSB_T_BBB_DATA_WRITE); + ATAUSB_T_BBB_DATA_WRITE, error); } static void atausb2_t_bbb_data_clear_stall_callback(struct usb_xfer *xfer, - uint8_t next_xfer, - uint8_t stall_xfer) + uint8_t next_xfer, uint8_t stall_xfer, usb_error_t error) { - struct atausb2_softc *sc = xfer->priv_sc; + struct atausb2_softc *sc = usbd_xfer_softc(xfer); switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: @@ -533,18 +547,19 @@ tr_transferred: return; default: /* Error */ - atausb2_tr_error(xfer); + atausb2_tr_error(xfer, error); return; } } static void -atausb2_t_bbb_command_callback(struct usb_xfer *xfer) +atausb2_t_bbb_command_callback(struct usb_xfer *xfer, usb_error_t error) { - struct atausb2_softc *sc = xfer->priv_sc; + struct atausb2_softc *sc = usbd_xfer_softc(xfer); struct ata_request *request = sc->ata_request; struct ata_channel *ch; + struct usb_page_cache *pc; uint32_t tag; switch (USB_GET_STATE(xfer)) { @@ -575,37 +590,42 @@ atausb2_t_bbb_command_callback(struct us bzero(sc->cbw.cdb, 16); bcopy(request->u.atapi.ccb, sc->cbw.cdb, 12); /* XXX SOS */ - usbd_copy_in(xfer->frbuffers, 0, &sc->cbw, sizeof(sc->cbw)); + pc = usbd_xfer_get_frame(xfer, 0); + usbd_copy_in(pc, 0, &sc->cbw, sizeof(sc->cbw)); - xfer->frlengths[0] = sizeof(sc->cbw); + usbd_xfer_set_frame_len(xfer, 0, sizeof(sc->cbw)); usbd_transfer_submit(xfer); } return; default: /* Error */ - atausb2_tr_error(xfer); + atausb2_tr_error(xfer, error); return; } } static void -atausb2_t_bbb_data_read_callback(struct usb_xfer *xfer) +atausb2_t_bbb_data_read_callback(struct usb_xfer *xfer, usb_error_t error) { - struct atausb2_softc *sc = xfer->priv_sc; - uint32_t max_bulk = xfer->max_data_length; + struct atausb2_softc *sc = usbd_xfer_softc(xfer); + uint32_t max_bulk = usbd_xfer_max_len(xfer); + struct usb_page_cache *pc; + int actlen, sumlen; + + usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL); switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - usbd_copy_out(xfer->frbuffers, 0, - sc->ata_data, xfer->actlen); + pc = usbd_xfer_get_frame(xfer, 0); + usbd_copy_out(pc, 0, sc->ata_data, actlen); - sc->ata_bytecount -= xfer->actlen; - sc->ata_data += xfer->actlen; - sc->ata_donecount += xfer->actlen; + sc->ata_bytecount -= actlen; + sc->ata_data += actlen; + sc->ata_donecount += actlen; - if (xfer->actlen < xfer->sumlen) { + if (actlen < sumlen) { /* short transfer */ sc->ata_bytecount = 0; } @@ -622,15 +642,15 @@ atausb2_t_bbb_data_read_callback(struct if (max_bulk > sc->ata_bytecount) { max_bulk = sc->ata_bytecount; } - xfer->timeout = sc->timeout; - xfer->frlengths[0] = max_bulk; + usbd_xfer_set_timeout(xfer, sc->timeout); + usbd_xfer_set_frame_len(xfer, 0, max_bulk); usbd_transfer_submit(xfer); return; default: /* Error */ - if (xfer->error == USB_ERR_CANCELLED) { - atausb2_tr_error(xfer); + if (error == USB_ERR_CANCELLED) { + atausb2_tr_error(xfer, error); } else { atausb2_transfer_start(sc, ATAUSB_T_BBB_DATA_RD_CS); } @@ -640,24 +660,28 @@ atausb2_t_bbb_data_read_callback(struct } static void -atausb2_t_bbb_data_rd_cs_callback(struct usb_xfer *xfer) +atausb2_t_bbb_data_rd_cs_callback(struct usb_xfer *xfer, usb_error_t error) { atausb2_t_bbb_data_clear_stall_callback(xfer, ATAUSB_T_BBB_STATUS, - ATAUSB_T_BBB_DATA_READ); + ATAUSB_T_BBB_DATA_READ, error); } static void -atausb2_t_bbb_data_write_callback(struct usb_xfer *xfer) +atausb2_t_bbb_data_write_callback(struct usb_xfer *xfer, usb_error_t error) { - struct atausb2_softc *sc = xfer->priv_sc; - uint32_t max_bulk = xfer->max_data_length; + struct atausb2_softc *sc = usbd_xfer_softc(xfer); + struct usb_page_cache *pc; + uint32_t max_bulk = usbd_xfer_max_len(xfer); + int actlen; + + usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - sc->ata_bytecount -= xfer->actlen; - sc->ata_data += xfer->actlen; - sc->ata_donecount += xfer->actlen; + sc->ata_bytecount -= actlen; + sc->ata_data += actlen; + sc->ata_donecount += actlen; case USB_ST_SETUP: @@ -672,18 +696,18 @@ atausb2_t_bbb_data_write_callback(struct if (max_bulk > sc->ata_bytecount) { max_bulk = sc->ata_bytecount; } - xfer->timeout = sc->timeout; - xfer->frlengths[0] = max_bulk; - usbd_copy_in(xfer->frbuffers, 0, - sc->ata_data, max_bulk); + pc = usbd_xfer_get_frame(xfer, 0); + usbd_copy_in(pc, 0, sc->ata_data, max_bulk); + usbd_xfer_set_frame_len(xfer, 0, max_bulk); + usbd_xfer_set_timeout(xfer, sc->timeout); usbd_transfer_submit(xfer); return; default: /* Error */ - if (xfer->error == USB_ERR_CANCELLED) { - atausb2_tr_error(xfer); + if (error == USB_ERR_CANCELLED) { + atausb2_tr_error(xfer, error); } else { atausb2_transfer_start(sc, ATAUSB_T_BBB_DATA_WR_CS); } @@ -693,26 +717,31 @@ atausb2_t_bbb_data_write_callback(struct } static void -atausb2_t_bbb_data_wr_cs_callback(struct usb_xfer *xfer) +atausb2_t_bbb_data_wr_cs_callback(struct usb_xfer *xfer, usb_error_t error) { atausb2_t_bbb_data_clear_stall_callback(xfer, ATAUSB_T_BBB_STATUS, - ATAUSB_T_BBB_DATA_WRITE); + ATAUSB_T_BBB_DATA_WRITE, error); } static void -atausb2_t_bbb_status_callback(struct usb_xfer *xfer) +atausb2_t_bbb_status_callback(struct usb_xfer *xfer, usb_error_t error) { - struct atausb2_softc *sc = xfer->priv_sc; + struct atausb2_softc *sc = usbd_xfer_softc(xfer); struct ata_request *request = sc->ata_request; + struct usb_page_cache *pc; uint32_t residue; + int actlen; + + usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - if (xfer->actlen < sizeof(sc->csw)) { + if (actlen < sizeof(sc->csw)) { bzero(&sc->csw, sizeof(sc->csw)); } - usbd_copy_out(xfer->frbuffers, 0, &sc->csw, xfer->actlen); + pc = usbd_xfer_get_frame(xfer, 0); + usbd_copy_out(pc, 0, &sc->csw, actlen); if (request->flags & (ATA_R_READ | ATA_R_WRITE)) { request->donecount = sc->ata_donecount; @@ -779,15 +808,14 @@ atausb2_t_bbb_status_callback(struct usb return; case USB_ST_SETUP: - xfer->frlengths[0] = xfer->max_data_length; + usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer)); usbd_transfer_submit(xfer); return; default: tr_error: - if ((xfer->error == USB_ERR_CANCELLED) || - (sc->status_try)) { - atausb2_tr_error(xfer); + if (error == USB_ERR_CANCELLED || sc->status_try) { + atausb2_tr_error(xfer, error); } else { sc->status_try = 1; atausb2_transfer_start(sc, ATAUSB_T_BBB_DATA_RD_CS); @@ -820,15 +848,15 @@ atausb2_cancel_request(struct atausb2_so } static void -atausb2_tr_error(struct usb_xfer *xfer) +atausb2_tr_error(struct usb_xfer *xfer, usb_error_t error) { - struct atausb2_softc *sc = xfer->priv_sc; + struct atausb2_softc *sc = usbd_xfer_softc(xfer); - if (xfer->error != USB_ERR_CANCELLED) { + if (error != USB_ERR_CANCELLED) { if (atausbdebug) { device_printf(sc->dev, "transfer failed, %s, in state %d " - "-> BULK reset\n", usbd_errstr(xfer->error), + "-> BULK reset\n", usbd_errstr(error), sc->last_xfer_no); } } Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Tue Jun 23 01:04:58 2009 (r194676) +++ head/sys/dev/if_ndis/if_ndis.c Tue Jun 23 02:19:59 2009 (r194677) @@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include Modified: head/sys/dev/if_ndis/if_ndis_pccard.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis_pccard.c Tue Jun 23 01:04:58 2009 (r194676) +++ head/sys/dev/if_ndis/if_ndis_pccard.c Tue Jun 23 02:19:59 2009 (r194677) @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include Modified: head/sys/dev/if_ndis/if_ndis_pci.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis_pci.c Tue Jun 23 01:04:58 2009 (r194676) +++ head/sys/dev/if_ndis/if_ndis_pci.c Tue Jun 23 02:19:59 2009 (r194677) @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include Modified: head/sys/dev/if_ndis/if_ndis_usb.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis_usb.c Tue Jun 23 01:04:58 2009 (r194676) +++ head/sys/dev/if_ndis/if_ndis_usb.c Tue Jun 23 02:19:59 2009 (r194677) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Tue Jun 23 01:04:58 2009 (r194676) +++ head/sys/dev/sound/usb/uaudio.c Tue Jun 23 02:19:59 2009 (r194677) @@ -45,23 +45,33 @@ * $NetBSD: uaudio.c,v 1.97 2005/02/24 08:19:38 martin Exp $ */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include "usbdevs.h" #include -#include -#include +#include +#include #define USB_DEBUG_VAR uaudio_debug - -#include -#include #include -#include -#include -#include -#include -#include -#include -#include #include @@ -946,8 +956,6 @@ uaudio_chan_fill_info_sub(struct uaudio_ bChannels = UAUDIO_MAX_CHAN(asf1d->bNrChannels); bBitResolution = asf1d->bBitResolution; - DPRINTFN(9, "bChannels=%u\n", bChannels); - if (asf1d->bSamFreqType == 0) { DPRINTFN(16, "Sample rate: %d-%dHz\n", UA_SAMP_LO(asf1d), UA_SAMP_HI(asf1d)); @@ -1106,14 +1114,17 @@ done: } static void -uaudio_chan_play_callback(struct usb_xfer *xfer) +uaudio_chan_play_callback(struct usb_xfer *xfer, usb_error_t error) { - struct uaudio_chan *ch = xfer->priv_sc; - uint32_t *p_len = xfer->frlengths; + struct uaudio_chan *ch = usbd_xfer_softc(xfer); + struct usb_page_cache *pc; uint32_t total; uint32_t blockcount; uint32_t n; uint32_t offset; + int actlen, sumlen; + + usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL); /* allow dynamic sizing of play buffer */ total = ch->intr_size; @@ -1129,8 +1140,8 @@ uaudio_chan_play_callback(struct usb_xfe blockcount = UAUDIO_MINFRAMES; } /* range check - max */ - if (blockcount > xfer->max_frame_count) { - blockcount = xfer->max_frame_count; + if (blockcount > usbd_xfer_max_frames(xfer)) { + blockcount = usbd_xfer_max_frames(xfer); } /* compute the total length */ total = blockcount * ch->bytes_per_frame; @@ -1138,25 +1149,24 @@ uaudio_chan_play_callback(struct usb_xfe switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: tr_transferred: - if (xfer->actlen < xfer->sumlen) { + if (actlen < sumlen) { DPRINTF("short transfer, " - "%d of %d bytes\n", xfer->actlen, total); + "%d of %d bytes\n", actlen, total); } chn_intr(ch->pcm_ch); case USB_ST_SETUP: - if (ch->bytes_per_frame > xfer->max_frame_size) { + if (ch->bytes_per_frame > usbd_xfer_max_framelen(xfer)) { DPRINTF("bytes per transfer, %d, " "exceeds maximum, %d!\n", ch->bytes_per_frame, - xfer->max_frame_size); + usbd_xfer_max_framelen(xfer)); break; } /* setup frame length */ - xfer->nframes = blockcount; - for (n = 0; n != blockcount; n++) { - p_len[n] = ch->bytes_per_frame; - } + usbd_xfer_set_frames(xfer, blockcount); + for (n = 0; n != blockcount; n++) + usbd_xfer_set_frame_len(xfer, n, ch->bytes_per_frame); if (ch->end == ch->start) { DPRINTF("no buffer!\n"); @@ -1166,13 +1176,14 @@ tr_transferred: offset = 0; + pc = usbd_xfer_get_frame(xfer, 0); while (total > 0) { n = (ch->end - ch->cur); if (n > total) { n = total; } - usbd_copy_in(xfer->frbuffers, offset, ch->cur, n); + usbd_copy_in(pc, offset, ch->cur, n); total -= n; ch->cur += n; @@ -1187,7 +1198,7 @@ tr_transferred: break; default: /* Error */ - if (xfer->error == USB_ERR_CANCELLED) { + if (error == USB_ERR_CANCELLED) { break; } goto tr_transferred; @@ -1195,16 +1206,20 @@ tr_transferred: } static void -uaudio_chan_record_callback(struct usb_xfer *xfer) +uaudio_chan_record_callback(struct usb_xfer *xfer, usb_error_t error) { - struct uaudio_chan *ch = xfer->priv_sc; - uint32_t *p_len = xfer->frlengths; + struct uaudio_chan *ch = usbd_xfer_softc(xfer); + struct usb_page_cache *pc; uint32_t n; uint32_t m; uint32_t total; uint32_t blockcount; uint32_t offset0; uint32_t offset1; + int len; + int actlen, nframes; + + usbd_xfer_status(xfer, &actlen, NULL, NULL, &nframes); /* allow dynamic sizing of play buffer */ total = ch->intr_size; @@ -1220,8 +1235,8 @@ uaudio_chan_record_callback(struct usb_x blockcount = UAUDIO_MINFRAMES; } /* range check - max */ - if (blockcount > xfer->max_frame_count) { - blockcount = xfer->max_frame_count; + if (blockcount > usbd_xfer_max_frames(xfer)) { + blockcount = usbd_xfer_max_frames(xfer); } /* compute the total length */ total = blockcount * ch->bytes_per_frame; @@ -1229,29 +1244,31 @@ uaudio_chan_record_callback(struct usb_x switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: tr_transferred: - if (xfer->actlen < total) { + if (actlen < total) { DPRINTF("short transfer, " - "%d of %d bytes\n", xfer->actlen, total); + "%d of %d bytes\n", actlen, total); } else { - DPRINTFN(6, "transferred %d bytes\n", xfer->actlen); + DPRINTFN(6, "transferred %d bytes\n", actlen); } offset0 = 0; - for (n = 0; n != xfer->nframes; n++) { + for (n = 0; n != nframes; n++) { offset1 = offset0; + pc = usbd_xfer_get_frame(xfer, n); + len = usbd_xfer_get_framelen(xfer, n); - while (p_len[n] > 0) { + while (len > 0) { m = (ch->end - ch->cur); - if (m > p_len[n]) { - m = p_len[n]; + if (m > len) { + m = len; } - usbd_copy_out(xfer->frbuffers, offset1, ch->cur, m); + usbd_copy_out(pc, offset1, ch->cur, m); - p_len[n] -= m; + len -= m; offset1 += m; ch->cur += m; @@ -1266,16 +1283,16 @@ tr_transferred: chn_intr(ch->pcm_ch); case USB_ST_SETUP: - if (ch->bytes_per_frame > xfer->max_frame_size) { + if (ch->bytes_per_frame > usbd_xfer_max_framelen(xfer)) { DPRINTF("bytes per transfer, %d, " "exceeds maximum, %d!\n", ch->bytes_per_frame, - xfer->max_frame_size); + usbd_xfer_max_framelen(xfer)); return; } - xfer->nframes = blockcount; - for (n = 0; n != xfer->nframes; n++) { - p_len[n] = ch->bytes_per_frame; + usbd_xfer_set_frames(xfer, blockcount); + for (n = 0; n < blockcount; n++) { + usbd_xfer_set_frame_len(xfer, n, ch->bytes_per_frame); } if (ch->end == ch->start) { @@ -1286,7 +1303,7 @@ tr_transferred: return; default: /* Error */ - if (xfer->error == USB_ERR_CANCELLED) { + if (error == USB_ERR_CANCELLED) { return; } goto tr_transferred; @@ -2958,11 +2975,12 @@ uaudio_mixer_get(struct usb_device *udev } static void -uaudio_mixer_write_cfg_callback(struct usb_xfer *xfer) +uaudio_mixer_write_cfg_callback(struct usb_xfer *xfer, usb_error_t error) { struct usb_device_request req; - struct uaudio_softc *sc = xfer->priv_sc; + struct uaudio_softc *sc = usbd_xfer_softc(xfer); struct uaudio_mixer_node *mc = sc->sc_mixer_curr; + struct usb_page_cache *pc; uint16_t len; uint8_t repeat = 1; uint8_t update; @@ -3011,12 +3029,14 @@ tr_setup: if (len > 1) { buf[1] = (mc->wData[chan] >> 8) & 0xFF; } - usbd_copy_in(xfer->frbuffers, 0, &req, sizeof(req)); - usbd_copy_in(xfer->frbuffers + 1, 0, buf, len); - - xfer->frlengths[0] = sizeof(req); - xfer->frlengths[1] = len; - xfer->nframes = xfer->frlengths[1] ? 2 : 1; + pc = usbd_xfer_get_frame(xfer, 0); + usbd_copy_in(pc, 0, &req, sizeof(req)); + pc = usbd_xfer_get_frame(xfer, 1); + usbd_copy_in(pc, 0, buf, len); + + usbd_xfer_set_frame_len(xfer, 0, sizeof(req)); + usbd_xfer_set_frame_len(xfer, 1, len); + usbd_xfer_set_frames(xfer, len ? 2 : 1); usbd_transfer_submit(xfer); return; } @@ -3033,8 +3053,8 @@ tr_setup: break; default: /* Error */ - DPRINTF("error=%s\n", usbd_errstr(xfer->error)); - if (xfer->error == USB_ERR_CANCELLED) { + DPRINTF("error=%s\n", usbd_errstr(error)); + if (error == USB_ERR_CANCELLED) { /* do nothing - we are detaching */ break; } @@ -3237,9 +3257,9 @@ uaudio_mixer_setrecsrc(struct uaudio_sof *========================================================================*/ static void -umidi_read_clear_stall_callback(struct usb_xfer *xfer) +umidi_read_clear_stall_callback(struct usb_xfer *xfer, usb_error_t error) { - struct umidi_chan *chan = xfer->priv_sc; + struct umidi_chan *chan = usbd_xfer_softc(xfer); struct usb_xfer *xfer_other = chan->xfer[1]; if (usbd_clear_stall_callback(xfer, xfer_other)) { @@ -3250,42 +3270,47 @@ umidi_read_clear_stall_callback(struct u } static void -umidi_bulk_read_callback(struct usb_xfer *xfer) +umidi_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 02:39:22 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E20E106564A; Tue, 23 Jun 2009 02:39:22 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id ACA3E8FC0A; Tue, 23 Jun 2009 02:39:21 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-107-126-113.carlnfd1.nsw.optusnet.com.au (c122-107-126-113.carlnfd1.nsw.optusnet.com.au [122.107.126.113]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n5N2dGRd002823 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 23 Jun 2009 12:39:18 +1000 Date: Tue, 23 Jun 2009 12:39:17 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: "Bjoern A. Zeeb" In-Reply-To: <20090622151017.H22887@maildrop.int.zabbadoz.net> Message-ID: <20090623120338.T32054@delplex.bde.org> References: <200906221507.n5MF7CIq044459@svn.freebsd.org> <20090622151017.H22887@maildrop.int.zabbadoz.net> 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: r194629 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 02:39:22 -0000 On Mon, 22 Jun 2009, Bjoern A. Zeeb wrote: > On Mon, 22 Jun 2009, Bjoern A. Zeeb wrote: >> Log: >> Collect all VIMAGE_GLOBALS variables in one place. >> >> No longer export rt_tables as all lookups go through >> rt_tables_get_rnh(). >> >> We cannot make rt_tables (and rtstat, rttrash[1]) static as >> netstat -r (-rs[1]) would stop working on a stripped >> VIMAGE_GLOBALS kernel. We can do this. >> >> Reviewed by: zec >> Presumably broken by: phk 13.5y ago in r12820 [1] > > Which seriously leads to the questions: > 1) is this because we do not ship stripped kernels? It shouldn't be: - we shouldn't try to break all utilities that use nlist() on kernels by shipping stripped kernels - we shouldn't try to break some utilities that use nlist() on kernels by shipping kernels with only static symbols stripped. Static symbols are public except at the level of compiling. > 2) is the kvm_* interface to read them the wrong way? It's the easiest way, and should still work even if the values are exported by sysctls, since it is the only way that works on dead kernels. Maybe netstat is looking up the wrong symbols. Maybe this is a gcc bug. gcc now leaves out static symbols that it thinhs are not used at the level of compiling. An example might be a pointer that is initialized at compile time but not used except by kvm and debuggers (not to mention nm to check that it has not been removed), or even a non-volatile pointer that is initialized at runtime but not used except by kvm, etc. gcc now also leaves out static functions that are called only once, after inlining them. This probably doesn't affect kvm, but it breaks profiling and debugging. There are various attributes and compiler flags to prevent these bugs, but these are not used everywhere necessary. > 3) those stats are useless and should be garbage collected entirely? > > I only tripped over this because I wanted to do the same to rt_tables > as phk did 13.5 years back to rtstat,rttrash and Marko made me > tripple check things. Bruce From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 04:02:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77513106564A; Tue, 23 Jun 2009 04:02:37 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 655D78FC15; Tue, 23 Jun 2009 04:02:37 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5N42bUn063365; Tue, 23 Jun 2009 04:02:37 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5N42bP6063363; Tue, 23 Jun 2009 04:02:37 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200906230402.n5N42bP6063363@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 23 Jun 2009 04:02: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: r194678 - head/sys/powerpc/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 04:02:38 -0000 Author: nwhitehorn Date: Tue Jun 23 04:02:36 2009 New Revision: 194678 URL: http://svn.freebsd.org/changeset/base/194678 Log: Fix copy/paste typo in last revision. PMC0 control should be shifted 8 bits, not 6, on the PPC 970. Modified: head/sys/powerpc/include/spr.h Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Tue Jun 23 02:19:59 2009 (r194677) +++ head/sys/powerpc/include/spr.h Tue Jun 23 04:02:36 2009 (r194678) @@ -336,7 +336,7 @@ #define SPR_MMCR0_TRIGGER 0x00002000 /* Trigger */ #define SPR_MMCR0_PMC1SEL(x) ((x) << 6) /* PMC1 selector */ #define SPR_MMCR0_PMC2SEL(x) ((x) << 0) /* PMC2 selector */ -#define SPR_970MMCR0_PMC1SEL(x) ((x) << 6) /* PMC1 selector (970) */ +#define SPR_970MMCR0_PMC1SEL(x) ((x) << 8) /* PMC1 selector (970) */ #define SPR_970MMCR0_PMC2SEL(x) ((x) << 1) /* PMC2 selector (970) */ #define SPR_SGR 0x3b9 /* 4.. Storage Guarded Register */ #define SPR_PMC1 0x3b9 /* .6. Performance Counter Register 1 */ From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 04:28:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBD8A106564A; Tue, 23 Jun 2009 04:28:32 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B7C328FC1C; Tue, 23 Jun 2009 04:28:32 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5N4SWZq063902; Tue, 23 Jun 2009 04:28:32 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5N4SWbR063896; Tue, 23 Jun 2009 04:28:32 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200906230428.n5N4SWbR063896@svn.freebsd.org> From: Nathan Whitehorn Date: Tue, 23 Jun 2009 04: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: r194679 - in head/sys: conf powerpc/conf powerpc/cpufreq powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 04:28:33 -0000 Author: nwhitehorn Date: Tue Jun 23 04:28:32 2009 New Revision: 194679 URL: http://svn.freebsd.org/changeset/base/194679 Log: Add cpufreq support on the PowerPC G5, along with a skeleton SMU driver in order to slew CPU voltage during frequency changes. The OpenBSD SMU driver was an extremely helpful reference for this. Added: head/sys/powerpc/cpufreq/pcr.c (contents, props changed) head/sys/powerpc/powermac/smu.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/powerpc/conf/GENERIC head/sys/powerpc/conf/NOTES Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Tue Jun 23 04:02:36 2009 (r194678) +++ head/sys/conf/files.powerpc Tue Jun 23 04:28:32 2009 (r194679) @@ -99,6 +99,7 @@ powerpc/booke/swtch.S optional e500 powerpc/booke/trap.c optional e500 powerpc/booke/vm_machdep.c optional e500 powerpc/cpufreq/dfs.c optional cpufreq +powerpc/cpufreq/pcr.c optional cpufreq aim powerpc/fpu/fpu_add.c optional fpu_emu powerpc/fpu/fpu_compare.c optional fpu_emu powerpc/fpu/fpu_div.c optional fpu_emu @@ -127,18 +128,19 @@ powerpc/ofw/ofw_syscons.c optional sc ai powerpc/powermac/ata_kauai.c optional powermac ata | powermac atamacio powerpc/powermac/ata_macio.c optional powermac ata | powermac atamacio powerpc/powermac/ata_dbdma.c optional powermac ata | powermac atamacio +powerpc/powermac/cuda.c optional powermac cuda +powerpc/powermac/cpcht.c optional powermac pci powerpc/powermac/dbdma.c optional powermac pci powerpc/powermac/grackle.c optional powermac pci powerpc/powermac/hrowpic.c optional powermac pci powerpc/powermac/kiic.c optional powermac kiic +powerpc/powermac/macgpio.c optional powermac pci powerpc/powermac/macio.c optional powermac pci powerpc/powermac/openpic_macio.c optional powermac pci powerpc/powermac/pswitch.c optional powermac pswitch -powerpc/powermac/uninorth.c optional powermac pci -powerpc/powermac/cuda.c optional powermac cuda powerpc/powermac/pmu.c optional powermac pmu -powerpc/powermac/macgpio.c optional powermac pci -powerpc/powermac/cpcht.c optional powermac pci +powerpc/powermac/smu.c optional powermac smu +powerpc/powermac/uninorth.c optional powermac pci powerpc/powermac/vcoregpio.c optional powermac powerpc/powerpc/altivec.c optional aim powerpc/powerpc/atomic.S standard Modified: head/sys/powerpc/conf/GENERIC ============================================================================== --- head/sys/powerpc/conf/GENERIC Tue Jun 23 04:02:36 2009 (r194678) +++ head/sys/powerpc/conf/GENERIC Tue Jun 23 04:28:32 2009 (r194679) @@ -158,6 +158,7 @@ device fwe # Ethernet over FireWire (n # Misc device powermac_nvram # Open Firmware configuration NVRAM +device smu # Apple System Management Unit # ADB support device adb Modified: head/sys/powerpc/conf/NOTES ============================================================================== --- head/sys/powerpc/conf/NOTES Tue Jun 23 04:02:36 2009 (r194678) +++ head/sys/powerpc/conf/NOTES Tue Jun 23 04:28:32 2009 (r194679) @@ -33,6 +33,7 @@ device ofwd # Open Firmware disks device adb # Apple Desktop Bus device cuda # VIA-CUDA ADB interface device pmu # Apple Power Management Unit +device smu # Apple System Management Unit device snd_ai2s # Apple I2S Audio device snd_davbus # Apple Davbus Audio Added: head/sys/powerpc/cpufreq/pcr.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/cpufreq/pcr.c Tue Jun 23 04:28:32 2009 (r194679) @@ -0,0 +1,333 @@ +/*- + * Copyright (c) 2009 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include + +#include "cpufreq_if.h" + +struct pcr_softc { + device_t dev; + uint32_t pcr_vals[3]; + int nmodes; +}; + +static void pcr_identify(driver_t *driver, device_t parent); +static int pcr_probe(device_t dev); +static int pcr_attach(device_t dev); +static int pcr_settings(device_t dev, struct cf_setting *sets, int *count); +static int pcr_set(device_t dev, const struct cf_setting *set); +static int pcr_get(device_t dev, struct cf_setting *set); +static int pcr_type(device_t dev, int *type); + +static device_method_t pcr_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, pcr_identify), + DEVMETHOD(device_probe, pcr_probe), + DEVMETHOD(device_attach, pcr_attach), + + /* cpufreq interface */ + DEVMETHOD(cpufreq_drv_set, pcr_set), + DEVMETHOD(cpufreq_drv_get, pcr_get), + DEVMETHOD(cpufreq_drv_type, pcr_type), + DEVMETHOD(cpufreq_drv_settings, pcr_settings), + + {0, 0} +}; + +static driver_t pcr_driver = { + "pcr", + pcr_methods, + sizeof(struct pcr_softc) +}; + +static devclass_t pcr_devclass; +DRIVER_MODULE(pcr, cpu, pcr_driver, pcr_devclass, 0, 0); + +/* + * States + */ + +#define PCR_TO_FREQ(a) ((a >> 17) & 3) + +#define PCR_FULL 0 +#define PCR_HALF 1 +#define PCR_QUARTER 2 /* Only on 970MP */ + +#define PSR_RECEIVED (1ULL << 61) +#define PSR_COMPLETED (1ULL << 61) + +/* + * SCOM addresses + */ + +#define SCOM_PCR 0x0aa00100 /* Power Control Register */ +#define SCOM_PCR_BIT 0x80000000 /* Data bit for PCR */ +#define SCOM_PSR 0x40800100 /* Power Status Register */ + +/* + * SCOM Glue + */ + +#define SCOMC_READ 0x00008000 +#define SCOMC_WRITE 0x00000000 + +static void +write_scom(register_t address, uint64_t value) +{ + register_t msr; + register_t hi, lo, scratch; + + hi = (value >> 32) & 0xffffffff; + lo = value & 0xffffffff; + + msr = mfmsr(); + mtmsr(msr & ~PSL_EE); isync(); + + mtspr64(SPR_SCOMD, hi, lo, scratch); + isync(); + mtspr(SPR_SCOMC, address | SCOMC_WRITE); + isync(); + + mtmsr(msr); isync(); +} + +static uint64_t +read_scom(register_t address) +{ + register_t msr; + uint64_t ret; + + msr = mfmsr(); + mtmsr(msr & ~PSL_EE); isync(); + + mtspr(SPR_SCOMC, address | SCOMC_READ); + isync(); + + __asm __volatile ("mfspr %0,%1;" + " mr %0+1, %0; srdi %0,%0,32" : "=r" (ret) : "K" (SPR_SCOMD)); + + (void)mfspr(SPR_SCOMC); /* Complete transcation */ + + mtmsr(msr); isync(); + + return (ret); +} + +static void +pcr_identify(driver_t *driver, device_t parent) +{ + uint16_t vers; + vers = mfpvr() >> 16; + + /* Check for an IBM 970-class CPU */ + switch (vers) { + case IBM970FX: + case IBM970GX: + case IBM970MP: + break; + default: + return; + } + + /* Make sure we're not being doubly invoked. */ + if (device_find_child(parent, "pcr", -1) != NULL) + return; + + /* + * We attach a child for every CPU since settings need to + * be performed on every CPU in the SMP case. + */ + if (BUS_ADD_CHILD(parent, 10, "pcr", -1) == NULL) + device_printf(parent, "add pcr child failed\n"); +} + +static int +pcr_probe(device_t dev) +{ + if (resource_disabled("pcr", 0)) + return (ENXIO); + + device_set_desc(dev, "PPC 970 Power Control Register"); + return (0); +} + +static int +pcr_attach(device_t dev) +{ + struct pcr_softc *sc; + phandle_t cpu; + uint32_t modes[3]; + int i; + + sc = device_get_softc(dev); + sc->dev = dev; + + cpu = ofw_bus_get_node(device_get_parent(dev)); + + if (cpu <= 0) { + device_printf(dev,"No CPU device tree node!\n"); + return (ENXIO); + } + + /* + * Collect the PCR values for each mode from the device tree. + * These include bus timing information, and so cannot be + * directly computed. + */ + sc->nmodes = OF_getproplen(cpu, "power-mode-data"); + if (sc->nmodes <= 0 || sc->nmodes > sizeof(sc->pcr_vals)) { + device_printf(dev,"No power mode data in device tree!\n"); + return (ENXIO); + } + OF_getprop(cpu, "power-mode-data", modes, sc->nmodes); + sc->nmodes /= sizeof(modes[0]); + + /* Sort the modes */ + for (i = 0; i < sc->nmodes; i++) + sc->pcr_vals[PCR_TO_FREQ(modes[i])] = modes[i]; + + cpufreq_register(dev); + return (0); +} + +static int +pcr_settings(device_t dev, struct cf_setting *sets, int *count) +{ + struct pcr_softc *sc; + + sc = device_get_softc(dev); + if (sets == NULL || count == NULL) + return (EINVAL); + if (*count < sc->nmodes) + return (E2BIG); + + /* Return a list of valid settings for this driver. */ + memset(sets, CPUFREQ_VAL_UNKNOWN, sizeof(*sets) * sc->nmodes); + + sets[0].freq = 10000; sets[0].dev = dev; + sets[1].freq = 5000; sets[1].dev = dev; + if (sc->nmodes > 2) + sets[2].freq = 2500; sets[2].dev = dev; + *count = sc->nmodes; + + return (0); +} + +static int +pcr_set(device_t dev, const struct cf_setting *set) +{ + struct pcr_softc *sc; + register_t pcr, msr; + uint64_t psr; + + if (set == NULL) + return (EINVAL); + sc = device_get_softc(dev); + + /* Construct the new PCR */ + + pcr = SCOM_PCR_BIT; + + if (set->freq == 10000) + pcr |= sc->pcr_vals[0]; + else if (set->freq == 5000) + pcr |= sc->pcr_vals[1]; + else if (set->freq == 2500) + pcr |= sc->pcr_vals[2]; + + msr = mfmsr(); + mtmsr(msr & ~PSL_EE); isync(); + + /* 970MP requires PCR and PCRH to be cleared first */ + + write_scom(SCOM_PCR,0); /* Clear PCRH */ + write_scom(SCOM_PCR,SCOM_PCR_BIT); /* Clear PCR */ + + /* Set PCR */ + + write_scom(SCOM_PCR, pcr); + + /* Wait for completion */ + + do { + DELAY(100); + psr = read_scom(SCOM_PSR); + } while ((psr & PSR_RECEIVED) && !(psr & PSR_COMPLETED)); + + mtmsr(msr); isync(); + + return (0); +} + +static int +pcr_get(device_t dev, struct cf_setting *set) +{ + struct pcr_softc *sc; + uint64_t psr; + + if (set == NULL) + return (EINVAL); + sc = device_get_softc(dev); + + memset(set, CPUFREQ_VAL_UNKNOWN, sizeof(*set)); + + psr = read_scom(SCOM_PSR); + + /* We want bits 6 and 7 */ + psr = (psr >> 56) & 3; + + set->freq = 10000; + if (psr == PCR_HALF) + set->freq = 5000; + else if (psr == PCR_QUARTER) + set->freq = 2500; + + set->dev = dev; + + return (0); +} + +static int +pcr_type(device_t dev, int *type) +{ + + if (type == NULL) + return (EINVAL); + + *type = CPUFREQ_TYPE_RELATIVE; + return (0); +} + Added: head/sys/powerpc/powermac/smu.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powermac/smu.c Tue Jun 23 04:28:32 2009 (r194679) @@ -0,0 +1,288 @@ +/*- + * Copyright (c) 2009 Nathan Whitehorn + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +struct smu_cmd { + uint8_t cmd; + uint8_t len; + uint8_t data[254]; +}; + +struct smu_softc { + device_t sc_dev; + struct mtx sc_mtx; + + struct resource *sc_memr; + int sc_memrid; + + bus_dma_tag_t sc_dmatag; + bus_space_tag_t sc_bt; + bus_space_handle_t sc_mailbox; + + struct smu_cmd *sc_cmd; + bus_addr_t sc_cmd_phys; + bus_dmamap_t sc_cmd_dmamap; +}; + +/* regular bus attachment functions */ + +static int smu_probe(device_t); +static int smu_attach(device_t); + +/* cpufreq notification hooks */ + +static void smu_cpufreq_pre_change(device_t, const struct cf_level *level); +static void smu_cpufreq_post_change(device_t, const struct cf_level *level); + +/* where to find the doorbell GPIO */ + +static device_t smu_doorbell = NULL; + +static device_method_t smu_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, smu_probe), + DEVMETHOD(device_attach, smu_attach), + { 0, 0 }, +}; + +static driver_t smu_driver = { + "smu", + smu_methods, + sizeof(struct smu_softc) +}; + +static devclass_t smu_devclass; + +DRIVER_MODULE(smu, nexus, smu_driver, smu_devclass, 0, 0); + +#define SMU_MAILBOX 0x860c + +/* Command types */ +#define SMU_POWER 0xaa + +static int +smu_probe(device_t dev) +{ + const char *name = ofw_bus_get_name(dev); + + if (strcmp(name, "smu") != 0) + return (ENXIO); + + device_set_desc(dev, "Apple System Management Unit"); + return (0); +} + +static void +smu_phys_callback(void *xsc, bus_dma_segment_t *segs, int nsegs, int error) +{ + struct smu_softc *sc = xsc; + + sc->sc_cmd_phys = segs[0].ds_addr; +} + +static int +smu_attach(device_t dev) +{ + struct smu_softc *sc; + + sc = device_get_softc(dev); + + mtx_init(&sc->sc_mtx, "smu", NULL, MTX_DEF); + + /* + * Map the mailbox area. This should be determined from firmware, + * but I have not found a simple way to do that. + */ + bus_dma_tag_create(NULL, 16, 0, BUS_SPACE_MAXADDR_32BIT, + BUS_SPACE_MAXADDR, NULL, NULL, PAGE_SIZE, 1, PAGE_SIZE, 0, NULL, + NULL, &(sc->sc_dmatag)); + sc->sc_bt = &bs_be_tag; + bus_space_map(sc->sc_bt, SMU_MAILBOX, 4, 0, &sc->sc_mailbox); + + /* + * Allocate the command buffer. This can be anywhere in the low 4 GB + * of memory. + */ + bus_dmamem_alloc(sc->sc_dmatag, (void **)&sc->sc_cmd, BUS_DMA_WAITOK | + BUS_DMA_ZERO, &sc->sc_cmd_dmamap); + bus_dmamap_load(sc->sc_dmatag, sc->sc_cmd_dmamap, + sc->sc_cmd, PAGE_SIZE, smu_phys_callback, sc, 0); + + /* + * Set up handlers to change CPU voltage when CPU frequency is changed. + */ + EVENTHANDLER_REGISTER(cpufreq_pre_change, smu_cpufreq_pre_change, dev, + EVENTHANDLER_PRI_ANY); + EVENTHANDLER_REGISTER(cpufreq_post_change, smu_cpufreq_post_change, dev, + EVENTHANDLER_PRI_ANY); + + return (0); +} + +static int +smu_run_cmd(device_t dev, struct smu_cmd *cmd) +{ + struct smu_softc *sc; + int doorbell_ack, result; + + sc = device_get_softc(dev); + + mtx_lock(&sc->sc_mtx); + + /* Copy the command to the mailbox */ + memcpy(sc->sc_cmd, cmd, sizeof(*cmd)); + bus_dmamap_sync(sc->sc_dmatag, sc->sc_cmd_dmamap, BUS_DMASYNC_PREWRITE); + bus_space_write_4(sc->sc_bt, sc->sc_mailbox, 0, sc->sc_cmd_phys); + + /* Invalidate the cacheline it is in -- SMU bypasses the cache */ + __asm __volatile("dcbst 0,%0; sync" :: "r"(sc->sc_cmd): "memory"); + + /* Ring SMU doorbell */ + macgpio_write(smu_doorbell, GPIO_DDR_OUTPUT); + + /* Wait for the doorbell GPIO to go high, signaling completion */ + do { + /* XXX: timeout */ + DELAY(50); + doorbell_ack = macgpio_read(smu_doorbell); + } while (!doorbell_ack); + + /* Check result. First invalidate the cache again... */ + __asm __volatile("dcbf 0,%0; sync" :: "r"(sc->sc_cmd) : "memory"); + + bus_dmamap_sync(sc->sc_dmatag, sc->sc_cmd_dmamap, BUS_DMASYNC_POSTREAD); + + /* SMU acks the command by inverting the command bits */ + if (sc->sc_cmd->cmd == ~cmd->cmd) + result = 0; + else + result = EIO; + + mtx_unlock(&sc->sc_mtx); + + return (result); +} + +static void +smu_slew_cpu_voltage(device_t dev, int to) +{ + struct smu_cmd cmd; + + cmd.cmd = SMU_POWER; + cmd.len = 8; + cmd.data[0] = 'V'; + cmd.data[1] = 'S'; + cmd.data[2] = 'L'; + cmd.data[3] = 'E'; + cmd.data[4] = 'W'; + cmd.data[5] = 0xff; + cmd.data[6] = 1; + cmd.data[7] = to; + + smu_run_cmd(dev, &cmd); +} + +static void +smu_cpufreq_pre_change(device_t dev, const struct cf_level *level) +{ + /* + * Make sure the CPU voltage is raised before we raise + * the clock. + */ + + if (level->rel_set[0].freq == 10000 /* max */) + smu_slew_cpu_voltage(dev, 0); +} + +static void +smu_cpufreq_post_change(device_t dev, const struct cf_level *level) +{ + /* We are safe to reduce CPU voltage after a downward transition */ + + if (level->rel_set[0].freq < 10000 /* max */) + smu_slew_cpu_voltage(dev, 1); /* XXX: 1/4 voltage for 970MP? */ +} + +/* Routines for probing the SMU doorbell GPIO */ +static int doorbell_probe(device_t dev); +static int doorbell_attach(device_t dev); + +static device_method_t doorbell_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, doorbell_probe), + DEVMETHOD(device_attach, doorbell_attach), + { 0, 0 }, +}; + +static driver_t doorbell_driver = { + "smudoorbell", + doorbell_methods, + 0 +}; + +static devclass_t doorbell_devclass; + +DRIVER_MODULE(smudoorbell, macgpio, doorbell_driver, doorbell_devclass, 0, 0); + +static int +doorbell_probe(device_t dev) +{ + const char *name = ofw_bus_get_name(dev); + + if (strcmp(name, "smu-doorbell") != 0) + return (ENXIO); + + device_set_desc(dev, "SMU Doorbell GPIO"); + device_quiet(dev); + return (0); +} + +static int +doorbell_attach(device_t dev) +{ + smu_doorbell = dev; + return (0); +} From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 05:51:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92C5F1065674; Tue, 23 Jun 2009 05:51:48 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 816748FC0A; Tue, 23 Jun 2009 05:51:48 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5N5pmWq065484; Tue, 23 Jun 2009 05:51:48 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5N5pmsX065482; Tue, 23 Jun 2009 05:51:48 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <200906230551.n5N5pmsX065482@svn.freebsd.org> From: Maxim Konovalov Date: Tue, 23 Jun 2009 05:51: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: r194680 - head/usr.sbin/wpa/ndis_events X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 05:51:49 -0000 Author: maxim Date: Tue Jun 23 05:51:48 2009 New Revision: 194680 URL: http://svn.freebsd.org/changeset/base/194680 Log: o Remove unneeded argument in fprintf(3) call in usage(). Submitted by: Pawel Worach Modified: head/usr.sbin/wpa/ndis_events/ndis_events.c Modified: head/usr.sbin/wpa/ndis_events/ndis_events.c ============================================================================== --- head/usr.sbin/wpa/ndis_events/ndis_events.c Tue Jun 23 04:28:32 2009 (r194679) +++ head/usr.sbin/wpa/ndis_events/ndis_events.c Tue Jun 23 05:51:48 2009 (r194680) @@ -265,7 +265,7 @@ static void usage(progname) char *progname; { - fprintf(stderr, "Usage: ndis_events [-a] [-d] [-v]\n", progname); + fprintf(stderr, "Usage: ndis_events [-a] [-d] [-v]\n"); exit(1); } From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 05:55:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9054D1065670; Tue, 23 Jun 2009 05:55:56 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7EC108FC18; Tue, 23 Jun 2009 05:55:56 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5N5tuVc065620; Tue, 23 Jun 2009 05:55:56 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5N5tubJ065618; Tue, 23 Jun 2009 05:55:56 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <200906230555.n5N5tubJ065618@svn.freebsd.org> From: Maxim Konovalov Date: Tue, 23 Jun 2009 05:55: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: r194681 - head/usr.sbin/wpa/ndis_events X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 05:55:57 -0000 Author: maxim Date: Tue Jun 23 05:55:56 2009 New Revision: 194681 URL: http://svn.freebsd.org/changeset/base/194681 Log: o style(9) usage() definition: it doesn't need an argument. Modified: head/usr.sbin/wpa/ndis_events/ndis_events.c Modified: head/usr.sbin/wpa/ndis_events/ndis_events.c ============================================================================== --- head/usr.sbin/wpa/ndis_events/ndis_events.c Tue Jun 23 05:51:48 2009 (r194680) +++ head/usr.sbin/wpa/ndis_events/ndis_events.c Tue Jun 23 05:55:56 2009 (r194681) @@ -93,7 +93,7 @@ struct ndis_evt { static int find_ifname(int, char *); static int announce_event(char *, int, struct sockaddr_in *); -static void usage(char *); +static void usage(); static void dbgmsg(const char *fmt, ...) @@ -262,8 +262,7 @@ announce_event(ifname, sock, dst) } static void -usage(progname) - char *progname; +usage() { fprintf(stderr, "Usage: ndis_events [-a] [-d] [-v]\n"); exit(1); From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 06:00:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01349106566C; Tue, 23 Jun 2009 06:00:32 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E1A0A8FC18; Tue, 23 Jun 2009 06:00:31 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5N60VVR065771; Tue, 23 Jun 2009 06:00:31 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5N60VDi065763; Tue, 23 Jun 2009 06:00:31 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200906230600.n5N60VDi065763@svn.freebsd.org> From: Andrew Thompson Date: Tue, 23 Jun 2009 06:00:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194682 - in head/sys: compat/ndis dev/sound/usb dev/usb dev/usb/net dev/usb/serial netgraph/bluetooth/drivers/ubt X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 06:00:32 -0000 Author: thompsa Date: Tue Jun 23 06:00:31 2009 New Revision: 194682 URL: http://svn.freebsd.org/changeset/base/194682 Log: Fix a typeo in the frame len function to unbreak the build, make it shorter while I am here. Modified: head/sys/compat/ndis/subr_usbd.c head/sys/dev/sound/usb/uaudio.c head/sys/dev/usb/net/if_cdce.c head/sys/dev/usb/serial/ufoma.c head/sys/dev/usb/usb_transfer.c head/sys/dev/usb/usbdi.h head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Modified: head/sys/compat/ndis/subr_usbd.c ============================================================================== --- head/sys/compat/ndis/subr_usbd.c Tue Jun 23 05:55:56 2009 (r194681) +++ head/sys/compat/ndis/subr_usbd.c Tue Jun 23 06:00:31 2009 (r194682) @@ -981,7 +981,7 @@ usbd_ctrl_callback(struct usb_xfer *xfer if (vcreq->uvc_trans_flags & USBD_TRANSFER_DIRECTION_IN) { pc = usbd_xfer_get_frame(xfer, 1); - len = usbd_xfer_get_framelen(xfer, 1); + len = usbd_xfer_frame_len(xfer, 1); usbd_copy_out(pc, 0, vcreq->uvc_trans_buf, len); nx->nx_urbactlen += len; } Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Tue Jun 23 05:55:56 2009 (r194681) +++ head/sys/dev/sound/usb/uaudio.c Tue Jun 23 06:00:31 2009 (r194682) @@ -1257,7 +1257,7 @@ tr_transferred: offset1 = offset0; pc = usbd_xfer_get_frame(xfer, n); - len = usbd_xfer_get_framelen(xfer, n); + len = usbd_xfer_frame_len(xfer, n); while (len > 0) { Modified: head/sys/dev/usb/net/if_cdce.c ============================================================================== --- head/sys/dev/usb/net/if_cdce.c Tue Jun 23 05:55:56 2009 (r194681) +++ head/sys/dev/usb/net/if_cdce.c Tue Jun 23 06:00:31 2009 (r194682) @@ -641,7 +641,7 @@ cdce_bulk_read_callback(struct usb_xfer m = sc->sc_rx_buf[x]; sc->sc_rx_buf[x] = NULL; - len = usbd_xfer_get_frame_len(xfer, x); + len = usbd_xfer_frame_len(xfer, x); /* Strip off CRC added by Zaurus, if any */ if ((sc->sc_flags & CDCE_FLAG_ZAURUS) && len >= 14) Modified: head/sys/dev/usb/serial/ufoma.c ============================================================================== --- head/sys/dev/usb/serial/ufoma.c Tue Jun 23 05:55:56 2009 (r194681) +++ head/sys/dev/usb/serial/ufoma.c Tue Jun 23 06:00:31 2009 (r194682) @@ -571,7 +571,7 @@ tr_transferred: if (aframes != nframes) goto tr_setup; pc1 = usbd_xfer_get_frame(xfer, 1); - len = usbd_xfer_get_frame_len(xfer, 1); + len = usbd_xfer_frame_len(xfer, 1); if (len > 0) ucom_put_data(&sc->sc_ucom, pc1, 0, len); /* FALLTHROUGH */ Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Tue Jun 23 05:55:56 2009 (r194681) +++ head/sys/dev/usb/usb_transfer.c Tue Jun 23 06:00:31 2009 (r194682) @@ -1805,7 +1805,7 @@ usbd_xfer_get_frame(struct usb_xfer *xfe } usb_frlength_t -usbd_xfer_get_frame_len(struct usb_xfer *xfer, usb_frcount_t frindex) +usbd_xfer_frame_len(struct usb_xfer *xfer, usb_frcount_t frindex) { KASSERT(frindex < xfer->max_frame_count, ("frame index overflow")); @@ -1832,7 +1832,7 @@ usbd_xfer_set_frame_data(struct usb_xfer } void -usbd_xfer_get_frame_data(struct usb_xfer *xfer, usb_frcount_t frindex, +usbd_xfer_frame_data(struct usb_xfer *xfer, usb_frcount_t frindex, void **ptr, int *len) { KASSERT(frindex < xfer->max_frame_count, ("frame index overflow")); Modified: head/sys/dev/usb/usbdi.h ============================================================================== --- head/sys/dev/usb/usbdi.h Tue Jun 23 05:55:56 2009 (r194681) +++ head/sys/dev/usb/usbdi.h Tue Jun 23 06:00:31 2009 (r194682) @@ -469,14 +469,14 @@ void usbd_xfer_set_interval(struct usb_x uint8_t usbd_xfer_state(struct usb_xfer *xfer); void usbd_xfer_set_frame_data(struct usb_xfer *xfer, usb_frcount_t frindex, void *ptr, usb_frlength_t len); -void usbd_xfer_get_frame_data(struct usb_xfer *xfer, usb_frcount_t frindex, +void usbd_xfer_frame_data(struct usb_xfer *xfer, usb_frcount_t frindex, void **ptr, int *len); void usbd_xfer_set_frame_offset(struct usb_xfer *xfer, usb_frlength_t offset, usb_frcount_t frindex); usb_frlength_t usbd_xfer_max_len(struct usb_xfer *xfer); usb_frlength_t usbd_xfer_max_framelen(struct usb_xfer *xfer); usb_frcount_t usbd_xfer_max_frames(struct usb_xfer *xfer); -usb_frlength_t usbd_xfer_get_frame_len(struct usb_xfer *xfer, +usb_frlength_t usbd_xfer_frame_len(struct usb_xfer *xfer, usb_frcount_t frindex); void usbd_xfer_set_frame_len(struct usb_xfer *xfer, usb_frcount_t frindex, usb_frlength_t len); Modified: head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c ============================================================================== --- head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Tue Jun 23 05:55:56 2009 (r194681) +++ head/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c Tue Jun 23 06:00:31 2009 (r194682) @@ -1002,7 +1002,7 @@ ubt_isoc_read_one_frame(struct usb_xfer /* Get existing SCO reassembly buffer */ pc = usbd_xfer_get_frame(xfer, 0); m = sc->sc_isoc_in_buffer; - total = usbd_xfer_get_framelen(xfer, frame_no); + total = usbd_xfer_frame_len(xfer, frame_no); /* While we have data in the frame */ while (total > 0) { @@ -1143,7 +1143,7 @@ send_next: for (n = 0; n < nframes; n ++) { usbd_xfer_set_frame_len(xfer, n, min(offset, usbd_xfer_max_framelen(xfer))); - offset -= usbd_xfer_get_framelen(xfer, n); + offset -= usbd_xfer_frame_len(xfer, n); } usbd_transfer_submit(xfer); From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 06:11:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08B941065673; Tue, 23 Jun 2009 06:11:05 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D0D998FC14; Tue, 23 Jun 2009 06:11:04 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5N6B40C066009; Tue, 23 Jun 2009 06:11:04 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5N6B4Gr066003; Tue, 23 Jun 2009 06:11:04 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <200906230611.n5N6B4Gr066003@svn.freebsd.org> From: Marko Zec Date: Tue, 23 Jun 2009 06:11: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: r194683 - in head/sys: conf modules/netgraph modules/netgraph/pipe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 06:11:05 -0000 Author: zec Date: Tue Jun 23 06:11:04 2009 New Revision: 194683 URL: http://svn.freebsd.org/changeset/base/194683 Log: Connect ng_pipe to the default build. Approved by: julian (mentor) Added: head/sys/modules/netgraph/pipe/ head/sys/modules/netgraph/pipe/Makefile (contents, props changed) Modified: head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/modules/netgraph/Makefile Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Tue Jun 23 06:00:31 2009 (r194682) +++ head/sys/conf/NOTES Tue Jun 23 06:11:04 2009 (r194683) @@ -690,6 +690,7 @@ options NETGRAPH_MPPC_ENCRYPTION options NETGRAPH_NETFLOW options NETGRAPH_NAT options NETGRAPH_ONE2MANY +options NETGRAPH_PIPE options NETGRAPH_PPP options NETGRAPH_PPPOE options NETGRAPH_PPTPGRE Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Jun 23 06:00:31 2009 (r194682) +++ head/sys/conf/files Tue Jun 23 06:11:04 2009 (r194683) @@ -2330,6 +2330,7 @@ netgraph/ng_mppc.c optional netgraph_mp netgraph/ng_nat.c optional netgraph_nat inet libalias netgraph/ng_one2many.c optional netgraph_one2many netgraph/ng_parse.c optional netgraph +netgraph/ng_pipe.c optional netgraph_pipe netgraph/ng_ppp.c optional netgraph_ppp netgraph/ng_pppoe.c optional netgraph_pppoe netgraph/ng_pptpgre.c optional netgraph_pptpgre Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Tue Jun 23 06:00:31 2009 (r194682) +++ head/sys/conf/options Tue Jun 23 06:11:04 2009 (r194683) @@ -485,6 +485,7 @@ NETGRAPH_MPPC_ENCRYPTION opt_netgraph.h NETGRAPH_NAT opt_netgraph.h NETGRAPH_NETFLOW opt_netgraph.h NETGRAPH_ONE2MANY opt_netgraph.h +NETGRAPH_PIPE opt_netgraph.h NETGRAPH_PPP opt_netgraph.h NETGRAPH_PPPOE opt_netgraph.h NETGRAPH_PPTPGRE opt_netgraph.h Modified: head/sys/modules/netgraph/Makefile ============================================================================== --- head/sys/modules/netgraph/Makefile Tue Jun 23 06:00:31 2009 (r194682) +++ head/sys/modules/netgraph/Makefile Tue Jun 23 06:11:04 2009 (r194683) @@ -35,6 +35,7 @@ SUBDIR= async \ netflow \ netgraph \ one2many \ + pipe \ ppp \ pppoe \ pptpgre \ Added: head/sys/modules/netgraph/pipe/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/netgraph/pipe/Makefile Tue Jun 23 06:11:04 2009 (r194683) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +KMOD= ng_pipe +SRCS= ng_pipe.c + +.include From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 06:46:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABF8E106564A; Tue, 23 Jun 2009 06:46:14 +0000 (UTC) (envelope-from jhay@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9854B8FC08; Tue, 23 Jun 2009 06:46:14 +0000 (UTC) (envelope-from jhay@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5N6kEE7066670; Tue, 23 Jun 2009 06:46:14 GMT (envelope-from jhay@svn.freebsd.org) Received: (from jhay@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5N6kEQS066668; Tue, 23 Jun 2009 06:46:14 GMT (envelope-from jhay@svn.freebsd.org) Message-Id: <200906230646.n5N6kEQS066668@svn.freebsd.org> From: John Hay Date: Tue, 23 Jun 2009 06:46: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: r194684 - head/sbin/sysctl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 06:46:16 -0000 Author: jhay Date: Tue Jun 23 06:46:14 2009 New Revision: 194684 URL: http://svn.freebsd.org/changeset/base/194684 Log: time_t does not always fit into long, for instance on arm. So rather cast it intmax_t and use %j in printf. Modified: head/sbin/sysctl/sysctl.c Modified: head/sbin/sysctl/sysctl.c ============================================================================== --- head/sbin/sysctl/sysctl.c Tue Jun 23 06:11:04 2009 (r194683) +++ head/sbin/sysctl/sysctl.c Tue Jun 23 06:46:14 2009 (r194684) @@ -365,9 +365,9 @@ S_timeval(int l2, void *p) warnx("S_timeval %d != %d", l2, sizeof(*tv)); return (1); } - printf(hflag ? "{ sec = %'ld, usec = %'ld } " : - "{ sec = %ld, usec = %ld } ", - tv->tv_sec, tv->tv_usec); + printf(hflag ? "{ sec = %'jd, usec = %'ld } " : + "{ sec = %jd, usec = %ld } ", + (intmax_t)tv->tv_sec, tv->tv_usec); tv_sec = tv->tv_sec; p1 = strdup(ctime(&tv_sec)); for (p2=p1; *p2 ; p2++) From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 06:57:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B6F61065679; Tue, 23 Jun 2009 06:57:47 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 368548FC1E; Tue, 23 Jun 2009 06:57:47 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5N6vlEH066920; Tue, 23 Jun 2009 06:57:47 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5N6vltL066918; Tue, 23 Jun 2009 06:57:47 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200906230657.n5N6vltL066918@svn.freebsd.org> From: Jeff Roberson Date: Tue, 23 Jun 2009 06:57: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: r194685 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 06:57:50 -0000 Author: jeff Date: Tue Jun 23 06:57:46 2009 New Revision: 194685 URL: http://svn.freebsd.org/changeset/base/194685 Log: - Add a new cpuset macro, CPU_FILL(), for setting the set to all 1s. Modified: head/sys/sys/cpuset.h Modified: head/sys/sys/cpuset.h ============================================================================== --- head/sys/sys/cpuset.h Tue Jun 23 06:46:14 2009 (r194684) +++ head/sys/sys/cpuset.h Tue Jun 23 06:57:46 2009 (r194685) @@ -60,6 +60,12 @@ typedef struct _cpuset { (p)->__bits[__i] = 0; \ } while (0) +#define CPU_FILL(p) do { \ + __size_t __i; \ + for (__i = 0; __i < _NCPUWORDS; __i++) \ + (p)->__bits[__i] = -1; \ +} while (0) + /* Is p empty. */ #define CPU_EMPTY(p) __extension__ ({ \ __size_t __i; \ From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 07:07:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0ECEC106564A; Tue, 23 Jun 2009 07:07:27 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id C7BC28FC18; Tue, 23 Jun 2009 07:07:26 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 63E8346B5B; Tue, 23 Jun 2009 03:07:26 -0400 (EDT) Date: Tue, 23 Jun 2009 08:07:26 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Andre Oppermann In-Reply-To: <200906222308.n5MN856I055711@svn.freebsd.org> Message-ID: References: <200906222308.n5MN856I055711@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) 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: r194672 - in head/sys: kern netinet sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 07:07:27 -0000 On Mon, 22 Jun 2009, Andre Oppermann wrote: > Add soreceive_stream(), an optimized version of soreceive() for > stream (TCP) sockets. While this sounds like very interesting work, I was struck by the lack of: Reviewed by: ? Tested by: ? Have you tested this change with some of our TCP conumer edge cases, especially in-kernel consumers: - Accept filters - NFS client - NFS server - smbfs - iscsi initiator I also assume that the plan is that this will not be enabled by default in 8.0? With soreceive_dgram, it took three months to shake out the nits, and the datagram case is far simpler than the stream case. Given that experience, I'd guess it will take longer for the new stream code to shake out, and probably involve painfully tracking subtle bugs in blocking code, data corruption in NFS, etc. I've identified one such possible bug for iscsi. To provide easier access for early adopters, we shipped with soreceive_dgram available for UDP, but optionally enabled by a loader tunable, for at least one minor rev. I would recommend doing something similar here. A few inline comments below, including one serious bug (assuming my reading is right). This doesn't consistute a full review because it's too early in the morning to reason fully about the socket buffer code. Robert N M Watson Computer Laboratory University of Cambridge > It is functionally identical to generic soreceive() but has a > number stream specific optimizations: > o does only one sockbuf unlock/lock per receive independent of > the length of data to be moved into the uio compared to > soreceive() which unlocks/locks per *mbuf*. Hmm. I count four locks and unlocks per receive, assuming no blocking and a I/O to user memory: - sblock/sbunlock to stabilize sb_mb and prevent I/O interlacing. - start/stop socket buffer mutex lock/unlock at beginning/end of function - unlock/relock around m_mbuftouio() - unlock/relock around pru_rcvd One idea I've futzed with a little is whether or not we could drop sblock() in certain cases for receive and transmit. As far as I'm aware, it is used for at least four purposes in receive: - Prevent I/O interlacing from concurrent system calls - Provide consistency for blocking logic during concurrent system calls - Stabilize non-NULL sb_mb while the socket buffer mutex is dropped - Minimize contention on the socket buffer mutex during concurrent system calls Some of these are more important than others -- in particular, the function of preventing I/O interlacing for stream system calls seems something we might drop, as it's not a guarantee provided by other OS's, so no portable application should depend on it. Have you looked at all at this? > o uses m_mbuftouio() instead of its own copy(out) variant. > o much more compact code flow as a large number of special > cases is removed. > o much improved reability. > > It offers significantly reduced CPU usage and lock contention > when receiving fast TCP streams. Additional gains are obtained > when the receiving application is using SO_RCVLOWAT to batch up > some data before a read (and wakeup) is done. > > This function was written by "reverse engineering" and is not > just a stripped down variant of soreceive(). > > It is not yet enabled by default on TCP sockets. Instead it is > commented out in the protocol initialization in tcp_usrreq.c > until more widespread testing has been done. Have you looked at using this with SCTP and UNIX domain sockets? UNIX domain socket performance is quite important for database workloads, and SCTP is going to be increasingly important for Internet applications. In the UNIX domain socket case, not supporting control mbuf will be a potential problem (see comments below about either implementing it or falling back, and if falling back m_mbuftouio needs to know how to properly free them). > Testers, especially with 10GigE gear, are welcome. > > MFP4: r164817 //depot/user/andre/soreceive_stream/ > > Modified: > head/sys/kern/uipc_socket.c > head/sys/netinet/tcp_usrreq.c > head/sys/sys/socketvar.h > > Modified: head/sys/kern/uipc_socket.c > ============================================================================== > --- head/sys/kern/uipc_socket.c Mon Jun 22 22:54:44 2009 (r194671) > +++ head/sys/kern/uipc_socket.c Mon Jun 22 23:08:05 2009 (r194672) > @@ -1857,6 +1857,202 @@ release: > } > > /* > + * Optimized version of soreceive() for stream (TCP) sockets. > + */ > +int > +soreceive_stream(struct socket *so, struct sockaddr **psa, struct uio *uio, > + struct mbuf **mp0, struct mbuf **controlp, int *flagsp) > +{ > + int len = 0, error = 0, flags, oresid; > + struct sockbuf *sb; > + struct mbuf *m, *n = NULL; > + > + /* We only do stream sockets. */ > + if (so->so_type != SOCK_STREAM) > + return (EINVAL); This should be a KASSERT(). You should also assert !PR_ADDR and !PR_ATOMIC, and possibly a few other things to ensure that soreceive_stream is not used with protocols that require features it does not implement. Much better to discover on sanity-checking the kernel than through subtle application bugs later when people start throwing switches without giving things full consideration. > + if (psa != NULL) > + *psa = NULL; > + if (controlp != NULL) > + return (EINVAL); This would seem to preclude easy future use of ancillary data with TCP -- one type I've been considering adding is TCP_INFO updates as part of the stream. How would you feel about making this call into soreceive_generic() instead? My reading of the control code was that it actually was fairly simple and I did include it in soreceive_dgram() (especially given that it's popular for UDP so you can get the receive IP address per-datagram). > + if (flagsp != NULL) > + flags = *flagsp &~ MSG_EOR; > + else > + flags = 0; > + if (flags & MSG_OOB) > + return (soreceive_rcvoob(so, uio, flags)); > + if (mp0 != NULL) > + *mp0 = NULL; > + > + sb = &so->so_rcv; > + > + /* Prevent other readers from entering the socket. */ > + error = sblock(sb, SBLOCKWAIT(flags)); > + if (error) > + goto out; > + SOCKBUF_LOCK(sb); > + > + /* Easy one, no space to copyout anything. */ > + if (uio->uio_resid == 0) { > + error = EINVAL; > + goto out; > + } Didn't we previously allow a resid of 0 to be used to probe for socket errors without receiving data? I've never used this semantic but it seems to be supported, which undoubtably means someone is using it :-). I notice that previously we didn't allow receiving EWOULDBLOCK using a 0-byte buffer, but perhaps we should have. > + oresid = uio->uio_resid; > + > + /* We will never ever get anything unless we are connected. */ > + if (!(so->so_state & (SS_ISCONNECTED|SS_ISDISCONNECTED))) { > + /* When disconnecting there may be still some data left. */ > + if (sb->sb_cc > 0) > + goto deliver; > + if (!(so->so_state & SS_ISDISCONNECTED)) > + error = ENOTCONN; > + goto out; > + } > + > + /* Socket buffer is empty and we shall not block. */ > + if (sb->sb_cc == 0 && > + ((sb->sb_flags & SS_NBIO) || (flags & (MSG_DONTWAIT|MSG_NBIO)))) { > + error = EAGAIN; > + goto out; > + } I think you've changed the error number reporting here in subtle ways, but it's early in the morning. It appears we now prefer ENOTCONN to so_error once the socket has entered SS_ISDISCONNECTED. We need to report and clear so_error if non-0 so that ECONNRESET, EPERM, etc, can be reported properly. The new so_state logic is markedly different from what came before, but I'm not sure what the impact of that is. Certainly the comment needs to change to "... are or have been connected". The previous logic appears to have handled SS_ISCONNECTING differently, and possibly SS_ISDISCONNECTING. > +restart: > + SOCKBUF_LOCK_ASSERT(&so->so_rcv); > + > + /* Abort if socket has reported problems. */ > + if (so->so_error) { > + if (sb->sb_cc > 0) > + goto deliver; > + if (oresid > uio->uio_resid) > + goto out; > + error = so->so_error; > + if (!(flags & MSG_PEEK)) > + so->so_error = 0; > + goto out; > + } > + > + /* Door is closed. Deliver what is left, if any. */ > + if (sb->sb_state & SBS_CANTRCVMORE) { > + if (sb->sb_cc > 0) > + goto deliver; > + else > + goto out; > + } > + > + /* Socket buffer got some data that we shall deliver now. */ > + if (sb->sb_cc > 0 && !(flags & MSG_WAITALL) && > + ((sb->sb_flags & SS_NBIO) || > + (flags & (MSG_DONTWAIT|MSG_NBIO)) || > + sb->sb_cc >= sb->sb_lowat || > + sb->sb_cc >= uio->uio_resid || > + sb->sb_cc >= sb->sb_hiwat) ) { > + goto deliver; > + } > + > + /* On MSG_WAITALL we must wait until all data or error arrives. */ > + if ((flags & MSG_WAITALL) && > + (sb->sb_cc >= uio->uio_resid || sb->sb_cc >= sb->sb_lowat)) > + goto deliver; > + > + /* > + * Wait and block until (more) data comes in. > + * NB: Drops the sockbuf lock during wait. > + */ > + error = sbwait(sb); > + if (error) > + goto out; > + goto restart; > + > +deliver: > + SOCKBUF_LOCK_ASSERT(&so->so_rcv); > + KASSERT(sb->sb_cc > 0, ("%s: sockbuf empty", __func__)); > + KASSERT(sb->sb_mb != NULL, ("%s: sb_mb == NULL", __func__)); > + > + /* Statistics. */ > + if (uio->uio_td) > + uio->uio_td->td_ru.ru_msgrcv++; > + > + /* Fill uio until full or current end of socket buffer is reached. */ > + len = min(uio->uio_resid, sb->sb_cc); > + if (mp0 != NULL) { > + /* Dequeue as many mbufs as possible. */ > + if (!(flags & MSG_PEEK) && len >= sb->sb_mb->m_len) { > + for (*mp0 = m = sb->sb_mb; > + m != NULL && m->m_len <= len; > + m = m->m_next) { > + len -= m->m_len; > + uio->uio_resid -= m->m_len; > + sbfree(sb, m); > + n = m; > + } Since control mbufs aren't supported, you should assert !MT_CONTROL. Or add control mbuf support per above. Again, early in the morning, but: does (mp0 != NULL) still work with (flags & MSG_WAITALL)? In soreceive_generic(), mp0 is updated to point to &m->m_next as the loop iterates, so that as you go back to 'repeat:', the chain pointed to by mp0 is appended to rather than replaced, whereas your code appears to replace it in each loop (which seems wrong). Perhaps it's just too early in the morning. I think the only consumer of (mp0 != NULL) with MSG_WAITALL is the iscsi initiator, but breaking that would be bad. smbfs probably *should* use it... :-) > + sb->sb_mb = m; > + if (sb->sb_mb == NULL) > + SB_EMPTY_FIXUP(sb); > + n->m_next = NULL; > + } > + /* Copy the remainder. */ > + if (len > 0) { > + KASSERT(sb->sb_mb != NULL, > + ("%s: len > 0 && sb->sb_mb empty", __func__)); > + > + m = m_copym(sb->sb_mb, 0, len, M_DONTWAIT); > + if (m == NULL) > + len = 0; /* Don't flush data from sockbuf. */ > + else > + uio->uio_resid -= m->m_len; > + if (*mp0 != NULL) > + n->m_next = m; > + else > + *mp0 = m; > + if (*mp0 == NULL) { > + error = ENOBUFS; > + goto out; > + } > + } > + } else { > + /* NB: Must unlock socket buffer as uiomove may sleep. */ > + SOCKBUF_UNLOCK(sb); > + error = m_mbuftouio(uio, sb->sb_mb, len); m_mbuftouio() should assert !MT_CONTROL on each mbuf if it doesn't support control mbufs. See also above. :-) > + SOCKBUF_LOCK(sb); > + if (error) > + goto out; > + } > + SBLASTRECORDCHK(sb); > + SBLASTMBUFCHK(sb); > + > + /* > + * Remove the delivered data from the socket buffer unless we > + * were only peeking. > + */ > + if (!(flags & MSG_PEEK)) { > + if (len > 0) > + sbdrop_locked(sb, len); > + > + /* Notify protocol that we drained some data. */ > + if ((so->so_proto->pr_flags & PR_WANTRCVD) && > + (((flags & MSG_WAITALL) && uio->uio_resid > 0) || > + !(flags & MSG_SOCALLBCK))) { > + SOCKBUF_UNLOCK(sb); > + (*so->so_proto->pr_usrreqs->pru_rcvd)(so, flags); > + SOCKBUF_LOCK(sb); > + } > + } > + > + /* > + * For MSG_WAITALL we may have to loop again and wait for > + * more data to come in. > + */ > + if ((flags & MSG_WAITALL) && uio->uio_resid > 0) > + goto restart; > +out: > + SOCKBUF_LOCK_ASSERT(sb); > + SBLASTRECORDCHK(sb); > + SBLASTMBUFCHK(sb); > + SOCKBUF_UNLOCK(sb); > + sbunlock(sb); > + return (error); > +} > + > +/* > * Optimized version of soreceive() for simple datagram cases from userspace. > * Unlike in the stream case, we're able to drop a datagram if copyout() > * fails, and because we handle datagrams atomically, we don't need to use a > > Modified: head/sys/netinet/tcp_usrreq.c > ============================================================================== > --- head/sys/netinet/tcp_usrreq.c Mon Jun 22 22:54:44 2009 (r194671) > +++ head/sys/netinet/tcp_usrreq.c Mon Jun 22 23:08:05 2009 (r194672) > @@ -1032,6 +1032,9 @@ struct pr_usrreqs tcp_usrreqs = { > .pru_send = tcp_usr_send, > .pru_shutdown = tcp_usr_shutdown, > .pru_sockaddr = in_getsockaddr, > +#if 0 > + .pru_soreceive = soreceive_stream, > +#endif > .pru_sosetlabel = in_pcbsosetlabel, > .pru_close = tcp_usr_close, > }; > @@ -1053,6 +1056,9 @@ struct pr_usrreqs tcp6_usrreqs = { > .pru_send = tcp_usr_send, > .pru_shutdown = tcp_usr_shutdown, > .pru_sockaddr = in6_mapped_sockaddr, > +#if 0 > + .pru_soreceive = soreceive_stream, > +#endif > .pru_sosetlabel = in_pcbsosetlabel, > .pru_close = tcp_usr_close, > }; > > Modified: head/sys/sys/socketvar.h > ============================================================================== > --- head/sys/sys/socketvar.h Mon Jun 22 22:54:44 2009 (r194671) > +++ head/sys/sys/socketvar.h Mon Jun 22 23:08:05 2009 (r194672) > @@ -345,6 +345,9 @@ int sopoll_generic(struct socket *so, in > struct ucred *active_cred, struct thread *td); > int soreceive(struct socket *so, struct sockaddr **paddr, struct uio *uio, > struct mbuf **mp0, struct mbuf **controlp, int *flagsp); > +int soreceive_stream(struct socket *so, struct sockaddr **paddr, > + struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, > + int *flagsp); > int soreceive_dgram(struct socket *so, struct sockaddr **paddr, > struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, > int *flagsp); > From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 07:53:53 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BDFA1065678; Tue, 23 Jun 2009 07:53:53 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id F2A5B8FC21; Tue, 23 Jun 2009 07:53:52 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 62B401CC63; Tue, 23 Jun 2009 09:53:52 +0200 (CEST) Date: Tue, 23 Jun 2009 09:53:52 +0200 From: Ed Schouten To: Rong-En Fan Message-ID: <20090623075352.GJ48776@hoeg.nl> References: <200906221500.n5MF0F6v044301@svn.freebsd.org> <20090622151917.GC48776@hoeg.nl> <20090623015306.GB27380@svm.csie.ntu.edu.tw> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Lm2aua8EgO0wdo9l" Content-Disposition: inline In-Reply-To: <20090623015306.GB27380@svm.csie.ntu.edu.tw> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r194628 - head/lib/ncurses/ncurses X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 07:53:53 -0000 --Lm2aua8EgO0wdo9l Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, * Rong-En Fan wrote: > There is a --with-fallbacks in ncurses, let me check if we can use that. >=20 > We don't really use the termcap/terminfo entries from ncurses, but > instead we have our own version. So, not sure if we should provide a=20 > small /etc/termcap.small or we should use the entries from ncurses. I've noticed the xterm entry we have in FreeBSD is somewhat inconsistent with the one from other operating systems. For example: I've noticed that we use erase-line to fill a line with a certain color, but this breaks on OS X, because Terminal.app uses the default attributes while performing erase-line, instead of the current attributes. Is this a known issue? --=20 Ed Schouten WWW: http://80386.nl/ --Lm2aua8EgO0wdo9l Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkpAihAACgkQ52SDGA2eCwUmtQCcDV6y6Gpll1L/UzaXDkZl1E6p cj0An2Q5Rv5D5VQxaoc+fpnBXFlX9RGq =DUeO -----END PGP SIGNATURE----- --Lm2aua8EgO0wdo9l-- From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 08:00:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 779411065674; Tue, 23 Jun 2009 08:00:16 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 3A60D8FC1B; Tue, 23 Jun 2009 08:00:16 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 9F8D41CC63; Tue, 23 Jun 2009 10:00:15 +0200 (CEST) Date: Tue, 23 Jun 2009 10:00:15 +0200 From: Ed Schouten To: Maxim Konovalov Message-ID: <20090623080015.GK48776@hoeg.nl> References: <200906230555.n5N5tubJ065618@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cHAfZBNe+ETbtd8W" Content-Disposition: inline In-Reply-To: <200906230555.n5N5tubJ065618@svn.freebsd.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194681 - head/usr.sbin/wpa/ndis_events X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 08:00:17 -0000 --cHAfZBNe+ETbtd8W Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Maxim, * Maxim Konovalov wrote: > +static void usage(); =2E.. > +usage() That should probably read: static void usage(void); Right? --=20 Ed Schouten WWW: http://80386.nl/ --cHAfZBNe+ETbtd8W Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkpAi48ACgkQ52SDGA2eCwWumQCdGC/jQ+BwwXWVj0YWPjL6JbIl XMMAnjw9s/cbjbKQFQwT7dJ76z7af/Yq =Tks8 -----END PGP SIGNATURE----- --cHAfZBNe+ETbtd8W-- From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 08:03:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AEB11065670; Tue, 23 Jun 2009 08:03:49 +0000 (UTC) (envelope-from jeremie@le-hen.org) Received: from smtpfb1-g21.free.fr (smtpfb1-g21.free.fr [212.27.42.9]) by mx1.freebsd.org (Postfix) with ESMTP id B3A628FC0A; Tue, 23 Jun 2009 08:03:43 +0000 (UTC) (envelope-from jeremie@le-hen.org) Received: from smtp1-g21.free.fr (smtp1-g21.free.fr [212.27.42.1]) by smtpfb1-g21.free.fr (Postfix) with ESMTP id CB31777C699; Tue, 23 Jun 2009 09:47:19 +0200 (CEST) Received: from smtp1-g21.free.fr (localhost [127.0.0.1]) by smtp1-g21.free.fr (Postfix) with ESMTP id 27E0394012E; Tue, 23 Jun 2009 09:47:10 +0200 (CEST) Received: from endor.tataz.chchile.org (tataz.chchile.org [82.233.239.98]) by smtp1-g21.free.fr (Postfix) with ESMTP id 428789400AF; Tue, 23 Jun 2009 09:47:08 +0200 (CEST) Received: from obiwan.tataz.chchile.org (obiwan.tataz.chchile.org [192.168.1.222]) by endor.tataz.chchile.org (Postfix) with ESMTP id AC1B333E61; Tue, 23 Jun 2009 07:46:31 +0000 (UTC) Received: by obiwan.tataz.chchile.org (Postfix, from userid 1000) id 728B750835; Tue, 23 Jun 2009 09:46:31 +0200 (CEST) Date: Tue, 23 Jun 2009 09:46:31 +0200 From: Jeremie Le Hen To: "Bjoern A. Zeeb" Message-ID: <20090623074631.GL30065@obiwan.tataz.chchile.org> References: <200905231642.n4NGgcbJ060961@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200905231642.n4NGgcbJ060961@svn.freebsd.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r192648 - in head: share/man/man4 sys/conf sys/netinet sys/netinet6 sys/netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 08:03:49 -0000 Hi, On Sat, May 23, 2009 at 04:42:38PM +0000, Bjoern A. Zeeb wrote: > Author: bz > Date: Sat May 23 16:42:38 2009 > New Revision: 192648 > URL: http://svn.freebsd.org/changeset/base/192648 > > Log: > Add sysctls to toggle the behaviour of the (former) IPSEC_FILTERTUNNEL > kernel option. > This also permits tuning of the option per virtual network stack, as > well as separately per inet, inet6. > > The kernel option is left for a transition period, marked deprecated, > and will be removed soon. Sorry, I'm lagging behind regarding my FreeBSD mail queue... But I'd like to know if this feature is going to be simply removed, or if it is replaced by something else? Thanks. Regards, -- Jeremie Le Hen < jeremie at le-hen dot org >< ttz at chchile dot org > From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 08:29:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CAB2B1065672 for ; Tue, 23 Jun 2009 08:29:44 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id E5FB88FC3E for ; Tue, 23 Jun 2009 08:29:43 +0000 (UTC) (envelope-from andre@freebsd.org) Received: (qmail 23427 invoked from network); 23 Jun 2009 08:17:05 -0000 Received: from localhost (HELO [127.0.0.1]) ([127.0.0.1]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 23 Jun 2009 08:17:05 -0000 Message-ID: <4A409275.30705@freebsd.org> Date: Tue, 23 Jun 2009 10:29:41 +0200 From: Andre Oppermann User-Agent: Thunderbird 1.5.0.14 (Windows/20071210) MIME-Version: 1.0 To: Robert Watson References: <200906222308.n5MN856I055711@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194672 - in head/sys: kern netinet sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 08:29:45 -0000 Robert Watson wrote: > > On Mon, 22 Jun 2009, Andre Oppermann wrote: > >> Add soreceive_stream(), an optimized version of soreceive() for >> stream (TCP) sockets. > > While this sounds like very interesting work, I was struck by the lack of: > > Reviewed by: ? > Tested by: ? > > Have you tested this change with some of our TCP conumer edge cases, > especially in-kernel consumers: > > - Accept filters > - NFS client > - NFS server > - smbfs > - iscsi initiator No, yes, yes, no, no. Plus a large number of SSH copying (it will trip over every corrupted byte) and fetching half of the ports collection programs source code and comparing the checksum. > I also assume that the plan is that this will not be enabled by default > in 8.0? With soreceive_dgram, it took three months to shake out the > nits, and the datagram case is far simpler than the stream case. Given > that experience, I'd guess it will take longer for the new stream code > to shake out, and probably involve painfully tracking subtle bugs in > blocking code, data corruption in NFS, etc. I've identified one such > possible bug for iscsi. No, it not supposed to be enable by default in 8.0. > To provide easier access for early adopters, we shipped with > soreceive_dgram available for UDP, but optionally enabled by a loader > tunable, for at least one minor rev. I would recommend doing something > similar here. A good hint, thank you. > A few inline comments below, including one serious bug (assuming my > reading is right). This doesn't consistute a full review because it's > too early in the morning to reason fully about the socket buffer code. OK. Thanks. I will look into the specifics later today. -- Andre > Robert N M Watson > Computer Laboratory > University of Cambridge > >> It is functionally identical to generic soreceive() but has a >> number stream specific optimizations: >> o does only one sockbuf unlock/lock per receive independent of >> the length of data to be moved into the uio compared to >> soreceive() which unlocks/locks per *mbuf*. > > Hmm. I count four locks and unlocks per receive, assuming no blocking > and a I/O to user memory: > > - sblock/sbunlock to stabilize sb_mb and prevent I/O interlacing. > - start/stop socket buffer mutex lock/unlock at beginning/end of function > - unlock/relock around m_mbuftouio() > - unlock/relock around pru_rcvd > > One idea I've futzed with a little is whether or not we could drop > sblock() in certain cases for receive and transmit. As far as I'm > aware, it is used for at least four purposes in receive: > > - Prevent I/O interlacing from concurrent system calls > - Provide consistency for blocking logic during concurrent system calls > - Stabilize non-NULL sb_mb while the socket buffer mutex is dropped > - Minimize contention on the socket buffer mutex during concurrent system > calls > > Some of these are more important than others -- in particular, the > function of preventing I/O interlacing for stream system calls seems > something we might drop, as it's not a guarantee provided by other OS's, > so no portable application should depend on it. Have you looked at all > at this? > >> o uses m_mbuftouio() instead of its own copy(out) variant. >> o much more compact code flow as a large number of special >> cases is removed. >> o much improved reability. >> >> It offers significantly reduced CPU usage and lock contention >> when receiving fast TCP streams. Additional gains are obtained >> when the receiving application is using SO_RCVLOWAT to batch up >> some data before a read (and wakeup) is done. >> >> This function was written by "reverse engineering" and is not >> just a stripped down variant of soreceive(). >> >> It is not yet enabled by default on TCP sockets. Instead it is >> commented out in the protocol initialization in tcp_usrreq.c >> until more widespread testing has been done. > > Have you looked at using this with SCTP and UNIX domain sockets? UNIX > domain socket performance is quite important for database workloads, and > SCTP is > going to be increasingly important for Internet applications. In the > UNIX domain socket case, not supporting control mbuf will be a potential > problem (see comments below about either implementing it or falling > back, and if falling back m_mbuftouio needs to know how to properly free > them). > >> Testers, especially with 10GigE gear, are welcome. >> >> MFP4: r164817 //depot/user/andre/soreceive_stream/ >> >> Modified: >> head/sys/kern/uipc_socket.c >> head/sys/netinet/tcp_usrreq.c >> head/sys/sys/socketvar.h >> >> Modified: head/sys/kern/uipc_socket.c >> ============================================================================== >> >> --- head/sys/kern/uipc_socket.c Mon Jun 22 22:54:44 2009 (r194671) >> +++ head/sys/kern/uipc_socket.c Mon Jun 22 23:08:05 2009 (r194672) >> @@ -1857,6 +1857,202 @@ release: >> } >> >> /* >> + * Optimized version of soreceive() for stream (TCP) sockets. >> + */ >> +int >> +soreceive_stream(struct socket *so, struct sockaddr **psa, struct uio >> *uio, >> + struct mbuf **mp0, struct mbuf **controlp, int *flagsp) >> +{ >> + int len = 0, error = 0, flags, oresid; >> + struct sockbuf *sb; >> + struct mbuf *m, *n = NULL; >> + >> + /* We only do stream sockets. */ >> + if (so->so_type != SOCK_STREAM) >> + return (EINVAL); > > This should be a KASSERT(). You should also assert !PR_ADDR and > !PR_ATOMIC, and possibly a few other things to ensure that > soreceive_stream is not used with protocols that require features it > does not implement. > > Much better to discover on sanity-checking the kernel than through > subtle application bugs later when people start throwing switches > without giving things full consideration. > >> + if (psa != NULL) >> + *psa = NULL; >> + if (controlp != NULL) >> + return (EINVAL); > > This would seem to preclude easy future use of ancillary data with TCP > -- one type I've been considering adding is TCP_INFO updates as part of > the stream. How would you feel about making this call into > soreceive_generic() instead? > > My reading of the control code was that it actually was fairly simple > and I did include it in soreceive_dgram() (especially given that it's > popular for UDP so you can get the receive IP address per-datagram). > >> + if (flagsp != NULL) >> + flags = *flagsp &~ MSG_EOR; >> + else >> + flags = 0; >> + if (flags & MSG_OOB) >> + return (soreceive_rcvoob(so, uio, flags)); >> + if (mp0 != NULL) >> + *mp0 = NULL; >> + >> + sb = &so->so_rcv; >> + >> + /* Prevent other readers from entering the socket. */ >> + error = sblock(sb, SBLOCKWAIT(flags)); >> + if (error) >> + goto out; >> + SOCKBUF_LOCK(sb); >> + >> + /* Easy one, no space to copyout anything. */ >> + if (uio->uio_resid == 0) { >> + error = EINVAL; >> + goto out; >> + } > > Didn't we previously allow a resid of 0 to be used to probe for socket > errors without receiving data? I've never used this semantic but it > seems to be supported, which undoubtably means someone is using it :-). > I notice that previously we didn't allow receiving EWOULDBLOCK using a > 0-byte buffer, but perhaps we should have. > >> + oresid = uio->uio_resid; >> + >> + /* We will never ever get anything unless we are connected. */ >> + if (!(so->so_state & (SS_ISCONNECTED|SS_ISDISCONNECTED))) { >> + /* When disconnecting there may be still some data left. */ >> + if (sb->sb_cc > 0) >> + goto deliver; >> + if (!(so->so_state & SS_ISDISCONNECTED)) >> + error = ENOTCONN; >> + goto out; >> + } >> + >> + /* Socket buffer is empty and we shall not block. */ >> + if (sb->sb_cc == 0 && >> + ((sb->sb_flags & SS_NBIO) || (flags & >> (MSG_DONTWAIT|MSG_NBIO)))) { >> + error = EAGAIN; >> + goto out; >> + } > > I think you've changed the error number reporting here in subtle ways, > but it's early in the morning. It appears we now prefer ENOTCONN to > so_error once the socket has entered SS_ISDISCONNECTED. We need to > report and clear so_error if non-0 so that ECONNRESET, EPERM, etc, can > be reported properly. > > The new so_state logic is markedly different from what came before, but > I'm not sure what the impact of that is. Certainly the comment needs to > change to "... are or have been connected". The previous logic appears > to have handled SS_ISCONNECTING differently, and possibly > SS_ISDISCONNECTING. > >> +restart: >> + SOCKBUF_LOCK_ASSERT(&so->so_rcv); >> + >> + /* Abort if socket has reported problems. */ >> + if (so->so_error) { >> + if (sb->sb_cc > 0) >> + goto deliver; >> + if (oresid > uio->uio_resid) >> + goto out; >> + error = so->so_error; >> + if (!(flags & MSG_PEEK)) >> + so->so_error = 0; >> + goto out; >> + } >> + >> + /* Door is closed. Deliver what is left, if any. */ >> + if (sb->sb_state & SBS_CANTRCVMORE) { >> + if (sb->sb_cc > 0) >> + goto deliver; >> + else >> + goto out; >> + } >> + >> + /* Socket buffer got some data that we shall deliver now. */ >> + if (sb->sb_cc > 0 && !(flags & MSG_WAITALL) && >> + ((sb->sb_flags & SS_NBIO) || >> + (flags & (MSG_DONTWAIT|MSG_NBIO)) || >> + sb->sb_cc >= sb->sb_lowat || >> + sb->sb_cc >= uio->uio_resid || >> + sb->sb_cc >= sb->sb_hiwat) ) { >> + goto deliver; >> + } >> + >> + /* On MSG_WAITALL we must wait until all data or error arrives. */ >> + if ((flags & MSG_WAITALL) && >> + (sb->sb_cc >= uio->uio_resid || sb->sb_cc >= sb->sb_lowat)) >> + goto deliver; >> + >> + /* >> + * Wait and block until (more) data comes in. >> + * NB: Drops the sockbuf lock during wait. >> + */ >> + error = sbwait(sb); >> + if (error) >> + goto out; >> + goto restart; >> + >> +deliver: >> + SOCKBUF_LOCK_ASSERT(&so->so_rcv); >> + KASSERT(sb->sb_cc > 0, ("%s: sockbuf empty", __func__)); >> + KASSERT(sb->sb_mb != NULL, ("%s: sb_mb == NULL", __func__)); >> + >> + /* Statistics. */ >> + if (uio->uio_td) >> + uio->uio_td->td_ru.ru_msgrcv++; >> + >> + /* Fill uio until full or current end of socket buffer is >> reached. */ >> + len = min(uio->uio_resid, sb->sb_cc); >> + if (mp0 != NULL) { >> + /* Dequeue as many mbufs as possible. */ >> + if (!(flags & MSG_PEEK) && len >= sb->sb_mb->m_len) { >> + for (*mp0 = m = sb->sb_mb; >> + m != NULL && m->m_len <= len; >> + m = m->m_next) { >> + len -= m->m_len; >> + uio->uio_resid -= m->m_len; >> + sbfree(sb, m); >> + n = m; >> + } > > Since control mbufs aren't supported, you should assert !MT_CONTROL. Or > add control mbuf support per above. > > Again, early in the morning, but: does (mp0 != NULL) still work with > (flags & MSG_WAITALL)? In soreceive_generic(), mp0 is updated to point > to &m->m_next as the loop iterates, so that as you go back to 'repeat:', > the chain pointed to by mp0 is appended to rather than replaced, whereas > your code appears to replace it in each loop (which seems wrong). > Perhaps it's just too early in the morning. > > I think the only consumer of (mp0 != NULL) with MSG_WAITALL is the iscsi > initiator, but breaking that would be bad. smbfs probably *should* use > it... :-) > >> + sb->sb_mb = m; >> + if (sb->sb_mb == NULL) >> + SB_EMPTY_FIXUP(sb); >> + n->m_next = NULL; >> + } >> + /* Copy the remainder. */ >> + if (len > 0) { >> + KASSERT(sb->sb_mb != NULL, >> + ("%s: len > 0 && sb->sb_mb empty", __func__)); >> + >> + m = m_copym(sb->sb_mb, 0, len, M_DONTWAIT); >> + if (m == NULL) >> + len = 0; /* Don't flush data from sockbuf. */ >> + else >> + uio->uio_resid -= m->m_len; >> + if (*mp0 != NULL) >> + n->m_next = m; >> + else >> + *mp0 = m; >> + if (*mp0 == NULL) { >> + error = ENOBUFS; >> + goto out; >> + } >> + } >> + } else { >> + /* NB: Must unlock socket buffer as uiomove may sleep. */ >> + SOCKBUF_UNLOCK(sb); >> + error = m_mbuftouio(uio, sb->sb_mb, len); > > m_mbuftouio() should assert !MT_CONTROL on each mbuf if it doesn't > support control mbufs. See also above. :-) > >> + SOCKBUF_LOCK(sb); >> + if (error) >> + goto out; >> + } >> + SBLASTRECORDCHK(sb); >> + SBLASTMBUFCHK(sb); >> + >> + /* >> + * Remove the delivered data from the socket buffer unless we >> + * were only peeking. >> + */ >> + if (!(flags & MSG_PEEK)) { >> + if (len > 0) >> + sbdrop_locked(sb, len); >> + >> + /* Notify protocol that we drained some data. */ >> + if ((so->so_proto->pr_flags & PR_WANTRCVD) && >> + (((flags & MSG_WAITALL) && uio->uio_resid > 0) || >> + !(flags & MSG_SOCALLBCK))) { >> + SOCKBUF_UNLOCK(sb); >> + (*so->so_proto->pr_usrreqs->pru_rcvd)(so, flags); >> + SOCKBUF_LOCK(sb); >> + } >> + } >> + >> + /* >> + * For MSG_WAITALL we may have to loop again and wait for >> + * more data to come in. >> + */ >> + if ((flags & MSG_WAITALL) && uio->uio_resid > 0) >> + goto restart; >> +out: >> + SOCKBUF_LOCK_ASSERT(sb); >> + SBLASTRECORDCHK(sb); >> + SBLASTMBUFCHK(sb); >> + SOCKBUF_UNLOCK(sb); >> + sbunlock(sb); >> + return (error); >> +} >> + >> +/* >> * Optimized version of soreceive() for simple datagram cases from >> userspace. >> * Unlike in the stream case, we're able to drop a datagram if copyout() >> * fails, and because we handle datagrams atomically, we don't need to >> use a >> >> Modified: head/sys/netinet/tcp_usrreq.c >> ============================================================================== >> >> --- head/sys/netinet/tcp_usrreq.c Mon Jun 22 22:54:44 2009 >> (r194671) >> +++ head/sys/netinet/tcp_usrreq.c Mon Jun 22 23:08:05 2009 >> (r194672) >> @@ -1032,6 +1032,9 @@ struct pr_usrreqs tcp_usrreqs = { >> .pru_send = tcp_usr_send, >> .pru_shutdown = tcp_usr_shutdown, >> .pru_sockaddr = in_getsockaddr, >> +#if 0 >> + .pru_soreceive = soreceive_stream, >> +#endif >> .pru_sosetlabel = in_pcbsosetlabel, >> .pru_close = tcp_usr_close, >> }; >> @@ -1053,6 +1056,9 @@ struct pr_usrreqs tcp6_usrreqs = { >> .pru_send = tcp_usr_send, >> .pru_shutdown = tcp_usr_shutdown, >> .pru_sockaddr = in6_mapped_sockaddr, >> +#if 0 >> + .pru_soreceive = soreceive_stream, >> +#endif >> .pru_sosetlabel = in_pcbsosetlabel, >> .pru_close = tcp_usr_close, >> }; >> >> Modified: head/sys/sys/socketvar.h >> ============================================================================== >> >> --- head/sys/sys/socketvar.h Mon Jun 22 22:54:44 2009 (r194671) >> +++ head/sys/sys/socketvar.h Mon Jun 22 23:08:05 2009 (r194672) >> @@ -345,6 +345,9 @@ int sopoll_generic(struct socket *so, in >> struct ucred *active_cred, struct thread *td); >> int soreceive(struct socket *so, struct sockaddr **paddr, struct >> uio *uio, >> struct mbuf **mp0, struct mbuf **controlp, int *flagsp); >> +int soreceive_stream(struct socket *so, struct sockaddr **paddr, >> + struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, >> + int *flagsp); >> int soreceive_dgram(struct socket *so, struct sockaddr **paddr, >> struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, >> int *flagsp); >> > > From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 08:51:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D43A11065672; Tue, 23 Jun 2009 08:51:11 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C2A1A8FC08; Tue, 23 Jun 2009 08:51:11 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5N8pBwc069097; Tue, 23 Jun 2009 08:51:11 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5N8pBip069095; Tue, 23 Jun 2009 08:51:11 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <200906230851.n5N8pBip069095@svn.freebsd.org> From: Maxim Konovalov Date: Tue, 23 Jun 2009 08:51: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: r194686 - head/usr.sbin/wpa/ndis_events X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 08:51:12 -0000 Author: maxim Date: Tue Jun 23 08:51:11 2009 New Revision: 194686 URL: http://svn.freebsd.org/changeset/base/194686 Log: o Fix usage() prototype [1] and correct its call. Submitted by: ed [1] Modified: head/usr.sbin/wpa/ndis_events/ndis_events.c Modified: head/usr.sbin/wpa/ndis_events/ndis_events.c ============================================================================== --- head/usr.sbin/wpa/ndis_events/ndis_events.c Tue Jun 23 06:57:46 2009 (r194685) +++ head/usr.sbin/wpa/ndis_events/ndis_events.c Tue Jun 23 08:51:11 2009 (r194686) @@ -93,7 +93,7 @@ struct ndis_evt { static int find_ifname(int, char *); static int announce_event(char *, int, struct sockaddr_in *); -static void usage(); +static void usage(void); static void dbgmsg(const char *fmt, ...) @@ -293,7 +293,7 @@ main(argc, argv) all_events++; break; default: - usage(PROGNAME); + usage(); break; } } From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 08:51:49 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 538D81065675; Tue, 23 Jun 2009 08:51:49 +0000 (UTC) (envelope-from maxim@macomnet.ru) Received: from mp2.macomnet.net (cl-2958.ham-01.de.sixxs.net [IPv6:2001:6f8:900:b8d::2]) by mx1.freebsd.org (Postfix) with ESMTP id B3B468FC12; Tue, 23 Jun 2009 08:51:48 +0000 (UTC) (envelope-from maxim@macomnet.ru) Received: from localhost (localhost [127.0.0.1]) by mp2.macomnet.net (8.14.3/8.14.3) with ESMTP id n5N8pa7P010584; Tue, 23 Jun 2009 12:51:36 +0400 (MSD) (envelope-from maxim@macomnet.ru) Date: Tue, 23 Jun 2009 12:51:36 +0400 (MSD) From: Maxim Konovalov To: Ed Schouten In-Reply-To: <20090623080015.GK48776@hoeg.nl> Message-ID: <20090623125125.F1156@mp2.macomnet.net> References: <200906230555.n5N5tubJ065618@svn.freebsd.org> <20090623080015.GK48776@hoeg.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r194681 - head/usr.sbin/wpa/ndis_events X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 08:51:49 -0000 On Tue, 23 Jun 2009, 10:00+0200, Ed Schouten wrote: > Hi Maxim, > > * Maxim Konovalov wrote: > > +static void usage(); > ... > > +usage() > > That should probably read: > > static void usage(void); > > Right? > fixed, thanks. -- Maxim Konovalov From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 08:58:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B51CC1065677 for ; Tue, 23 Jun 2009 08:58:22 +0000 (UTC) (envelope-from andre@freebsd.org) Received: from c00l3r.networx.ch (c00l3r.networx.ch [62.48.2.2]) by mx1.freebsd.org (Postfix) with ESMTP id 1DCCC8FC27 for ; Tue, 23 Jun 2009 08:58:21 +0000 (UTC) (envelope-from andre@freebsd.org) Received: (qmail 23690 invoked from network); 23 Jun 2009 08:45:46 -0000 Received: from localhost (HELO [127.0.0.1]) ([127.0.0.1]) (envelope-sender ) by c00l3r.networx.ch (qmail-ldap-1.03) with SMTP for ; 23 Jun 2009 08:45:46 -0000 Message-ID: <4A409932.9090802@freebsd.org> Date: Tue, 23 Jun 2009 10:58:26 +0200 From: Andre Oppermann User-Agent: Thunderbird 1.5.0.14 (Windows/20071210) MIME-Version: 1.0 To: Kip Macy References: <200906221935.n5MJZdLJ050266@svn.freebsd.org> <3c1674c90906221510s9b62e25w3a5d41c21bd512e1@mail.gmail.com> <4A40056F.4000207@freebsd.org> <3c1674c90906221559q66fe3934ued99694c30aa3a81@mail.gmail.com> In-Reply-To: <3c1674c90906221559q66fe3934ued99694c30aa3a81@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Sam Leffler Subject: Re: svn commit: r194643 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 08:58:22 -0000 Kip Macy wrote: > As soon as >> INVARIANTS are enable the KASSERT will catch the offender red handed. > > The INVARIANTS check DTRT. i.e. fail-fast. If you're double-freeing a > valid mbuf you'll get a random crash elsewhere. There is the uncertainty whether the m_nextpkt mbuf is really referenced from somewhere else or just hangs on by accident (bug). Under INVARIANTS the response is clear. Without debug code the question is how to respond in the most useful way. The options are: 1) assume m_nextpkt is a potential memory leak and potentially risk a subtle crash if it was referenced. 2) NULL out m_nextpkt and risk a memory leak. 3) panic in any case. m_nextpkt in an m_next chain is a bug in any case and should not happen. Option 3) seems excessive. Which of option 1) and 2) do you prefer? -- Andre From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 09:02:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3BC61065670; Tue, 23 Jun 2009 09:02:24 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B1FB78FC1A; Tue, 23 Jun 2009 09:02:24 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5N92Oeg069336; Tue, 23 Jun 2009 09:02:24 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5N92OnJ069334; Tue, 23 Jun 2009 09:02:24 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200906230902.n5N92OnJ069334@svn.freebsd.org> From: Roman Divacky Date: Tue, 23 Jun 2009 09:02: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: r194687 - head/sys/dev/firewire X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 09:02:25 -0000 Author: rdivacky Date: Tue Jun 23 09:02:24 2009 New Revision: 194687 URL: http://svn.freebsd.org/changeset/base/194687 Log: Fix what seems to be an obvious typo preventing the body of the if statement to ever be executed. Approved by: ed (mentor) Modified: head/sys/dev/firewire/fwdev.c Modified: head/sys/dev/firewire/fwdev.c ============================================================================== --- head/sys/dev/firewire/fwdev.c Tue Jun 23 08:51:11 2009 (r194686) +++ head/sys/dev/firewire/fwdev.c Tue Jun 23 09:02:24 2009 (r194687) @@ -443,7 +443,7 @@ fw_write_async(struct fw_drv1 *d, struct xfer->send.pay_len = uio->uio_resid; if (uio->uio_resid > 0) { if ((err = uiomove((caddr_t)&xfer->send.payload[0], - uio->uio_resid, uio))); + uio->uio_resid, uio))) goto out; } From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 09:04:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDA6C1065673; Tue, 23 Jun 2009 09:04:59 +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 DC5A78FC08; Tue, 23 Jun 2009 09:04:59 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5N94xwB069449; Tue, 23 Jun 2009 09:04:59 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5N94xVw069447; Tue, 23 Jun 2009 09:04:59 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200906230904.n5N94xVw069447@svn.freebsd.org> From: Ed Schouten Date: Tue, 23 Jun 2009 09:04:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194688 - head/lib/libc/i386/stdlib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 09:05:00 -0000 Author: ed Date: Tue Jun 23 09:04:59 2009 New Revision: 194688 URL: http://svn.freebsd.org/changeset/base/194688 Log: Remove hand-written labs/abs implementations. GCC is smart enough. It turns out GCC generates code that's a couple of bytes big bigger, but performs no branching whatsoever. Submitted by: Christoph Mallon Deleted: head/lib/libc/i386/stdlib/abs.S head/lib/libc/i386/stdlib/labs.S Modified: head/lib/libc/i386/stdlib/Makefile.inc Modified: head/lib/libc/i386/stdlib/Makefile.inc ============================================================================== --- head/lib/libc/i386/stdlib/Makefile.inc Tue Jun 23 09:02:24 2009 (r194687) +++ head/lib/libc/i386/stdlib/Makefile.inc Tue Jun 23 09:04:59 2009 (r194688) @@ -1,4 +1,4 @@ # @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 # $FreeBSD$ -MDSRCS+=abs.S div.S labs.S ldiv.S +MDSRCS+=div.S ldiv.S From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 09:32:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5DF331065679; Tue, 23 Jun 2009 09:32:05 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (77-93-215-190.static.masterinter.net [77.93.215.190]) by mx1.freebsd.org (Postfix) with ESMTP id 177F98FC19; Tue, 23 Jun 2009 09:32:04 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id C84339CB08D; Tue, 23 Jun 2009 11:31:00 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (lev.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gBrCJ3aiRIdC; Tue, 23 Jun 2009 11:30:58 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id A3A079CB10C; Tue, 23 Jun 2009 11:30:58 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.3/8.14.3/Submit) id n5N9UwTT080650; Tue, 23 Jun 2009 11:30:58 +0200 (CEST) (envelope-from rdivacky) Date: Tue, 23 Jun 2009 11:30:58 +0200 From: Roman Divacky To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <20090623093058.GA78083@freebsd.org> References: <200906230902.n5N92OnJ069334@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200906230902.n5N92OnJ069334@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: Subject: Re: svn commit: r194687 - head/sys/dev/firewire X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 09:32:05 -0000 On Tue, Jun 23, 2009 at 09:02:24AM +0000, Roman Divacky wrote: > Author: rdivacky > Date: Tue Jun 23 09:02:24 2009 > New Revision: 194687 > URL: http://svn.freebsd.org/changeset/base/194687 > > Log: > Fix what seems to be an obvious typo preventing the body of the > if statement to ever be executed. what I meant was the the goto out; is executed every time. :( From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 09:50:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC23D1065677; Tue, 23 Jun 2009 09:50:50 +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 DAF718FC26; Tue, 23 Jun 2009 09:50:50 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5N9oofi070737; Tue, 23 Jun 2009 09:50:50 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5N9oofC070735; Tue, 23 Jun 2009 09:50:50 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200906230950.n5N9oofC070735@svn.freebsd.org> From: Ed Schouten Date: Tue, 23 Jun 2009 09:50: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: r194689 - head/libexec/rtld-elf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 09:50:51 -0000 Author: ed Date: Tue Jun 23 09:50:50 2009 New Revision: 194689 URL: http://svn.freebsd.org/changeset/base/194689 Log: Fix typo in comment. Submitted by: Christoph Mallon Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Tue Jun 23 09:04:59 2009 (r194688) +++ head/libexec/rtld-elf/rtld.c Tue Jun 23 09:50:50 2009 (r194689) @@ -1308,7 +1308,7 @@ init_rtld(caddr_t mapbase) /* * Conjure up an Obj_Entry structure for the dynamic linker. * - * The "path" member can't be initialized yet because string constatns + * The "path" member can't be initialized yet because string constants * cannot yet be acessed. Below we will set it correctly. */ memset(&objtmp, 0, sizeof(objtmp)); From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 11:29:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17CE61065670; Tue, 23 Jun 2009 11:29:55 +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 068A18FC15; Tue, 23 Jun 2009 11:29:55 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NBTsP6074667; Tue, 23 Jun 2009 11:29:54 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NBTsqm074665; Tue, 23 Jun 2009 11:29:54 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <200906231129.n5NBTsqm074665@svn.freebsd.org> From: Peter Holm Date: Tue, 23 Jun 2009 11:29: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: r194697 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 11:29:55 -0000 Author: pho Date: Tue Jun 23 11:29:54 2009 New Revision: 194697 URL: http://svn.freebsd.org/changeset/base/194697 Log: vn_open_cred() needs a non NULL ucred pointer Reviewed by: kib Modified: head/sys/kern/kern_sig.c Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Tue Jun 23 10:59:59 2009 (r194696) +++ head/sys/kern/kern_sig.c Tue Jun 23 11:29:54 2009 (r194697) @@ -2941,7 +2941,7 @@ restart: NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE, UIO_SYSSPACE, name, td); flags = O_CREAT | FWRITE | O_NOFOLLOW; error = vn_open_cred(&nd, &flags, S_IRUSR | S_IWUSR, VN_OPEN_NOAUDIT, - NULL, NULL); + cred, NULL); if (error) { #ifdef AUDIT audit_proc_coredump(td, name, error); From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 12:30:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86662106564A; Tue, 23 Jun 2009 12:30:21 +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 7326A8FC1E; Tue, 23 Jun 2009 12:30:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NCULv0075897; Tue, 23 Jun 2009 12:30:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NCULon075895; Tue, 23 Jun 2009 12:30:21 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200906231230.n5NCULon075895@svn.freebsd.org> From: Alexander Motin Date: Tue, 23 Jun 2009 12:30: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: r194699 - head/sys/netgraph X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 12:30:23 -0000 Author: mav Date: Tue Jun 23 12:30:21 2009 New Revision: 194699 URL: http://svn.freebsd.org/changeset/base/194699 Log: Mark ng_ether node hooks as HI_STACK. It is usually the last point when netgraph may unroll the call stack, and I have found that in some cases 2K guarantied there for i386 may be not enough for NIC driver and BPF. Modified: head/sys/netgraph/ng_ether.c Modified: head/sys/netgraph/ng_ether.c ============================================================================== --- head/sys/netgraph/ng_ether.c Tue Jun 23 11:41:58 2009 (r194698) +++ head/sys/netgraph/ng_ether.c Tue Jun 23 12:30:21 2009 (r194699) @@ -435,7 +435,7 @@ ng_ether_newhook(node_p node, hook_p hoo /* Disable hardware checksums while 'upper' hook is connected */ if (hookptr == &priv->upper) priv->ifp->if_hwassist = 0; - + NG_HOOK_HI_STACK(hook); /* OK */ *hookptr = hook; return (0); From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 13:10:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 068D9106564A; Tue, 23 Jun 2009 13:10:04 +0000 (UTC) (envelope-from uqs@spoerlein.net) Received: from acme.spoerlein.net (cl-43.dus-01.de.sixxs.net [IPv6:2a01:198:200:2a::2]) by mx1.freebsd.org (Postfix) with ESMTP id 89B9B8FC18; Tue, 23 Jun 2009 13:10:03 +0000 (UTC) (envelope-from uqs@spoerlein.net) Received: from acme.spoerlein.net (localhost.spoerlein.net [127.0.0.1]) by acme.spoerlein.net (8.14.3/8.14.3) with ESMTP id n5NDA1Wd005833 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 23 Jun 2009 15:10:02 +0200 (CEST) (envelope-from uqs@spoerlein.net) Received: (from uqs@localhost) by acme.spoerlein.net (8.14.3/8.14.3/Submit) id n5NDA1rA005832; Tue, 23 Jun 2009 15:10:01 +0200 (CEST) (envelope-from uqs@spoerlein.net) Date: Tue, 23 Jun 2009 15:10:01 +0200 From: Ulrich =?utf-8?B?U3DDtnJsZWlu?= To: Roman Divacky Message-ID: <20090623131001.GH31709@acme.spoerlein.net> Mail-Followup-To: Ulrich =?utf-8?B?U3DDtnJsZWlu?= , Roman Divacky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <200906230902.n5N92OnJ069334@svn.freebsd.org> <20090623093058.GA78083@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20090623093058.GA78083@freebsd.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194687 - head/sys/dev/firewire X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 13:10:04 -0000 On Tue, 23.06.2009 at 11:30:58 +0200, Roman Divacky wrote: > On Tue, Jun 23, 2009 at 09:02:24AM +0000, Roman Divacky wrote: > > Log: > > Fix what seems to be an obvious typo preventing the body of the > > if statement to ever be executed. > > what I meant was the the goto out; is executed every time. :( Better than staying inside all the time, no? *scnr* Cheers, Ulrich Spörlein From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 13:16:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEE0A106566C; Tue, 23 Jun 2009 13:16:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A363E8FC0A; Tue, 23 Jun 2009 13:16:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NDGGtM076827; Tue, 23 Jun 2009 13:16:16 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NDGGQw076825; Tue, 23 Jun 2009 13:16:16 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200906231316.n5NDGGQw076825@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 23 Jun 2009 13:16:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194700 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 13:16:17 -0000 Author: bz Date: Tue Jun 23 13:16:16 2009 New Revision: 194700 URL: http://svn.freebsd.org/changeset/base/194700 Log: Remove duplicate #include from the middle of the file. Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Jun 23 12:30:21 2009 (r194699) +++ head/sys/net/if.c Tue Jun 23 13:16:16 2009 (r194700) @@ -1727,7 +1727,6 @@ done: return (ifa); } -#include #include /* From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 13:17:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2AD91065679; Tue, 23 Jun 2009 13:17:25 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D4D38FC0C; Tue, 23 Jun 2009 13:17:25 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NDHPjJ076893; Tue, 23 Jun 2009 13:17:25 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NDHPFK076883; Tue, 23 Jun 2009 13:17:25 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200906231317.n5NDHPFK076883@svn.freebsd.org> From: Rui Paulo Date: Tue, 23 Jun 2009 13:17: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: r194701 - in head: share/man/man4 sys/conf sys/dev/acpi_support sys/i386/conf sys/modules/acpi sys/modules/acpi/acpi_hp sys/modules/acpi/acpi_wmi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 13:17:26 -0000 Author: rpaulo Date: Tue Jun 23 13:17:25 2009 New Revision: 194701 URL: http://svn.freebsd.org/changeset/base/194701 Log: * Driver for ACPI WMI (Windows Management Instrumentation) * Driver for ACPI HP extra functionations, which required ACPI WMI driver. Submitted by: Michael Approved by: re MFC after: 2 weeks Added: head/share/man/man4/acpi_hp.4 (contents, props changed) head/share/man/man4/acpi_wmi.4 (contents, props changed) head/sys/dev/acpi_support/acpi_hp.c (contents, props changed) head/sys/dev/acpi_support/acpi_wmi.c (contents, props changed) head/sys/dev/acpi_support/acpi_wmi_if.m (contents, props changed) head/sys/modules/acpi/acpi_hp/ head/sys/modules/acpi/acpi_hp/Makefile (contents, props changed) head/sys/modules/acpi/acpi_wmi/ head/sys/modules/acpi/acpi_wmi/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/conf/files head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/conf/kmod.mk head/sys/i386/conf/NOTES head/sys/modules/acpi/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Tue Jun 23 13:16:16 2009 (r194700) +++ head/share/man/man4/Makefile Tue Jun 23 13:17:25 2009 (r194701) @@ -7,12 +7,14 @@ MAN= aac.4 \ ${_acpi_asus.4} \ ${_acpi_dock.4} \ ${_acpi_fujitsu.4} \ + ${_acpi_hp.4} \ ${_acpi_ibm.4} \ ${_acpi_panasonic.4} \ ${_acpi_sony.4} \ acpi_thermal.4 \ ${_acpi_toshiba.4} \ acpi_video.4 \ + ${_acpi_wmi.4} \ adv.4 \ adw.4 \ ae.4 \ @@ -594,10 +596,12 @@ _acpi_aiboost.4=acpi_aiboost.4 _acpi_asus.4= acpi_asus.4 _acpi_dock.4= acpi_dock.4 _acpi_fujitsu.4=acpi_fujitsu.4 +_acpi_hp.4= acpi_hp.4 _acpi_ibm.4= acpi_ibm.4 _acpi_panasonic.4=acpi_panasonic.4 _acpi_sony.4= acpi_sony.4 _acpi_toshiba.4=acpi_toshiba.4 +_acpi_wmi.4= acpi_wmi.4 _amdsmb.4= amdsmb.4 _amdtemp.4= amdtemp.4 _asmc.4= asmc.4 Added: head/share/man/man4/acpi_hp.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/acpi_hp.4 Tue Jun 23 13:17:25 2009 (r194701) @@ -0,0 +1,546 @@ +.\" Copyright (c) 2009 Michael Gmelin +.\" 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 June 21, 2009 +.Dt ACPI_HP 4 i386 +.Os +.Sh NAME +.Nm acpi_hp +.Nd "ACPI extras driver for HP laptops" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device acpi_hp" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +acpi_hp_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for ACPI-controlled features found on HP laptops +that use a WMI enabled BIOS (e.g. HP Compaq 8510p and 6510p). +.Pp +The main purpose of this driver is to provide an interface, +accessible via +.Xr sysctl 8 , +.Xr devd 8 and +.Xr devfs 8 , +through which applications can determine and change the status of +various laptop components and BIOS settings. +.Pp +.Ss Xr devd 8 Ss Events +Devd events received by +.Xr devd 8 +provide the following information: +.Pp +.Bl -tag -width "subsystem" -offset indent -compact +.It system +.Qq Li ACPI +.It subsystem +.Qq Li HP +.It type +The source of the event in the ACPI namespace. +The value depends on the model. +.It notify +Event code (see below). +.El +.Pp +Event codes: +.Pp +.Bl -tag -width "0xc0" -offset indent -compact +.It Li 0xc0 +WLAN on air status changed to 0 (not on air) +.It Li 0xc1 +WLAN on air status changed to 1 (on air) +.It Li 0xd0 +Bluetooth on air status changed to 0 (not on air) +.It Li 0xd1 +Bluetooth on air status changed to 1 (on air) +.It Li 0xe0 +WWAN on air status changed to 0 (not on air) +.It Li 0xe1 +WWAN on air status changed to 1 (on air) +.El +.Ss Xr devfs 8 Ss Device +You can read /dev/hpcmi to see your current BIOS settings. The detail level +can be adjusted by setting the sysctl +.Va cmi_detail +as described below. +.Sh SYSCTL VARIABLES +The following sysctls are currently implemented: +.Ss WLAN: +.Bl -tag -width indent +.It Va dev.acpi_hp.0.wlan_enabled +Toggle WLAN chip activity. +.It Va dev.acpi_hp.0.wlan_radio +(read-only) +WLAN radio status (controlled by hardware switch) +.It Va dev.acpi_hp.0.wlan_on_air +(read-only) +WLAN on air (chip enabled, hardware switch enabled + enabled in BIOS) +.It Va dev.acpi_hp.0.wlan_enabled_if_radio_on +If set to 1, the WLAN chip will be enabled if the radio is turned on +.It Va dev.acpi_hp.0.wlan_disable_if_radio_off +If set to 1, the WLAN chip will be disabled if the radio is turned off +.El +.Ss Bluetooth: +.Bl -tag -width indent +.It Va dev.acpi_hp.0.bt_enabled +Toggle Bluetooth chip activity. +.It Va dev.acpi_hp.0.bt_radio +(read-only) +Bluetooth radio status (controlled by hardware switch) +.It Va dev.acpi_hp.0.bt_on_air +(read-only) +Bluetooth on air (chip enabled, hardware switch enabled + enabled in BIOS) +.It Va dev.acpi_hp.0.bt_enabled_if_radio_on +If set to 1, the Bluetooth chip will be enabled if the radio is turned on +.It Va dev.acpi_hp.0.bt_disable_if_radio_off +If set to 1, the Bluetooth chip will be disabled if the radio is turned off +.El +.Ss WWAN: +.Bl -tag -width indent +.It Va dev.acpi_hp.0.wwan_enabled +Toggle WWAN chip activity. +.It Va dev.acpi_hp.0.wwan_radio +(read-only) +WWAN radio status (controlled by hardware switch) +.It Va dev.acpi_hp.0.wwan_on_air +(read-only) +WWAN on air (chip enabled, hardware switch enabled + enabled in BIOS) +.It Va dev.acpi_hp.0.wwan_enabled_if_radio_on +If set to 1, the WWAN chip will be enabled if the radio is turned on +.It Va dev.acpi_hp.0.wwan_disable_if_radio_off +If set to 1, the WWAN chip will be disabled if the radio is turned off +.El +.Ss Misc: +.Bl -tag -width indent +.It Va dev.acpi_hp.0.als_enabled +Toggle ambient light sensor (ALS) +.It Va dev.acpi_hp.0.display +(read-only) +Display status (bitmask) +.It Va dev.acpi_hp.0.hdd_temperature +(read-only) +HDD temperature +.It Va dev.acpi_hp.0.is_docked +(read-only) +Docking station status (1 if docked) +.It Va dev.acpi_hp.0.cmi_detail +Bitmask to control detail level in /dev/hpcmi output (values can be ORed). +.Bl -tag -width "0x01" -offset indent -compact +.It Li 0x01 +Show path component of BIOS setting +.It Li 0x02 +Show a list of valid options for the BIOS setting +.It Li 0x04 +Show additional flags of BIOS setting (ReadOnly etc.) +.El +.El +.Pp +Defaults for these sysctls can be set in +.Xr sysctl.conf 5 . +.Sh FILES +.Bl -tag -width ".Pa /dev/hpcmi" +.It Pa /dev/hpcmi +Interface to read BIOS settings +.El +.Sh EXAMPLES +The following can be added to +.Xr devd.conf 5 +in order disable the LAN interface when WLAN on air and reenable if it's +not: +.Bd -literal -offset indent +notify 0 { + match "system" "ACPI"; + match "subsystem" "HP"; + match "notify" "0xc0"; + action "ifconfig em0 up"; +}; + +notify 0 { + match "system" "ACPI"; + match "subsystem" "HP"; + match "notify" "0xc1"; + action "ifconfig em0 down"; +}; +.Ed +.Pp +Enable the ambient light sensor: +.Bd -literal -offset indent +sysctl dev.acpi_hp.0.als_enabled=1 +.Ed +.Pp +Enable Bluetooth: +.Bd -literal -offset indent +sysctl dev.acpi_hp.0.bt_enabled=1 +.Ed +.Pp +Get BIOS settings: +.Bd -literal -offset indent +cat /dev/hpcmi + +Serial Port Disable +Infrared Port Enable +Parallel Port Disable +Flash Media Reader Disable +USB Ports including Express Card slot Enable +1394 Port Enable +Cardbus Slot Disable +Express Card Slot Disable +(...) +.Ed +.Pp +Set maximum detail level for /dev/hpcmi output: +.Bd -literal -offset indent +sysctl dev.acpi_hp.0.cmi_detail=7 +.Ed +.Pp + + + +.Sh SEE ALSO +.Xr acpi 4 , +.Xr acpi_wmi 4 , +.Xr sysctl.conf 5 , +.Xr devd 8 , +.Xr devfs 8 , +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx CURRENT . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Michael Gmelin Aq freebsd@grem.de +.Pp +It has been inspired by hp-wmi driver, which implements a subset of these +features (hotkeys) on Linux. +.Pp +.Bl -tag -width indent +.It HP CMI whitepaper: +http://h20331.www2.hp.com/Hpsub/downloads/cmi_whitepaper.pdf +.It wmi-hp for Linux: +http://www.kernel.org +.It WMI and ACPI: +http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx +.El +.Pp +This manual page was written by +.An Michael Gmelin Aq freebsd@grem.de +.Sh BUGS +This driver is experimental and has only been tested on CURRENT i386 on an +HP Compaq 8510p which featured all supported wireless devices (WWAN/BT/WLAN). +Expect undefined results when operating on different hardware. +.Pp +Loading the driver is slow. Reading from /dev/hpcmi is even slower. +.Pp +Additional features like HP specific sensor readings or writing BIOS +settings are not supported. +.\" Copyright (c) 2009 Michael Gmelin +.\" 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 June 21, 2009 +.Dt ACPI_HP 4 i386 +.Os +.Sh NAME +.Nm acpi_hp +.Nd "ACPI extras driver for HP laptops" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device acpi_hp" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +acpi_hp_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for ACPI-controlled features found on HP laptops +that use a WMI enabled BIOS (e.g. HP Compaq 8510p and 6510p). +.Pp +The main purpose of this driver is to provide an interface, +accessible via +.Xr sysctl 8 , +.Xr devd 8 and +.Xr devfs 8 , +through which applications can determine and change the status of +various laptop components and BIOS settings. +.Pp +.Ss Xr devd 8 Ss Events +Devd events received by +.Xr devd 8 +provide the following information: +.Pp +.Bl -tag -width "subsystem" -offset indent -compact +.It system +.Qq Li ACPI +.It subsystem +.Qq Li HP +.It type +The source of the event in the ACPI namespace. +The value depends on the model. +.It notify +Event code (see below). +.El +.Pp +Event codes: +.Pp +.Bl -tag -width "0xc0" -offset indent -compact +.It Li 0xc0 +WLAN on air status changed to 0 (not on air) +.It Li 0xc1 +WLAN on air status changed to 1 (on air) +.It Li 0xd0 +Bluetooth on air status changed to 0 (not on air) +.It Li 0xd1 +Bluetooth on air status changed to 1 (on air) +.It Li 0xe0 +WWAN on air status changed to 0 (not on air) +.It Li 0xe1 +WWAN on air status changed to 1 (on air) +.El +.Ss Xr devfs 8 Ss Device +You can read /dev/hpcmi to see your current BIOS settings. The detail level +can be adjusted by setting the sysctl +.Va cmi_detail +as described below. +.Sh SYSCTL VARIABLES +The following sysctls are currently implemented: +.Ss WLAN: +.Bl -tag -width indent +.It Va dev.acpi_hp.0.wlan_enabled +Toggle WLAN chip activity. +.It Va dev.acpi_hp.0.wlan_radio +(read-only) +WLAN radio status (controlled by hardware switch) +.It Va dev.acpi_hp.0.wlan_on_air +(read-only) +WLAN on air (chip enabled, hardware switch enabled + enabled in BIOS) +.It Va dev.acpi_hp.0.wlan_enabled_if_radio_on +If set to 1, the WLAN chip will be enabled if the radio is turned on +.It Va dev.acpi_hp.0.wlan_disable_if_radio_off +If set to 1, the WLAN chip will be disabled if the radio is turned off +.El +.Ss Bluetooth: +.Bl -tag -width indent +.It Va dev.acpi_hp.0.bt_enabled +Toggle Bluetooth chip activity. +.It Va dev.acpi_hp.0.bt_radio +(read-only) +Bluetooth radio status (controlled by hardware switch) +.It Va dev.acpi_hp.0.bt_on_air +(read-only) +Bluetooth on air (chip enabled, hardware switch enabled + enabled in BIOS) +.It Va dev.acpi_hp.0.bt_enabled_if_radio_on +If set to 1, the Bluetooth chip will be enabled if the radio is turned on +.It Va dev.acpi_hp.0.bt_disable_if_radio_off +If set to 1, the Bluetooth chip will be disabled if the radio is turned off +.El +.Ss WWAN: +.Bl -tag -width indent +.It Va dev.acpi_hp.0.wwan_enabled +Toggle WWAN chip activity. +.It Va dev.acpi_hp.0.wwan_radio +(read-only) +WWAN radio status (controlled by hardware switch) +.It Va dev.acpi_hp.0.wwan_on_air +(read-only) +WWAN on air (chip enabled, hardware switch enabled + enabled in BIOS) +.It Va dev.acpi_hp.0.wwan_enabled_if_radio_on +If set to 1, the WWAN chip will be enabled if the radio is turned on +.It Va dev.acpi_hp.0.wwan_disable_if_radio_off +If set to 1, the WWAN chip will be disabled if the radio is turned off +.El +.Ss Misc: +.Bl -tag -width indent +.It Va dev.acpi_hp.0.als_enabled +Toggle ambient light sensor (ALS) +.It Va dev.acpi_hp.0.display +(read-only) +Display status (bitmask) +.It Va dev.acpi_hp.0.hdd_temperature +(read-only) +HDD temperature +.It Va dev.acpi_hp.0.is_docked +(read-only) +Docking station status (1 if docked) +.It Va dev.acpi_hp.0.cmi_detail +Bitmask to control detail level in /dev/hpcmi output (values can be ORed). +.Bl -tag -width "0x01" -offset indent -compact +.It Li 0x01 +Show path component of BIOS setting +.It Li 0x02 +Show a list of valid options for the BIOS setting +.It Li 0x04 +Show additional flags of BIOS setting (ReadOnly etc.) +.El +.El +.Pp +Defaults for these sysctls can be set in +.Xr sysctl.conf 5 . +.Sh FILES +.Bl -tag -width ".Pa /dev/hpcmi" +.It Pa /dev/hpcmi +Interface to read BIOS settings +.El +.Sh EXAMPLES +The following can be added to +.Xr devd.conf 5 +in order disable the LAN interface when WLAN on air and reenable if it's +not: +.Bd -literal -offset indent +notify 0 { + match "system" "ACPI"; + match "subsystem" "HP"; + match "notify" "0xc0"; + action "ifconfig em0 up"; +}; + +notify 0 { + match "system" "ACPI"; + match "subsystem" "HP"; + match "notify" "0xc1"; + action "ifconfig em0 down"; +}; +.Ed +.Pp +Enable the ambient light sensor: +.Bd -literal -offset indent +sysctl dev.acpi_hp.0.als_enabled=1 +.Ed +.Pp +Enable Bluetooth: +.Bd -literal -offset indent +sysctl dev.acpi_hp.0.bt_enabled=1 +.Ed +.Pp +Get BIOS settings: +.Bd -literal -offset indent +cat /dev/hpcmi + +Serial Port Disable +Infrared Port Enable +Parallel Port Disable +Flash Media Reader Disable +USB Ports including Express Card slot Enable +1394 Port Enable +Cardbus Slot Disable +Express Card Slot Disable +(...) +.Ed +.Pp +Set maximum detail level for /dev/hpcmi output: +.Bd -literal -offset indent +sysctl dev.acpi_hp.0.cmi_detail=7 +.Ed +.Pp + + + +.Sh SEE ALSO +.Xr acpi 4 , +.Xr acpi_wmi 4 , +.Xr sysctl.conf 5 , +.Xr devd 8 , +.Xr devfs 8 , +.Xr sysctl 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx CURRENT . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Michael Gmelin Aq freebsd@grem.de +.Pp +It has been inspired by hp-wmi driver, which implements a subset of these +features (hotkeys) on Linux. +.Pp +.Bl -tag -width indent +.It HP CMI whitepaper: +http://h20331.www2.hp.com/Hpsub/downloads/cmi_whitepaper.pdf +.It wmi-hp for Linux: +http://www.kernel.org +.It WMI and ACPI: +http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx +.El +.Pp +This manual page was written by +.An Michael Gmelin Aq freebsd@grem.de +.Sh BUGS +This driver is experimental and has only been tested on CURRENT i386 on an +HP Compaq 8510p which featured all supported wireless devices (WWAN/BT/WLAN). +Expect undefined results when operating on different hardware. +.Pp +Loading the driver is slow. Reading from /dev/hpcmi is even slower. +.Pp +Additional features like HP specific sensor readings or writing BIOS +settings are not supported. Added: head/share/man/man4/acpi_wmi.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/acpi_wmi.4 Tue Jun 23 13:17:25 2009 (r194701) @@ -0,0 +1,194 @@ +.\" Copyright (c) 2009 Michael Gmelin +.\" 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 June 21, 2009 +.Dt ACPI_WMI 4 i386 +.Os +.Sh NAME +.Nm acpi_wmi +.Nd "ACPI to WMI mapping driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device acpi_wmi" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +acpi_wmi_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides an interface for vendor specific WMI implementations +(e.g. HP and Acer laptops). It creates /dev/wmistat, which can be read to get +information about GUIDs found in the system. +.Sh FILES +.Bl -tag -width /dev/wmistat -compact +.It Pa /dev/wmistat +WMI status device. +.El +.Sh EXAMPLES +.Bd Literal +root# cat /dev/wmistat + +GUID INST EXPE METH STR EVENT OID +{5FB7F034-2C63-45E9-BE91-3D44E2C707E4} 1 NO WMAA NO NO AA +{95F24279-4D7B-4334-9387-ACCDC67EF61C} 1 NO NO NO 0x80+ - +{2B814318-4BE8-4707-9D84-A190A859B5D0} 1 NO NO NO 0xA0 - +{05901221-D566-11D1-B2F0-00A0C9062910} 1 NO NO NO NO AB +{1F4C91EB-DC5C-460B-951D-C7CB9B4B8D5E} 1 NO WMBA NO NO BA +{2D114B49-2DFB-4130-B8FE-4A3C09E75133} 57 NO NO NO NO BC +{988D08E3-68F4-4C35-AF3E-6A1B8106F83C} 20 NO NO NO NO BD +{14EA9746-CE1F-4098-A0E0-7045CB4DA745} 1 NO NO NO NO BE +{322F2028-0F84-4901-988E-015176049E2D} 2 NO NO NO NO BF +{8232DE3D-663D-4327-A8F4-E293ADB9BF05} 0 NO NO NO NO BG +{8F1F6436-9F42-42C8-BADC-0E9424F20C9A} 0 NO NO NO NO BH +{8F1F6435-9F42-42C8-BADC-0E9424F20C9A} 0 NO NO NO NO BI +.Ed + +.Sh SEE ALSO +.Xr acpi 4 , +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx CURRENT . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Michael Gmelin Aq freebsd@grem.de +.Pp +Work has been inspired by the Linux acpi-wmi driver written by Carlos Corbacho +.Pp +See http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx for +the specification of ACPI-WMI. +.Pp +This manual page was written by +.An Michael Gmelin Aq freebsd@grem.de +.\" Copyright (c) 2009 Michael Gmelin +.\" 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 June 21, 2009 +.Dt ACPI_WMI 4 i386 +.Os +.Sh NAME +.Nm acpi_wmi +.Nd "ACPI to WMI mapping driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device acpi_wmi" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +acpi_wmi_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides an interface for vendor specific WMI implementations +(e.g. HP and Acer laptops). It creates /dev/wmistat, which can be read to get +information about GUIDs found in the system. +.Sh FILES +.Bl -tag -width /dev/wmistat -compact +.It Pa /dev/wmistat +WMI status device. +.El +.Sh EXAMPLES +.Bd Literal +root# cat /dev/wmistat + +GUID INST EXPE METH STR EVENT OID +{5FB7F034-2C63-45E9-BE91-3D44E2C707E4} 1 NO WMAA NO NO AA +{95F24279-4D7B-4334-9387-ACCDC67EF61C} 1 NO NO NO 0x80+ - +{2B814318-4BE8-4707-9D84-A190A859B5D0} 1 NO NO NO 0xA0 - +{05901221-D566-11D1-B2F0-00A0C9062910} 1 NO NO NO NO AB +{1F4C91EB-DC5C-460B-951D-C7CB9B4B8D5E} 1 NO WMBA NO NO BA +{2D114B49-2DFB-4130-B8FE-4A3C09E75133} 57 NO NO NO NO BC +{988D08E3-68F4-4C35-AF3E-6A1B8106F83C} 20 NO NO NO NO BD +{14EA9746-CE1F-4098-A0E0-7045CB4DA745} 1 NO NO NO NO BE +{322F2028-0F84-4901-988E-015176049E2D} 2 NO NO NO NO BF +{8232DE3D-663D-4327-A8F4-E293ADB9BF05} 0 NO NO NO NO BG +{8F1F6436-9F42-42C8-BADC-0E9424F20C9A} 0 NO NO NO NO BH +{8F1F6435-9F42-42C8-BADC-0E9424F20C9A} 0 NO NO NO NO BI +.Ed + +.Sh SEE ALSO +.Xr acpi 4 , +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx CURRENT . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Michael Gmelin Aq freebsd@grem.de +.Pp +Work has been inspired by the Linux acpi-wmi driver written by Carlos Corbacho +.Pp +See http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx for +the specification of ACPI-WMI. +.Pp +This manual page was written by +.An Michael Gmelin Aq freebsd@grem.de Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Jun 23 13:16:16 2009 (r194700) +++ head/sys/conf/files Tue Jun 23 13:17:25 2009 (r194701) @@ -398,9 +398,11 @@ dev/aac/aac_debug.c optional aac dev/aac/aac_disk.c optional aac dev/aac/aac_linux.c optional aac compat_linux dev/aac/aac_pci.c optional aac pci +dev/acpi_support/acpi_wmi.c optional acpi_wmi acpi dev/acpi_support/acpi_aiboost.c optional acpi_aiboost acpi dev/acpi_support/acpi_asus.c optional acpi_asus acpi dev/acpi_support/acpi_fujitsu.c optional acpi_fujitsu acpi +dev/acpi_support/acpi_hp.c optional acpi_hp acpi dev/acpi_support/acpi_ibm.c optional acpi_ibm acpi dev/acpi_support/acpi_panasonic.c optional acpi_panasonic acpi dev/acpi_support/acpi_sony.c optional acpi_sony acpi Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Tue Jun 23 13:16:16 2009 (r194700) +++ head/sys/conf/files.amd64 Tue Jun 23 13:17:25 2009 (r194701) @@ -146,6 +146,7 @@ crypto/via/padlock.c optional padlock crypto/via/padlock_cipher.c optional padlock crypto/via/padlock_hash.c optional padlock dev/acpica/acpi_if.m standard +dev/acpi_support/acpi_wmi_if.m standard dev/agp/agp_amd64.c optional agp dev/agp/agp_i810.c optional agp dev/agp/agp_intel.c optional agp Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Tue Jun 23 13:16:16 2009 (r194700) +++ head/sys/conf/files.i386 Tue Jun 23 13:17:25 2009 (r194701) @@ -223,6 +223,7 @@ dev/syscons/scvtb.c optional sc dev/syscons/teken/teken.c optional sc dev/uart/uart_cpu_i386.c optional uart dev/acpica/acpi_if.m standard +dev/acpi_support/acpi_wmi_if.m standard dev/wpi/if_wpi.c optional wpi i386/acpica/OsdEnvironment.c optional acpi i386/acpica/acpi_machdep.c optional acpi Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Tue Jun 23 13:16:16 2009 (r194700) +++ head/sys/conf/kmod.mk Tue Jun 23 13:17:25 2009 (r194701) @@ -320,7 +320,8 @@ ${_src}: .endfor .endif -MFILES?= dev/acpica/acpi_if.m dev/agp/agp_if.m dev/ata/ata_if.m dev/eisa/eisa_if.m \ +MFILES?= dev/acpica/acpi_if.m dev/acpi_support/acpi_wmi_if.m \ + dev/agp/agp_if.m dev/ata/ata_if.m dev/eisa/eisa_if.m \ dev/iicbus/iicbb_if.m dev/iicbus/iicbus_if.m \ dev/mmc/mmcbr_if.m dev/mmc/mmcbus_if.m \ dev/mii/miibus_if.m dev/ofw/ofw_bus_if.m \ Added: head/sys/dev/acpi_support/acpi_hp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/acpi_support/acpi_hp.c Tue Jun 23 13:17:25 2009 (r194701) @@ -0,0 +1,1183 @@ +/*- + * Copyright (c) 2009 Michael Gmelin + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Driver for extra ACPI-controlled features found on HP laptops + * that use a WMI enabled BIOS (e.g. HP Compaq 8510p and 6510p). + * Allows to control and read status of integrated hardware and read + * BIOS settings through CMI. + * Inspired by the hp-wmi driver, which implements a subset of these + * features (hotkeys) on Linux. + * + * HP CMI whitepaper: + * http://h20331.www2.hp.com/Hpsub/downloads/cmi_whitepaper.pdf + * wmi-hp for Linux: + * http://www.kernel.org + * WMI and ACPI: + * http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx + */ + +#include "opt_acpi.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "acpi_wmi_if.h" + +#define _COMPONENT ACPI_OEM +ACPI_MODULE_NAME("HP") + +#define ACPI_HP_WMI_EVENT_GUID "95F24279-4D7B-4334-9387-ACCDC67EF61C" +#define ACPI_HP_WMI_BIOS_GUID "5FB7F034-2C63-45E9-BE91-3D44E2C707E4" +#define ACPI_HP_WMI_CMI_GUID "2D114B49-2DFB-4130-B8FE-4A3C09E75133" + +#define ACPI_HP_WMI_DISPLAY_COMMAND 0x1 +#define ACPI_HP_WMI_HDDTEMP_COMMAND 0x2 +#define ACPI_HP_WMI_ALS_COMMAND 0x3 +#define ACPI_HP_WMI_DOCK_COMMAND 0x4 +#define ACPI_HP_WMI_WIRELESS_COMMAND 0x5 + +#define ACPI_HP_METHOD_WLAN_ENABLED 1 +#define ACPI_HP_METHOD_WLAN_RADIO 2 +#define ACPI_HP_METHOD_WLAN_ON_AIR 3 +#define ACPI_HP_METHOD_WLAN_ENABLE_IF_RADIO_ON 4 +#define ACPI_HP_METHOD_WLAN_DISABLE_IF_RADIO_OFF 5 +#define ACPI_HP_METHOD_BLUETOOTH_ENABLED 6 +#define ACPI_HP_METHOD_BLUETOOTH_RADIO 7 +#define ACPI_HP_METHOD_BLUETOOTH_ON_AIR 8 +#define ACPI_HP_METHOD_BLUETOOTH_ENABLE_IF_RADIO_ON 9 +#define ACPI_HP_METHOD_BLUETOOTH_DISABLE_IF_RADIO_OFF 10 +#define ACPI_HP_METHOD_WWAN_ENABLED 11 +#define ACPI_HP_METHOD_WWAN_RADIO 12 +#define ACPI_HP_METHOD_WWAN_ON_AIR 13 +#define ACPI_HP_METHOD_WWAN_ENABLE_IF_RADIO_ON 14 +#define ACPI_HP_METHOD_WWAN_DISABLE_IF_RADIO_OFF 15 +#define ACPI_HP_METHOD_ALS 16 +#define ACPI_HP_METHOD_DISPLAY 17 +#define ACPI_HP_METHOD_HDDTEMP 18 +#define ACPI_HP_METHOD_DOCK 19 +#define ACPI_HP_METHOD_CMI_DETAIL 20 + +#define HP_MASK_WWAN_ON_AIR 0x1000000 +#define HP_MASK_BLUETOOTH_ON_AIR 0x10000 +#define HP_MASK_WLAN_ON_AIR 0x100 +#define HP_MASK_WWAN_RADIO 0x8000000 +#define HP_MASK_BLUETOOTH_RADIO 0x80000 +#define HP_MASK_WLAN_RADIO 0x800 +#define HP_MASK_WWAN_ENABLED 0x2000000 +#define HP_MASK_BLUETOOTH_ENABLED 0x20000 +#define HP_MASK_WLAN_ENABLED 0x200 + +#define ACPI_HP_CMI_DETAIL_PATHS 0x01 +#define ACPI_HP_CMI_DETAIL_ENUMS 0x02 +#define ACPI_HP_CMI_DETAIL_FLAGS 0x04 + +struct acpi_hp_inst_seq_pair { + UINT32 sequence; /* sequence number as suggested by cmi bios */ + UINT8 instance; /* object instance on guid */ +}; + +struct acpi_hp_softc { + device_t dev; + ACPI_HANDLE handle; + device_t wmi_dev; + int has_notify; /* notification GUID found */ + int has_cmi; /* CMI GUID found */ + int cmi_detail; /* CMI detail level + (set by sysctl) */ + int wlan_enable_if_radio_on; /* set by sysctl */ + int wlan_disable_if_radio_off; /* set by sysctl */ + int bluetooth_enable_if_radio_on; /* set by sysctl */ + int bluetooth_disable_if_radio_off; /* set by sysctl */ + int wwan_enable_if_radio_on; /* set by sysctl */ + int wwan_disable_if_radio_off; /* set by sysctl */ + int was_wlan_on_air; /* last known WLAN + on air status */ + int was_bluetooth_on_air; /* last known BT + on air status */ + int was_wwan_on_air; /* last known WWAN + on air status */ + struct sysctl_ctx_list *sysctl_ctx; + struct sysctl_oid *sysctl_tree; + struct cdev *hpcmi_dev_t; /* hpcmi device handle */ + struct sbuf hpcmi_sbuf; /* /dev/hpcmi output sbuf */ + pid_t hpcmi_open_pid; /* pid operating on + /dev/hpcmi */ + int hpcmi_bufptr; /* current pointer position + in /dev/hpcmi output buffer + */ + int cmi_order_size; /* size of cmi_order list */ + struct acpi_hp_inst_seq_pair cmi_order[128]; /* list of CMI + instances ordered by BIOS suggested sequence */ +}; + +static struct { + char *name; + int method; + char *description; + int access; +} acpi_hp_sysctls[] = { + { + .name = "wlan_enabled", + .method = ACPI_HP_METHOD_WLAN_ENABLED, + .description = "Enable/Disable WLAN (WiFi)", + .access = CTLTYPE_INT | CTLFLAG_RW + }, + { + .name = "wlan_radio", + .method = ACPI_HP_METHOD_WLAN_RADIO, + .description = "WLAN radio status", + .access = CTLTYPE_INT | CTLFLAG_RD + }, + { + .name = "wlan_on_air", + .method = ACPI_HP_METHOD_WLAN_ON_AIR, + .description = "WLAN radio ready to use (enabled and radio)", + .access = CTLTYPE_INT | CTLFLAG_RD + }, + { + .name = "wlan_enable_if_radio_on", + .method = ACPI_HP_METHOD_WLAN_ENABLE_IF_RADIO_ON, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 13:22:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B142106566C; Tue, 23 Jun 2009 13:22:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 396158FC16; Tue, 23 Jun 2009 13:22:20 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NDMKX5077025; Tue, 23 Jun 2009 13:22:20 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NDMKdS077023; Tue, 23 Jun 2009 13:22:20 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200906231322.n5NDMKdS077023@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 23 Jun 2009 13:22: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: r194702 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 13:22:21 -0000 Author: bz Date: Tue Jun 23 13:22:19 2009 New Revision: 194702 URL: http://svn.freebsd.org/changeset/base/194702 Log: in6_rtqdrain() has been unused. Cleanup. As this was the only consumer of net/route.h left remove that as well. Modified: head/sys/netinet6/in6_rmx.c Modified: head/sys/netinet6/in6_rmx.c ============================================================================== --- head/sys/netinet6/in6_rmx.c Tue Jun 23 13:17:25 2009 (r194701) +++ head/sys/netinet6/in6_rmx.c Tue Jun 23 13:22:19 2009 (r194702) @@ -90,7 +90,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -409,28 +408,6 @@ in6_mtutimo(void *rock) CURVNET_RESTORE(); } -#if 0 -void -in6_rtqdrain(void) -{ - INIT_VNET_NET(curvnet); - struct radix_node_head *rnh; - struct rtqk_arg arg; - - rnh = rt_tables_get_rnh(0, AF_INET6); - if (rnh == NULL) - panic("%s: rnh == NULL", __func__); - arg.found = arg.killed = 0; - arg.rnh = rnh; - arg.nextstop = 0; - arg.draining = 1; - arg.updating = 0; - RADIX_NODE_HEAD_LOCK(rnh); - rnh->rnh_walktree(rnh, in6_rtqkill, &arg); - RADIX_NODE_HEAD_UNLOCK(rnh); -} -#endif - /* * Initialize our routing tree. * XXX MRT When off == 0, we are being called from vfs_export.c From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 13:43:48 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAFFD1065670; Tue, 23 Jun 2009 13:43:48 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.freebsd.org (Postfix) with ESMTP id 918E68FC12; Tue, 23 Jun 2009 13:43:48 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from [172.31.193.10] (cpe-075-177-134-250.nc.res.rr.com [75.177.134.250]) (authenticated bits=0) by duke.cs.duke.edu (8.14.2/8.14.2) with ESMTP id n5NDgn3R020317 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 23 Jun 2009 09:43:18 -0400 (EDT) Message-ID: <4A40DBD4.3070904@cs.duke.edu> Date: Tue, 23 Jun 2009 09:42:44 -0400 From: Andrew Gallatin User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Andre Oppermann References: <200906222308.n5MN856I055711@svn.freebsd.org> In-Reply-To: <200906222308.n5MN856I055711@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r194672 - in head/sys: kern netinet sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 13:43:49 -0000 Andre Oppermann wrote: > Add soreceive_stream(), an optimized version of soreceive() for > stream (TCP) sockets. <....> > > Testers, especially with 10GigE gear, are welcome. Awesome! On my very weak, ancient consumer grade athlon64 test machine (AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ (2050.16-MHz K8-class CPU)) using mxge and LRO, I see a roughly 700Mb/s increase in bandwidth from 7.7Gb/s to 8.4Gb/s. For what its worth, this finally gives FreeBSD performance parity with Linux on this hardware for 10GbE single-stream receive. TCP SENDFILE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to venice-my (192.168.1.15) port 0 AF_INET Recv Send Send Utilization Service Demand Socket Socket Message Elapsed Send Recv Send Recv Size Size Size Time Throughput local remote local remote bytes bytes bytes secs. 10^6bits/s % S % C us/KB us/KB before: 65536 65536 65536 60.01 7709.14 13.30 79.60 0.283 1.692 after: 65536 65536 65536 60.01 8403.86 14.66 81.63 0.286 1.592 This is consistent across runs. Lockstat output for 10 seconds in the middle of a run is very interesting and shows a huge reduction in lock contention. Before: Adaptive mutex spin: 369333 events in 10.017 seconds (36869 events/sec) Count indv cuml rcnt nsec Lock Caller ------------------------------------------------------------------------------- 303685 82% 82% 0.00 1080 0xffffff000f2f98d0 recvit+0x21 63847 17% 100% 0.00 25 0xffffff000f2f98d0 ip_input+0xad 1788 0% 100% 0.00 172 0xffffff0001c57c08 intr_event_execute_handlers+0x100 8 0% 100% 0.00 389 vm_page_queue_mtx trap+0x4ce 1 0% 100% 0.00 30 0xffffff8000251598 ithread_loop+0x8e 1 0% 100% 0.00 720 0xffffff8000251598 uhub_read_port_status+0x2d 1 0% 100% 0.00 1639 0xffffff000f477190 vm_fault+0x112 1 0% 100% 0.00 1 0xffffff001fecce10 mxge_intr+0x425 1 0% 100% 0.00 1332 0xffffff0001845600 clnt_reconnect_call+0x105 ------------------------------------------------------------------------------- Adaptive mutex block: 89 events in 10.017 seconds (9 events/sec) Count indv cuml rcnt nsec Lock Caller ------------------------------------------------------------------------------- 83 93% 93% 0.00 20908 0xffffff000f2f98d0 tcp_input+0xd96 3 3% 97% 0.00 45234 0xffffff8000259f08 fork_exit+0x118 3 3% 100% 0.00 44862 0xffffff8000251598 fork_exit+0x118 ------------------------------------------------------------------------------- After: Adaptive mutex spin: 105102 events in 10.020 seconds (10490 events/sec) Count indv cuml rcnt nsec Lock Caller ------------------------------------------------------------------------------- 75886 72% 72% 0.00 2860 0xffffff0001fdde20 ip_input+0xad 28418 27% 99% 0.00 1355 0xffffff0001fdde20 recvit+0x21 779 1% 100% 0.00 171 0xffffff0001642808 intr_event_execute_handlers+0x100 7 0% 100% 0.00 670 vm_page_queue_mtx trap+0x4ce 5 0% 100% 0.00 46 0xffffff001fecce10 mxge_intr+0x425 1 0% 100% 0.00 105 vm_page_queue_mtx trap_pfault+0x142 1 0% 100% 0.00 568 0xffffff8000251598 usb_process+0xd8 1 0% 100% 0.00 880 0xffffff8000251598 ithread_loop+0x8e 1 0% 100% 0.00 233 0xffffff001a224578 vm_fault+0x112 1 0% 100% 0.00 60 0xffffff001a1759b8 syscall+0x28f 1 0% 100% 0.00 809 0xffffff0001846000 clnt_reconnect_call+0x105 1 0% 100% 0.00 1139 0xffffff0001fdde20 kern_recvit+0x1d4 ------------------------------------------------------------------------------- Adaptive mutex block: 88 events in 10.020 seconds (9 events/sec) Count indv cuml rcnt nsec Lock Caller ------------------------------------------------------------------------------- 80 91% 91% 0.00 25891 0xffffff0001fdde20 tcp_input+0xd96 3 3% 94% 0.00 45979 0xffffff8000259f08 fork_exit+0x118 3 3% 98% 0.00 45886 0xffffff8000251598 fork_exit+0x118 1 1% 99% 0.00 38254 0xffffff8000259f08 intr_event_execute_handlers+0x100 1 1% 100% 0.00 79858 0xffffff001a1760f8 kern_wait+0x7ee ------------------------------------------------------------------------------- Drew From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 14:10:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E79BF106568C; Tue, 23 Jun 2009 14:10:46 +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 D63D38FC22; Tue, 23 Jun 2009 14:10:46 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NEAkxL078287; Tue, 23 Jun 2009 14:10:46 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NEAk85078285; Tue, 23 Jun 2009 14:10:46 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200906231410.n5NEAk85078285@svn.freebsd.org> From: Ed Schouten Date: Tue, 23 Jun 2009 14:10: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: r194703 - head/lib/libc/stdlib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 14:10:47 -0000 Author: ed Date: Tue Jun 23 14:10:46 2009 New Revision: 194703 URL: http://svn.freebsd.org/changeset/base/194703 Log: Simplify. We can just use .sinclude here. Submitted by: Christoph Mallon Modified: head/lib/libc/stdlib/Makefile.inc Modified: head/lib/libc/stdlib/Makefile.inc ============================================================================== --- head/lib/libc/stdlib/Makefile.inc Tue Jun 23 13:22:19 2009 (r194702) +++ head/lib/libc/stdlib/Makefile.inc Tue Jun 23 14:10:46 2009 (r194703) @@ -16,9 +16,7 @@ MISRCS+=_Exit.c a64l.c abort.c abs.c ate SYM_MAPS+= ${.CURDIR}/stdlib/Symbol.map # machine-dependent stdlib sources -.if exists(${.CURDIR}/${MACHINE_ARCH}/stdlib/Makefile.inc) -.include "${.CURDIR}/${MACHINE_ARCH}/stdlib/Makefile.inc" -.endif +.sinclude "${.CURDIR}/${MACHINE_ARCH}/stdlib/Makefile.inc" MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 bsearch.3 \ div.3 exit.3 getenv.3 getopt.3 getopt_long.3 getsubopt.3 \ From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 14:11:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FB6210656EE; Tue, 23 Jun 2009 14:11:41 +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 62E168FC08; Tue, 23 Jun 2009 14:11:41 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NEBfkc078356; Tue, 23 Jun 2009 14:11:41 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NEBfnx078355; Tue, 23 Jun 2009 14:11:41 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200906231411.n5NEBfnx078355@svn.freebsd.org> From: Ed Schouten Date: Tue, 23 Jun 2009 14:11: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: r194704 - in head/lib/libc: arm/stdlib ia64/stdlib mips/stdlib sparc64/stdlib X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 14:11:42 -0000 Author: ed Date: Tue Jun 23 14:11:41 2009 New Revision: 194704 URL: http://svn.freebsd.org/changeset/base/194704 Log: Remove unneeded stdlib directories. It's not necessary to add stdlib directories for each architecture, even if the architecture doesn't implement any files of its own. Submitted by: Christoph Mallon Deleted: head/lib/libc/arm/stdlib/ head/lib/libc/ia64/stdlib/ head/lib/libc/mips/stdlib/ head/lib/libc/sparc64/stdlib/ From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 14:12:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2C691065676; Tue, 23 Jun 2009 14:12:49 +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 A15858FC0C; Tue, 23 Jun 2009 14:12:49 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NECnEv078412; Tue, 23 Jun 2009 14:12:49 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NECnkx078410; Tue, 23 Jun 2009 14:12:49 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200906231412.n5NECnkx078410@svn.freebsd.org> From: Ed Schouten Date: Tue, 23 Jun 2009 14:12: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: r194705 - head/libexec/rtld-elf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 14:12:50 -0000 Author: ed Date: Tue Jun 23 14:12:49 2009 New Revision: 194705 URL: http://svn.freebsd.org/changeset/base/194705 Log: Fix a typo in the same comment, one line below. Submitted by: bf1783 googlemail com Modified: head/libexec/rtld-elf/rtld.c Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Tue Jun 23 14:11:41 2009 (r194704) +++ head/libexec/rtld-elf/rtld.c Tue Jun 23 14:12:49 2009 (r194705) @@ -1309,7 +1309,7 @@ init_rtld(caddr_t mapbase) * Conjure up an Obj_Entry structure for the dynamic linker. * * The "path" member can't be initialized yet because string constants - * cannot yet be acessed. Below we will set it correctly. + * cannot yet be accessed. Below we will set it correctly. */ memset(&objtmp, 0, sizeof(objtmp)); objtmp.path = NULL; From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 14:37:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E783D1065672; Tue, 23 Jun 2009 14:37:07 +0000 (UTC) (envelope-from cokane@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D59698FC28; Tue, 23 Jun 2009 14:37:07 +0000 (UTC) (envelope-from cokane@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NEb7fT078874; Tue, 23 Jun 2009 14:37:07 GMT (envelope-from cokane@svn.freebsd.org) Received: (from cokane@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NEb7tO078872; Tue, 23 Jun 2009 14:37:07 GMT (envelope-from cokane@svn.freebsd.org) Message-Id: <200906231437.n5NEb7tO078872@svn.freebsd.org> From: Coleman Kane Date: Tue, 23 Jun 2009 14:37: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: r194706 - head/sys/dev/if_ndis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 14:37:08 -0000 Author: cokane Date: Tue Jun 23 14:37:07 2009 New Revision: 194706 URL: http://svn.freebsd.org/changeset/base/194706 Log: Code cleanup by moving some repetitive code into an ndis_get_bssid_list helper function. Also, add ieee80211_announce() call for bootverbose case. Submitted by: Paul B. Mahol Modified: head/sys/dev/if_ndis/if_ndis.c Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Tue Jun 23 14:12:49 2009 (r194705) +++ head/sys/dev/if_ndis/if_ndis.c Tue Jun 23 14:37:07 2009 (r194706) @@ -183,6 +183,8 @@ static void ndis_init (void *); static void ndis_stop (struct ndis_softc *); static int ndis_ifmedia_upd (struct ifnet *); static void ndis_ifmedia_sts (struct ifnet *, struct ifmediareq *); +static int ndis_get_bssid_list (struct ndis_softc *, + ndis_80211_bssid_list_ex **); static int ndis_get_assoc (struct ndis_softc *, ndis_wlan_bssid_ex **); static int ndis_probe_offload (struct ndis_softc *); static int ndis_set_offload (struct ndis_softc *); @@ -943,6 +945,9 @@ got_crypto: ic->ic_update_mcast = ndis_update_mcast; ic->ic_update_promisc = ndis_update_promisc; + if (bootverbose) + ieee80211_announce(ic); + } else { ifmedia_init(&sc->ifmedia, IFM_IMASK, ndis_ifmedia_upd, ndis_ifmedia_sts); @@ -2621,6 +2626,36 @@ ndis_auth_and_assoc(sc, vap) } static int +ndis_get_bssid_list(sc, bl) + struct ndis_softc *sc; + ndis_80211_bssid_list_ex **bl; +{ + int len, error; + + len = sizeof(uint32_t) + (sizeof(ndis_wlan_bssid_ex) * 16); + *bl = malloc(len, M_DEVBUF, M_NOWAIT | M_ZERO); + if (*bl == NULL) + return (ENOMEM); + + error = ndis_get_info(sc, OID_802_11_BSSID_LIST, *bl, &len); + if (error == ENOSPC) { + free(*bl, M_DEVBUF); + *bl = malloc(len, M_DEVBUF, M_NOWAIT | M_ZERO); + if (*bl == NULL) + return (ENOMEM); + + error = ndis_get_info(sc, OID_802_11_BSSID_LIST, *bl, &len); + } + if (error) { + DPRINTF(("%s: failed to read\n", __func__)); + free(*bl, M_DEVBUF); + return (error); + } + + return (0); +} + +static int ndis_get_assoc(sc, assoc) struct ndis_softc *sc; ndis_wlan_bssid_ex **assoc; @@ -2647,25 +2682,9 @@ ndis_get_assoc(sc, assoc) vap = TAILQ_FIRST(&ic->ic_vaps); ni = vap->iv_bss; - len = sizeof(uint32_t) + (sizeof(ndis_wlan_bssid_ex) * 16); - bl = malloc(len, M_TEMP, M_NOWAIT | M_ZERO); - if (bl == NULL) - return (ENOMEM); - - error = ndis_get_info(sc, OID_802_11_BSSID_LIST, bl, &len); - if (error == ENOSPC) { - free(bl, M_TEMP); - bl = malloc(len, M_TEMP, M_NOWAIT | M_ZERO); - if (bl == NULL) - return (ENOMEM); - - error = ndis_get_info(sc, OID_802_11_BSSID_LIST, bl, &len); - } - if (error) { - free(bl, M_TEMP); - device_printf(sc->ndis_dev, "bssid_list failed\n"); + error = ndis_get_bssid_list(sc, &bl); + if (error) return (error); - } bs = (ndis_wlan_bssid_ex *)&bl->nblx_bssid[0]; for (i = 0; i < bl->nblx_items; i++) { @@ -3281,7 +3300,7 @@ ndis_scan_results(struct ndis_softc *sc) struct ieee80211_frame wh; struct ieee80211_channel *saved_chan; int i, j; - int error, len, rssi, noise, freq, chanflag; + int rssi, noise, freq, chanflag; uint8_t ssid[2+IEEE80211_NWID_LEN]; uint8_t rates[2+IEEE80211_RATE_MAXSIZE]; uint8_t *frm, *efrm; @@ -3291,26 +3310,9 @@ ndis_scan_results(struct ndis_softc *sc) saved_chan = ic->ic_curchan; noise = -96; - len = sizeof(uint32_t) + (sizeof(ndis_wlan_bssid_ex) * 16); - bl = malloc(len, M_DEVBUF, M_NOWAIT | M_ZERO); - if (bl == NULL) + if (ndis_get_bssid_list(sc, &bl)) return; - error = ndis_get_info(sc, OID_802_11_BSSID_LIST, bl, &len); - if (error == ENOSPC) { - free(bl, M_DEVBUF); - bl = malloc(len, M_DEVBUF, M_NOWAIT | M_ZERO); - if (bl == NULL) - return; - - error = ndis_get_info(sc, OID_802_11_BSSID_LIST, bl, &len); - } - if (error) { - DPRINTF(("%s: failed to read\n", __func__)); - free(bl, M_DEVBUF); - return;; - } - DPRINTF(("%s: %d results\n", __func__, bl->nblx_items)); wb = &bl->nblx_bssid[0]; for (i = 0; i < bl->nblx_items; i++) { From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 14:39:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A258106567B; Tue, 23 Jun 2009 14:39:22 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 386B48FC16; Tue, 23 Jun 2009 14:39:22 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NEdMq1078956; Tue, 23 Jun 2009 14:39:22 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NEdMNa078953; Tue, 23 Jun 2009 14:39:22 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200906231439.n5NEdMNa078953@svn.freebsd.org> From: Jamie Gritton Date: Tue, 23 Jun 2009 14:39: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: r194707 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 14:39:23 -0000 Author: jamie Date: Tue Jun 23 14:39:21 2009 New Revision: 194707 URL: http://svn.freebsd.org/changeset/base/194707 Log: Remove unnecessary/redundant includes. Approved by: bz (mentor) Modified: head/sys/kern/kern_cpuset.c head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/kern_cpuset.c ============================================================================== --- head/sys/kern/kern_cpuset.c Tue Jun 23 14:37:07 2009 (r194706) +++ head/sys/kern/kern_cpuset.c Tue Jun 23 14:39:21 2009 (r194707) @@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Tue Jun 23 14:37:07 2009 (r194706) +++ head/sys/kern/uipc_usrreq.c Tue Jun 23 14:39:21 2009 (r194707) @@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 14:39:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF6871065673; Tue, 23 Jun 2009 14:39:51 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ADBB88FC12; Tue, 23 Jun 2009 14:39:51 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NEdpjk079000; Tue, 23 Jun 2009 14:39:51 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NEdpgj078998; Tue, 23 Jun 2009 14:39:51 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200906231439.n5NEdpgj078998@svn.freebsd.org> From: Jamie Gritton Date: Tue, 23 Jun 2009 14:39: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: r194708 - head/usr.sbin/jail X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 14:39:53 -0000 Author: jamie Date: Tue Jun 23 14:39:51 2009 New Revision: 194708 URL: http://svn.freebsd.org/changeset/base/194708 Log: Remove obsolete comment describing how the command line is no longer parsed. Approved by: bz (mentor) Modified: head/usr.sbin/jail/jail.c Modified: head/usr.sbin/jail/jail.c ============================================================================== --- head/usr.sbin/jail/jail.c Tue Jun 23 14:39:21 2009 (r194707) +++ head/usr.sbin/jail/jail.c Tue Jun 23 14:39:51 2009 (r194708) @@ -210,11 +210,6 @@ main(int argc, char **argv) if (uflag) GET_USER_INFO; - /* - * If the first argument (path) starts with a slash, and the third - * argument (IP address) starts with a digit, it is likely to be - * an old-style fixed-parameter command line. - */ if (jailname) set_param("name", jailname); if (securelevel) From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 14:40:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9568E106566C; Tue, 23 Jun 2009 14:40:08 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 83C578FC14; Tue, 23 Jun 2009 14:40:08 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NEe8HL079050; Tue, 23 Jun 2009 14:40:08 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NEe8Fa079048; Tue, 23 Jun 2009 14:40:08 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200906231440.n5NEe8Fa079048@svn.freebsd.org> From: Jamie Gritton Date: Tue, 23 Jun 2009 14:40: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: r194709 - head/usr.sbin/jexec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 14:40:09 -0000 Author: jamie Date: Tue Jun 23 14:40:08 2009 New Revision: 194709 URL: http://svn.freebsd.org/changeset/base/194709 Log: Whitespace fix. Approved by: bz (mentor) Modified: head/usr.sbin/jexec/jexec.c Modified: head/usr.sbin/jexec/jexec.c ============================================================================== --- head/usr.sbin/jexec/jexec.c Tue Jun 23 14:39:51 2009 (r194708) +++ head/usr.sbin/jexec/jexec.c Tue Jun 23 14:40:08 2009 (r194709) @@ -75,9 +75,9 @@ main(int argc, char *argv[]) int ch, ngroups, uflag, Uflag; long ngroups_max; char *ep, *username; + ch = uflag = Uflag = 0; username = NULL; - ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; if ((groups = malloc(sizeof(gid_t) * ngroups_max)) == NULL) err(1, "malloc"); From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 14:53:14 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8B0A0106567C; Tue, 23 Jun 2009 14:53:14 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.freebsd.org (Postfix) with ESMTP id 5ED5C8FC17; Tue, 23 Jun 2009 14:53:14 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from [172.31.193.10] (cpe-075-177-134-250.nc.res.rr.com [75.177.134.250]) (authenticated bits=0) by duke.cs.duke.edu (8.14.2/8.14.2) with ESMTP id n5NE3x4Q021774 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 23 Jun 2009 10:03:59 -0400 (EDT) Message-ID: <4A40E0C9.2030408@cs.duke.edu> Date: Tue, 23 Jun 2009 10:03:53 -0400 From: Andrew Gallatin User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: "Bjoern A. Zeeb" References: <200906231322.n5NDMKdS077023@svn.freebsd.org> In-Reply-To: <200906231322.n5NDMKdS077023@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r194702 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 14:53:15 -0000 Bjoern A. Zeeb wrote: > Author: bz > Date: Tue Jun 23 13:22:19 2009 > New Revision: 194702 > URL: http://svn.freebsd.org/changeset/base/194702 > > Log: > in6_rtqdrain() has been unused. Cleanup. > As this was the only consumer of net/route.h left remove that as well. > > Modified: > head/sys/netinet6/in6_rmx.c > > Modified: head/sys/netinet6/in6_rmx.c > ============================================================================== > --- head/sys/netinet6/in6_rmx.c Tue Jun 23 13:17:25 2009 (r194701) > +++ head/sys/netinet6/in6_rmx.c Tue Jun 23 13:22:19 2009 (r194702) > @@ -90,7 +90,6 @@ __FBSDID("$FreeBSD$"); > #include > > #include > -#include > #include My kernel build dies without net/route.h: cc -c -O2 -frename-registers -pipe -fno-strict-aliasing -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstric s -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -nostdinc ../.. -I../../../contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit am inline-unit-growth=100 --param large-function-growth=1000 -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone 7 -mno-sse -mno-sse2 -mno-sse3 -mno-mmx -mno-3dnow -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fsta r -Werror ../../../netinet6/in6_rmx.c cc1: warnings being treated as errors ../../../netinet6/in6_rmx.c:123: warning: 'struct radix_node_head' declared inside parameter list ../../../netinet6/in6_rmx.c:123: warning: its scope is only this definition or declaration, which is probably not wha ../../../netinet6/in6_rmx.c: In function 'in6_addroute': ../../../netinet6/in6_rmx.c:126: warning: implicit declaration of function 'rt_key' ../../../netinet6/in6_rmx.c:126: warning: nested extern declaration of 'rt_key' ../../../netinet6/in6_rmx.c:126: warning: cast to pointer from integer of different size ../../../netinet6/in6_rmx.c:129: warning: implicit declaration of function 'RADIX_NODE_HEAD_WLOCK_ASSERT' ../../../netinet6/in6_rmx.c:129: warning: nested extern declaration of 'RADIX_NODE_HEAD_WLOCK_ASSERT' ../../../netinet6/in6_rmx.c:131: error: dereferencing pointer to incomplete type ../../../netinet6/in6_rmx.c:131: error: 'RTF_MULTICAST' undeclared (first use in this function) ../../../netinet6/in6_rmx.c:131: error: (Each undeclared identifier is reported only once ../../../netinet6/in6_rmx.c:131: error: for each function it appears in.) ../../../netinet6/in6_rmx.c:147: error: dereferencing pointer to incomplete type ../../../netinet6/in6_rmx.c:147: error: 'RTF_HOST' undeclared (first use in this function) ../../../netinet6/in6_rmx.c:148: error: dereferencing pointer to incomplete type ../../../netinet6/in6_rmx.c:151: error: dereferencing pointer to incomplete type ../../../netinet6/in6_rmx.c:151: error: 'RTF_LOCAL' undeclared (first use in this function) ../../../netinet6/in6_rmx.c:155: error: dereferencing pointer to incomplete type ../../../netinet6/in6_rmx.c:155: error: dereferencing pointer to incomplete type ../../../netinet6/in6_rmx.c:156: error: dereferencing pointer to incomplete type ../../../netinet6/in6_rmx.c:156: error: dereferencing pointer to incomplete type ../../../netinet6/in6_rmx.c:156: error: dereferencing pointer to incomplete type ../../../netinet6/in6_rmx.c:156: error: dereferencing pointer to incomplete type ../../../netinet6/in6_rmx.c:156: error: dereferencing pointer to incomplete type ../../../netinet6/in6_rmx.c:156: error: dereferencing pointer to incomplete type ../../../netinet6/in6_rmx.c:156: error: dereferencing pointer to incomplete type ../../../netinet6/in6_rmx.c:156: error: dereferencing pointer to incomplete type ../../../netinet6/in6_rmx.c:156: error: dereferencing pointer to incomplete type ../../../netinet6/in6_rmx.c:156: error: dereferencing pointer to incomplete type ../../../netinet6/in6_rmx.c:158: warning: implicit declaration of function 'rn_addroute' ../../../netinet6/in6_rmx.c:158: warning: nested extern declaration of 'rn_addroute' ../../../netinet6/in6_rmx.c:158: warning: assignment makes pointer from integer without a cast ../../../netinet6/in6_rmx.c:173: warning: implicit declaration of function 'rtalloc1' ../../../netinet6/in6_rmx.c:173: warning: nested extern declaration of 'rtalloc1' ../../../netinet6/in6_rmx.c:173: error: 'RTF_RNH_LOCKED' undeclared (first use in this function) ../../../netinet6/in6_rmx.c:173: warning: assignment makes pointer from integer without a cast Re-instating the net/route.h include fixes the build for me. Drew From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 14:54:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5ECFB1065695; Tue, 23 Jun 2009 14:54:42 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D46C8FC24; Tue, 23 Jun 2009 14:54:42 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NEsgVW079651; Tue, 23 Jun 2009 14:54:42 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NEsgCY079649; Tue, 23 Jun 2009 14:54:42 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200906231454.n5NEsgCY079649@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 23 Jun 2009 14:54:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194714 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 14:54:43 -0000 Author: bz Date: Tue Jun 23 14:54:42 2009 New Revision: 194714 URL: http://svn.freebsd.org/changeset/base/194714 Log: In r194702 I meant to remove vnet.h which is no longer needed, not route.h. Modified: head/sys/netinet6/in6_rmx.c Modified: head/sys/netinet6/in6_rmx.c ============================================================================== --- head/sys/netinet6/in6_rmx.c Tue Jun 23 14:51:45 2009 (r194713) +++ head/sys/netinet6/in6_rmx.c Tue Jun 23 14:54:42 2009 (r194714) @@ -90,7 +90,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 14:57:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6ABB106567A; Tue, 23 Jun 2009 14:57:06 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 92D028FC15; Tue, 23 Jun 2009 14:57:06 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NEv6Yo079771; Tue, 23 Jun 2009 14:57:06 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NEv675079768; Tue, 23 Jun 2009 14:57:06 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200906231457.n5NEv675079768@svn.freebsd.org> From: Rui Paulo Date: Tue, 23 Jun 2009 14:57: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: r194715 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 14:57:07 -0000 Author: rpaulo Date: Tue Jun 23 14:57:06 2009 New Revision: 194715 URL: http://svn.freebsd.org/changeset/base/194715 Log: Fix double path issue and other nits. MFC after: 2 weeks Modified: head/share/man/man4/acpi_hp.4 head/share/man/man4/acpi_wmi.4 Modified: head/share/man/man4/acpi_hp.4 ============================================================================== --- head/share/man/man4/acpi_hp.4 Tue Jun 23 14:54:42 2009 (r194714) +++ head/share/man/man4/acpi_hp.4 Tue Jun 23 14:57:06 2009 (r194715) @@ -226,282 +226,6 @@ Set maximum detail level for /dev/hpcmi sysctl dev.acpi_hp.0.cmi_detail=7 .Ed .Pp - - - -.Sh SEE ALSO -.Xr acpi 4 , -.Xr acpi_wmi 4 , -.Xr sysctl.conf 5 , -.Xr devd 8 , -.Xr devfs 8 , -.Xr sysctl 8 -.Sh HISTORY -The -.Nm -device driver first appeared in -.Fx CURRENT . -.Sh AUTHORS -.An -nosplit -The -.Nm -driver was written by -.An Michael Gmelin Aq freebsd@grem.de -.Pp -It has been inspired by hp-wmi driver, which implements a subset of these -features (hotkeys) on Linux. -.Pp -.Bl -tag -width indent -.It HP CMI whitepaper: -http://h20331.www2.hp.com/Hpsub/downloads/cmi_whitepaper.pdf -.It wmi-hp for Linux: -http://www.kernel.org -.It WMI and ACPI: -http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx -.El -.Pp -This manual page was written by -.An Michael Gmelin Aq freebsd@grem.de -.Sh BUGS -This driver is experimental and has only been tested on CURRENT i386 on an -HP Compaq 8510p which featured all supported wireless devices (WWAN/BT/WLAN). -Expect undefined results when operating on different hardware. -.Pp -Loading the driver is slow. Reading from /dev/hpcmi is even slower. -.Pp -Additional features like HP specific sensor readings or writing BIOS -settings are not supported. -.\" Copyright (c) 2009 Michael Gmelin -.\" 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 June 21, 2009 -.Dt ACPI_HP 4 i386 -.Os -.Sh NAME -.Nm acpi_hp -.Nd "ACPI extras driver for HP laptops" -.Sh SYNOPSIS -To compile this driver into the kernel, -place the following line in your -kernel configuration file: -.Bd -ragged -offset indent -.Cd "device acpi_hp" -.Ed -.Pp -Alternatively, to load the driver as a -module at boot time, place the following line in -.Xr loader.conf 5 : -.Bd -literal -offset indent -acpi_hp_load="YES" -.Ed -.Sh DESCRIPTION -The -.Nm -driver provides support for ACPI-controlled features found on HP laptops -that use a WMI enabled BIOS (e.g. HP Compaq 8510p and 6510p). -.Pp -The main purpose of this driver is to provide an interface, -accessible via -.Xr sysctl 8 , -.Xr devd 8 and -.Xr devfs 8 , -through which applications can determine and change the status of -various laptop components and BIOS settings. -.Pp -.Ss Xr devd 8 Ss Events -Devd events received by -.Xr devd 8 -provide the following information: -.Pp -.Bl -tag -width "subsystem" -offset indent -compact -.It system -.Qq Li ACPI -.It subsystem -.Qq Li HP -.It type -The source of the event in the ACPI namespace. -The value depends on the model. -.It notify -Event code (see below). -.El -.Pp -Event codes: -.Pp -.Bl -tag -width "0xc0" -offset indent -compact -.It Li 0xc0 -WLAN on air status changed to 0 (not on air) -.It Li 0xc1 -WLAN on air status changed to 1 (on air) -.It Li 0xd0 -Bluetooth on air status changed to 0 (not on air) -.It Li 0xd1 -Bluetooth on air status changed to 1 (on air) -.It Li 0xe0 -WWAN on air status changed to 0 (not on air) -.It Li 0xe1 -WWAN on air status changed to 1 (on air) -.El -.Ss Xr devfs 8 Ss Device -You can read /dev/hpcmi to see your current BIOS settings. The detail level -can be adjusted by setting the sysctl -.Va cmi_detail -as described below. -.Sh SYSCTL VARIABLES -The following sysctls are currently implemented: -.Ss WLAN: -.Bl -tag -width indent -.It Va dev.acpi_hp.0.wlan_enabled -Toggle WLAN chip activity. -.It Va dev.acpi_hp.0.wlan_radio -(read-only) -WLAN radio status (controlled by hardware switch) -.It Va dev.acpi_hp.0.wlan_on_air -(read-only) -WLAN on air (chip enabled, hardware switch enabled + enabled in BIOS) -.It Va dev.acpi_hp.0.wlan_enabled_if_radio_on -If set to 1, the WLAN chip will be enabled if the radio is turned on -.It Va dev.acpi_hp.0.wlan_disable_if_radio_off -If set to 1, the WLAN chip will be disabled if the radio is turned off -.El -.Ss Bluetooth: -.Bl -tag -width indent -.It Va dev.acpi_hp.0.bt_enabled -Toggle Bluetooth chip activity. -.It Va dev.acpi_hp.0.bt_radio -(read-only) -Bluetooth radio status (controlled by hardware switch) -.It Va dev.acpi_hp.0.bt_on_air -(read-only) -Bluetooth on air (chip enabled, hardware switch enabled + enabled in BIOS) -.It Va dev.acpi_hp.0.bt_enabled_if_radio_on -If set to 1, the Bluetooth chip will be enabled if the radio is turned on -.It Va dev.acpi_hp.0.bt_disable_if_radio_off -If set to 1, the Bluetooth chip will be disabled if the radio is turned off -.El -.Ss WWAN: -.Bl -tag -width indent -.It Va dev.acpi_hp.0.wwan_enabled -Toggle WWAN chip activity. -.It Va dev.acpi_hp.0.wwan_radio -(read-only) -WWAN radio status (controlled by hardware switch) -.It Va dev.acpi_hp.0.wwan_on_air -(read-only) -WWAN on air (chip enabled, hardware switch enabled + enabled in BIOS) -.It Va dev.acpi_hp.0.wwan_enabled_if_radio_on -If set to 1, the WWAN chip will be enabled if the radio is turned on -.It Va dev.acpi_hp.0.wwan_disable_if_radio_off -If set to 1, the WWAN chip will be disabled if the radio is turned off -.El -.Ss Misc: -.Bl -tag -width indent -.It Va dev.acpi_hp.0.als_enabled -Toggle ambient light sensor (ALS) -.It Va dev.acpi_hp.0.display -(read-only) -Display status (bitmask) -.It Va dev.acpi_hp.0.hdd_temperature -(read-only) -HDD temperature -.It Va dev.acpi_hp.0.is_docked -(read-only) -Docking station status (1 if docked) -.It Va dev.acpi_hp.0.cmi_detail -Bitmask to control detail level in /dev/hpcmi output (values can be ORed). -.Bl -tag -width "0x01" -offset indent -compact -.It Li 0x01 -Show path component of BIOS setting -.It Li 0x02 -Show a list of valid options for the BIOS setting -.It Li 0x04 -Show additional flags of BIOS setting (ReadOnly etc.) -.El -.El -.Pp -Defaults for these sysctls can be set in -.Xr sysctl.conf 5 . -.Sh FILES -.Bl -tag -width ".Pa /dev/hpcmi" -.It Pa /dev/hpcmi -Interface to read BIOS settings -.El -.Sh EXAMPLES -The following can be added to -.Xr devd.conf 5 -in order disable the LAN interface when WLAN on air and reenable if it's -not: -.Bd -literal -offset indent -notify 0 { - match "system" "ACPI"; - match "subsystem" "HP"; - match "notify" "0xc0"; - action "ifconfig em0 up"; -}; - -notify 0 { - match "system" "ACPI"; - match "subsystem" "HP"; - match "notify" "0xc1"; - action "ifconfig em0 down"; -}; -.Ed -.Pp -Enable the ambient light sensor: -.Bd -literal -offset indent -sysctl dev.acpi_hp.0.als_enabled=1 -.Ed -.Pp -Enable Bluetooth: -.Bd -literal -offset indent -sysctl dev.acpi_hp.0.bt_enabled=1 -.Ed -.Pp -Get BIOS settings: -.Bd -literal -offset indent -cat /dev/hpcmi - -Serial Port Disable -Infrared Port Enable -Parallel Port Disable -Flash Media Reader Disable -USB Ports including Express Card slot Enable -1394 Port Enable -Cardbus Slot Disable -Express Card Slot Disable -(...) -.Ed -.Pp -Set maximum detail level for /dev/hpcmi output: -.Bd -literal -offset indent -sysctl dev.acpi_hp.0.cmi_detail=7 -.Ed -.Pp - - - .Sh SEE ALSO .Xr acpi 4 , .Xr acpi_wmi 4 , Modified: head/share/man/man4/acpi_wmi.4 ============================================================================== --- head/share/man/man4/acpi_wmi.4 Tue Jun 23 14:54:42 2009 (r194714) +++ head/share/man/man4/acpi_wmi.4 Tue Jun 23 14:57:06 2009 (r194715) @@ -57,8 +57,7 @@ WMI status device. .El .Sh EXAMPLES .Bd Literal -root# cat /dev/wmistat - +# cat /dev/wmistat GUID INST EXPE METH STR EVENT OID {5FB7F034-2C63-45E9-BE91-3D44E2C707E4} 1 NO WMAA NO NO AA {95F24279-4D7B-4334-9387-ACCDC67EF61C} 1 NO NO NO 0x80+ - @@ -73,104 +72,6 @@ GUID IN {8F1F6436-9F42-42C8-BADC-0E9424F20C9A} 0 NO NO NO NO BH {8F1F6435-9F42-42C8-BADC-0E9424F20C9A} 0 NO NO NO NO BI .Ed - -.Sh SEE ALSO -.Xr acpi 4 , -.Sh HISTORY -The -.Nm -device driver first appeared in -.Fx CURRENT . -.Sh AUTHORS -.An -nosplit -The -.Nm -driver was written by -.An Michael Gmelin Aq freebsd@grem.de -.Pp -Work has been inspired by the Linux acpi-wmi driver written by Carlos Corbacho -.Pp -See http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx for -the specification of ACPI-WMI. -.Pp -This manual page was written by -.An Michael Gmelin Aq freebsd@grem.de -.\" Copyright (c) 2009 Michael Gmelin -.\" 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 June 21, 2009 -.Dt ACPI_WMI 4 i386 -.Os -.Sh NAME -.Nm acpi_wmi -.Nd "ACPI to WMI mapping driver" -.Sh SYNOPSIS -To compile this driver into the kernel, -place the following line in your -kernel configuration file: -.Bd -ragged -offset indent -.Cd "device acpi_wmi" -.Ed -.Pp -Alternatively, to load the driver as a -module at boot time, place the following line in -.Xr loader.conf 5 : -.Bd -literal -offset indent -acpi_wmi_load="YES" -.Ed -.Sh DESCRIPTION -The -.Nm -driver provides an interface for vendor specific WMI implementations -(e.g. HP and Acer laptops). It creates /dev/wmistat, which can be read to get -information about GUIDs found in the system. -.Sh FILES -.Bl -tag -width /dev/wmistat -compact -.It Pa /dev/wmistat -WMI status device. -.El -.Sh EXAMPLES -.Bd Literal -root# cat /dev/wmistat - -GUID INST EXPE METH STR EVENT OID -{5FB7F034-2C63-45E9-BE91-3D44E2C707E4} 1 NO WMAA NO NO AA -{95F24279-4D7B-4334-9387-ACCDC67EF61C} 1 NO NO NO 0x80+ - -{2B814318-4BE8-4707-9D84-A190A859B5D0} 1 NO NO NO 0xA0 - -{05901221-D566-11D1-B2F0-00A0C9062910} 1 NO NO NO NO AB -{1F4C91EB-DC5C-460B-951D-C7CB9B4B8D5E} 1 NO WMBA NO NO BA -{2D114B49-2DFB-4130-B8FE-4A3C09E75133} 57 NO NO NO NO BC -{988D08E3-68F4-4C35-AF3E-6A1B8106F83C} 20 NO NO NO NO BD -{14EA9746-CE1F-4098-A0E0-7045CB4DA745} 1 NO NO NO NO BE -{322F2028-0F84-4901-988E-015176049E2D} 2 NO NO NO NO BF -{8232DE3D-663D-4327-A8F4-E293ADB9BF05} 0 NO NO NO NO BG -{8F1F6436-9F42-42C8-BADC-0E9424F20C9A} 0 NO NO NO NO BH -{8F1F6435-9F42-42C8-BADC-0E9424F20C9A} 0 NO NO NO NO BI -.Ed - .Sh SEE ALSO .Xr acpi 4 , .Sh HISTORY From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 14:58:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AEAAE1065672; Tue, 23 Jun 2009 14:58:32 +0000 (UTC) (envelope-from rpaulo@gmail.com) Received: from mail-ew0-f212.google.com (mail-ew0-f212.google.com [209.85.219.212]) by mx1.freebsd.org (Postfix) with ESMTP id DB2898FC16; Tue, 23 Jun 2009 14:58:31 +0000 (UTC) (envelope-from rpaulo@gmail.com) Received: by ewy8 with SMTP id 8so179347ewy.43 for ; Tue, 23 Jun 2009 07:58:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=1SUQ9UBficeOPCTFi+gR1u6jnnEyaWqAqP0wpeu90uk=; b=cWipAjfOW1q3IBufrDEi0QSvgZfJLwSLrKLFhmqQ9gK8ZsgdeUqp4LeTJkm0iM4sPH h4aJkdrY/sHAJJy+SSl/kxFhzDML/8LfAJ0mQhmelbbyVaLFdudj/H8mTXDBl8bZFHKC Q16+rGJ4dnkIfrxPOYvukMxgKNzTqYLOdVQdQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=K7OQfW0uiifuRLHIhJm1Y+yglR5X8LCZVU8AtXigzEEGW2h5r4CW0yg8AV42872U5o IDUvXhHqyTViOHzIniU/u4PpAAJW21woM32KtVS8GCz2GYH9+KKmNIj7f4HtTKPAgxdz qDgGTFbNEGytZHSTnxZSBFsUhzvohdImUPBrg= Received: by 10.210.29.9 with SMTP id c9mr6499650ebc.26.1245769110998; Tue, 23 Jun 2009 07:58:30 -0700 (PDT) Received: from omega.lan (bl9-155-202.dsl.telepac.pt [85.242.155.202]) by mx.google.com with ESMTPS id 24sm20318eyx.13.2009.06.23.07.58.30 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 23 Jun 2009 07:58:30 -0700 (PDT) Sender: Rui Paulo Message-Id: <7D052F2A-4A7E-47A2-A77C-8F8E4D037AFC@freebsd.org> From: Rui Paulo To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <200906231457.n5NEv675079768@svn.freebsd.org> Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Date: Tue, 23 Jun 2009 15:58:29 +0100 References: <200906231457.n5NEv675079768@svn.freebsd.org> X-Mailer: Apple Mail (2.935.3) Cc: Subject: Re: svn commit: r194715 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 14:58:33 -0000 On 23 Jun 2009, at 15:57, Rui Paulo wrote: > Author: rpaulo > Date: Tue Jun 23 14:57:06 2009 > New Revision: 194715 > URL: http://svn.freebsd.org/changeset/base/194715 > > Log: > Fix double path issue and other nits. > > MFC after: 2 weeks Noticed by: maxim and -- Rui Paulo From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 15:05:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FBBC10657CB; Tue, 23 Jun 2009 15:05:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3]) by mx1.freebsd.org (Postfix) with ESMTP id 46F5F8FC33; Tue, 23 Jun 2009 15:05:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 6575341C801; Tue, 23 Jun 2009 17:05:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([195.88.108.3]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id PBPGCTcq31l7; Tue, 23 Jun 2009 17:05:06 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id 10DCD41C7FD; Tue, 23 Jun 2009 17:05:06 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id B2D534448E6; Tue, 23 Jun 2009 15:01:18 +0000 (UTC) Date: Tue, 23 Jun 2009 15:01:18 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Andrew Gallatin In-Reply-To: <4A40E0C9.2030408@cs.duke.edu> Message-ID: <20090623145658.L22887@maildrop.int.zabbadoz.net> References: <200906231322.n5NDMKdS077023@svn.freebsd.org> <4A40E0C9.2030408@cs.duke.edu> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 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: r194702 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 15:05:08 -0000 On Tue, 23 Jun 2009, Andrew Gallatin wrote: Hi, > Bjoern A. Zeeb wrote: >> Author: bz >> Date: Tue Jun 23 13:22:19 2009 >> New Revision: 194702 >> URL: http://svn.freebsd.org/changeset/base/194702 >> >> Log: >> in6_rtqdrain() has been unused. Cleanup. >> As this was the only consumer of net/route.h left remove that as well. >> >> Modified: >> head/sys/netinet6/in6_rmx.c >> >> Modified: head/sys/netinet6/in6_rmx.c >> ============================================================================== >> --- head/sys/netinet6/in6_rmx.c Tue Jun 23 13:17:25 2009 >> (r194701) >> +++ head/sys/netinet6/in6_rmx.c Tue Jun 23 13:22:19 2009 >> (r194702) >> @@ -90,7 +90,6 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> -#include >> #include > > My kernel build dies without net/route.h: ... > Re-instating the net/route.h include fixes the build for me. yes, already fixed; That change was part of something larger that had passed universe a day or two ago and I got the wrong line cleaning up route.h in the other screen. Send more iscream! ;-) /bz -- Bjoern A. Zeeb The greatest risk is not taking one. From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 15:05:39 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C13E1065705; Tue, 23 Jun 2009 15:05:39 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 3A7278FC1A; Tue, 23 Jun 2009 15:05:39 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id D0E9246B35; Tue, 23 Jun 2009 11:05:38 -0400 (EDT) Date: Tue, 23 Jun 2009 16:05:38 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Andrew Gallatin In-Reply-To: <4A40DBD4.3070904@cs.duke.edu> Message-ID: References: <200906222308.n5MN856I055711@svn.freebsd.org> <4A40DBD4.3070904@cs.duke.edu> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) 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, Andre Oppermann Subject: Re: svn commit: r194672 - in head/sys: kern netinet sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 15:05:40 -0000 On Tue, 23 Jun 2009, Andrew Gallatin wrote: > This is consistent across runs. Lockstat output for 10 seconds in the > middle of a run is very interesting and shows a huge reduction in lock > contention. I continue to wonder if we should be deferring TCP reassembly to the user thread when there's an effective pipeline going on -- currently we still contend on the inpcb lock heavily, generally, and pipelining the work via a separate queue (which is what Linux does, I believe) would mean the ithread could spend more time doing other things instead of spinning. Robert N M Watson Computer Laboratory University of Cambridge > > Before: > > Adaptive mutex spin: 369333 events in 10.017 seconds (36869 events/sec) > > Count indv cuml rcnt nsec Lock Caller > ------------------------------------------------------------------------------- > 303685 82% 82% 0.00 1080 0xffffff000f2f98d0 recvit+0x21 > 63847 17% 100% 0.00 25 0xffffff000f2f98d0 ip_input+0xad > 1788 0% 100% 0.00 172 0xffffff0001c57c08 > intr_event_execute_handlers+0x100 > 8 0% 100% 0.00 389 vm_page_queue_mtx trap+0x4ce > 1 0% 100% 0.00 30 0xffffff8000251598 ithread_loop+0x8e > 1 0% 100% 0.00 720 0xffffff8000251598 uhub_read_port_status+0x2d > 1 0% 100% 0.00 1639 0xffffff000f477190 vm_fault+0x112 > 1 0% 100% 0.00 1 0xffffff001fecce10 mxge_intr+0x425 > 1 0% 100% 0.00 1332 0xffffff0001845600 clnt_reconnect_call+0x105 > ------------------------------------------------------------------------------- > > Adaptive mutex block: 89 events in 10.017 seconds (9 events/sec) > > Count indv cuml rcnt nsec Lock Caller > ------------------------------------------------------------------------------- > 83 93% 93% 0.00 20908 0xffffff000f2f98d0 tcp_input+0xd96 > 3 3% 97% 0.00 45234 0xffffff8000259f08 fork_exit+0x118 > 3 3% 100% 0.00 44862 0xffffff8000251598 fork_exit+0x118 > ------------------------------------------------------------------------------- > > > After: > > Adaptive mutex spin: 105102 events in 10.020 seconds (10490 events/sec) > > Count indv cuml rcnt nsec Lock Caller > ------------------------------------------------------------------------------- > 75886 72% 72% 0.00 2860 0xffffff0001fdde20 ip_input+0xad > 28418 27% 99% 0.00 1355 0xffffff0001fdde20 recvit+0x21 > 779 1% 100% 0.00 171 0xffffff0001642808 > intr_event_execute_handlers+0x100 > 7 0% 100% 0.00 670 vm_page_queue_mtx trap+0x4ce > 5 0% 100% 0.00 46 0xffffff001fecce10 mxge_intr+0x425 > 1 0% 100% 0.00 105 vm_page_queue_mtx trap_pfault+0x142 > 1 0% 100% 0.00 568 0xffffff8000251598 usb_process+0xd8 > 1 0% 100% 0.00 880 0xffffff8000251598 ithread_loop+0x8e > 1 0% 100% 0.00 233 0xffffff001a224578 vm_fault+0x112 > 1 0% 100% 0.00 60 0xffffff001a1759b8 syscall+0x28f > 1 0% 100% 0.00 809 0xffffff0001846000 clnt_reconnect_call+0x105 > 1 0% 100% 0.00 1139 0xffffff0001fdde20 kern_recvit+0x1d4 > ------------------------------------------------------------------------------- > > Adaptive mutex block: 88 events in 10.020 seconds (9 events/sec) > > Count indv cuml rcnt nsec Lock Caller > ------------------------------------------------------------------------------- > 80 91% 91% 0.00 25891 0xffffff0001fdde20 tcp_input+0xd96 > 3 3% 94% 0.00 45979 0xffffff8000259f08 fork_exit+0x118 > 3 3% 98% 0.00 45886 0xffffff8000251598 fork_exit+0x118 > 1 1% 99% 0.00 38254 0xffffff8000259f08 > intr_event_execute_handlers+0x100 > 1 1% 100% 0.00 79858 0xffffff001a1760f8 kern_wait+0x7ee > ------------------------------------------------------------------------------- > > > Drew > From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 15:08:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 254C7106568E; Tue, 23 Jun 2009 15:08:04 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 125308FC1E; Tue, 23 Jun 2009 15:08:04 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NF83tS080098; Tue, 23 Jun 2009 15:08:03 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NF83oJ080096; Tue, 23 Jun 2009 15:08:03 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200906231508.n5NF83oJ080096@svn.freebsd.org> From: Rui Paulo Date: Tue, 23 Jun 2009 15:08: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: r194716 - head/sys/dev/acpi_support X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 15:08:05 -0000 Author: rpaulo Date: Tue Jun 23 15:08:03 2009 New Revision: 194716 URL: http://svn.freebsd.org/changeset/base/194716 Log: Fix build with ACPI_DEBUG. MFC after: 2 weeks Modified: head/sys/dev/acpi_support/acpi_wmi.c Modified: head/sys/dev/acpi_support/acpi_wmi.c ============================================================================== --- head/sys/dev/acpi_support/acpi_wmi.c Tue Jun 23 14:57:06 2009 (r194715) +++ head/sys/dev/acpi_support/acpi_wmi.c Tue Jun 23 15:08:03 2009 (r194716) @@ -653,7 +653,7 @@ acpi_wmi_ec_handler(UINT32 function, ACP UINT8 ec_addr; ACPI_STATUS status; - ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, (UINT32)Address); + ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, (UINT32)address); sc = (struct acpi_wmi_softc *)context; if (width % 8 != 0 || value == NULL || context == NULL) From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 17:03:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE58E106566C; Tue, 23 Jun 2009 17:03:45 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C878C8FC1A; Tue, 23 Jun 2009 17:03:45 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NH3jHi083829; Tue, 23 Jun 2009 17:03:45 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NH3jxV083801; Tue, 23 Jun 2009 17:03:45 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200906231703.n5NH3jxV083801@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 23 Jun 2009 17:03: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: r194739 - in head/sys: compat/linprocfs compat/linux compat/svr4 contrib/altq/altq contrib/pf/net dev/cxgb/ulp/iw_cxgb kern net net80211 netgraph netgraph/atm netinet netinet6 nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 17:03:46 -0000 Author: bz Date: Tue Jun 23 17:03:45 2009 New Revision: 194739 URL: http://svn.freebsd.org/changeset/base/194739 Log: After cleaning up rt_tables from vnet.h and cleaning up opt_route.h a lot of files no longer need route.h either. Garbage collect them. While here remove now unneeded vnet.h #includes as well. Modified: head/sys/compat/linprocfs/linprocfs.c head/sys/compat/linux/linux_ioctl.c head/sys/compat/svr4/svr4_sockio.c head/sys/contrib/altq/altq/altq_subr.c head/sys/contrib/pf/net/pf_if.c head/sys/contrib/pf/net/pf_ioctl.c head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c head/sys/kern/kern_poll.c head/sys/kern/kern_uuid.c head/sys/net/bridgestp.c head/sys/net/if_ef.c head/sys/net/if_mib.c head/sys/net/if_vlan.c head/sys/net/raw_cb.c head/sys/net/raw_usrreq.c head/sys/net80211/ieee80211_ddb.c head/sys/netgraph/atm/ng_atm.c head/sys/netgraph/ng_ether.c head/sys/netinet/if_ether.c head/sys/netinet/igmp.c head/sys/netinet/in_pcb.h head/sys/netinet/in_rmx.c head/sys/netinet/tcp_hostcache.c head/sys/netinet/tcp_offload.c head/sys/netinet6/ip6_mroute.c head/sys/netinet6/scope6.c head/sys/nfsclient/nfs_diskless.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/compat/linprocfs/linprocfs.c Tue Jun 23 17:03:45 2009 (r194739) @@ -77,7 +77,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/compat/linux/linux_ioctl.c Tue Jun 23 17:03:45 2009 (r194739) @@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #ifdef COMPAT_LINUX32 Modified: head/sys/compat/svr4/svr4_sockio.c ============================================================================== --- head/sys/compat/svr4/svr4_sockio.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/compat/svr4/svr4_sockio.c Tue Jun 23 17:03:45 2009 (r194739) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/contrib/altq/altq/altq_subr.c ============================================================================== --- head/sys/contrib/altq/altq/altq_subr.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/contrib/altq/altq/altq_subr.c Tue Jun 23 17:03:45 2009 (r194739) @@ -55,7 +55,6 @@ #include #include #ifdef __FreeBSD__ -#include #include #endif Modified: head/sys/contrib/pf/net/pf_if.c ============================================================================== --- head/sys/contrib/pf/net/pf_if.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/contrib/pf/net/pf_if.c Tue Jun 23 17:03:45 2009 (r194739) @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include #include #ifdef __FreeBSD__ -#include #include #endif Modified: head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- head/sys/contrib/pf/net/pf_ioctl.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/contrib/pf/net/pf_ioctl.c Tue Jun 23 17:03:45 2009 (r194739) @@ -98,7 +98,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #ifdef __FreeBSD__ #include #endif Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c ============================================================================== --- head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c Tue Jun 23 17:03:45 2009 (r194739) @@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$"); #include #include #if __FreeBSD_version >= 800056 -#include #include #endif Modified: head/sys/kern/kern_poll.c ============================================================================== --- head/sys/kern/kern_poll.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/kern/kern_poll.c Tue Jun 23 17:03:45 2009 (r194739) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include /* for IFF_* flags */ #include /* for NETISR_POLL */ -#include #include static int poll_switch(SYSCTL_HANDLER_ARGS); Modified: head/sys/kern/kern_uuid.c ============================================================================== --- head/sys/kern/kern_uuid.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/kern/kern_uuid.c Tue Jun 23 17:03:45 2009 (r194739) @@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include /* Modified: head/sys/net/bridgestp.c ============================================================================== --- head/sys/net/bridgestp.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/net/bridgestp.c Tue Jun 23 17:03:45 2009 (r194739) @@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/net/if_ef.c ============================================================================== --- head/sys/net/if_ef.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/net/if_ef.c Tue Jun 23 17:03:45 2009 (r194739) @@ -48,7 +48,6 @@ #include #include #include -#include #include #include Modified: head/sys/net/if_mib.c ============================================================================== --- head/sys/net/if_mib.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/net/if_mib.c Tue Jun 23 17:03:45 2009 (r194739) @@ -38,7 +38,6 @@ #include #include -#include #include /* Modified: head/sys/net/if_vlan.c ============================================================================== --- head/sys/net/if_vlan.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/net/if_vlan.c Tue Jun 23 17:03:45 2009 (r194739) @@ -64,7 +64,6 @@ #include #include #include -#include #include #define VLANNAME "vlan" Modified: head/sys/net/raw_cb.c ============================================================================== --- head/sys/net/raw_cb.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/net/raw_cb.c Tue Jun 23 17:03:45 2009 (r194739) @@ -46,7 +46,6 @@ #include #include -#include #include /* Modified: head/sys/net/raw_usrreq.c ============================================================================== --- head/sys/net/raw_usrreq.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/net/raw_usrreq.c Tue Jun 23 17:03:45 2009 (r194739) @@ -48,7 +48,6 @@ #include #include -#include #include MTX_SYSINIT(rawcb_mtx, &rawcb_mtx, "rawcb", MTX_DEF); Modified: head/sys/net80211/ieee80211_ddb.c ============================================================================== --- head/sys/net80211/ieee80211_ddb.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/net80211/ieee80211_ddb.c Tue Jun 23 17:03:45 2009 (r194739) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/netgraph/atm/ng_atm.c ============================================================================== --- head/sys/netgraph/atm/ng_atm.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/netgraph/atm/ng_atm.c Tue Jun 23 17:03:45 2009 (r194739) @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/netgraph/ng_ether.c ============================================================================== --- head/sys/netgraph/ng_ether.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/netgraph/ng_ether.c Tue Jun 23 17:03:45 2009 (r194739) @@ -63,7 +63,6 @@ #include #include #include -#include #include #include Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/netinet/if_ether.c Tue Jun 23 17:03:45 2009 (r194739) @@ -56,11 +56,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include -#include +#include #include #include Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/netinet/igmp.c Tue Jun 23 17:03:45 2009 (r194739) @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/netinet/in_pcb.h ============================================================================== --- head/sys/netinet/in_pcb.h Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/netinet/in_pcb.h Tue Jun 23 17:03:45 2009 (r194739) @@ -39,8 +39,6 @@ #include #include -#include - #ifdef _KERNEL #include #endif Modified: head/sys/netinet/in_rmx.c ============================================================================== --- head/sys/netinet/in_rmx.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/netinet/in_rmx.c Tue Jun 23 17:03:45 2009 (r194739) @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/netinet/tcp_hostcache.c ============================================================================== --- head/sys/netinet/tcp_hostcache.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/netinet/tcp_hostcache.c Tue Jun 23 17:03:45 2009 (r194739) @@ -79,6 +79,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include Modified: head/sys/netinet/tcp_offload.c ============================================================================== --- head/sys/netinet/tcp_offload.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/netinet/tcp_offload.c Tue Jun 23 17:03:45 2009 (r194739) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: head/sys/netinet6/ip6_mroute.c ============================================================================== --- head/sys/netinet6/ip6_mroute.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/netinet6/ip6_mroute.c Tue Jun 23 17:03:45 2009 (r194739) @@ -108,7 +108,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/netinet6/scope6.c ============================================================================== --- head/sys/netinet6/scope6.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/netinet6/scope6.c Tue Jun 23 17:03:45 2009 (r194739) @@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/nfsclient/nfs_diskless.c ============================================================================== --- head/sys/nfsclient/nfs_diskless.c Tue Jun 23 16:50:23 2009 (r194738) +++ head/sys/nfsclient/nfs_diskless.c Tue Jun 23 17:03:45 2009 (r194739) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 17:38:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 00E56106566C; Tue, 23 Jun 2009 17:38:29 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E2EA38FC08; Tue, 23 Jun 2009 17:38:28 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NHcS7l084588; Tue, 23 Jun 2009 17:38:28 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NHcSA1084586; Tue, 23 Jun 2009 17:38:28 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200906231738.n5NHcSA1084586@svn.freebsd.org> From: Robert Noland Date: Tue, 23 Jun 2009 17:38: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: r194741 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 17:38:29 -0000 Author: rnoland Date: Tue Jun 23 17:38:28 2009 New Revision: 194741 URL: http://svn.freebsd.org/changeset/base/194741 Log: Hold the lock while we save/restore register for suspend/resume. MFC after: 3 days Modified: head/sys/dev/drm/i915_drv.c Modified: head/sys/dev/drm/i915_drv.c ============================================================================== --- head/sys/dev/drm/i915_drv.c Tue Jun 23 17:19:50 2009 (r194740) +++ head/sys/dev/drm/i915_drv.c Tue Jun 23 17:38:28 2009 (r194741) @@ -52,7 +52,10 @@ static int i915_suspend(device_t kdev) return -ENODEV; } + DRM_LOCK(); + DRM_DEBUG("starting suspend\n"); i915_save_state(dev); + DRM_UNLOCK(); return (bus_generic_suspend(kdev)); } @@ -61,7 +64,10 @@ static int i915_resume(device_t kdev) { struct drm_device *dev = device_get_softc(kdev); + DRM_LOCK(); i915_restore_state(dev); + DRM_DEBUG("finished resume\n"); + DRM_UNLOCK(); return (bus_generic_resume(kdev)); } From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 17:42:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DCD51065678; Tue, 23 Jun 2009 17:42:07 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B6138FC16; Tue, 23 Jun 2009 17:42:07 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NHg7KB084743; Tue, 23 Jun 2009 17:42:07 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NHg766084738; Tue, 23 Jun 2009 17:42:07 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <200906231742.n5NHg766084738@svn.freebsd.org> From: Andrew Gallatin Date: Tue, 23 Jun 2009 17:42: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: r194743 - in head/sys: conf dev/mxge modules/mxge/mxge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 17:42:08 -0000 Author: gallatin Date: Tue Jun 23 17:42:06 2009 New Revision: 194743 URL: http://svn.freebsd.org/changeset/base/194743 Log: Implement minimal set of changes suggested by bz to make mxge no longer depend on INET. Modified: head/sys/conf/files head/sys/dev/mxge/if_mxge.c head/sys/dev/mxge/mxge_lro.c head/sys/modules/mxge/mxge/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Jun 23 17:41:51 2009 (r194742) +++ head/sys/conf/files Tue Jun 23 17:42:06 2009 (r194743) @@ -1207,12 +1207,12 @@ mwlboot.fw optional mwlfw \ compile-with "uudecode -o ${.TARGET} $S/contrib/dev/mwl/mwlboot.fw.uu" \ no-obj no-implicit-rule \ clean "mwlboot.fw" -dev/mxge/if_mxge.c optional mxge pci inet -dev/mxge/mxge_lro.c optional mxge pci inet -dev/mxge/mxge_eth_z8e.c optional mxge pci inet -dev/mxge/mxge_ethp_z8e.c optional mxge pci inet -dev/mxge/mxge_rss_eth_z8e.c optional mxge pci inet -dev/mxge/mxge_rss_ethp_z8e.c optional mxge pci inet +dev/mxge/if_mxge.c optional mxge pci +dev/mxge/mxge_lro.c optional mxge pci +dev/mxge/mxge_eth_z8e.c optional mxge pci +dev/mxge/mxge_ethp_z8e.c optional mxge pci +dev/mxge/mxge_rss_eth_z8e.c optional mxge pci +dev/mxge/mxge_rss_ethp_z8e.c optional mxge pci dev/my/if_my.c optional my dev/ncv/ncr53c500.c optional ncv dev/ncv/ncr53c500_pccard.c optional ncv pccard Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Tue Jun 23 17:41:51 2009 (r194742) +++ head/sys/dev/mxge/if_mxge.c Tue Jun 23 17:42:06 2009 (r194743) @@ -89,6 +89,8 @@ __FBSDID("$FreeBSD$"); #include #endif +#include "opt_inet.h" + /* tunable params */ static int mxge_nvidia_ecrc_enable = 1; static int mxge_force_firmware = 0; @@ -2408,10 +2410,13 @@ mxge_rx_csum(struct mbuf *m, int csum) if (__predict_false(ip->ip_p != IPPROTO_TCP && ip->ip_p != IPPROTO_UDP)) return 1; - +#ifdef INET c = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htonl(ntohs(csum) + ntohs(ip->ip_len) + - (ip->ip_hl << 2) + ip->ip_p)); +#else + c = 1; +#endif c ^= 0xffff; return (c); } @@ -2607,7 +2612,6 @@ static inline void mxge_clean_rx_done(struct mxge_slice_state *ss) { mxge_rx_done_t *rx_done = &ss->rx_done; - struct lro_entry *lro; int limit = 0; uint16_t length; uint16_t checksum; @@ -2628,11 +2632,13 @@ mxge_clean_rx_done(struct mxge_slice_sta if (__predict_false(++limit > rx_done->mask / 2)) break; } +#ifdef INET while (!SLIST_EMPTY(&ss->lro_active)) { - lro = SLIST_FIRST(&ss->lro_active); + struct lro_entry *lro = SLIST_FIRST(&ss->lro_active); SLIST_REMOVE_HEAD(&ss->lro_active, next); mxge_lro_flush(ss, lro); } +#endif } @@ -4529,7 +4535,10 @@ mxge_attach(device_t dev) ifp->if_baudrate = IF_Gbps(10UL); ifp->if_capabilities = IFCAP_RXCSUM | IFCAP_TXCSUM | IFCAP_TSO4 | - IFCAP_VLAN_MTU | IFCAP_LRO; + IFCAP_VLAN_MTU; +#ifdef INET + ifp->if_capabilities |= IFCAP_LRO; +#endif #ifdef MXGE_NEW_VLAN_API ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWCSUM; Modified: head/sys/dev/mxge/mxge_lro.c ============================================================================== --- head/sys/dev/mxge/mxge_lro.c Tue Jun 23 17:41:51 2009 (r194742) +++ head/sys/dev/mxge/mxge_lro.c Tue Jun 23 17:42:06 2009 (r194743) @@ -54,6 +54,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include "opt_inet.h" + +#ifdef INET /* Assume len is a multiple of 4 */ static uint16_t @@ -340,6 +343,8 @@ mxge_lro_rx(struct mxge_slice_state *ss, lro->m_tail = m_tail; return 0; } + +#endif /* INET */ /* This file uses Myri10GE driver indentation. Modified: head/sys/modules/mxge/mxge/Makefile ============================================================================== --- head/sys/modules/mxge/mxge/Makefile Tue Jun 23 17:41:51 2009 (r194742) +++ head/sys/modules/mxge/mxge/Makefile Tue Jun 23 17:42:06 2009 (r194743) @@ -3,6 +3,6 @@ .PATH: ${.CURDIR}/../../../dev/mxge KMOD= if_mxge -SRCS= if_mxge.c mxge_lro.c device_if.h bus_if.h pci_if.h +SRCS= if_mxge.c mxge_lro.c device_if.h bus_if.h pci_if.h opt_inet.h .include From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 17:50:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B2361065670; Tue, 23 Jun 2009 17:50:36 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 093EC8FC0A; Tue, 23 Jun 2009 17:50:36 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NHoZcP084988; Tue, 23 Jun 2009 17:50:35 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NHoZSX084986; Tue, 23 Jun 2009 17:50:35 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200906231750.n5NHoZSX084986@svn.freebsd.org> From: Robert Noland Date: Tue, 23 Jun 2009 17:50: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: r194745 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 17:50:36 -0000 Author: rnoland Date: Tue Jun 23 17:50:35 2009 New Revision: 194745 URL: http://svn.freebsd.org/changeset/base/194745 Log: vblank[crtc].last represents the hardware counter while request.sequence represents the software counter. Don't currupt things here. MFC after: 3 days Modified: head/sys/dev/drm/drm_irq.c Modified: head/sys/dev/drm/drm_irq.c ============================================================================== --- head/sys/dev/drm/drm_irq.c Tue Jun 23 17:44:55 2009 (r194744) +++ head/sys/dev/drm/drm_irq.c Tue Jun 23 17:50:35 2009 (r194745) @@ -463,7 +463,6 @@ int drm_wait_vblank(struct drm_device *d } else { DRM_DEBUG("waiting on vblank count %d, crtc %d\n", vblwait->request.sequence, crtc); - dev->vblank[crtc].last = vblwait->request.sequence; for ( ret = 0 ; !ret && !(((drm_vblank_count(dev, crtc) - vblwait->request.sequence) <= (1 << 23)) || !dev->irq_enabled) ; ) { From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 17:52:41 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5780A1065670; Tue, 23 Jun 2009 17:52:41 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 45B298FC14; Tue, 23 Jun 2009 17:52:41 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NHqft1085068; Tue, 23 Jun 2009 17:52:41 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NHqfKu085066; Tue, 23 Jun 2009 17:52:41 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200906231752.n5NHqfKu085066@svn.freebsd.org> From: Robert Noland Date: Tue, 23 Jun 2009 17:52: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: r194746 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 17:52:41 -0000 Author: rnoland Date: Tue Jun 23 17:52:41 2009 New Revision: 194746 URL: http://svn.freebsd.org/changeset/base/194746 Log: Given that vblanks generally occur 60 times a second, waiting 3 seconds seems rather excessive. MFC after: 3 days Modified: head/sys/dev/drm/drm_irq.c Modified: head/sys/dev/drm/drm_irq.c ============================================================================== --- head/sys/dev/drm/drm_irq.c Tue Jun 23 17:50:35 2009 (r194745) +++ head/sys/dev/drm/drm_irq.c Tue Jun 23 17:52:41 2009 (r194746) @@ -472,7 +472,7 @@ int drm_wait_vblank(struct drm_device *d !dev->irq_enabled)) ret = mtx_sleep(&dev->vblank[crtc].queue, &dev->irq_lock, PCATCH, "vblwtq", - 3 * DRM_HZ); + DRM_HZ); mtx_unlock(&dev->irq_lock); } From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 18:00:43 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76AED1065676; Tue, 23 Jun 2009 18:00:43 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 640B08FC15; Tue, 23 Jun 2009 18:00:43 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NI0hED085291; Tue, 23 Jun 2009 18:00:43 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NI0hjW085288; Tue, 23 Jun 2009 18:00:43 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <200906231800.n5NI0hjW085288@svn.freebsd.org> From: Andrew Gallatin Date: Tue, 23 Jun 2009 18:00: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: r194747 - head/sys/dev/mxge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 18:00:44 -0000 Author: gallatin Date: Tue Jun 23 18:00:43 2009 New Revision: 194747 URL: http://svn.freebsd.org/changeset/base/194747 Log: Update mxge firmware from 1.4.39 to 1.4.43. Changes include: - Support for 10G-PCIE*-8B*-C (dual-port CX4) NICs - For dual-port NICs, f/w failover is now a few microsecs instead of a few millisecs. - On failover, f/w sends RARP broadcast to make the change immediately known to the network - Fixed a bug observed on IBM X3 architecture where some spurious ecrc errors would be reported when OS enabled ecrc support. Sponsored by: Myricom Inc. Modified: head/sys/dev/mxge/eth_z8e.h head/sys/dev/mxge/ethp_z8e.h head/sys/dev/mxge/rss_eth_z8e.h head/sys/dev/mxge/rss_ethp_z8e.h Modified: head/sys/dev/mxge/eth_z8e.h ============================================================================== --- head/sys/dev/mxge/eth_z8e.h Tue Jun 23 17:52:41 2009 (r194746) +++ head/sys/dev/mxge/eth_z8e.h Tue Jun 23 18:00:43 2009 (r194747) @@ -28,6951 +28,7033 @@ POSSIBILITY OF SUCH DAMAGE. $FreeBSD$ ***************************************************************************/ -static unsigned int eth_z8e_uncompressed_length = 357812 ; -static unsigned int eth_z8e_length = 111096 ; -static unsigned char eth_z8e[111096 + 1] = - "\x78\x9c\xec\xbd\x7f\x78\x54\xd5\xb5\x37\xbe\x72\x32\xc0\x24\x0d" - "\xcc\x88\x29\x1d\x11\x75\x50\xb4\xd1\xf2\x23\x2a\xb6\x68\x41\xa3" - "\x80\xc5\x5e\x7e\xa4\x8a\x6d\xaa\x68\x82\x26\x34\x68\x84\x08\x11" - "\x07\x08\x99\x61\xc0\x36\x41\x20\x51\x02\x44\x08\x49\x6c\x43\x8b" - "\x14\x24\x56\xda\xd2\xb7\x56\xa7\x25\xbe\x0f\xbd\x0d\x19\x6e\xbf" - "\xd0\x37\x57\xf1\x76\xe4\x46\x9a\x72\x13\x18\xc9\x40\xc6\x64\x66" - "\xf6\xfb\x59\x7b\x9f\x93\xcc\x0c\x13\x94\xdb\xfb\x7c\xdf\x7f\x9a" - "\xe7\x99\x9c\x73\xf6\x8f\xb5\xd7\x5e\x7b\xed\xb5\xd7\xda\x3f\xd6" - "\x26\xfa\x07\xfe\xb4\xbd\xbe\x7f\x24\xfb\x3f\xff\xfe\xf9\xf7\xcf" - "\xbf\x7f\xfe\xfd\xf3\xef\x9f\x7f\xff\xfc\xfb\x7f\xf3\x77\x5e\x33" - "\xd1\x1f\xaa\x88\x7a\xdc\x66\x9b\x8f\xba\xde\xd9\xbe\x45\x84\x10" - "\x9c\xe4\x23\xb3\x8d\x9f\xfa\x8f\x5e\x45\xb8\x56\x45\xe6\x1b\xad" - "\x94\x36\x7d\x17\x51\xf5\x28\xd1\xb9\x65\x9b\xf0\xaf\xdb\x26\x3a" - "\x67\xec\x26\x6a\x1e\x47\xb4\x65\x94\x08\x00\xce\x02\x1f\x7d\x7f" - "\x1c\xc3\x59\x87\x6f\x8e\x5f\x3f\x4a\xf8\x11\x5e\x82\xf0\x5a\x0e" - "\x5f\x3b\x0a\xb0\xd2\x89\xdc\xdb\x44\x30\x0a\xae\x99\xf3\x33\xcc" - "\x19\x63\x25\x3e\x8d\x71\x70\x18\xc6\x21\x1f\x3d\x96\x7e\x19\x18" - "\x69\x06\x5e\x01\x8d\x92\x18\x5e\xb7\x9b\x6c\x01\xb7\xe7\xcb\xc8" - "\x1b\x40\x9d\x32\x38\x6f\x25\xd2\x08\x37\x25\x37\x3b\x42\x64\xbf" - "\x91\x92\x4e\x53\xca\xdf\xf1\xd4\xf0\xfc\x88\xeb\xbb\x4e\xe5\x1b" - "\xc7\x30\x90\x37\xa9\xc7\x9d\x92\xd9\x9f\x17\xb0\xed\x65\x64\x42" - "\xda\xb7\x02\x9a\x47\x53\x69\xad\x29\x7a\x5a\x0d\x69\x17\x18\x69" - "\x55\x9c\xf6\x90\x1e\xf7\x25\xc4\x39\x62\xe3\x4c\xaf\xea\x71\x69" - "\x88\xab\x8e\xc3\xcf\xe4\xed\x0d\x11\xca\x61\x5c\xec\x3e\x3c\x0f" - "\xa3\x65\x74\xdc\x18\xa7\x66\xa4\x77\x71\xfa\x19\x76\x11\x9a\x6f" - "\x27\x89\x0b\xd3\x0e\x69\x67\x1d\x6e\x50\x69\xf1\x3e\x86\xf3\xeb" - "\xef\x76\xbc\xcb\x70\xbd\xdc\xab\x7a\xdc\xa9\x69\xb1\x38\x11\xe9" - "\x71\x23\x11\x97\x11\x1b\xf7\x6e\xa6\x1e\xf7\x15\xc4\xcd\x88\x8d" - "\x4b\x32\xf2\xd9\x10\x97\x67\xc4\x45\xb7\x93\xe2\x38\x13\x7e\x43" - "\xcc\x44\x43\xf1\x1b\x66\x36\xda\x6e\xb9\x4d\x44\x9c\xd7\x90\x49" - "\x6c\xd8\xd2\x11\x71\x0b\xf2\x3a\x82\x64\x1f\x4d\xce\x53\x94\x7a" - "\x0c\x70\x69\xf3\x2a\x32\x3b\x8b\x45\xd0\xeb\xe8\xa4\x56\x7f\x27" - "\x39\xfd\xa2\xc3\x1b\xba\x40\x65\x17\xc8\xec\x0d\x75\x51\xd9\xf3" - "\x64\x6b\x2e\xfd\x84\x12\xf1\x45\x44\x13\xe4\x1c\xc3\x79\xdb\xa9" - "\xb5\xb6\x9d\x9c\xb5\xb1\x79\x9d\xd7\x91\xed\x28\xbe\x41\x73\x0b" - "\xe3\xd1\x6c\x0f\x51\x28\x75\x4b\x47\xe9\x6b\x64\x72\x8e\x25\xed" - "\x68\xbe\x47\xc7\xe5\x4b\x35\x8c\xcb\xfa\x33\x64\xfe\xc9\x22\xb4" - "\xfd\x19\xc6\x77\x67\xc7\x81\x55\x41\xed\xb0\x6d\x36\x1d\xb6\x9d" - "\xa4\x66\xdb\x34\x6a\x76\xcc\xa0\xcd\x67\x28\xed\x70\x70\x2a\x35" - "\x9b\x1e\x44\xdf\x98\x41\xde\x4e\xbc\xdb\xc3\x48\x13\x20\xfb\x0a" - "\x42\xbb\x7e\xa9\xbc\xfa\x19\x32\xfb\x14\x4c\xb4\xe7\x97\xaa\x7f" - "\x5f\x42\xc4\x34\xe3\xef\x44\xf5\x58\x7e\x0d\xd9\x80\x5f\x07\x70" - "\xb9\x1b\xb8\x1c\x1d\x67\xa3\x4c\xe0\x3c\xcc\x5b\x13\x22\x53\x29" - "\xa5\x0c\xd2\x27\xd2\x23\x6e\xd9\x37\x3b\xeb\xb6\x89\x0e\xe6\xad" - "\xee\xd5\x39\xe8\x5f\x69\x26\x94\xdd\xc8\xe5\x6d\x46\x1f\x75\xbe" - "\x4e\xa6\xee\x17\x73\x92\xea\xb7\x89\x76\xc4\xd9\x8d\x38\xf0\x7b" - "\x3b\xe2\x3b\x26\xa5\x93\xd5\x1b\xca\xa2\xf7\x7a\x3b\x4c\x0c\x63" - "\x44\x80\x92\x18\x9e\xc5\x41\xc9\xa8\xcf\x10\xe0\xf3\x69\x3d\xc2" - "\x6f\x42\x3a\xe4\x47\xfb\x57\x04\x38\xbf\xf8\xca\xe3\x9f\x46\xbe" - "\xf2\xb8\x3f\xb2\xfd\xf1\xf3\x62\xfb\xe3\xdd\xe1\xed\x8f\x07\x9c" - "\x2b\xc9\x1c\xfe\xca\xe3\x17\x5a\x8b\x65\x1b\x58\x5b\x8b\xd1\x06" - "\x61\x32\xaf\xe9\x22\xeb\x93\xcf\xa3\xed\x43\x1f\xd1\x9a\xc5\x64" - "\x8b\xa4\xec\x68\xf0\x86\x4e\xd0\x93\xa5\x24\xf0\xde\x94\xa8\x7e" - "\xdd\xa9\xb5\x19\x8a\x67\xcd\x5c\xa7\x36\x9f\xf6\xaa\x8f\xcb\xf5" - "\xa7\x34\x66\xe0\x37\x1e\xbf\x4c\xfc\x26\x8b\xd4\xda\xc9\xa0\x95" - "\x73\xc4\xda\x24\xaa\xeb\x25\x9a\x14\xa1\x24\x34\x51\x00\xf8\x5b" - "\x07\xa1\xdb\x98\xc8\x86\x37\x9b\xbe\xea\xa2\xb2\x9e\x9e\x42\x62" - "\x99\xc2\xf2\x84\xe5\x4b\x8f\x7b\x78\x96\x4f\xdb\x62\x97\xbc\xbf" - "\x4d\x04\x44\xea\x9b\x4d\x08\xef\x08\xac\x2e\x4c\xf2\xaf\x2e\xd4" - "\xba\x53\xdf\x7c\x1b\x69\xf2\x91\x26\x47\xa7\x61\x07\xc3\x42\x3f" - "\xf1\x0f\x0f\x51\x32\x60\x16\xff\xfa\x62\x9b\x69\xd7\x36\x71\x12" - "\xe9\x36\xf6\xc3\x02\x6c\xc0\x01\xfd\x87\x37\x18\x61\xa0\x75\xfb" - "\x26\xa4\xe3\xfc\xde\x60\x16\xcb\x5d\x9f\xb7\xa8\x83\x2c\x21\x4a" - "\x15\x7d\xaa\x3c\xa4\xe9\x60\xf9\x38\x3c\x48\x43\x7b\xdc\x94\xcd" - "\xb0\x39\x9f\xb7\xb3\x83\x90\xef\x6d\xe1\x2c\x84\x5c\xa2\xb9\x3d" - "\xa2\x30\x09\xb2\xb8\xfd\x30\xf2\xab\xb2\x47\x98\x0d\x1c\xb9\x0c" - "\x6e\x6b\x89\x27\xf8\xe1\x70\x51\x90\x86\xd7\x50\x32\xf2\x3d\xc2" - "\xf0\x18\x16\xf8\xc0\x87\xba\xbe\x7d\xb8\xc8\x4f\x11\x11\x03\xd3" - "\xa7\xc3\xcb\x89\x81\x87\x70\x01\x78\xcc\x7f\xcd\xc8\x33\xbc\x41" - "\xc2\x7b\xf8\xd7\x11\x86\x17\x24\x93\x5d\xe2\xfb\x5d\x86\xd1\xc3" - "\x32\x0d\x30\x3d\x2b\x1e\xa0\x4e\x1a\xe1\xf1\x3b\x0b\x93\x5b\x4b" - "\x89\x38\xff\x81\xb2\x8e\x21\xa2\x3b\x27\x99\x79\x8e\xe3\xbd\xa1" - "\xf3\x9c\xe6\x75\xd1\x5d\x98\x3c\xbc\x93\x4c\x8c\x33\xf2\x3b\x18" - "\xcf\xe8\xb6\x7c\x78\xe6\x77\xa7\xd1\x9c\xfb\xa7\x4f\xa3\xec\xef" - "\x3d\x8c\x7f\x73\xa7\xd1\x23\xf8\x65\xde\x3d\x21\xf3\xce\x6f\x4c" - "\xb9\x93\x72\x1e\x7c\x08\xa1\xd3\xa7\xdd\x9e\xf9\xad\x09\xd9\xd3" - "\x1f\x9a\x49\xdf\x99\x7f\x47\xe6\x1d\x77\xd0\xfd\x33\x67\xdf\x9e" - "\x99\xa9\x3f\x6f\xcf\xe4\x24\x8f\x4d\x99\xf9\xc8\x84\xec\x65\x4b" - "\x4b\x96\x4e\x98\xfb\xd0\xf4\xd8\xf1\xd0\x16\x59\x11\xa1\x3a\xf0" - "\x86\xe8\x9e\x45\x02\xf2\x01\xfd\xc0\xcf\x7d\xc1\x53\x76\x1e\xfd" - "\xdc\x7a\x73\x3d\xb7\x8f\x94\x91\x23\x4e\xa2\x6f\x9b\x7a\xdc\x16" - "\x17\xe8\x54\xc3\x74\xc2\xb8\x83\x34\xe9\xaf\x21\xee\x63\x5d\x2e" - "\x73\x7c\x43\x5c\xfc\x1a\xc4\x9f\x8e\x8a\xf7\xc4\xc5\x2f\x44\xfc" - "\x7f\xe9\xf1\xa0\xb1\xc5\x17\x1b\x7f\x15\xe4\xfe\x88\x73\x9b\x11" - "\x3f\xa2\x98\x92\x81\xab\x7f\x9d\x1c\xab\xad\xe6\x7e\x3e\x03\x1f" - "\x37\x97\x66\x91\xf8\xc9\xac\x24\xb4\x4b\x12\xc6\x38\xe4\xb3\x14" - "\x82\xdf\x02\x91\xd4\xc6\x29\xa0\x3f\xa9\x30\xeb\x7c\xc1\xdf\x1b" - "\x1a\xef\x16\x4e\x84\xad\x92\x61\x8f\x72\x18\xda\x20\xb9\xa7\xbb" - "\x90\xc4\x6a\x19\x9e\x8c\xf0\x3f\xd6\x33\x0f\x70\xfa\x3e\x99\x7f" - "\x18\xc2\xde\xc0\xf7\xdd\x80\x79\x8f\x0e\x13\xe3\x6e\xfa\x21\xc0" - "\xfb\x66\x44\xe4\x90\x30\x9f\x6b\xc3\xfb\x54\xcf\xaa\x4e\x3a\x5d" - "\x4c\x9a\x0f\x71\x11\x27\x60\xf6\xf5\x97\xef\xe0\xbc\x28\xcb\xd4" - "\xd3\x57\x88\xb1\xce\x5a\xca\x63\x36\xc2\xee\x8e\xc2\xb1\x90\xcb" - "\xe4\xfe\x86\x7a\x77\x83\x26\x29\xa8\x6b\x20\x8e\x26\x56\xce\x53" - "\x29\x79\xba\xf1\x6e\xc0\xc9\x47\x7f\x82\x0c\x21\x8d\xeb\xe0\x1b" - "\x80\xa1\xd3\xf4\xaa\xc9\x71\xf9\xb3\x01\x9b\xfb\x27\xcb\x90\x64" - "\x1f\x59\x82\x46\x3b\xab\x36\xba\x2a\x3f\x36\xfd\xc8\xf1\xdd\x6e" - "\x4b\x12\xd3\x19\xcf\xe1\x48\x33\x0c\x7d\xd8\xc4\xf2\xf6\x70\x29" - "\xeb\x3b\x57\x55\xc7\xc1\x3f\x88\x74\xe9\x8c\xe3\x00\x4e\x96\xa0" - "\xae\x9f\xb4\x23\xbf\x19\x79\x8e\xc4\xe5\xe9\x40\x9e\x31\x42\xe5" - "\x49\x56\xf4\xb9\x24\x4f\x28\x0e\xaf\x31\x92\x76\x1b\x64\x1e\x13" - "\xfa\x60\x7f\x1e\xd9\x27\x63\xcb\xe5\xba\x41\x8f\x19\x99\x15\xc7" - "\x7f\xd0\x31\x2c\xe3\x98\x16\xa2\x6f\xd6\x97\xd0\x06\x77\x20\x6c" - "\x38\xf0\x98\xc6\xed\xc6\x7c\xe7\xf5\x07\x21\x33\x66\xa5\xa9\xb1" - "\x6f\xe4\xeb\x96\x52\xe2\xf7\x09\xfc\xce\xb0\x45\xdf\x6c\x9d\xe7" - "\x46\xbe\x8e\x27\x87\x97\x73\x38\x68\x8b\xb8\x7f\x89\x28\x98\x23" - "\xdf\x87\x2c\xd1\xf0\x1d\xd6\xcb\x18\x82\xef\x24\xe0\x7e\x0f\xe4" - "\x11\x78\x64\x16\xb7\xff\xe4\xd3\x74\xb5\x1e\x7f\xf5\x05\x4e\x8f" - "\xf7\xdb\xf5\xf7\xa4\x58\xbe\xbb\xba\x4b\x96\x2d\x79\x4f\xe5\x8f" - "\x28\x3e\x9b\x8e\xb8\x7f\xc7\xf3\x21\x3c\xdf\xc7\xf3\x3b\x78\xbe" - "\xee\xbc\x40\x36\x67\x18\xe3\xaf\xfa\xde\x84\xe7\xc3\x78\xae\xc4" - "\xf3\x11\x3c\x0b\x98\x5f\x20\x8f\x89\xdb\x18\x6d\xab\x78\x02\xb2" - "\x34\xa2\xfa\xc6\x30\x45\xcb\xab\xe7\xeb\x65\xaa\xfe\x22\xa2\xc2" - "\x54\x3a\x4d\xb5\x9b\x1e\xd6\x37\x8b\xe9\x92\x0d\xf8\x99\x5c\xbe" - "\x0e\x6b\x48\x02\x58\xa6\x04\xb0\x92\xa2\x61\xe1\x69\x2a\x0b\x08" - "\xe1\xa3\x91\x7e\xa6\x2b\xbe\x03\xa0\x09\xf4\x80\x91\xcd\x4c\xa7" - "\x81\xf4\x23\xf3\xa2\xda\x1b\x7a\x60\x7a\x66\x6c\x7b\x5b\x82\x4c" - "\xb3\x4a\x5d\x36\x30\xff\x4b\xbc\x85\xec\x3f\x43\x0d\x9e\x61\x19" - "\xc8\xb4\x48\x2e\xe5\xfe\x90\x0e\xfd\xff\x27\x7e\x86\xc1\x71\x81" - "\x94\x03\x99\x9c\x3f\xd9\x21\xe3\xaa\xa0\x6f\xb4\x19\x71\x5c\x76" - "\x54\xbe\x7d\x46\xbe\x48\x6a\xb5\x55\xe6\x5d\x5e\x98\xcc\x63\x25" - "\x8f\x79\x18\x7b\x3a\x90\xe6\x98\x8f\x86\x5b\x07\xb3\x0b\xfa\xb4" - "\xf4\xdf\x43\xaf\x3c\xdf\xe7\xcc\x20\x51\x5e\x4d\x13\x88\xb4\xf1" - "\x2e\x4a\xf1\x86\x8e\xd3\xbc\x90\x08\xe3\xd7\x97\xe1\xa2\xab\xbc" - "\xa1\x16\xfa\x2a\xd1\x58\x6f\x68\x23\xc6\x98\x12\x8e\x7b\xef\x26" - "\x4a\x4a\xc2\xd3\x79\x1b\x69\x49\xde\xd0\x64\x84\x37\xd2\x4d\x2e" - "\x53\xd2\x83\x2f\x89\x1e\x6f\x68\x2a\xbe\x8b\x68\xc6\x4b\xe2\xaf" - "\xb9\x61\xb2\xce\x1e\x22\x9c\xde\xd0\x6c\x7a\x70\x48\x44\x78\x43" - "\xcd\x88\xcb\xa7\x79\xe1\xcf\xc4\xbc\x70\x8f\x10\xe6\x6a\xeb\xbc" - "\xf0\x39\xbc\xff\x55\x80\xd6\x78\xbe\x27\x58\x97\x9d\x17\x76\x0a" - "\x51\x51\x4d\xb9\x2b\x35\xea\xc3\x38\x29\x52\xaa\xad\x62\x43\xb5" - "\xbd\x4f\x14\x26\x8b\xd4\xea\x1b\xfa\xfa\xf0\xdc\x50\x7d\xbd\xfc" - "\x2e\xaf\xce\x04\x1c\xfb\x04\x17\x74\x3e\xe0\x1e\x81\x9c\xf1\x86" - "\x4e\xa2\x9c\x4f\x68\xde\x4a\xbf\x60\xfc\x47\xac\x15\x78\x7f\x4f" - "\x60\xac\xb4\xcc\x5b\xe9\x14\xb9\x21\x32\x03\xa6\xdd\x1b\xea\x24" - "\x94\x93\x09\x98\x13\x24\xcc\xf2\xea\x6c\xa4\xf5\x73\x3a\x86\x65" - "\xc0\x61\x18\x9c\x76\x5e\x98\x2c\x48\x9f\xdd\x57\x51\x9d\x85\x5f" - "\x1e\x7e\x55\xc8\xfb\xe3\xbe\xd5\x92\x86\x4d\x78\xf7\x7c\x06\x7e" - "\x91\x34\x0c\xd3\x30\xa4\xe5\x31\x78\x46\x8f\xc2\xd7\x27\xf1\xdd" - "\x50\xfd\xd7\xcf\x54\x3d\xfe\x43\xaf\xc7\x47\x1c\x0e\x9e\x1a\x22" - "\x36\x6c\xa5\x80\x53\xc6\x09\xe4\x9b\x2f\xf3\x95\x6f\x85\xfc\xdf" - "\x6a\x05\x7d\x92\xe7\x85\x85\x8b\x69\x08\xba\xba\x98\x8e\x4c\x2b" - "\x51\x81\xf8\x94\xad\xa0\xcf\xd6\x3b\xfa\x2a\xb6\x82\x46\xc0\x25" - "\x75\x6b\xd6\x67\x12\xf6\xd6\xfb\x00\x67\x41\x0f\x97\x67\xde\x9a" - "\x05\x58\xd9\x9f\x69\x76\xd0\x42\x04\xe7\x85\xd6\x86\x72\x57\x52" - "\x72\x06\xb9\x80\xef\x56\xc0\x2a\x42\x1d\xd7\xe3\x39\x1b\xf1\x74" - "\x35\xca\x7a\x0f\x70\xb3\xb8\x3c\x94\x91\x0d\x98\x73\x00\x2b\x9f" - "\x71\xea\x75\x93\x15\xdf\x79\xbd\x0a\x3f\x57\xa4\x7c\x6b\x43\xc4" - "\xbc\xb5\x2a\x9a\x77\x14\xcd\x98\x67\xf6\x73\x98\xd5\xe0\x93\x70" - "\xf9\xd6\xe2\xaf\x11\x59\xe7\x06\x44\x88\x79\x65\x12\x15\x27\xb5" - "\x06\x5a\x28\x37\x64\xa6\xd6\xe2\x83\x74\x1b\xb1\xfd\x11\xa0\xd6" - "\xc0\x46\x7c\xef\xc2\xb3\x84\x8e\x76\x36\x12\xe3\x38\xb7\x38\xb0" - "\x36\x6c\xde\xea\x3f\xda\x39\x93\x90\xff\x3d\xe0\x18\x79\xb2\xd8" - "\xe4\x6a\x2d\x0e\xf0\xb7\xf3\x68\x27\xf8\x33\x2c\xc2\xa1\xf2\xad" - "\x79\x21\xf3\x36\x9a\x7b\x41\xf8\xe7\x74\xba\x86\x20\xac\xcf\x92" - "\x24\x42\x16\x87\x53\x1c\xed\x5c\x4f\x4f\x5e\xa0\xa4\xa3\x85\x07" - "\x25\x9f\x3e\x59\x5c\x4c\x32\xff\x85\x90\xe5\x89\x4e\x17\x3d\x51" - "\x48\x23\x90\xfe\x1c\xf3\xac\x18\xe1\xa2\x96\xf6\x7c\x9a\xd3\x15" - "\x4a\x9e\x7b\xa1\x4f\xb4\xe4\x6d\xa4\xa3\x85\x1b\x99\x1e\x2e\xd6" - "\xd3\xe7\x74\x75\x8b\xb9\x17\x7a\xc4\xd1\xc2\xfd\xd4\x92\x77\x90" - "\x66\x7f\xe2\xb1\x84\x2b\xb6\x16\x47\x52\xb6\x56\x45\x2a\xb6\x36" - "\x84\x2a\xb6\xe6\x85\x53\xb6\xfa\x43\x29\xdb\xa0\xb3\x6d\x2b\x06" - "\xfd\x52\x64\x5b\xa4\x6e\x5b\x82\x77\xbb\x6c\x5f\xf3\x36\x17\x74" - "\x70\xc9\xff\x5e\xd8\xde\xa2\x7c\x5b\x83\x48\xd9\xe6\xea\xab\xd8" - "\x56\xa5\xf8\x13\xdf\xa9\xdb\x1a\x14\xaf\x6c\x6b\x52\x7d\x60\xdb" - "\x01\x6e\x5f\xa4\xf1\xe0\x77\x0c\x3f\xe8\x94\xdb\x33\x01\xf3\x2a" - "\x86\x1f\x31\x6f\xcf\x8c\x94\x6f\xcf\x12\xe6\xed\xd9\x80\xad\xcd" - "\x7d\x3e\x08\x3a\x82\x86\x0e\xd0\x9f\x6d\x23\x47\x18\xdf\x61\x7a" - "\xf2\x79\x72\x7a\x1d\x27\xf1\x7e\x92\xc4\xbb\x55\x34\xf7\x79\xee" - "\x7f\x61\x3c\x9d\x02\x34\xb2\x44\x52\x00\xa7\x02\x70\x52\x00\x67" - "\xc3\xf6\x62\x5d\x36\x03\x8f\xed\x4b\x15\x1e\xdb\x8b\xfb\xfa\x32" - "\x58\xbf\x33\x21\x8d\x0b\xe1\xe7\xe5\x78\xc2\x3c\x58\xbe\xdd\x3f" - "\xe7\x25\xe1\x17\xe6\x9a\xec\xc8\x50\x92\x7d\x29\xf2\xae\x10\xaa" - "\x3f\x75\x82\x87\x47\xbb\x72\x1d\xd4\x20\x2a\xb6\xfb\x45\x4a\x0d" - "\xe0\xef\x78\x15\x70\x92\x85\x94\x47\x3b\xaa\xfa\x2a\x76\x34\xe1" - "\xd7\x30\xd0\x07\x99\x16\x3b\xaa\x62\x6d\xe7\xc4\x76\x73\x8f\xfb" - "\x9a\x16\x1f\xed\x3f\xc6\xb2\x0f\xef\x6d\x3e\x7a\xb3\x51\x7f\x6f" - "\xf7\x51\xb5\xb4\xc1\x59\xe6\x15\x97\xd1\x97\xcf\xd0\xe8\x1a\xd0" - "\x84\xdf\xd3\xf0\x5e\x3b\xef\xd6\xf7\x44\xa4\xfc\x43\x33\x78\xa0" - "\x87\x65\x90\x70\x4f\x66\xf9\x9d\x05\x7b\xc7\x2c\x7a\x32\xd2\x30" - "\x86\x6c\x16\x7d\x36\xb6\xcd\x2c\xf8\x1e\x01\xfa\x8e\xc3\x73\xe4" - "\xae\x8b\x94\x8e\x9f\x6d\x97\x3b\xe2\x62\x59\x8d\xf7\x4c\xf1\xa2" - "\x2d\x75\xf3\x0a\x1a\x6f\x09\x90\xb9\xde\x1d\xc9\xb1\xac\xb5\xb2" - "\x8d\x92\xce\xef\xc2\x5d\x33\xbb\xfe\x22\x99\x78\xcc\x89\xa4\xa0" - "\x3c\x87\x45\x88\xe5\x19\x54\xbf\x0c\xb2\xc9\x4d\xb6\x7a\xb7\x68" - "\x0a\xf7\x64\x68\x8c\xa7\x81\x0b\xe3\x06\x3c\xaf\x03\x9e\xfb\x1e" - "\x5d\x99\x45\xef\x3b\x28\xa1\x6d\xdf\xe3\x1e\xdd\x5f\xff\x41\xe2" - "\x3b\x0d\x9a\x24\x8e\xbf\x36\xcd\xa0\xd3\x60\xf6\x33\xf7\xfb\xf0" - "\x45\xe1\xaf\x5c\x42\x4c\x0b\x9b\x33\x24\xfe\x13\xb2\xd7\x55\x16" - "\xa6\xeb\xe6\xad\xbc\x41\x78\xfd\xc2\xe3\x75\x74\xc9\xf9\xaf\x7a" - "\xa4\x29\x0b\x89\x08\xdb\x8b\x6c\x2b\x56\xb3\xed\x57\xd1\x58\x2c" - "\x2a\x1a\x8b\xba\x57\x88\x50\x9d\xb4\xef\xae\x75\xf9\x68\x72\x93" - "\x6a\x9b\xad\x2e\xe8\x47\xed\xdd\xe6\xc6\x22\xc0\xbe\x8a\x61\xb7" - "\x16\x0b\x4f\x24\xa5\xb1\x04\xe9\xf6\xf8\xe8\x7f\x99\xa3\xe7\xc0" - "\x30\xde\x75\xae\xdf\xc6\x63\xde\xb5\xcd\x3e\xba\xfe\x92\x7a\xa9" - "\xd9\x3a\x42\xbb\xd8\x07\x26\xf9\x92\xf4\x69\x17\xe3\xcf\x8a\x5f" - "\x56\xe2\x68\xa3\xde\xe8\x9b\xd4\x0d\x5b\xc6\xb9\x86\xc6\xa0\x1d" - "\xae\x3d\x43\x63\xee\x76\x3a\xc4\x69\xe1\xbe\xf6\xd8\x4f\x56\x05" - "\xa1\x2b\x8c\x99\xe1\x23\xd7\x9e\xc1\xe8\x26\x58\x4e\x5e\x14\x1d" - "\x95\x2b\xfa\x69\xf6\xf1\xbc\x95\x11\xc1\xef\xdc\xef\xea\x11\xce" - "\xf4\x00\x9c\x8d\x06\x2d\x06\xa1\xbf\x49\x94\x37\xba\x94\x6e\x38" - "\xa6\x53\xb8\x05\x79\xae\xe7\x79\xb1\x31\x4a\x77\x2b\xdf\x56\xd5" - "\x0d\xb9\xc2\xf3\x07\xd0\xb5\x02\xcb\x6d\x22\x08\x98\x3e\x1f\xdd" - "\x9c\x69\xd8\x35\xde\xd0\x4c\x96\x2d\x55\x83\xcd\x3b\x0e\xc0\xbf" - "\x3e\xad\x75\x0c\x29\xb9\x64\x3e\x50\x52\xa6\xf0\x66\x1d\x2e\xc0" - "\xb6\x5c\x3b\xe2\x97\x07\x44\x87\x28\x3f\x50\xb8\x99\xc3\x56\xf4" - "\x72\xd8\x70\x96\x69\x9e\x65\x8c\xd3\xf5\xc3\x3d\xd7\xf7\xd2\x69" - "\xe8\x43\x6c\x03\x2a\xdb\xe8\xba\xe0\xe1\x12\x35\xe7\xd6\xe3\xbe" - "\xce\xe1\xa3\x5b\x82\x06\x5e\x2c\x07\x41\x5f\xa6\xb5\x8b\xfb\x3c" - "\xcf\x49\x2d\x2f\x15\x41\xe0\xea\x42\xda\x46\xa3\x0e\x5c\x3f\x55" - "\xaf\xeb\x0e\x45\xd7\x0b\x38\xf8\xa1\x47\x4b\x1a\x2c\x5f\x49\x66" - "\xbb\xa2\xb5\x99\xeb\xcb\x75\xe1\x3a\xcb\xba\x68\x90\xb7\x18\x67" - "\xbc\xa1\xbb\xa0\x97\xc9\xf0\x86\x1e\xf7\xf5\xd0\xfb\x6e\xae\x56" - "\x3a\xd7\x75\x0e\xa6\x65\xc2\x76\x34\x6f\xcd\x76\x7e\x46\xd7\x3b" - "\x23\xe2\x14\x60\xbe\x02\x3a\x25\xf3\x53\x8e\xd1\x41\xf0\xaf\x79" - "\xef\x6c\x1e\x9b\xbd\xa5\x17\x78\x6c\xe6\xb4\x57\x23\x6d\x3b\xd2" - "\xac\xd5\xd3\xae\x55\xf3\xa5\xf2\x39\x8c\x9f\x18\xab\xe7\x00\x8f" - "\x1a\xb6\xf1\x41\xe7\x4c\xe3\x5b\xe0\x1b\xcf\x6c\x51\xb1\x77\x76" - "\x62\x5c\x20\x5f\x55\x5f\xec\x44\x39\x5f\x61\x9e\x72\xae\xa4\x6b" - "\xc0\x97\x1f\x97\xad\xa1\xab\x99\x9f\x44\x4a\xe3\x46\x45\xf7\xeb" - "\xdb\x85\xdb\x45\x5e\x48\xce\xe2\x15\x74\x2d\xfa\xdf\xfa\x33\x74" - "\xfd\x67\xb9\xa5\x76\xe0\x4a\x54\x79\x96\x94\xac\x49\x69\x2c\x67" - "\x99\x5b\x7f\x96\x6d\xb0\x1b\x6c\x06\x2f\xe2\x7d\xdc\xe5\xe4\x02" - "\xe8\x7a\x4c\xd9\x10\x37\xbc\xc2\xf3\x4f\xa7\xe8\x86\x52\xae\x2f" - "\x7e\x49\x08\x7b\x4e\x5c\x14\x0b\x04\xeb\x73\x18\xb7\x7c\x74\xc3" - "\x1e\x3c\x8f\xc9\x9f\x9b\xf2\xf4\x6f\x0f\xd2\x2d\x10\x17\x23\x9c" - "\x06\xfa\xeb\x0d\x25\xc2\x9d\xc4\x7d\xe2\x1d\x94\xdd\xe0\xa3\x6f" - "\x1c\x51\x6d\x73\x43\x11\xc3\x1a\x04\x07\x0f\xcf\x37\xa8\x79\x06" - "\x7b\x8a\xbd\x2c\x89\xf1\x90\x73\xd8\x0c\xab\x5e\x53\xf2\x39\x02" - "\x5c\xeb\xdc\x91\x42\xc8\xe2\xc2\xc8\x86\x7d\x0d\xf2\x5d\x8f\x63" - "\x3c\x22\x28\x3f\x31\xfc\x03\x25\x9e\xd1\xcc\xe3\xf6\x7c\x05\xe7" - "\x40\xa1\x67\xf4\x19\xfe\x2e\xe0\xef\x80\x79\x7f\x83\xb7\x26\x0b" - "\xe5\x9f\x41\xb9\xf6\x7c\x65\x1b\xd8\x0b\xba\x51\x46\x8f\xdb\x9e" - "\xef\xa3\x0c\x93\x9a\x8b\xdb\xdf\x30\x48\xdf\xb3\x72\xdf\x39\x5a" - "\x4b\x7a\x9f\xbe\x31\x85\xe7\x1b\x50\xaf\xa6\xb0\x79\xdb\x31\x5d" - "\x6e\xb0\xbd\xf5\xa5\x53\x74\xa3\xb9\xb5\x50\xf2\xb7\x26\x34\x7b" - "\xf3\x9b\x11\xbf\xc6\xf3\xa5\x4a\x7c\xdd\x68\xbe\xf4\x67\x0f\x40" - "\x95\x87\x58\x1b\x6b\x55\xdf\x63\xd1\xb3\xc7\x66\xe2\xe7\x92\x74" - "\xeb\xce\x87\xfd\x73\xa3\x39\x92\x82\x36\x29\xe7\x36\xb2\x87\x44" - "\xf7\x38\x2d\xa2\xbf\xd7\x7d\xca\xb6\xc7\xd8\x0c\xd0\xff\xa0\x6a" - "\x07\x86\x41\x49\xe8\x8b\x4c\x73\xe1\xac\x11\xc1\xe6\xb2\x00\x70" - "\x1e\x9b\xd3\x5c\x13\x20\xfb\x2d\x5c\xf7\xb1\x0b\x96\xd7\x08\x7f" - "\x00\xb4\xe7\x27\xd7\xed\x70\x6d\x88\x78\xce\x16\xb0\x60\xff\x2c" - "\x3c\x2e\x65\x7e\xea\x81\x2a\x86\x27\x52\x24\x3f\x08\xa3\xee\x4a" - "\x9e\xed\x6f\xe0\x76\x04\xac\x37\x50\x6f\xcb\x59\x1a\x2b\xdb\xf3" - "\x30\xea\xbe\x0b\x32\x65\x17\xec\xc9\x7a\x29\xff\xc7\x42\xfe\xdb" - "\xd3\x8d\xf9\xc5\x4d\x88\xdb\x84\xb8\xa3\x85\x41\x62\x18\x61\xc0" - "\x96\xf6\x19\xda\x62\x4d\xa7\x08\xbe\x57\xd6\x61\xc2\x78\x8c\xf6" - "\xde\xdf\xc0\x65\x3a\xa1\x17\x7b\x96\x70\xb9\x63\xab\x20\xab\x02" - "\x09\xdb\xbf\x1f\xb7\x9b\x86\x1f\x1e\x27\xe5\x62\x53\x04\xf5\x8f" - "\x6d\x97\x9b\xd2\x54\x9b\xdc\x98\x13\xdb\x26\x37\xa5\x81\xee\x68" - "\xd9\x1b\x0f\xe2\xd7\xac\xbe\xa3\x7f\x37\x96\x47\xbd\x1f\xef\x71" - "\xdf\x58\x0d\x5a\x67\x2a\x5a\x73\x18\x70\x65\x1e\xf8\x94\xcc\x6c" - "\x93\xf3\x3c\x3d\x87\x33\xbf\x72\x78\x04\x7a\x09\x68\xb8\x07\xf1" - "\x56\xee\x8b\x95\x11\x8a\x89\xf7\xae\x07\x4f\xad\xea\x65\xba\x7e" - "\x26\xe7\x11\xd6\x96\x97\x33\x1f\x22\xcf\x3e\x4b\xa8\xbc\xbc\xc7" - "\x7d\x93\xc9\xa0\x1f\xc2\x3a\x39\x3e\xb1\x7e\x70\xd3\xf8\x7e\x3d" - "\x0a\xba\x26\xcb\x96\x4e\x1a\x37\x05\xf2\x07\x6d\xb5\xaf\x46\x8d" - "\x1b\xe3\xee\xe6\x6f\xc8\xbd\x8f\xf1\x3e\xf9\x28\xe4\x4b\xef\x86" - "\xc6\x8c\x3e\x8d\x86\xf5\x6a\x94\x15\xda\xf0\xe1\xf8\x50\x6a\xed" - "\x64\x6f\xc7\x41\x6a\x0d\xfd\x82\xec\xcf\x48\x18\x13\xbc\xcc\xcf" - "\x2b\x45\xf8\x40\xef\x1e\xd8\x71\xe7\x3c\x18\x67\x6f\x38\x43\xe3" - "\x64\xdd\x5f\x3e\x05\x0e\x7e\x52\xc2\xd6\x69\xf1\xa1\x79\xf3\x22" - "\x11\xda\x7c\x9a\xe7\x58\x6c\xa9\x9b\x7a\x69\xfc\x8e\x55\x94\x59" - "\xdb\x4b\xe3\xea\x7a\x29\x43\xfc\x2d\x43\xab\x85\xae\xf5\xe4\x05" - "\x2b\xa1\x7f\xe7\x8c\x28\x26\x73\xdd\x2a\x92\x6d\x1e\xae\x80\xce" - "\x15\x82\xce\x75\x2e\x83\xe5\x5c\xbf\xce\x05\x7d\x16\x3a\x57\xa3" - "\x5f\xf1\x45\xa3\x7f\x78\x21\x25\xa5\xe5\x91\x15\xf8\x39\xcf\xd2" - "\x4d\xcf\xa5\xb5\x43\xdf\x43\x9d\x7d\x7a\x7d\x41\x5f\x97\xa5\x90" - "\x86\xc9\xba\x42\xf6\x8a\x8a\x7d\x35\x83\x8e\xa9\x1a\xf3\x4e\x80" - "\xd7\x54\xb8\x0e\x2f\xf1\xba\xc0\xc1\xd1\x41\xd3\xf2\x5a\xf0\x1d" - "\xc2\x4b\xc6\x8a\x20\xc2\x8b\xb8\xec\x26\x84\xf7\xb8\xc7\x55\xfb" - "\xb4\x2a\xd3\x60\xf2\xd6\xb2\xd6\x18\xf7\x6f\xfe\xb2\xd0\x5c\xac" - "\x73\x17\xaf\x09\x09\xbf\xf7\x2c\xf7\xc1\x9b\xd3\xe7\x15\x89\x90" - "\x7d\x09\xaf\xd1\xdc\x6c\xe2\xf5\x23\x9e\x37\x7e\x13\x7a\xca\xe7" - "\xad\x19\xb1\xec\x87\x5e\xee\xb2\x14\x01\x26\xf4\x7e\xd6\xc9\xbf" - "\x88\xde\xcd\x6b\x8d\x5b\xe4\xba\xe6\xcd\xb3\x7d\x34\x53\x8e\xa3" - "\xac\xef\xb1\x0c\x84\xde\x74\x35\x70\x2a\x87\x9d\x0b\xdb\xf6\xe6" - "\x22\x1f\x3d\x50\xa8\xeb\x70\x72\xbd\x14\x61\xd0\xff\xa6\xef\xe3" - "\xb0\x92\xb1\x64\x2b\xb1\x8b\x8e\xc1\x74\x1f\xb9\x86\xa9\xd1\x57" - "\x90\xe7\xa0\x01\x07\xe3\xcd\xde\x6e\xed\xd1\x47\x11\x76\xc4\x80" - "\x83\x34\x5f\xc6\x77\x5b\x7f\x1a\x95\xa7\x23\x2a\xcf\xa3\xdd\xda" - "\x6d\x7b\x11\x16\x8a\xcd\x73\x4b\x5a\x6c\x9e\x5b\xc6\x44\xe5\x71" - "\xa9\x72\x6e\xc9\x8c\xcb\x93\x15\x97\x27\xfb\x52\xdc\x6e\xc9\x8f" - "\xcb\x53\x12\x97\x67\xfd\xa5\xb8\xdd\x52\x13\x97\x67\x4f\x5c\x9e" - "\x43\x51\xb4\xe4\xb5\x4a\xd8\x81\xb7\xb4\xc4\xe5\x39\x19\x97\xa7" - "\xd3\xf8\x1e\x6c\xcd\x78\xf9\x2e\xb2\x81\x2f\x3b\xb8\x3d\xa1\xb7" - "\x77\x76\x6f\x7f\xb6\x47\xe5\xfd\x6a\xc6\xa5\xf5\xfa\xea\xd4\xd8" - "\xf2\xbe\x3a\x3b\xb6\xbc\xaf\x2e\xb8\xb4\x5e\x5f\x2d\x8e\xcb\xe3" - "\x8a\xcb\x53\x15\x95\xa7\x41\x2f\xa7\x31\x2e\xcf\xc1\xb8\x3c\xcd" - "\x97\xf2\xd5\x57\xdb\xe2\xf2\x74\xc4\xe5\x09\x7e\x0e\x2d\x78\x3c" - "\x56\x6b\xfb\xa3\x58\xe7\x7d\x00\x63\x7d\xc6\x42\xb6\x65\x30\x96" - "\xf8\x7f\xd2\x1b\x1c\xc2\x63\x0a\x8f\x3f\x87\x1d\x41\xe8\x4b\x19" - "\xb3\x7c\x34\xe1\xa0\x31\x06\xf1\xba\x20\xf7\x67\xa5\x2b\x67\x64" - "\x0c\xa6\x53\x72\x39\xc6\x5a\x3f\x97\x75\x78\x0c\xeb\x5e\x19\xd5" - "\xfd\xba\xad\x5a\xff\x26\x1d\xce\xdf\xe5\x7c\x20\xaf\xa9\xa8\xf5" - "\xc6\x24\xd6\xad\x0f\x3b\x64\x9e\x23\x51\xfa\x30\x97\x1f\x38\xb8" - "\x2a\x68\x8a\xc3\x63\xcf\x65\xf0\x48\x83\x8e\x93\xd3\x8a\x51\xaa" - "\x15\xe6\xd2\xd1\x5a\xe8\x32\xd0\xdf\x19\xb7\x53\x74\x6b\xa6\xd4" - "\xad\x96\xf4\x12\xbf\x7b\x4b\xef\x21\x2f\xd2\x28\xdd\xf2\xd6\xc2" - "\x66\x94\x2f\xd7\x4c\x8a\xcf\x53\xb7\xd4\xff\x59\x07\xbb\x75\xeb" - "\xe1\x52\x3f\xf0\xba\x35\xcf\x58\x87\xf4\xd1\xad\xd5\x52\x6f\x28" - "\x3f\x90\x5d\xa7\xaf\x0b\x1d\x0e\x4c\xe1\x34\xe0\xff\x8c\x22\xa3" - "\xbe\xb0\x01\xfd\x48\x3b\xf5\x72\x34\x53\x6d\x78\xeb\x3b\xb1\x3c" - "\x39\x04\xbc\x72\xeb\xb1\xd8\x76\xbf\xd5\x17\xdb\xee\xb7\xfa\x63" - "\x79\x52\x03\x4f\xde\x66\x8a\xcd\x73\x5b\x7a\x6c\x9e\xdb\xc6\x45" - "\xe5\xa9\x52\xe5\xdc\x36\x25\x2e\xcf\xac\xb8\x3c\x39\x51\xdf\xa8" - "\xe3\x6d\x85\xfd\x36\x8c\x5c\xe3\xbe\xcd\x11\xf5\xad\x55\x4b\xf9" - "\x79\xdb\x46\x23\x8c\xd7\x09\xeb\xb6\xa9\x35\x56\x1d\xde\x9e\xb8" - "\xfe\xce\xe9\xdf\x89\xc3\xa1\x25\x0e\x87\xfe\xfe\x5f\xa9\x6c\xb0" - "\x3f\x9c\xa6\xaf\x1d\xd4\xe7\x94\x3b\x31\x5e\xcf\xe3\x6f\xc0\xaa" - "\x41\x7a\xd0\xe1\x6b\x69\xb1\xf0\xbe\x36\x26\x16\xde\xd7\xc6\x47" - "\x7d\x5b\xf1\x3d\x35\xaa\x0e\xd6\x64\x9b\xdc\x67\x02\x7d\xec\x6b" - "\xf3\x8d\x70\xb6\x0d\x81\x6f\x87\x53\x8e\x33\x59\xbc\x77\x60\xe4" - "\x29\xfa\xda\xfd\x6c\x47\xea\x30\xa3\xfb\x3f\xa9\x7a\x7d\xad\x3a" - "\x0e\x8f\xc6\x38\x3c\x0e\x46\xd5\x2b\x60\x59\x4b\xdf\xb1\x84\x1e" - "\xfe\x3e\xeb\x38\xbc\x27\x45\xae\xe1\xaf\x81\x5e\x76\x81\xac\xbc" - "\x77\xe2\x74\x09\x25\x7b\x1d\x1d\xb0\xc9\x1a\x3b\x07\xe5\xa7\xd4" - "\x03\x79\xfa\x7e\x0f\x7b\x8f\x7b\x7c\xba\xc1\x8f\x78\xb7\x83\x17" - "\x1b\xa4\xce\xb3\x61\xaf\x4f\x38\x73\x6a\x40\x47\xd8\x35\x13\x74" - "\x1d\xf5\x40\x09\xf7\x45\xc8\x9c\x0e\x8c\xeb\x69\x6a\xbd\x6b\xfc" - "\xfc\x28\x7e\x0e\xd8\x57\xdd\x27\x4e\xd1\x84\x2f\xf3\xb8\xcf\xfb" - "\x07\xd8\x66\x3e\x1c\xf0\x43\x8f\x3b\x23\xf5\x32\xc4\xa5\xeb\xf9" - "\x36\x46\xe5\xf3\xeb\x76\x6d\x07\xc7\x4d\x0a\x91\x89\xf3\x00\x46" - "\xba\xd2\xe5\x26\x7c\xf9\x30\xfa\x28\xf2\x78\x8c\x3c\x6c\x03\xcb" - "\xf5\x96\x12\x32\x4d\x2c\x25\x93\x67\xd5\x29\x09\x5b\x6f\xef\x0e" - "\xd6\x89\xbd\xa5\x1d\xe4\x0d\xb4\xf1\x7c\x94\xc9\x53\x76\x8a\xe1" - "\xa4\x27\x07\xc9\xdc\x5d\x71\x00\xe3\xd6\x84\xf4\x70\xc5\x81\x1c" - "\xd8\x36\x90\xd1\xe3\xa7\xf2\x9e\x86\x68\x7a\xcd\x9c\x99\xfd\xf0" - "\xbc\x39\x13\xbe\xf7\xf0\x43\xf3\x67\xde\x63\x9f\xbf\xf8\xb9\x82" - "\xfc\x09\x4b\x5f\x28\xb1\xbf\xb8\x6c\x71\xc9\xe2\x25\x3f\xb0\x67" - "\x3a\x6e\x76\xd8\x17\x96\xa8\x67\x46\xd1\xc2\xe5\x25\xd3\xf8\x75" - "\xbc\xbd\x78\x59\xc1\x0a\xf9\x7a\x6b\x2a\xc5\x02\x59\x5c\x52\xb0" - "\xcc\x7e\x73\xfe\x78\xfb\x83\x0b\x17\x17\xbd\xb0\xac\x20\x21\xac" - "\x7b\xec\xcb\x0a\x96\x15\x2c\xcc\xb7\x4f\xb3\x67\x32\xe4\x68\x70" - "\x51\x6d\x98\x69\x8c\x5d\x3c\x66\x55\xba\xc5\x31\x7d\x0c\xf3\x29" - "\x9e\x99\xd0\x71\xe9\xf8\x35\x21\x6e\xfc\x9f\x18\x37\xfe\x4f\x1c" - "\x73\xe9\xf8\x35\x31\x6e\xfc\x9f\x18\x37\xfe\x4f\xcc\xbe\x74\xfc" - "\x9a\x18\x37\xfe\x4f\x8c\x1b\xff\x27\xf6\x8f\xff\xe0\x23\xdf\x3a" - "\x29\x0b\x26\xc6\x8d\xff\x13\xe3\xc6\xff\x89\x87\xe2\xbe\x8f\x44" - "\x7d\x5f\x8d\xef\xb6\xe8\x31\x11\xdf\x1d\x46\x9f\x1c\x90\x29\x13" - "\x43\x46\x1a\x7d\xad\xbe\x5d\xa5\x9d\x94\x1e\x95\xb6\x43\xa5\x9d" - "\xd4\x3f\xfe\xb3\xec\xe0\x7d\x16\xca\xd6\x9e\xb4\x49\xae\x6d\x21" - "\x2f\x8f\x47\xe8\x1b\x37\x9c\xa5\x49\x43\x18\x16\xf3\xb0\x9c\x33" - "\xdc\xfe\x78\x4f\xfd\x48\x32\x73\x9e\xfa\x57\xc9\x24\xdc\x13\xec" - "\x78\x12\xc2\xd2\xf0\x83\x1c\x99\xb4\x1e\xfa\xee\x71\x35\x46\x4c" - "\x3a\x2e\xfb\x15\xf2\xe8\xf0\x4f\xf0\x37\xef\x2d\x40\x1e\x73\xa5" - "\x1a\x7f\xdb\xf1\x9e\xc6\x3c\x8d\xfc\x26\xa1\x4d\x28\xc0\x93\x10" - "\x66\xc5\x2f\x1d\xf0\x8e\x1b\xf0\x78\x4d\x2c\x51\x9f\x4f\x68\xe3" - "\x69\x64\xa9\x74\x47\xda\xbc\x11\xd6\xa3\x33\x4d\x6a\x4e\xa0\x71" - "\x96\x70\xbf\x97\x53\x8f\xf0\xc4\x36\x51\x26\xda\x7f\x52\x50\xc9" - "\x8a\x4c\xe8\x3f\x0f\x8e\x53\x73\x99\x8d\xb3\x20\x5f\x7b\x01\xe7" - "\x13\x3c\xfb\xf0\xfc\xa3\x01\xdf\x23\x6d\xe5\xcc\x7c\xe1\x4e\x7a" - "\x84\xe1\xc6\x85\x97\x42\x9e\xf5\x5a\x42\xae\x9c\x04\x71\x35\xc2" - "\x9d\xfc\x70\x82\xf0\x26\xe8\x08\xbd\x3e\xca\x6c\x67\x7c\xa3\xc2" - "\x8f\x08\xf7\x88\xf9\x9c\xde\xc7\xe5\x21\xcf\x60\xba\xb5\xb1\x9f" - "\x4a\xed\x5b\xbc\x3d\x3d\xae\x1e\x9f\x9d\xa6\xdb\x5f\x51\xf5\xb8" - "\xbd\x2b\xb6\xec\xdb\xc7\x27\xae\xc7\xed\x33\x50\x8f\xcf\x12\xd7" - "\xe3\x76\xb9\xa6\x2a\x34\xd4\x45\xbb\x24\xae\x14\x75\xf9\x4c\xd2" - "\x3d\x36\xbc\x5a\xd7\x7d\x02\xb0\xb9\xac\x88\x93\x79\x1f\x29\x1d" - "\x68\x37\x3d\xdd\x3b\x96\x1a\xca\x4e\x50\xe6\x71\xe1\x1e\xf6\x88" - "\x8f\xee\x90\x36\x64\x54\x78\xa7\xc2\x05\x74\xd2\x98\x4e\xa8\x0f" - "\xf2\x0d\xd6\xde\x86\x1d\xa2\xe6\x31\xee\xc0\xf8\x97\xe9\x37\xe6" - "\x20\x97\x97\x0a\xbf\x41\x47\xc4\xe5\xc4\xc5\x05\xa3\xe2\x4a\x62" - "\xe2\xd6\xf4\x87\x6f\x34\xc2\xbf\x58\x3b\xdd\xf1\x4e\x5c\x3b\xa1" - "\x7d\xee\x9c\x13\x5b\xef\x3b\x5a\x54\xfd\xd0\x46\x97\xd0\xfa\x8e" - "\x0e\xb4\x51\x5f\xe2\x36\xba\xd3\x94\x98\xd7\xee\x1c\x23\xe1\x8d" - "\xa4\x04\xf0\xee\x9c\x82\xb6\xeb\x93\x3c\xa8\xb7\xd3\xa5\xed\x73" - "\xe7\x02\xa3\x7d\xbe\x58\x1d\xef\x6c\x88\xab\x63\xf8\x34\x4d\xbe" - "\x4e\xd5\x75\xf2\x73\x71\xb0\x0f\x25\xe6\xc5\x3b\x8f\xa1\x9e\xe1" - "\x41\xea\xd9\x39\x38\x2f\x4e\xe6\xf9\x81\xf0\xa5\xbc\x38\xd9\xae" - "\xf2\x50\xa2\x3c\x53\x85\x3b\x51\x39\x93\xe7\x3b\x43\xac\xd7\x4e" - "\xde\xc8\x73\x46\x51\xe1\x45\xb1\xfc\x87\x3a\x70\x3e\xa6\x5f\x48" - "\xc9\x58\x6e\x87\xd3\x76\xd2\x3e\x8f\x27\x7b\xdc\x93\x5b\xe2\x68" - "\x75\xee\x34\xdd\x35\xa7\x5b\x4b\x6a\x54\xf4\xfa\xfa\x55\x71\x38" - "\x75\x24\xa6\xd7\x5d\x10\x14\x74\x2e\x31\xbd\xee\x1a\x33\x38\xbd" - "\xee\xe2\xf6\x3f\x77\x29\xbd\xee\xca\x8e\xa6\x17\x74\x5b\x59\xbf" - "\x9b\x6c\xe0\x8d\xbe\x5c\xc1\x73\x6e\xa0\x89\xd5\x02\x5e\x51\x79" - "\x3a\x39\xcf\x7a\x4b\x50\xf1\x09\x74\x46\xf3\x59\xba\xab\xc8\xe8" - "\xff\x23\x6a\x68\x98\xe8\x7b\x5c\x00\x5e\x12\xe7\xf3\x3a\xce\x79" - "\xbc\xa1\x4c\x62\x7b\x23\xae\xdc\x23\x89\x65\xc1\x5d\x3e\xd0\xf4" - "\xd5\x04\xe1\x41\xb5\x37\xe4\xeb\x99\xb1\x32\xe2\xeb\xd6\xd8\x36" - "\x02\xdd\x90\x2f\x6a\x4f\xf8\x65\x7f\x97\x6f\xb3\xaf\xbb\x2e\x6d" - "\xb3\x6f\x8c\x55\xed\xf5\x8d\xa4\x58\xfc\xbe\x5e\x93\xb8\xbd\xbe" - "\xde\x34\x78\x7b\x7d\xbd\x65\xf0\xf6\xfa\x7a\x07\xb7\x97\x8f\xbe" - "\x61\x8f\x1d\x37\xbe\x41\xb1\xf5\x45\xb9\xc8\x27\xb4\xa1\x57\xf3" - "\xf7\x17\xad\xb7\xf1\x63\x19\xc7\x6d\x55\x5f\x46\xe0\xe5\xa4\xb1" - "\x8c\xe3\x95\xc2\x18\x14\x36\x68\x58\xb5\x2a\xf1\x7a\x28\xdb\xb4" - "\xad\x35\xc4\x6b\xdf\x64\xbf\x9e\x75\xf6\x6f\x5c\x88\x68\xd4\x86" - "\x77\xed\x34\xdd\xfd\xfb\x88\xa6\x95\xee\x02\x6e\x6c\x8b\xd6\xc9" - "\x39\x83\x29\x69\xd1\x6d\xb1\x89\xf5\xef\x51\xca\x9e\x40\x7b\xfc" - "\xf5\x34\x4d\xd9\xaa\xda\xe5\xee\xd7\x63\xe9\x38\x25\x33\x71\xbb" - "\x4c\x99\x85\x76\xf9\x6b\xe2\x76\x99\x92\x3f\x78\xbb\x4c\xe1\xbd" - "\x01\x7f\xbd\xb4\x1f\x4d\xa9\xd1\xfb\xd1\x3a\xce\x63\x5f\xc2\xf6" - "\xf7\xdd\x29\x9c\x06\xef\xe8\x23\x53\x3e\xe5\xf8\x09\x9d\x46\x3f" - "\x92\x79\x5a\x00\x4b\x96\xaf\xa7\x39\xa2\xc3\x88\x86\xeb\xb7\x74" - "\x26\xea\x27\x77\xcb\x79\xfe\x89\xc5\x64\x06\x0d\x73\x76\x31\x8c" - "\x65\x44\x67\xe9\xee\x27\x38\x1d\x87\x4f\x0c\x44\xf7\x93\xbb\xa7" - "\x18\xe9\x58\xd6\xe9\x69\x33\x45\x4f\x21\x71\xba\x38\xd8\x7a\xfd" - "\x87\xc9\x71\x84\xd3\x73\xba\xb8\x34\xe5\xaa\x3f\xde\xdd\x12\xdb" - "\x1f\xef\x6e\x88\xe5\xcf\x29\x3c\x3f\x61\x89\x40\xce\x81\x97\x03" - "\xc0\xe1\x0b\xf3\xd7\xe5\xfb\xe6\x3d\x63\xe2\xfa\x26\x78\xe0\x9e" - "\xdf\x29\x1e\xb8\x67\x57\x2c\xae\xf7\x4c\x4e\xcc\x03\xf7\xcc\x1e" - "\x9c\x07\xee\x29\x1c\x9c\x07\xee\x59\xcf\x3c\xe0\xa3\x7b\xde\x89" - "\xed\x9b\xf7\xd4\xc6\xd6\x1d\xe5\xca\xbe\x49\x57\x5d\x49\xdf\x84" - "\x2e\x74\xf5\x60\xfd\x50\xee\x5d\x74\xa3\xbf\xf6\x1a\xeb\x17\x5f" - "\x88\x66\x66\xf4\x2b\xe0\xf7\xcd\x6c\x9e\x43\x82\x8c\x9f\xc2\x34" - "\xac\x93\x67\x55\xbe\x99\x1f\x4d\xc7\xcd\xea\xdc\x88\x13\x69\xff" - "\xce\xeb\xc1\x8a\x9e\x53\xdf\x8a\xad\xff\x37\xd7\x27\xa6\xe7\x37" - "\x6b\x41\x4f\x67\x62\x7a\x7e\xf3\xd0\xe0\xf4\xfc\xe6\x71\xde\xf3" - "\x7e\x69\x9f\xfa\x66\xa7\x7d\x85\xd4\x51\x64\x9e\xb3\x34\x75\xe6" - "\x17\x1b\x9f\xa6\x8e\x8b\x1d\x9f\xa6\xa6\x5d\xf9\xf8\x34\xb5\x30" - "\xf1\xf8\x34\xd5\x95\x78\x7c\x9a\x5a\xa3\xfa\xc3\xd4\x63\xb1\xfd" - "\x61\x6a\x53\x2c\x4f\x80\x76\xff\x63\xe3\xd3\x34\x7b\x5c\x1f\xa8" - "\x3c\x4d\xd3\x5e\x87\x4e\xe1\x52\xed\x76\x6f\x41\x2c\x8e\xd3\xa6" - "\x26\x6e\xb7\x69\xf3\xd1\x6e\x95\x89\xdb\x6d\x5a\xf1\xe0\xed\x36" - "\x6d\x23\xda\xad\xf2\xd2\x76\x9b\xd6\x78\xe5\x3a\xc5\xb4\xb6\xd8" - "\x36\x9b\xe6\xb9\xf2\x36\xbb\x77\x4c\xe2\x36\xbb\x77\x72\xe2\x36" - "\xbb\x77\xb6\x6a\xb3\x7b\xd7\xc7\xb6\xd9\xbd\xf9\xb1\x6d\x06\xba" - "\xfd\x83\x6d\x86\xf6\x99\xad\xf6\x15\xdc\xfb\x09\x6c\xf6\x61\x3d" - "\xee\x7b\x4f\xfa\xe8\xbe\x46\x65\x57\xdf\xa7\xc6\x0e\xd5\x86\x07" - "\x90\xe6\xd8\xa5\xe3\xc0\xbd\x41\x3d\xec\x7b\x97\xb6\xc3\x7d\xe9" - "\x90\xd1\x9d\xcd\xa5\x72\x1d\x4b\xb5\x21\xd3\x1c\xe9\x3c\xab\x78" - "\x2d\xea\xbe\xc9\x9c\x17\x6d\x2c\xbc\xc1\x10\xb1\x5c\x47\xfa\x00" - "\xc3\xe1\xb3\x3e\x71\xb0\xf2\xae\x64\x8c\xbf\xcc\x5e\x98\xd9\x9e" - "\xb2\x3b\x00\x2f\xeb\x05\xc5\xab\xf7\xc5\xeb\xbf\xf5\x88\x7b\x48" - "\xf1\xe9\x03\x5f\x8e\xc3\xa1\x3d\x31\x9f\xde\x17\x42\x1d\xea\x13" - "\xf3\x69\x96\x6d\x70\x3e\xcd\xe2\x33\x35\xf5\x51\xb6\xcf\xc8\x27" - "\x43\xbe\x38\xdb\x27\x2b\xc7\x12\x50\xbc\x23\x75\xa2\x8a\xc6\xd9" - "\x3d\xee\xac\x78\xfd\x0f\x6d\x93\x15\x56\x38\xdf\x7f\x21\x2e\xff" - "\x20\xfa\x5f\x16\xeb\x7f\x07\x06\xc1\xf9\x32\xfa\x5f\x16\xeb\x7f" - "\x07\x2e\xed\x5b\xf7\xeb\xfa\x5f\x22\x1b\xef\xfe\x31\x89\xdb\xff" - "\xfe\xb8\xf6\xa7\x9c\x12\xd8\xc3\x32\x7f\x6c\xba\x05\xd1\xe9\x78" - "\x4f\x11\xa7\x65\x1e\x49\x90\xb6\x3c\x1e\xe6\x20\xe9\x9a\x2e\xe1" - "\x3d\xde\x03\x95\x90\xf7\xee\x3f\xa9\xfa\xe3\x03\x93\x63\xfb\xe3" - "\xfd\x81\xd8\xfe\x98\x55\x13\x9b\xef\x81\xf4\xd8\x78\xf0\xcf\xff" - "\x98\x8c\x7d\x60\x7d\x1c\x0f\xbc\x77\x9a\xa6\x27\x29\x1e\x98\xfe" - "\xfd\x38\x3c\x6a\x13\xf3\xc0\x03\x07\x51\xff\xf7\x12\xf3\xc0\x03" - "\xc7\x06\xe7\x81\x07\x78\x7d\xe9\xbd\x68\xbe\x7d\xa4\x34\x6b\x58" - "\x6c\x9a\xe9\xd6\xc4\x32\x6f\x7a\x46\xe2\x39\x82\xe9\x59\x8a\xc6" - "\xd3\x1d\xb1\x34\x9e\x9e\x13\x4b\x43\xd4\xe5\x1f\xa7\x61\xff\x59" - "\xd9\x1e\xf7\xf4\xf8\xfe\xef\x3d\x4d\x33\xf4\xfe\x3f\xf3\xfe\x38" - "\x1c\xdb\x15\x2e\x89\xe6\x45\x66\xb0\xfd\xeb\x4d\x4c\xcb\x19\x63" - "\x12\xd7\x79\xc6\x64\x8c\x41\xde\xc8\x25\x7d\x69\xc6\x6c\x84\x3f" - "\xc2\x73\xa1\x3c\x1f\x52\x87\xf0\x47\x42\x64\x96\xe3\x55\xff\xb8" - "\x34\xa3\x98\xf7\x97\x30\xfd\x99\x7f\x2d\x63\x28\x9b\xc7\x20\xc6" - "\x2b\xb7\x54\xee\x51\xb0\xac\x67\x5e\xbf\x91\x79\x7d\x86\xd4\xff" - "\x78\x5d\x85\xf7\xff\x59\x1c\x94\xed\x0d\x84\xc8\xe0\x77\x4e\x1f" - "\x07\xbb\x85\xfb\x05\xa7\x37\xd2\xaa\x79\x33\x57\x9c\x6c\x9a\x11" - "\x48\xdc\xc6\x33\xd3\x06\xe7\x9d\x99\x19\xaa\x9d\x67\x2e\x88\x6d" - "\xe7\x99\x59\x11\xf7\x88\xf9\x5c\x57\xf0\xc0\x15\xf5\x93\x12\xbb" - "\xf0\x0f\x2a\xef\xd7\x3d\xde\x56\x5c\x46\xd7\x9f\xa1\x99\xcd\xb2" - "\x3c\x4d\x04\x2d\x6b\x93\xa8\x59\xca\x80\x07\xaf\x91\x78\x22\x4d" - "\x6e\x88\x34\xb1\xee\xd9\x36\x8e\xab\x77\x8b\x20\xd2\x1d\xe3\xf5" - "\x00\x3e\x2b\x07\x5e\xb8\xfa\x14\xcd\xfc\x28\x26\xbf\x89\xc8\xab" - "\x60\xd8\xea\x65\x7f\x7c\x30\xdd\x98\xd3\x5d\x3f\xc8\x7e\x20\xa4" - "\x99\x62\xec\x75\x50\x7b\xbd\x1e\x1c\x3f\xe8\xb8\x0c\x9c\x78\x7f" - "\x3c\xe3\x74\x79\x39\xf0\xe0\x46\x83\x7f\xd5\x1e\xc9\x07\x6b\x07" - "\xf6\xe0\x3d\xb8\x07\x71\xd9\x97\x99\x1b\x8c\xea\x07\x0f\x1e\x8f" - "\x86\xa3\xce\x8b\x3f\xd8\x61\xec\xa3\xc3\x7b\xe0\x73\x60\xe9\xf8" - "\x7c\x6b\x4c\x2c\x3e\xdf\x1a\x0f\x3d\xc5\xa4\x60\x7c\x6b\xca\xe5" - "\x60\x70\x9b\x2b\x9e\x65\x7e\xf8\x56\xf6\xe5\xe6\xfc\x92\x6d\x94" - "\xbd\xe5\x12\xde\xfa\x96\xd4\x97\x18\xc6\xe7\xe0\xe8\x89\xb1\x2d" - "\xe4\x5a\x3d\xaf\x6b\xcd\xda\xa4\xfa\xfd\xac\xb8\x39\xc2\x6f\x9d" - "\x94\xfb\xa4\xf4\x7e\xff\x64\x28\xbe\x1f\x7c\x2b\x64\x8c\xd1\xb1" - "\xe1\xb3\xd2\x8d\x7e\x0f\xbb\x96\xe1\xc6\xcd\xb3\xce\x9a\xac\xfa" - "\xc2\xac\x8d\x91\x94\x68\x7b\x6d\x96\xd4\xff\x8c\xf9\x52\xc4\x4f" - "\x8e\xcb\x17\x37\xff\xf7\xad\x93\x62\xf0\x79\xfa\x34\xb4\x6f\x80" - "\xd7\xb5\xd4\xd9\xdb\x59\xef\xc4\xcd\x57\xf8\x37\xcb\xb3\x96\x1f" - "\x00\xee\x43\xba\xdc\xfb\xf6\xed\x71\xe5\x9d\x74\x76\x5d\xae\xfe" - "\xb3\x06\xa9\xff\x43\x03\xf5\x5f\x22\xe1\xc6\xcd\x25\x3e\x24\xeb" - "\x1f\xbe\x44\xfe\x3d\x34\x1b\xf2\xcb\xa0\x1b\x74\xee\x87\x76\x1b" - "\xba\x3a\xcf\x1f\x0c\xae\xab\x3f\x34\x30\xff\xa7\xf2\x0d\xcc\xff" - "\xf9\x13\xe9\xea\x3e\x3a\x1c\x8a\xd7\xd5\x1f\x3a\x62\xa9\x4d\x58" - "\x97\x41\xe6\xff\x1e\xd2\xe7\xff\xbe\x9d\x1d\x2b\xcf\xbe\x6d\x8d" - "\x6d\xc3\x87\xe2\xda\xf0\xdb\x99\xb1\x6d\x38\xeb\xe4\x7f\x77\x5c" - "\x63\xc5\x2b\x39\x39\x59\x4b\x4e\xd2\x92\x92\x11\x8d\x2a\xd2\xb0" - "\x64\x53\xf2\x10\xfc\x86\xea\xcf\x61\x5a\xb2\x66\xc2\x6f\x88\xfe" - "\x1c\x1a\xf7\x3d\x8c\xf3\xe2\x67\xd2\x9f\x43\xe2\xbe\x87\x7e\x4e" - "\xfc\x30\xbd\x5c\xa3\x7c\x53\xdc\xf7\x90\xcf\x89\x1f\xfa\x0f\xe6" - "\xa7\x4b\xbe\x63\xf7\x9d\x3d\xb4\x64\xc5\xc2\xa2\xc5\xf9\x72\xad" - "\xb8\xc0\xbe\xf0\xe9\xa7\x0b\x96\x2f\xb7\x97\x2c\xb5\x3f\x70\xff" - "\xc3\x77\xdc\x63\x57\x4b\xce\x45\xd3\x6e\xce\x4f\xa5\x39\x2f\x2e" - "\xe3\x88\x39\x8f\x3c\x94\x63\xcf\x7e\xe0\xfe\xd8\x48\x03\x8c\x5c" - "\x5a\xbe\x1c\x94\xa8\xfe\x97\x55\x31\x8a\x68\xe3\x28\x29\x7b\xda" - "\x8f\x36\x10\xa9\x39\x8f\xec\xd7\x5b\x60\x8d\x8a\x5e\xa7\xf0\xdc" - "\xc8\xeb\xf9\xb3\x1f\xe5\x4a\x4c\x68\x70\x51\xf1\x22\x3e\x5f\x32" - "\xfb\x79\xf1\xae\x9f\xec\xdf\x26\xed\x14\x3d\xfa\x56\xf3\x2c\xa4" - "\xc5\xb7\xb7\x3d\x44\x76\x27\x99\x91\xff\x3b\x88\x4b\x12\xf7\x46" - "\x10\x16\xd0\xf7\x30\xcf\x5b\x28\xc3\xde\x75\x19\xe9\x2c\xa7\x69" - "\xce\x97\xc5\xbb\x42\x7e\x8b\x7b\xab\xf4\x74\xb3\xff\x1e\x71\xff" - "\xcb\x1e\x96\x0d\xb5\xaf\x92\xa9\xee\x55\xa2\xd7\x46\x92\xf9\xb5" - "\x51\x7c\x06\x7d\xf6\x49\x63\x1d\xb4\x02\xdf\x3e\x7a\xb4\x89\xcb" - "\xe6\xb4\x11\xed\x5f\xfe\x2c\xd3\x8f\x8c\x4e\x3f\x27\x6d\x60\x1d" - "\x76\xf6\x49\x0d\xe9\xe6\x7d\x42\x96\x60\x6a\x6d\x86\xb7\xd4\x45" - "\x96\xb0\xf8\x74\xe2\x2c\x4a\x6a\x85\x64\x5e\x19\x12\x21\xcf\xb2" - "\x33\x28\x7f\xce\xf7\x2d\x2b\xc5\xa7\x5e\x68\xcf\x73\x3a\x9d\x62" - "\x73\x17\x99\xd0\xaf\x93\x3c\xcb\x78\x8f\xc2\x9c\xac\xba\xcf\xc8" - "\x04\x1a\x8c\x39\x43\x73\x8b\x4b\xe7\x88\xb0\x73\x0e\x99\xfe\xd5" - "\xc1\xfb\x0b\x1b\x37\x6f\xfe\x33\x99\x7e\xde\xeb\xd2\x7a\x85\x8d" - "\x4a\x4b\x44\x87\x60\xdf\x14\x01\x11\xe4\xfd\xf9\x2d\x79\x61\x4e" - "\x53\xd6\xe3\xb4\x51\x6b\x49\x80\xd6\x9c\x14\xc1\xf2\x3f\xab\x7d" - "\xfd\x47\x3b\x03\xbc\x5f\xd1\xbc\x66\x0e\x25\x9f\xce\x21\xed\x68" - "\x61\x0d\x79\x17\x04\xa8\xf4\xa4\xe8\x68\xc9\xfb\x84\x5a\x0b\x9b" - "\x28\xb7\x8d\xb4\x96\xf6\x8f\x48\xfa\x57\xd8\xf0\xa1\xbd\xec\x02" - "\xd9\xd6\x2c\xe6\xb0\x0b\xb4\x6a\x0d\x0d\x5f\x75\x82\x2c\xde\x8e" - "\x36\x94\xd3\x45\x8f\x1d\xa7\x24\xc0\xd3\x56\x7f\x44\xb6\xd5\xdf" - "\xe7\xfd\xbb\x59\x54\x5b\x46\x36\xe1\xcc\x48\xeb\x75\x66\x58\x7b" - "\x45\xc6\xc8\x1e\x67\x46\x7a\x6b\x31\xd2\xb7\xff\x8e\x46\xb4\x51" - "\xfa\xbb\x67\xda\xb4\x9a\xf3\x34\xc6\x3e\x97\xdb\x7f\x6e\x51\xed" - "\x79\xa4\xdf\xd0\xd4\x10\x41\xde\xe8\x3c\xa1\x94\xa6\x43\xde\x9c" - "\x20\x45\x00\xab\xa6\x97\xc6\xd4\xf6\x92\x2d\x52\xd1\xd4\xc0\xb4" - "\xe8\xdb\xd0\x98\x01\x59\x38\xec\xc0\x53\x87\x4c\xde\x96\x4e\x3a" - "\x1a\xe8\xa5\x56\xfa\x80\xbc\x8e\xbf\x79\x7e\xfe\xd4\xa1\x21\x11" - "\x30\xbf\x67\x55\x3b\xe0\x2b\x9e\x71\x1e\xe5\x33\x8e\x2e\xaa\x2c" - "\xa3\xb4\xe2\x55\x34\xec\x0c\xc2\x95\x4d\xbf\x3d\xd3\x1b\xfa\x9b" - "\x67\x95\xdc\x73\xfb\x68\x53\xd9\x51\x4a\x6e\x0d\xd4\xf0\xde\x4e" - "\x2d\x9c\xfa\xa1\xdd\x1b\x38\x46\xde\xe2\xbf\x7a\x22\xe6\x0f\xcd" - "\x1b\x23\x64\xde\x7f\xf1\x98\xe6\x35\x5d\x24\x6f\x4e\x80\xde\x43" - "\xd9\x62\xc3\x87\xbc\xe6\x99\xd5\x1a\x08\xf2\x39\xa4\x4c\xd1\x6d" - "\x4b\xad\x5c\x46\xe3\xeb\xce\xd3\xb8\x5d\xe7\x29\x43\xf4\x64\x68" - "\xbc\x8f\xf6\x89\x2e\x2b\xed\xc2\x33\xad\x9d\xcc\xa8\xaf\xda\x43" - "\x9d\xa2\xef\xa7\xed\xcb\xa0\xfa\xde\x81\xfd\xb4\xbd\xdd\x03\xfb" - "\x69\xc1\x4b\x3e\xde\x53\x8b\x7e\x51\xc3\xfc\x5c\x79\x96\x4c\xeb" - "\xce\x12\x4d\x74\x69\x64\x7f\x8a\xcf\x43\x64\xcf\xf4\xe6\x77\xc9" - "\xf7\x53\x34\x2f\x84\x67\x1a\x7e\x49\xe8\x03\x72\x3e\xbb\x5d\xe7" - "\x5b\x84\x69\x08\xfb\x04\xcf\x64\x3c\x3f\x72\xd6\x0a\xbf\x28\xdf" - "\x3d\xa3\x5b\xa3\x54\xe6\x5f\xb5\x77\x77\xf7\x8c\x1e\xf7\x3c\xe8" - "\x3f\xf9\xf3\x0d\x3e\x56\x32\x7d\xb6\xef\xbd\xd3\x5d\xec\xef\xc4" - "\x2f\xf1\xe9\x2b\x4c\x62\xdf\x27\x7a\x38\xe3\x30\x8d\xcb\x3d\x45" - "\xd9\x76\x3c\x2d\xf8\xa1\x5f\xce\x3b\x68\xe4\xed\xee\x2b\x44\x99" - "\xd9\x77\x21\x5c\x18\xe1\xa8\xaf\x89\xe3\xde\x3e\xdd\xa5\xa9\x34" - "\x19\x1a\x60\x06\x75\xf8\xe8\xeb\xb3\xd7\x73\x9f\xee\xd6\x2c\xe2" - "\x70\xfe\x64\xaa\x1d\x25\x8e\xed\xda\x26\x9a\x55\x5f\xcb\x76\xf8" - "\xa8\x20\x8f\x71\xc4\xb8\xdd\xbc\x11\x71\x87\xed\x44\x4c\x97\xe6" - "\x3c\xde\x2f\x96\x5d\xe3\xa3\xd4\x93\xd1\x75\x10\xee\x6f\x97\xf3" - "\xd8\xf9\x66\x99\x67\x88\xd0\xfe\xa5\xbc\xd5\xd7\x49\x3f\xef\xed" - "\x18\xe2\xfc\x23\x69\xde\xd0\x29\x9a\x94\x4e\x36\xd6\xff\xea\xb7" - "\x09\x1f\x9e\x1d\xbc\x7f\x13\x7c\x72\xdd\x19\xca\xfe\xe4\x6b\xe9" - "\x94\xfe\x27\x58\x63\x4a\x1e\x65\x87\xa3\xe4\xd1\x4b\x47\xdb\x0f" - "\x45\xc9\xa2\x47\xef\xba\x54\x16\xcd\xbf\x5d\xc9\x22\x11\x52\xb2" - "\x27\xec\xd3\xc3\xaf\x8b\x0b\xd7\xf7\x84\xcc\x4f\x8a\x0b\x0f\xaa" - "\xf0\x47\xba\xe2\xc2\xfd\x7a\xf8\x04\x43\xd6\xb5\x32\x1e\x2f\xb2" - "\xac\x7b\xe4\x2a\x96\x75\xad\xf9\xba\xac\x93\x7b\x0a\x1f\xbe\x20" - "\x7e\xec\x22\x3e\x6b\x84\xf7\xa3\x8c\xbf\x78\x97\x0c\xdc\x53\x10" - "\xb6\x89\xc3\xaa\x3e\x20\x13\x7e\x52\xce\x09\xf7\xbf\x9c\x63\x39" - "\xc7\x32\x8e\xf7\x9c\xec\x1c\x25\xda\x76\x6e\x13\xc7\x6b\xb7\x89" - "\x96\x1e\xf7\x77\x42\x86\xbc\x7b\x19\x61\x1b\x11\xf6\x32\xe2\x59" - "\xee\x31\x4d\x8e\xe6\x1c\xe2\xf3\xfa\xed\xe0\xe3\x8d\x96\x24\x2a" - "\xde\x0c\x9e\xe7\xf3\x7f\xeb\x41\x5f\x2f\x64\x12\x9f\xdd\x92\x7e" - "\x42\xb4\x4c\xc8\xa8\x76\xee\x6f\xa3\xd6\xa1\x7f\x79\x1d\x9f\x50" - "\x59\x40\x9c\xe1\x73\x70\x8c\x43\xee\xca\x6f\xf3\xf9\xe4\xa4\xe6" - "\x42\x22\xde\xf3\xcd\x7b\x55\x20\x77\x4d\x55\xc0\xe9\x70\x11\xb7" - "\xf5\xc3\xb0\xff\x6b\xaa\x54\x5b\x3f\xda\xc4\x7e\x75\x4e\xd1\x77" - "\x8e\xc0\xbe\x0b\x72\xdd\x2c\x61\x17\xf1\x79\x15\xf4\x51\xb6\xf1" - "\x0a\x77\xe2\x57\x65\x9c\x59\x61\xdf\x48\x48\xe3\x6d\x0b\x12\xe3" - "\xec\xa3\x87\xd3\x8f\x96\x1e\xe2\xfc\x87\x98\x36\xc2\xed\x34\x60" - "\x24\xc9\x33\x2f\x6e\x32\xf3\x99\x17\xa4\x93\x7b\x41\x45\x6a\x63" - "\xc6\xd1\x05\x7e\x62\x39\xef\xed\x00\x8c\xd2\x53\x0a\x06\x60\x09" - "\xc8\xfd\x98\x38\x1d\xfe\xf0\x35\xe2\x53\xc0\x5f\xcf\xed\xc5\xe7" - "\x14\x79\x7d\x0d\x74\x49\xe3\x7d\xf0\x4a\xf7\x7c\x78\x78\xfd\x07" - "\x44\xfa\x59\x4b\xf0\xdb\xc3\x69\x7c\xbe\x88\xcf\x57\xca\xb3\x95" - "\xda\x64\x12\x2f\x66\xa4\xf5\x9f\xaf\xfc\xff\xe1\x6c\x25\xe8\x6f" - "\xab\xd3\x44\x13\xf0\x4f\xe3\xf3\x95\xc0\xbf\x88\xf9\x50\xaf\x93" - "\x75\xeb\x63\x92\xe6\xf3\x39\x0c\xb6\xe2\x11\xa3\xfd\xb9\xbe\x5c" - "\x17\xc4\x4d\x51\x3a\xa1\x38\xe6\xa3\xf9\x56\x8e\x47\xd8\x38\x4e" - "\x3f\x09\x72\xcc\x9b\x1f\xa6\x03\xa7\xc3\x5a\xe5\x2a\x32\x29\x99" - "\xf6\xe8\xad\x9c\x5f\xc9\xb4\xf9\xbe\x01\x99\x36\xff\x84\x92\x69" - "\x8a\xc6\x4a\xa6\xcd\xff\xa3\x92\x69\xf3\x7f\x2f\xd7\xc1\x20\xd3" - "\x38\x8e\xe5\x9a\x21\xd3\x76\x8d\x12\x47\x58\x76\xf4\xb8\xe7\x37" - "\x19\xb2\x6d\x13\xc2\x58\x76\x30\x8e\x4a\x4e\x3d\x62\x16\x1f\x66" - "\x90\xda\x67\xc0\xef\x85\x7c\x36\xa1\x43\x7f\xe7\x71\x64\xac\x92" - "\x71\x8f\x9a\x06\x64\xdc\xfc\xf2\x81\xbc\x2c\xe3\x1e\xbd\x46\xc9" - "\x38\x15\x5e\xff\x18\xcb\xb8\x47\xcc\x4c\x03\x1d\xbe\xc6\x73\x76" - "\x7a\x7a\xa6\xa3\x35\x5a\xc6\xc5\xf6\xaf\x47\x17\x18\x32\x8e\x65" - "\x1b\xbe\x8b\x20\xd3\xa4\x9f\x2e\xee\x67\xd5\xa0\xb9\xd1\xef\xb8" - "\x0d\xb8\xce\xec\x3f\x87\xe9\x36\xbd\x8b\x86\xe9\xe7\x7c\xf4\x7a" - "\x3f\xba\xc7\xd8\xe7\x08\xfa\x37\x25\xd2\x9b\x0d\x3d\x0d\xfc\x78" - "\x43\x18\xfd\xcd\xeb\xc2\x58\x5a\x23\x5c\xad\xa1\xe3\xf4\x64\x09" - "\x69\x91\xe4\x67\x3f\xe6\xb6\x85\x9d\x31\x94\x9f\x2c\x7b\x30\x86" - "\x76\xe5\x06\x68\x28\x6c\xf3\x8f\x2b\x35\xc4\x39\xe8\x9b\x03\x71" - "\xdf\x95\x7b\x3c\xa3\xf2\x4d\x88\x8a\xbb\x59\xea\x78\x67\xd9\x77" - "\xd2\xa3\xc7\x06\xb3\xfd\xaf\x0c\x97\xef\xae\xbc\x0c\x2e\x5b\x2f" - "\x83\x8b\xd4\x03\x26\x74\x52\x12\x6c\xb3\xab\xce\xd2\x77\xe5\x7c" - "\x8c\xf4\x61\xb1\x2e\x61\x39\x1f\xeb\xf1\x43\xa2\xe2\xa3\xca\xfa" - "\x5e\x52\x82\xfc\x51\xe5\x7d\x6f\xec\xe5\xe1\x7f\xef\xfe\xcf\x81" - "\xbf\xf0\x73\xe0\xaf\x65\x19\x08\xda\x59\x22\x5a\x6c\xba\x89\x21" - "\xd9\x07\x8f\xf0\x39\x3b\xa4\x7b\x43\x9f\xf3\xf9\xd8\x39\x56\xda" - "\x82\xf2\x2c\xd6\x66\xc4\x7b\x43\xed\x52\x3e\xcf\x58\x49\xa4\xd6" - "\xa8\xfb\xf3\x7c\x14\x8f\xdb\x88\x90\x81\x9b\x8c\x0f\xc7\xe3\x86" - "\xf8\x09\x03\xf1\x39\xd7\x0d\xb4\xfb\xf7\x6a\x2e\x33\x2f\x99\xe6" - "\x45\x2c\xfb\xa0\x3b\x0c\xf3\x85\x7d\x9f\x54\xf7\xcf\xcf\xe4\x94" - "\x40\xce\x7b\xa2\xf6\xec\x76\x42\xb6\xdf\xd0\x1a\xe0\x73\xa9\x01" - "\xaa\x54\xf6\xf0\x57\x30\x9e\x8c\xe4\xb3\x39\x7c\x4e\x27\x37\x9c" - "\xad\x29\xdf\x38\x39\x4d\x46\xde\xc1\xe6\x81\xb8\x5c\xbd\x4c\xde" - "\xff\x1a\x40\x9e\x76\x23\x0f\xc3\xe6\x3d\x94\x18\x07\x6e\x90\x67" - "\x55\x43\x9d\x2c\x77\xbf\x02\x3d\x79\xa4\x2a\x27\x8f\x54\x39\xdf" - "\xb7\xf9\xe8\xbb\xb3\x2f\x77\x56\x64\xf0\xfa\x7d\x7f\xfe\x95\xd7" - "\x8f\xf4\xfa\x7d\xbf\xea\x73\xea\x77\xb9\x72\x5b\xae\xbc\x5c\xab" - "\x5e\xee\x63\xe6\x2b\xa7\xeb\x63\x53\xbf\x38\x5d\x33\x75\xba\x3e" - "\x56\xfc\x39\x74\x4d\x54\x4e\xe3\x17\x2f\xc7\x6e\x94\xd3\x96\xa8" - "\x1c\x92\x7f\x83\x9e\xe3\x32\x1b\xbe\xdd\xd8\xaf\xa2\xf2\x15\xf5" - "\xb8\x3d\xda\xf7\xa4\xf2\xb7\xf8\xf8\x64\xc3\xf7\xa4\xee\x03\x12" - "\x63\xcb\xe3\xdf\xc9\x6d\x60\x7d\x44\x44\x7c\xf4\xf8\x7c\xf6\x1b" - "\x38\x63\x4d\xb4\x8f\xc6\xc7\x0b\x2f\xe7\xf3\x92\xfd\xf6\x08\x91" - "\x43\x87\x6b\xe4\x7e\x00\x8c\x43\x8f\xbf\xce\xe7\x01\xd4\x7a\xe6" - "\xe3\xfb\x54\x9f\x7c\x7c\x1f\xca\x0d\x0e\x0e\xe3\x40\x55\x63\x59" - "\xe6\x90\xc1\xf6\xf8\x23\x7f\xa7\x8f\x7e\x20\xe7\x2f\xc3\x1b\xf6" - "\x37\x89\x73\x36\xdd\x47\xd6\x93\x0f\x45\xf9\xf0\xc2\xd8\xfd\xc4" - "\x4a\xfd\x2c\x02\x68\xe0\x02\x2d\x17\x8c\x33\x68\x60\x84\x23\x6c" - "\x8a\x41\x03\xe8\x2b\x69\xde\x86\x10\x9f\x15\x0a\xa8\xf3\xdd\x0b" - "\x9e\x10\x15\x07\xf4\x73\xf4\x0b\xd4\x3a\x43\xea\xfe\xa6\xc0\x6a" - "\x9b\x66\xe4\x1f\x67\x77\x7e\xc6\x3c\xec\x4f\x39\xe0\x02\xac\xf5" - "\x06\x7c\xc1\x78\x89\x81\x74\xf5\x72\x5f\xd2\x02\xb4\xff\x63\xa5" - "\x92\xaf\x51\x86\xc4\x5d\xa3\xe4\x08\xf0\x47\x1d\x34\x6f\x71\x80" - "\xf5\xd4\xce\x30\xea\xcf\xb2\xee\xe0\x12\x9f\x89\xd3\x48\xdd\xe1" - "\x5c\x86\xa6\xfc\x8f\x2d\x08\x47\xce\xb1\x8f\x0d\x89\x57\x1a\xea" - "\x3c\x8b\x71\xf2\xe1\xe9\x5f\x9d\x41\xf3\x2e\x90\x4e\x8b\x05\x9f" - "\x44\x10\x1e\x59\x3e\x80\x43\x9d\x3c\xd3\xf1\x44\x86\x81\x43\x84" - "\xcb\xef\xb1\x69\xd0\xc5\xb8\xdc\x0e\x79\xae\x12\x65\x4f\x62\xff" - "\x54\xec\xbb\xe2\xc5\x0c\x62\x1c\x90\x67\x81\x41\x6f\x3d\x8f\x5e" - "\xc6\x13\x69\x11\x59\xb6\xa2\x8d\xa2\xf3\x61\xe8\x83\x4f\x6c\xbc" - "\x94\xce\x4f\x34\x44\xd1\x39\x99\xf9\x8a\xe7\x58\x80\xff\x34\xa6" - "\x37\xaf\x6b\xd8\x57\xb0\x5e\xf5\xc4\xbf\x1d\x0e\xc8\x7d\x27\x69" - "\x0c\x37\x02\xfa\x33\x0c\xc0\xfd\x92\xa2\xf1\x13\x1d\xfd\x34\x46" - "\xd9\x02\x6d\xb1\x4e\x9d\x41\x91\x3e\xea\x7a\xdc\x4f\x9a\xfb\xcb" - "\x61\x5c\x9d\x36\x2d\x22\x6c\xc4\x73\xaa\x8c\x6b\x89\x5d\x04\x59" - "\xaf\x94\xfb\x98\x50\xd7\x83\x65\x6d\x26\xe8\x96\x9a\x2c\xab\x3b" - "\x83\xf5\x7b\xb3\x7c\x47\x59\x83\xf0\xf7\xdd\xec\xd3\xcd\xa8\x17" - "\xea\x62\x66\xde\x02\xee\xd0\xff\x72\xe7\x48\x7e\x59\xc1\xed\x94" - "\x7b\x3b\x87\x19\xe9\xf0\x3d\x84\xd3\x19\xdf\x88\x03\x7f\x3d\xf9" - "\x3e\xea\x95\xca\x78\xfa\xd9\x6f\x8a\xac\x73\x6e\x21\xc3\x40\x3d" - "\x8e\xc5\xd4\xb3\x2f\xc7\x64\xf0\x1d\xaf\x11\x35\xdb\x83\x52\x76" - "\x2a\xda\x3e\x19\x32\xfa\x24\xe7\x57\x7d\x2c\xd7\x1a\xcd\x8b\x01" - "\xe7\x00\x1f\x94\x8c\x25\xb3\xc9\xce\x7e\xe8\x9e\xd4\xfd\xd2\xe6" - "\x4e\x8d\x6f\x2f\x8e\x63\x1f\x71\x3a\x0d\xb9\x3f\x59\x4f\x51\x6e" - "\x26\xd7\x0d\x71\xeb\x2f\x37\x5e\x1a\x7e\xeb\xb6\xa8\x7e\x04\xba" - "\xe4\xbd\xb1\x45\x9d\xe7\x09\x28\x5f\x69\xb9\xfb\x85\xf6\xba\x6c" - "\x2f\xde\x97\x27\xfd\x5f\x48\x5f\x13\xb9\xbc\xc7\x4d\x8c\x28\x7e" - "\x9d\x7d\x0f\xfa\xf5\x3d\x7b\xfe\xe6\xe2\x90\xf4\xb7\xe6\x2c\xe1" - "\x73\xaf\x21\xb6\xc9\xe4\x9e\xb4\xc3\x25\x21\x7a\x24\x28\x69\x1b" - "\xe2\xf3\xe9\x01\x49\x8b\x3c\xb3\x71\x26\x3d\xc2\xb2\xa0\x27\x87" - "\x26\x85\x28\x99\x75\x0a\xbb\x93\x7d\x09\xe4\xf9\x58\x27\x51\x34" - "\x05\xdf\x6b\xe2\x98\xe2\xe5\xbc\xef\xd4\xf1\xf9\x07\xb9\xbe\x74" - "\x0a\xfc\x9d\xfc\x37\xa4\x5d\xac\xe6\x65\x8c\xbe\x96\xf7\x31\xaf" - "\x31\xf9\x74\x18\x28\x0b\xe3\xff\xe3\xc7\x2f\xed\x17\x79\xdf\x31" - "\x6c\x0c\x3e\x07\xa7\xd6\xab\x06\xe0\x21\xbf\x9c\x97\x1e\x90\x4d" - "\x7f\x60\x58\x9e\x4b\xfb\x4c\xde\x71\x83\x97\x8b\x6f\xe4\x73\xd4" - "\xb9\x35\x5c\xfe\x60\x32\x53\x38\xbf\xcf\xed\x64\x3e\x6d\xa7\xe4" - "\x2f\x7a\x56\xa2\xc7\xbd\x70\x8a\x51\x07\x83\x26\xaa\x0e\x0b\x5f" - "\xe9\x4e\x6d\xcc\x1e\xa8\xfb\xc2\x57\x24\x2d\x06\xe2\xff\x18\x45" - "\x1b\xfe\x3e\xa2\xf8\x6e\x61\x39\xf8\x43\x9f\xb3\x51\x61\x22\xf5" - "\xc0\x3a\xf6\x9f\xa8\x70\x5c\x4c\x06\xbf\x23\xed\x41\x1f\x7d\xd2" - "\xac\xd6\xa1\x16\xa2\xfe\x0b\xad\x7a\xbe\x05\x8c\x4b\xc2\x7a\xc6" - "\xe0\xf8\x54\x16\x8f\xb1\xca\x4f\xc1\x53\xf7\x33\xbe\xf6\x5b\xb8" - "\x8d\x9f\x1a\xce\xe5\x32\x4f\x88\xbe\xc2\x21\x81\xbe\x0c\xea\xee" - "\x2b\x44\xff\xc9\xd0\x7a\xdc\x4f\x41\xfe\xb5\x37\xa8\x32\x9f\x9a" - "\x6c\xe0\xca\xb8\x41\x57\x34\xf7\x88\xc5\x89\xe9\xcb\xe5\x72\x7f" - "\xef\x2b\x1c\x86\x9f\x19\xbf\xa1\x5f\x74\x3c\x86\x5e\xdb\xe1\xaf" - "\xd8\xbb\x3e\xb2\x42\x1c\x99\x17\x12\x11\xd8\x05\x1d\x95\xe0\xdf" - "\x11\x6b\x3d\x34\x22\xf0\x84\x96\xbb\x92\xb2\x60\xdb\x92\xb8\x28" - "\xa6\xd4\x45\xf0\x5c\x21\x26\xb3\x3f\x57\x7c\x67\xea\xdf\xe3\xf9" - "\xbb\x7b\x85\x58\x00\x9c\x3b\x8c\xb5\x3b\xe5\x6b\xe6\xa9\x60\xbf" - "\xdf\x9d\xe4\xc7\xf9\x8c\x0f\xcd\x73\xa0\x8c\xe4\x67\x3b\xb8\xdc" - "\x5c\x1e\x3b\x50\x5e\x8f\xfb\x69\x8c\xff\x8f\x97\x70\x3a\x7f\xf2" - "\x6d\x23\xf1\xcb\x18\x64\x8d\xb3\x83\xf1\xea\x4e\xd9\xbb\xde\xc0" - "\x75\x44\x20\x4b\xfb\x62\xb8\x3d\xbd\xde\xc0\x0d\xe1\x47\x2a\x55" - "\x78\x88\x7d\x91\xf1\x1e\x44\xc4\x37\x1a\xb8\x1a\x38\x70\x79\x7c" - "\x8e\x52\xa4\x36\xe6\xb1\x2f\x17\x2e\x8f\xfd\x0d\x22\xed\x31\x03" - "\xdf\xcf\xe3\xe5\xc1\xe8\x0e\xfb\x7a\x8c\xe2\xc9\xfc\x31\xc6\xf8" - "\x85\xf7\x8c\xd8\xf5\xde\x7c\x6b\xbc\x2c\x7b\x6a\xe9\xd2\x92\xdc" - "\x65\x05\xfc\xc8\xb8\xf9\x85\x5b\x53\xa3\x6d\x52\x96\x6f\xca\x17" - "\x40\x7e\x16\xcf\xff\x6c\x19\x69\xac\x5f\xe6\xbb\x8c\x39\x28\x7d" - "\x9f\xf4\x7d\xac\xab\xb2\x4e\x87\xb8\xda\xdf\x97\xae\x61\x30\x49" - "\x1f\x9b\x49\x1b\x4c\x76\xb2\xbc\xe8\x4e\xf9\x4b\xb6\xa4\x47\x45" - "\x97\x07\xf9\xfa\xe7\x3f\x07\xd9\x27\x56\x18\xde\xd0\xe4\xb3\x8f" - "\x96\x3e\x8d\xb4\xb7\x57\xb5\x69\x3c\x86\x97\xe1\x9d\x6d\x27\xa9" - "\x37\xe8\x7e\x72\xde\x3d\xdf\x06\x39\x5c\x90\x21\x2a\x1a\xa1\xbf" - "\x15\xd8\x07\xc5\x21\x6a\x8d\x9d\xf7\x64\xb5\x53\x41\xd6\xa0\xeb" - "\xe1\xe5\xfb\x3d\xaa\x1f\x16\x6c\x6d\xb6\x11\x9f\x09\xfd\xd1\x29" - "\x2a\x78\xc5\x64\x83\xac\x1d\x4d\x3f\xc3\xbb\xb4\x75\x39\x2e\xa6" - "\xbd\xae\xeb\x6a\x30\x25\x0b\x4d\x08\x91\x24\xd4\x1f\x99\xf4\x97" - "\x64\xfc\x34\x91\x24\x57\x8b\x92\x41\xa9\x61\x43\x4d\x64\x19\x91" - "\x66\xbe\xe1\xfa\x31\xb6\xfb\xee\x9d\x3a\xc5\x59\x56\x0a\xee\x0e" - "\x05\x2d\x22\xda\xaf\xd3\x09\xff\xa3\xb7\xba\x48\xee\x17\xa8\x38" - "\x91\x70\xdf\xc1\x26\xb7\x28\xe6\xb3\xb8\x91\xd4\xae\x4c\xe7\x0b" - "\xa4\x1d\xe8\xf5\x69\xec\x7b\x97\xc7\x68\xf6\xcd\x7c\x8a\x16\x8d" - "\x7d\x0f\x61\xa8\xbf\x43\x94\x77\x65\xaa\xf5\xc0\x45\x0b\x23\x1b" - "\xba\x32\x07\xe0\x9b\x88\xe1\x3b\x5f\x23\xad\xb1\xac\x43\xf3\x9a" - "\xee\x25\xaf\x3d\x40\xef\xe1\x7d\x90\xf6\x2c\x06\xfd\x89\x61\xd4" - "\xbb\x23\xe5\xce\xcf\x48\xd3\xcf\xd6\x69\x67\x69\xd1\x6b\x4d\x83" - "\xe4\xe3\xf3\xab\xdd\xa9\x7b\xbf\xdd\xe3\x5e\x84\xf6\xff\xe6\x64" - "\x7d\x4c\x80\xec\x5a\x04\xfb\xaf\x40\x7d\xa7\xee\x7d\xa8\x5b\xfa" - "\xb7\x5c\x14\x34\xd2\x24\x1e\x17\x78\xce\x51\x78\xb8\x5d\xc5\xc5" - "\xbf\x77\xf0\xde\xfd\x41\xd6\xf9\x87\x79\x1d\x77\xf0\x3a\xcb\x90" - "\x11\x41\x4a\x73\x5e\x10\x7d\xb0\xdb\xd3\xc1\xb6\x5a\x18\xb6\x57" - "\xe8\xa2\xc8\x39\xda\x79\x9e\x5a\x03\xc7\x79\x6d\x36\xe9\xcd\x45" - "\x7f\xd0\xbc\xc1\x73\x1e\xef\xfa\x08\xb5\x62\x7c\xf6\xd6\x9e\xf3" - "\x1c\xed\x3c\x8e\xf7\x30\x1d\xa5\x0f\xe8\xa8\xe3\xff\xb8\xe4\x5c" - "\x49\xad\x70\x31\x9d\xfb\x2e\x8a\xf9\x5e\xd3\x5f\x88\xfd\xbd\xb3" - "\xac\x00\xdd\xed\x67\xe9\x07\xbf\x7f\x17\x70\x0e\xfc\x07\x60\x49" - "\x5f\x4e\xd3\xe8\x3d\xbc\xf7\xb8\x7f\xd0\x62\xc8\x91\x84\x7e\x33" - "\x92\x3c\x9b\x2c\x8e\x27\xb4\x08\x64\x12\xfb\xdc\x82\x2c\x9a\xcc" - "\xf5\xc2\x77\x26\x7f\xe3\x39\x9e\x9f\x96\xb5\x9e\x5d\x96\xd0\x13" - "\x2c\xa3\x72\x58\xfe\x20\x7c\x7e\xfd\x45\x29\xb3\xb2\xf5\xef\xd9" - "\xfa\xf7\x2c\xfd\x7b\x86\xfe\x9d\xa5\x7f\x4f\xe5\x6f\x25\xdb\x0a" - "\xf3\xfa\xe5\xae\x36\xec\x18\xbe\x8b\x8d\xb6\x00\x3e\xc3\x2d\x8e" - "\x35\x52\x46\xea\x78\x4c\xd6\xf1\xca\xd4\xbf\x0d\x7c\xae\xb3\x84" - "\xd6\xfc\x4f\xe1\xe3\x8f\xc5\x67\x31\x45\xe1\x43\x16\x47\xd6\x17" - "\xc1\xc7\x6a\x09\x65\xfd\x43\xf8\x30\x2e\x1c\x86\xf2\x5d\x71\xf8" - "\x54\x19\xf8\x24\xe4\xb7\x15\xa2\x83\xc7\x87\xe5\xd7\x48\x5f\x95" - "\xc3\x58\xf6\xd7\xf7\x1a\xfe\xd3\x16\xb7\x5c\xce\x7f\x1a\xfa\x82" - "\x0d\x69\x50\xff\xc5\xb5\xfa\x38\xf8\x8e\xd2\x97\x9e\x31\x19\x7b" - "\x63\x50\xd7\x3d\x95\xaa\xae\xfb\xd6\xb3\x0f\xb1\x95\x74\xad\xd3" - "\x21\x3a\xa0\xff\xff\x67\xb3\xdd\x1f\xd3\x07\x8a\x4a\x96\x2f\x7f" - "\xee\x1e\x7b\xd1\xc2\x25\x05\xf6\x9b\xf3\xed\xcb\x0b\x17\x2f\x2a" - "\x29\x88\x5d\x2f\xb6\xea\xfe\xe6\xe5\x3e\x78\xd6\x49\xb9\x0f\x30" - "\xff\xb3\x1d\xaf\xf6\x2e\x3e\xf3\xbe\x70\x3f\x93\xc9\x63\x43\xdd" - "\xab\x64\xe2\x35\x0a\xe0\x53\x6d\x8c\x09\xca\x6f\x33\x25\x69\x56" - "\xd6\xb9\x9e\x81\xfd\xfb\x83\xf1\x51\xe1\x9c\xd6\x63\x84\x31\x7c" - "\x5d\x36\x0d\x3b\x45\xcf\x2c\xe4\x32\x13\xd2\xf0\xa2\x68\x80\xad" - "\x9b\x04\x7b\x84\x6d\x43\xc1\xfe\x82\xf8\x7c\x19\xf2\x89\xd3\xf4" - "\xec\x55\x2c\x7b\xf9\x0e\x05\xa5\xfb\x0a\xe0\xf8\xec\xcd\xc8\xd3" - "\x88\x30\xd3\x66\xa4\x85\x3e\xdd\xc1\xf9\x10\x3e\x8d\xcf\xf5\x23" - "\xdc\xac\xfb\x40\xe2\xb0\xef\xf0\xb9\x7b\x84\x59\xa3\xc2\x0a\xd8" - "\x5f\x2f\xc2\xec\x3a\xbc\x17\x98\xce\xf8\xce\xd2\x6d\x6e\x4e\x53" - "\xa1\x97\x1b\x63\x3f\xb1\x2f\xf2\x3b\x26\x66\xda\xe7\x3f\xf2\xf5" - "\x69\xf7\x3e\xbd\x74\xc9\xa2\x54\x92\x64\xcf\xc8\x74\xdc\x9c\x79" - "\x87\xe3\xd6\x7b\xec\xc5\x05\x05\xcb\xec\x2f\x16\x2c\x29\xb1\x2f" - "\x7c\x71\xe1\xca\x54\x5a\xb4\x74\xd9\xd3\x7c\x82\x9c\x9b\x65\x79" - "\xee\xd3\x8b\x7e\xc0\x8b\xfa\x2a\x75\x6a\xcc\x78\x3c\x9f\x65\x9b" - "\xee\x67\xe1\x08\x64\x6e\x50\xa4\xbc\xe9\xc2\x3b\xfb\x1e\xb2\xe1" - "\xd9\x8c\xdf\x3b\xf8\x1d\xc2\xef\x38\x7e\xc7\xce\xd0\xf3\xf3\xf1" - "\x3c\xd8\xe3\x2e\x9a\x6c\xe8\x05\x03\x3c\x54\x34\xcb\xe0\x21\x8c" - "\xe3\x07\xd5\xf8\x56\xe4\x68\x0d\xc9\xfe\xd3\xcf\x53\x95\x17\x07" - "\x78\x4a\xfa\x37\xe4\x3d\x2b\x2b\x10\x0f\x1e\x66\x3b\x16\x34\x4f" - "\x61\xba\x9d\xa6\xa5\xcf\xc1\xf6\x67\xbb\x86\xe7\x81\x9a\xc1\x2f" - "\x2d\xca\xdf\x46\x11\xdb\x42\x63\x51\xc6\x3b\x7a\x19\xea\x7b\x94" - "\x38\xc2\x76\xfe\x29\xfd\x5b\xd9\xc4\x4b\x87\xf0\x3b\x3f\xf5\xb5" - "\x22\x0b\xef\xff\x53\xb6\x95\x11\xf7\xdc\x2e\xbd\x0c\x0f\x68\xe1" - "\xaa\x73\x8b\xa0\x61\x83\xf0\x1c\x93\x25\xe9\x3e\x01\x7c\xce\x45" - "\x92\x1f\x6f\x93\x7e\xf9\x5c\xbd\x90\x11\x77\xde\xe9\x75\xc8\xf4" - "\x49\x3c\x07\x35\xb7\x58\x44\xd8\x2f\x6a\x24\xf9\xd9\x36\xce\x27" - "\xcc\x6f\xba\x22\x9b\x87\x67\x29\x5d\x80\xfd\xa1\x3d\xa7\xef\x03" - "\x15\x41\xa6\xed\x19\x2a\xba\x55\xd9\x33\xcf\xcf\x57\x7a\xd6\x73" - "\xeb\x8d\xbd\x64\xe8\xa3\x19\xf8\xae\x36\x64\x80\x8f\x9e\xcb\xd3" - "\xf7\xfd\x78\x54\xfd\x9f\x6b\xd1\xbf\x0f\xe9\x38\x26\xb1\x6f\x07" - "\xe0\x7f\x8c\xdb\x0e\xb6\xe1\x21\xbc\x1f\x07\x7d\x5a\x14\x7d\x9e" - "\x93\x73\x0c\xd0\x6b\x38\xfe\x38\xf2\x1d\x43\xdc\x71\xe5\x43\xe1" - "\x39\x13\xd7\x79\x60\x6f\x60\x6d\x16\x70\x1d\xc2\x6b\x6a\xe8\x4b" - "\x87\xbc\x17\xb9\x7f\x3e\xc7\xb0\x9b\x0c\xb9\xc3\x72\x26\x37\x8c" - "\x7e\x2a\xf5\xd2\x25\x53\x0d\x79\x33\xc0\x07\x4b\xb2\x13\xc9\x92" - "\x44\xed\xae\xe8\xbf\xe4\x37\xc2\xfd\x6c\x35\x70\x6a\x92\x6d\xc0" - "\x7e\x22\x2f\xf6\xeb\xbf\x7d\x4a\x46\x2e\xe9\xd7\x7f\x0d\x3c\xd8" - "\xdf\xad\x8f\x71\xeb\x95\xeb\x9c\xba\xdc\x58\xd2\x62\xc8\x0d\x03" - "\x8e\x25\x49\x44\x2c\x0e\xfc\x2b\xdf\x6d\xe2\x39\x56\x1e\x2f\xa5" - "\x3e\x02\x38\x23\x2e\xa8\x33\x3e\x91\x8a\xdd\x90\x7f\x4b\xd6\x43" - "\xc6\x98\xa4\x8e\xea\x7e\xf6\x67\x03\xb2\x68\xa9\x3d\x1a\xa6\x30" - "\xef\x36\x31\x5c\x96\x47\xac\x93\xe4\x86\x01\x2b\x65\xb7\x49\x1f" - "\x5f\x20\x83\x97\x66\x1b\xb8\x82\x86\x47\x0c\x7c\xf5\x3b\x32\x8e" - "\xa0\x9c\xa6\x79\xe1\x3e\xde\xeb\xda\xac\xda\xf3\x79\x29\x6f\x10" - "\xb7\x0f\x79\x37\xfa\xe8\x19\x9f\xde\x87\x5a\x90\x7f\xdf\xe1\xb2" - "\x19\x48\xb3\x74\x8f\xbe\x5f\xf3\x18\xda\xf7\x78\x14\xef\xef\x8a" - "\xb2\x97\x8f\xab\x36\xbc\xd7\x75\x8a\x96\x76\x44\x85\xeb\x6d\x7b" - "\x38\xfb\x14\x15\xef\x52\xb6\x67\x63\xb3\xca\x5f\x2c\xf7\x6c\x1a" - "\x38\xb2\x2c\xe0\xf3\x48\xdc\xc7\x25\xed\x65\x1b\x17\xdb\x8d\xf1" - "\x02\xb0\x0e\x4a\x9a\x8f\x12\xef\x30\x9d\x94\x2f\x83\x67\xff\xb7" - "\xa2\x53\xf1\xac\x18\xda\xf3\xb8\x89\x72\x98\x4e\x23\xd6\x8a\xc8" - "\x88\x40\x92\xc8\x5d\x69\x92\xbe\x9b\xb9\x8f\xf3\xda\x04\xf8\x43" - "\xea\x55\x8a\x6e\xc5\xe5\x06\xdd\x8c\xb6\x63\x3a\xf9\x68\x69\x90" - "\x69\x1b\x5b\xc7\x61\xc7\x4e\x19\x75\x07\x4d\x79\xbe\x14\xdf\xb5" - "\x7a\xbf\x68\xf1\x8c\xe6\xb5\xf2\xa2\xd7\x0f\x9b\xbe\x4e\x87\x1d" - "\x93\x49\xd1\xb6\x18\xf6\xdf\x33\xb3\x64\x3d\x14\xac\x23\x4c\x5f" - "\xee\x2b\xa2\x7c\x37\xe9\xbe\x84\x8e\xa8\xfd\x1a\x45\xb5\xa2\x62" - "\xb7\x2c\x93\x69\xd3\xad\x49\x7f\xa2\xc7\x98\x46\x2c\x17\xb9\x2f" - "\x71\x1f\xe0\xfe\xa4\x68\xf4\xfc\x8c\x28\x1a\x35\x33\x7d\x74\x3a" - "\x1d\x8c\x93\xe5\x05\xf6\xa2\x69\x4a\x16\xdb\x33\x6e\xce\x9f\x24" - "\x9d\x78\xd8\x1f\x9c\x7e\x8f\x3d\x7b\xda\xcd\x8e\xc2\xf1\x73\xd5" - "\x63\x7a\xf6\x6c\x7e\xa6\xc6\xda\x4f\x76\x94\xb3\x2f\xd6\x06\x7b" - "\x71\xbc\x92\x1f\xcf\x37\xfb\xa8\x57\xf2\x0d\x6c\xe5\xce\xca\xf3" - "\x44\x61\xa6\xe1\x12\xb4\x69\x79\x63\xc3\x3c\xc8\xe0\x79\x2b\xc5" - "\x67\xf5\x08\x67\x9f\xb4\xcc\x8b\x91\x8a\xc6\x06\xb6\x79\xfd\x29" - "\x27\xfc\xf8\x35\xf9\x53\xf6\x2e\x98\x79\xab\x53\xf4\xb8\x97\x59" - "\x8d\xba\xb0\x5d\x2c\x38\xbf\x43\x84\x99\x2e\xb9\x0e\xb4\x37\xf2" - "\xb1\x8d\x8c\x74\x53\x7c\xb4\xc8\xa5\x6c\xc3\x65\xa8\xff\xb3\xed" - "\xba\xfc\xca\xc6\xf7\x7c\x1f\x4d\x92\xdf\x11\xb7\x8d\xe7\xe7\x4c" - "\x91\x75\xb7\x3d\x0c\x1b\xa0\xc9\x80\x09\x58\x43\x75\x5f\x73\x12" - "\xde\x17\xdd\x2b\x18\xd9\xb0\xbb\xc6\x92\xa4\xfc\xda\xa1\x5f\xbb" - "\xea\xb5\x48\x4e\xff\x5e\x00\xc4\x8d\x58\x6b\xe5\xbd\x02\x39\xe0" - "\x37\x17\xa7\x31\xe2\x2a\xdd\x11\x5f\xa5\x16\x09\xa2\xed\xac\x4a" - "\x67\xee\x64\xb9\x06\xfb\x73\x39\x19\x63\x99\x1c\x03\x35\x72\x29" - "\x1b\x66\xb9\x5c\xe3\x3b\xef\x36\x21\xfe\xf9\xda\x1b\xd3\xa5\x5d" - "\x12\x8c\xb8\x93\x48\xed\xcf\x5c\x76\xc1\x90\xab\xbc\xc6\x62\x59" - "\x2b\xfc\x3c\xbf\x66\x09\x09\x3f\xaf\xb7\xc8\xf1\x82\xce\x90\xb7" - "\xb4\xc7\xc5\x7e\x47\xa5\xde\x83\x72\xd5\x58\x11\x56\x63\x05\xca" - "\x87\x2d\x9f\x87\x31\x21\xe9\x0c\x2d\x6b\x66\xfc\x99\x36\x3c\x87" - "\x1b\x01\xad\xbc\x3c\x36\x32\x7d\x52\x7f\x66\xe3\x75\x7e\xae\xab" - "\x25\x84\x3a\x47\xd7\x4b\x8b\xf8\x36\xbb\x51\x2f\x0d\xf5\x72\x74" - "\x31\xcf\x06\x79\xff\x05\xfa\xd8\x28\xe9\x5b\x57\xda\xd8\xcb\xdb" - "\xa3\xeb\xc8\x32\x5f\xd5\xa1\x64\x48\xa2\x3a\x0a\x8d\xeb\x28\x69" - "\xf0\xef\x7a\x1f\x93\x78\xb2\xcc\xe8\xa4\xe5\xa0\x31\xef\x7b\x68" - "\x6c\x00\x1f\x4d\xe7\x36\xc4\x98\x59\xc5\x78\x26\x6a\x2f\x86\xa7" - "\x60\x95\x34\x5a\xd6\xba\xf2\x7a\xdc\x25\xc5\x89\xe9\x5d\xf2\xca" - "\xe5\xe9\x5d\x52\xc0\xf9\x19\x0f\xde\x07\x62\x09\xc1\x40\x07\xdf" - "\xc2\x46\x2b\x4f\x54\xee\x88\xb5\x0d\x8c\x57\xc2\x38\xc8\x9d\xce" - "\x4a\x5d\xee\x80\x0f\xc5\x3c\xfc\x58\x0e\xf5\xb8\x5f\x48\x33\x64" - "\x90\x25\xc9\x9e\x2c\x65\x82\x26\xaa\x12\xc1\xb0\xac\xad\xe2\x7d" - "\x17\xd3\x51\x7e\xc2\x78\xd0\xd8\x0e\x1a\x55\x45\xd6\x7d\xed\x46" - "\x4b\x12\xdd\xe7\x4f\xfe\x5a\xaa\xc5\x11\x1a\xc7\x34\x04\x4c\x07" - "\xfa\xee\x35\x6c\x9b\x2a\x5f\x58\x2f\x60\xfc\x7f\x49\xfa\x96\xf1" - "\xa7\x34\x56\x29\x7f\x59\x2f\xd4\xf8\x68\x63\x86\x31\xaf\x89\xef" - "\x3d\x3e\xfa\x20\x4d\xf5\xcb\x6b\x77\x88\x0d\x7b\x33\x22\x6e\x8b" - "\xb0\xaf\xb2\x40\x77\x5c\x71\x7f\x44\x64\x68\x22\x75\x6f\xc6\x00" - "\x9f\xa8\x3d\x21\x06\x9f\x20\x7f\x47\x62\x1e\x58\x91\x72\x79\x1e" - "\x78\x41\xae\x17\x33\xdd\x95\x7d\xb2\x22\xd3\xd0\x4d\xc4\xba\x6b" - "\x77\xd8\xcb\xb8\xfc\x17\x9a\x55\xd9\x4c\x93\x2c\x9e\xab\x9f\x0d" - "\xba\xb8\x90\x76\x81\x21\x07\x98\x5f\x2c\x61\x4a\x62\x59\xc4\xbc" - "\x82\x38\x07\xe4\x4c\x9b\x9a\x43\xdc\xeb\x93\x77\x2c\xb9\x9f\xcf" - "\xf3\x3b\x0b\x77\xf2\x1e\xce\x40\xca\x6e\xe8\xfb\x2b\x6a\x7d\xf4" - "\x4b\x25\x8b\xcc\xbb\xc1\x73\xbb\x4d\xd5\x23\x31\x2e\xab\xbd\x4c" - "\x69\xdc\xa7\xd9\xe7\x0d\xf7\x6b\x84\xa5\x03\x6f\xf6\x7f\x03\x1b" - "\x67\x45\xbf\xff\x9b\x88\x3b\x0b\xb2\x42\xc8\xf1\x13\x63\xd1\x98" - "\x6e\xd0\x6e\xab\x16\xd9\x73\x71\x92\x8d\xb8\xce\x17\xd7\x8d\xde" - "\xf3\xa3\x89\x64\xfa\xdf\xb6\xa7\xa8\xf8\x0e\x4a\x5f\xfb\x75\x13" - "\xfd\xd7\x14\xd2\x98\x0e\x3e\x5a\xd1\xae\x68\xf7\xe2\x38\xa3\x7d" - "\x7c\xf4\xc2\x46\x6e\x0f\x9e\x7f\x9b\x17\x12\x9f\xa9\x39\xc2\x17" - "\x21\xff\xf2\x49\xc5\x3f\x7f\x28\x7e\xde\x87\x75\x78\xfb\xe2\xe5" - "\xf6\xfc\xa5\x2f\x2e\x19\x3b\x36\xc6\x3e\x32\xc9\x73\x1d\xee\x17" - "\x73\xd4\x18\xfa\xe2\x46\x03\x6f\xd6\x45\xf0\x8d\xfa\x3f\x5f\x1d" - "\x6f\xcf\xcd\xce\xd5\xb7\xee\xe6\x66\xd2\xc0\xfb\xed\x34\xfb\xf6" - "\xa8\xcf\x3b\x69\xf6\x1d\x77\xe6\x3e\x5c\xb0\x30\x7f\x65\x54\xe8" - "\x5d\xd1\x73\x72\x95\x3b\x50\x76\xf2\xe8\x07\x20\x2b\x92\xe6\xae" - "\xe6\xf1\xc4\xb1\xb6\x2c\x24\xfe\x06\x79\x3d\x05\x7d\x2c\xf7\x68" - "\x49\x88\x8e\x42\x96\x89\x6b\x59\x86\x0f\x53\xe7\xd5\xa0\x43\x81" - "\xb7\x2c\xa8\xbb\x1f\xba\xdc\x05\x9e\x93\x41\xbe\xdd\xad\x35\xec" - "\x6b\x76\x6f\xbe\xd2\x2b\x1c\x79\x08\xbf\x0a\xcf\x0a\x3c\x87\xe2" - "\xb9\xc9\xbe\x04\xb6\x0e\xef\x0f\x5e\xc1\xfb\x83\x1d\x2f\x30\x8d" - "\x26\x06\x5c\x34\x71\x19\xeb\xe9\x0e\x1b\xeb\x1d\x3e\x72\x1c\xe1" - "\xf5\x01\x4e\x8b\xb0\x85\xf6\x67\x28\x93\x9f\x42\xae\xab\x38\xf2" - "\x44\xc5\xde\x7c\xb1\x33\x87\xef\x70\x19\x87\xf0\xf7\x93\x93\x3e" - "\xa6\x64\xdb\xb0\xfb\x7b\xdc\x0e\x8c\x7f\xf9\xb2\xdf\x0e\x76\x5f" - "\x1a\xeb\x1a\xdc\xe7\x07\x74\x11\xe8\x82\xd0\x45\x72\x1d\x1b\x08" - "\xef\xa6\x01\x3d\x64\xa5\xb5\x5f\xa7\xd5\x28\x15\xdf\x76\x83\xdf" - "\xf1\x3e\xde\xe0\xc7\x18\xbf\x60\x4b\x4a\x0a\x96\x15\xe4\xdb\x6f" - "\x5e\x9e\x4a\x51\x5e\xc1\x0a\x0b\x96\xd8\x97\x15\x3c\xff\x42\xc1" - "\x72\xe9\xd1\x8b\x63\x63\xc6\xf3\x74\x91\xba\xa7\xc6\x38\xb3\x62" - "\x1f\xcd\x74\x5c\xf9\x0a\xfb\x92\x12\x1b\xde\xb0\xf1\xba\xa7\xb2" - "\x25\xba\x66\xc5\xda\x12\xab\xc7\x29\x1d\x6e\xef\x7c\x65\xc7\xac" - "\xfa\x0d\x7f\x9f\xa2\x55\x53\x07\x7c\x4e\xaf\xec\xe2\xfb\x0f\x74" - "\xfa\xfc\x19\x78\xb7\x1b\xf4\xf1\xd1\x6a\xe3\x1c\x41\xa7\x94\x13" - "\x18\x4b\x21\xe7\x62\xc6\x51\x75\x1f\xda\x4a\xde\x3b\x90\x2c\xe7" - "\x64\x53\xf6\xe6\x70\x59\x0c\xf3\x34\xf2\xa3\x1d\xe6\x43\x3e\xb2" - "\x1c\x2b\x37\xe0\xa1\xcc\xe3\x5c\x9e\x6e\xe3\x7c\xe5\x0c\xad\x92" - "\x6b\xd6\x91\xf2\xbd\x39\x2c\x3b\x26\x4a\x9d\x03\x70\xe4\x3a\xd6" - "\xea\x22\xd6\x1f\xa5\xdf\x73\xc0\xe2\x39\x58\xc8\x80\x42\xbe\x3b" - "\x8f\xc3\x94\x4f\xab\x95\x53\x78\x9e\x18\x65\x41\x9f\x58\xd5\x38" - "\xb0\x2f\x7b\x75\x11\xeb\x94\x0c\xd7\x47\xab\x0a\x19\x9e\xf2\xd9" - "\xb5\x0a\xba\xf5\x8b\x1d\x03\xba\xd1\xea\xb4\x28\x9b\x0b\xf8\x28" - "\x3c\x03\xc0\x45\xfa\x84\x54\xfb\xe6\x64\xbd\x59\x4e\x56\xeb\x75" - "\x37\xea\xd3\xe3\x5e\x6d\x03\xcf\x1d\x37\xd6\x5d\x7d\x7a\xbd\x19" - "\x3f\xc6\x3d\x1a\x67\x1d\xdf\x19\x8c\x2f\xf2\x65\x47\xf5\x61\x9e" - "\x73\x19\x82\xb0\xfc\x81\xfd\xb8\x2b\xf7\xc5\xcb\x87\x07\x16\x3e" - "\xfd\x2c\x1b\xe9\xb3\x33\xc7\xdb\x59\x56\xe4\x3e\x3c\x73\xfa\x77" - "\x73\xa7\xcf\x7b\x74\xee\x7c\xb9\xff\xbe\x3f\x7e\xc6\x92\xc4\x09" - "\x62\xf9\xca\x0a\xde\xc8\x46\x7b\x0d\x39\x45\x65\x76\xe5\x8f\x79" - "\x75\x47\xac\x3f\x66\xbe\x26\xab\x74\x0c\x7e\x53\x88\xd6\xd8\xf1" - "\x83\x1e\x59\x96\xae\xf3\xcb\xe9\x1e\x77\x69\xfa\x00\xbf\x94\xc9" - "\x39\x6f\xde\x97\xa0\xe6\x52\x4b\x21\xff\x57\xe6\x47\xc7\x0d\xd8" - "\x7e\xa5\xb3\xfb\x6d\xbf\x7e\x59\x50\xea\x30\xec\x40\x84\x2d\x80" - "\x0d\x98\xc2\x36\xa0\x9a\xfb\x29\x93\x3a\x56\xbc\xad\x36\x60\xa7" - "\x99\xc9\xb0\x01\xd9\x17\x24\xaf\x7b\xaa\x3e\x5a\x7a\x30\xca\xc6" - "\x0a\x48\x5f\x81\x17\x95\x4d\xc8\xf9\xe4\x5c\x9b\xb9\x6b\x32\xcf" - "\x3f\x43\xaf\xcd\xc6\x18\x8f\x71\xa7\x47\x88\x94\xae\xc9\x3a\x4e" - "\x01\x9e\x8f\x66\x7d\x57\xd9\x7b\xab\x1d\x2c\x7f\xc5\xba\xd1\x0f" - "\xcc\x0b\x4b\x3f\x6a\x90\xbd\x6b\x6c\x03\x3c\x57\x66\xe7\xb6\x64" - "\x1a\xf8\xa8\x74\x1c\xe8\x60\x1a\xa8\xf3\x9a\xac\xfe\x3a\xeb\xf3" - "\x18\xc6\x1c\x86\x2a\xab\x6c\xec\x60\xf5\x4b\x5c\xb7\x35\x55\x9f" - "\x5b\x37\x37\x0d\xe1\x7e\x61\xd4\xf1\xd2\xfa\xad\x39\x1e\x57\xbf" - "\x9a\x04\xf5\x0b\xf6\xaf\xbb\xf4\xcf\x4b\x94\x8d\xe5\x7a\x32\x1f" - "\xa0\x9e\xe6\x64\x9b\xd9\x1e\xf5\x7e\x4b\x22\xb9\x3a\x62\xad\xa6" - "\x9f\x01\x29\x7b\xa1\x79\x8c\xb4\xd3\x82\x5b\xb4\x48\xe1\x16\x37" - "\x7e\x78\xb2\x9e\x3d\xa0\xab\x8a\xa0\x4e\x93\x92\x66\xc8\x5e\x9e" - "\x6b\x19\xec\x6c\x1b\x68\x76\xd2\x98\x07\xc0\x7b\x1b\xdb\x93\xf3" - "\xc2\xf7\x09\x0e\x67\x1a\xc0\x26\xf1\x83\xaf\xda\x94\xde\x56\xd6" - "\xdc\x2f\xb3\x6f\x99\xea\x4a\x5e\x4b\xf6\xc3\xb5\x77\x70\xf8\x49" - "\xb4\x9d\x9c\x1b\x94\x77\xd7\x0d\x02\x33\x37\x9c\x45\x89\xe1\x3a" - "\xc7\x18\x70\x07\x3b\x07\x19\x1d\xb6\x74\x89\xbd\x70\xe1\x92\xfc" - "\xa5\x8b\x16\x8d\xb7\xbf\xb0\xe4\xa9\xa2\xa5\x4f\x3f\xcb\x82\x7f" - "\x79\xc9\x0b\xe8\xbf\xb2\xdf\xce\x98\x3d\x3b\xf7\x81\x47\x1f\xf9" - "\x7e\x8c\x0e\x60\xae\x72\x47\xca\xe5\x5d\x59\xeb\x9e\x59\x85\x32" - "\xd1\xfe\x8b\x0e\xa9\xf1\xc6\x89\xf1\xff\xa9\xd9\x4a\xd7\x7a\xbc" - "\x43\x9d\xfd\x74\x06\xa3\xe4\xda\x88\x33\xe4\x82\xfe\xe0\xcc\x1a" - "\x98\x03\x71\x1e\x8b\xd6\x21\xba\xe5\x7d\x75\xce\x76\xc3\x0f\x42" - "\xc9\x58\xd2\x4c\x63\xab\xa8\x5a\x13\x2e\x1f\xb9\xcc\xb0\x17\x4f" - "\xf6\xb8\x5d\x26\xe8\x86\x6d\xba\xfd\x78\x92\xd7\x58\xd9\x7e\x0c" - "\xc3\x96\x9c\xb7\xd2\x73\x5f\xee\xca\x24\xde\x43\x2c\xef\x49\x08" - "\x5d\x14\xed\xbc\xce\xc9\x6b\x46\x7c\x4f\x42\xe5\x33\xd2\x9e\x4c" - "\x96\x69\xf0\x5e\x79\x9a\xd4\x3d\x37\x21\xb2\xd7\xe3\xbd\x4e\xda" - "\x1f\xae\x7c\x43\xf7\xb4\xac\xb5\xcb\x33\xa9\x9b\x55\x7b\xb4\x71" - "\x5b\x70\x79\xb9\x2b\x3d\xaa\x0c\xb4\x01\xf2\x5a\xd4\xbc\x8f\xab" - "\xf6\xb2\xf3\xd9\x29\x27\x06\x3b\x1b\x09\x9e\x77\x0d\xdb\xa2\xfc" - "\x13\xf3\x3e\x38\xbf\xb1\x0f\x8b\xf7\x64\x01\x6e\x20\x7e\x4f\x97" - "\xda\x97\xb0\x36\xcd\xd8\x0f\x82\x77\x5b\xbf\xbe\xcc\x77\x6b\xc0" - "\xce\xb1\x97\xad\x1d\x7a\x96\x5c\xff\x5e\x3f\xc8\xbc\xb2\x71\x06" - "\x55\xdf\x37\x35\x0c\x30\xfa\xef\x3f\x16\xf8\xae\x1f\x35\x80\x07" - "\xe2\x1c\xc6\x7e\x22\xb9\x87\x0c\x63\x16\xdf\xdf\x71\x9a\xd6\xbe" - "\x26\xef\x0b\xb9\x91\xe7\x84\xd7\x1e\x6a\x96\x7b\xd9\xd6\x36\x46" - "\xe3\xa2\xf0\x58\x5b\xc0\xf3\x96\x1c\x1f\x8d\x8b\x63\xe1\x0b\x8b" - "\x27\x39\x16\x2d\xb6\x3f\x5d\xb8\xb8\x38\x77\xb1\xf4\x19\x2a\xdd" - "\x91\x96\xac\x2c\xe6\x59\xfa\x5b\x53\xe3\xc6\x0a\x7d\xdf\x59\xff" - "\xfe\x1a\xb9\xf7\xcc\x7d\x1d\xe8\xa1\xa9\xbd\x67\xeb\xac\x6a\x3c" - "\x74\x67\x5c\xba\xcf\xc2\x3d\xd5\xd8\x67\x01\xbe\xb2\x56\x2b\xff" - "\xe4\xfa\xde\x0c\xe6\x3b\xf7\x82\x04\x79\x8a\xfb\xf7\x19\xf1\x7e" - "\x97\xbe\x1c\x79\x46\x40\xfa\x92\x7e\x95\xdb\x6d\x6d\xb3\xd7\x31" - "\x93\x7d\x63\xea\xfc\xec\x6e\x30\xf8\xd9\xd8\xa3\xc6\xb0\xf8\x8c" - "\xc2\xa4\x60\xf4\xfe\x94\x75\x43\x30\xb6\xd8\xfa\xeb\xb1\x5a\x23" - "\xc6\x3d\xa0\x79\x18\x8f\xf6\x78\x3c\x80\xdf\x58\x84\x47\xed\xff" - "\x31\xea\xb9\x0e\xfa\xdf\xba\xfc\x78\x9e\xbb\x7f\xe6\x6c\x28\x73" - "\xcb\x0b\x4a\x52\x69\xfa\xc2\xa2\x22\xee\xd7\x0b\x0b\x8a\x5e\x58" - "\xb6\x74\x79\xee\xe2\x25\x8b\x11\x7a\xff\x22\x76\xe5\x2a\x93\xdc" - "\xa3\xc7\xd8\x97\x14\x14\xe4\xab\x20\xbd\x19\x62\xd7\x46\xd4\xfa" - "\xf7\x3a\xf4\xc3\xb5\x53\x06\xf4\x96\x75\x6d\x42\x5b\x37\x06\xbf" - "\xaf\xca\x3e\x2d\x75\x8a\x75\x8d\xb1\x76\xc1\xba\x83\x06\x3f\xc8" - "\xf6\x73\xf2\x1e\x91\xc6\xbb\xbb\x85\x5c\x4b\x40\x9b\xbd\xc4\x77" - "\x50\x0f\x81\xcd\x62\x66\x7d\x38\x0a\x4e\x67\x3f\x2d\xd7\x3d\xde" - "\xc6\xbc\xc8\xf0\xd0\xdf\x4c\x7c\x36\xbb\xc7\xbd\x1e\xfc\xef\xf2" - "\x28\xfe\x5f\xdf\xcf\xff\xdd\x5a\x32\x6c\x9c\xf5\x19\x86\x1e\x1c" - "\xdb\x67\xd6\x67\x5d\xda\x97\x78\xcf\xe0\xfa\x1c\x83\xb6\x46\x3b" - "\x2b\xde\x5a\x7f\xc1\x98\x9b\xac\xd7\x7d\x89\xf3\x3b\xe7\x65\x1d" - "\x57\x8c\x18\x7e\x1f\xef\x81\x3e\x45\xeb\x9b\x15\xbf\xac\x6f\x88" - "\xda\xcb\x63\x3d\x43\xeb\x3d\xaa\x9d\xd6\x1f\x32\xf0\xf3\xd1\x7a" - "\xd6\x6c\xe4\x1d\x85\xaa\xef\xaf\x9b\xa6\x78\x67\xfd\x49\x83\xb6" - "\x6c\x37\xe2\xbb\x73\x60\x4c\x5f\xb7\x91\xc7\x3a\xfd\x6c\x7a\x1f" - "\xd7\x1f\x70\x8a\x0c\x38\x3d\xee\x97\x50\x7f\x73\xb3\x41\x2b\x23" - "\x4d\x34\x4f\x4c\x5f\x58\x0c\xa3\x6e\xf1\xa2\x45\x05\xcb\x96\x1b" - "\xbe\x7a\x33\x96\x16\xe5\x2b\xdf\xbc\xf7\xa0\xf9\x5f\x44\x0f\x9c" - "\xc6\xee\x7d\x11\xaa\x5e\xe3\x6c\x80\xf1\x6c\x87\xcb\xfd\x5e\x52" - "\xff\xaf\x58\x5b\xa7\xdb\x02\xa7\xe8\x87\x2e\x3c\x21\x0f\x7e\x78" - "\x97\xd2\xcb\x52\xfe\x0b\x38\xed\x33\xf4\xb2\xee\xa1\x53\x60\x5f" - "\xbf\xf4\x8e\x71\xef\x92\xa1\x2b\xf0\x59\x14\xcf\x12\xf6\x75\x5e" - "\xf1\x49\xa4\xa2\xd1\x25\x52\xb7\xf0\xdc\x6e\x1a\xf3\xfd\xf0\x4e" - "\xf6\x83\xce\xfe\x62\x7e\x28\x75\x19\x96\x25\xec\xd3\xbc\x9d\x5e" - "\x6a\xe3\xbb\x8f\x7d\x54\xd1\xe1\x4f\x69\x74\xad\x5f\x45\xe6\x5d" - "\xdb\x44\x3b\xdf\xd7\xda\xdc\xc0\x74\xfc\xe1\xb8\xdf\x97\xaa\xfb" - "\xa8\xf9\x1e\xdf\x4d\x88\x03\x6f\xf9\xf5\xb9\xe4\x6a\x7d\x1e\xaf" - "\x1a\xe9\xa0\xff\xa5\x1d\x52\x7c\xb9\x35\xf7\xab\x2e\x72\xc8\x7b" - "\xd3\xdc\xbc\x0f\x68\x8b\x9f\xcf\xc8\x89\xf2\xad\x79\x8c\x2b\xf4" - "\x19\x3f\xf4\x20\xe4\xdb\x9a\x07\x58\xfb\x22\x15\xfb\x3d\xca\x57" - "\x34\xf3\xc8\x4b\xb5\x5c\x67\x99\x8f\xe7\x0c\xcb\x1b\x6b\xe5\xfd" - "\x6a\x15\x8d\x0e\xbd\xac\x5a\xe8\x75\xb3\x59\xb7\x13\x17\xbb\x1a" - "\xa0\x5b\xf2\x38\xe6\x1f\xb1\xd6\xc7\x3e\xae\x4b\x79\xfe\x73\x44" - "\xe0\x06\x01\x79\x30\x3c\x37\x64\x25\xe3\x3e\x25\x9e\xff\x54\x3a" - "\xd6\x0f\x03\x03\x73\xcd\xc8\x7f\x91\xd2\xc0\x9b\xae\x76\xfa\x91" - "\xdc\xff\xc4\x7c\xc9\x74\xec\x05\xed\x24\xde\x17\xbb\x9a\x60\x93" - "\x0e\x3f\x4d\x3f\xba\x9d\x69\xc8\x6b\x80\xbc\x77\x07\x61\x16\xf6" - "\x23\x7d\x8a\x7e\x74\x1d\xd3\x8f\x61\x89\xf2\x6a\x4f\xa8\x27\xe7" - "\x5b\x7c\x9e\x90\x65\xd3\x9a\x52\xe8\x81\x8b\xb8\x5f\x97\xbf\xce" - "\xb6\x1d\xdf\xf7\xc1\xef\xce\x7c\x11\x91\xf4\x5f\xc5\xf4\x2f\x7f" - "\x7d\x4d\x87\x88\x7c\xe6\x26\x71\x24\x40\xf4\x99\x46\xa1\xa0\x96" - "\xc4\xeb\x25\x9a\xb3\x8b\xcf\x3c\x36\x90\xd7\x51\x4e\x28\xd7\xbc" - "\x79\x15\x59\xf9\x8c\x28\xdf\x65\xd1\x1a\xa8\xa5\xd6\xe2\x5a\xfa" - "\xd7\x50\x35\x79\x56\xf0\x99\xff\x8a\x59\x7f\x72\x54\xf3\xba\x4a" - "\x0a\xde\x53\xec\xdf\xe5\xb2\x7e\xe4\xfb\xd3\xf1\x3f\xd3\x9f\x3c" - "\x7f\x26\xfb\x63\xf2\xdb\xdf\x92\xf3\xaf\xd4\x92\xf5\xaf\xe4\x6c" - "\x17\x11\xb6\x0f\xca\x9e\xe3\x32\xca\x01\xab\x81\xcf\x56\x5a\x23" - "\xdd\xb6\x54\xd4\xdf\x34\xcf\x41\xd4\x1a\xf0\x83\x9f\xfe\x17\xe3" - "\xf8\x7c\xdd\x79\x32\x7b\x96\xfc\x41\xbe\x2b\xbd\xbd\xab\xc1\x9b" - "\xdf\xc6\x3a\x53\x88\xcf\x92\xf2\x3a\x14\xf4\xde\x48\x25\xe3\x18" - "\x56\x78\xf3\x9d\xcc\x46\x7e\xe8\x54\x46\x7e\x79\x56\x7e\x17\xd3" - "\x03\x38\x1d\x9d\xaf\x68\xd2\xd2\x06\x9a\x7e\x57\xa7\x4f\x4e\x34" - "\x7d\x7e\x54\xc5\xf4\x61\x3f\x84\x91\x15\x5d\x0d\xc0\x2d\x0b\x34" - "\x88\x18\x65\x70\xfb\xeb\x73\x78\xe6\xcd\xe7\x29\xcd\xb3\x84\xef" - "\x25\x2a\xbf\x60\xc9\x36\x99\x23\x17\xcf\x36\x55\x5e\x20\x13\xb7" - "\x1b\xcf\xd5\x57\xca\x78\x49\x73\xc9\xf3\xd1\x77\x83\x33\x1f\xf2" - "\xfd\xe0\x68\xaf\x72\xe0\x50\x8c\xb6\x6a\xe0\xa7\xe2\xf3\xad\x79" - "\x7c\xd6\x5e\xd7\xeb\x07\xc2\xc1\xe7\x21\xbe\x7b\x50\xce\x51\x94" - "\x17\x33\x1f\x4b\xdb\x5e\x7b\x29\x73\x17\x64\x4e\xed\xab\x72\x5d" - "\x3b\xad\x6e\x24\x59\x59\x06\xef\x90\x7b\x89\x2b\x4a\x0c\x39\xb4" - "\x61\x14\x9f\x4f\x2a\x6f\xd0\xe4\xdd\x72\x8d\x35\x3a\x7f\xd7\x20" - "\x4d\x8d\x8f\xd2\x4f\x2a\x59\x5c\xd1\x68\xf4\x2b\xe8\x4c\x7e\x83" - "\xf7\x81\xab\xc3\xcf\xfc\x2e\xf7\x24\xf8\x60\xcf\x5a\xe4\x5d\x8a" - "\x03\xf7\xa9\x55\x9c\x34\xf8\x1c\x75\x6b\x62\x99\xc1\xfd\x7b\x30" - "\x9d\x1b\xfa\x5e\x8b\xd8\x99\xc3\xf7\xd5\x53\xda\x5a\xe1\x4f\x6b" - "\xb7\x08\xbe\xa3\x92\xcf\xb6\xf1\xbd\x89\x75\x08\x47\x7c\xd2\xdc" - "\x80\xdf\x02\xfd\x90\xef\x64\x32\x19\xe1\xbc\xd6\xc0\x73\x33\x73" - "\x03\xc2\x3f\x6f\xa5\x85\xef\x76\x1b\x23\xe7\x9f\xf5\xf0\x56\x1b" - "\xaf\x41\xf8\x2d\xa0\x5f\xa8\x1f\x56\x77\x4e\x32\xe3\x89\xb4\xe9" - "\xfd\x69\xbb\x73\x4c\x5e\x87\x2a\x33\x2a\x6c\xc8\x3c\x07\xf2\x72" - "\x7b\xeb\x61\x4a\xaf\xdc\xf0\x4e\xbf\xad\xc4\x3e\xfb\xba\x31\x0e" - "\x2e\xcf\x49\x8a\x74\xe7\x68\x61\xc0\x46\xff\xb1\xca\x3b\xe6\x42" - "\x7e\xfd\x9e\x97\x0e\xc8\x81\x36\x12\x15\x5d\xd9\x48\x67\x62\xb8" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 18:09:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 279C110656C4; Tue, 23 Jun 2009 18:09:36 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1549C8FC1D; Tue, 23 Jun 2009 18:09:36 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NI9ZaW085483; Tue, 23 Jun 2009 18:09:35 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NI9Zan085480; Tue, 23 Jun 2009 18:09:35 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200906231809.n5NI9Zan085480@svn.freebsd.org> From: Robert Noland Date: Tue, 23 Jun 2009 18:09: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: r194748 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 18:09:37 -0000 Author: rnoland Date: Tue Jun 23 18:09:35 2009 New Revision: 194748 URL: http://svn.freebsd.org/changeset/base/194748 Log: Using signals for vblank events is prone to issues. There have never been any consumers and likely will never be. Furthermore, we have never enabled the code for it, so just get rid of it. MFC after: 3 days Modified: head/sys/dev/drm/drmP.h head/sys/dev/drm/drm_irq.c Modified: head/sys/dev/drm/drmP.h ============================================================================== --- head/sys/dev/drm/drmP.h Tue Jun 23 18:00:43 2009 (r194747) +++ head/sys/dev/drm/drmP.h Tue Jun 23 18:09:35 2009 (r194748) @@ -502,19 +502,10 @@ typedef struct drm_local_map { TAILQ_ENTRY(drm_local_map) link; } drm_local_map_t; -TAILQ_HEAD(drm_vbl_sig_list, drm_vbl_sig); -typedef struct drm_vbl_sig { - TAILQ_ENTRY(drm_vbl_sig) link; - unsigned int sequence; - int signo; - int pid; -} drm_vbl_sig_t; - struct drm_vblank_info { wait_queue_head_t queue; /* vblank wait queue */ atomic_t count; /* number of VBLANK interrupts */ /* (driver must alloc the right number of counters) */ - struct drm_vbl_sig_list sigs; /* signal list to send on VBLANK */ atomic_t refcount; /* number of users of vblank interrupts */ u32 last; /* protected by dev->vbl_lock, used */ /* for wraparound handling */ @@ -684,7 +675,6 @@ struct drm_device { int last_context; /* Last current context */ int vblank_disable_allowed; - atomic_t vbl_signal_pending; /* number of signals pending on all crtcs */ struct callout vblank_disable_timer; u32 max_vblank_count; /* size of vblank counter register */ struct drm_vblank_info *vblank; /* per crtc vblank info */ @@ -802,7 +792,6 @@ void drm_vblank_put(struct drm_device *d void drm_vblank_cleanup(struct drm_device *dev); int drm_vblank_wait(struct drm_device *dev, unsigned int *vbl_seq); int drm_vblank_init(struct drm_device *dev, int num_crtcs); -void drm_vbl_send_signals(struct drm_device *dev, int crtc); int drm_modeset_ctl(struct drm_device *dev, void *data, struct drm_file *file_priv); Modified: head/sys/dev/drm/drm_irq.c ============================================================================== --- head/sys/dev/drm/drm_irq.c Tue Jun 23 18:00:43 2009 (r194747) +++ head/sys/dev/drm/drm_irq.c Tue Jun 23 18:09:35 2009 (r194748) @@ -121,7 +121,6 @@ int drm_vblank_init(struct drm_device *d int i, ret = ENOMEM; callout_init_mtx(&dev->vblank_disable_timer, &dev->vbl_lock, 0); - atomic_set(&dev->vbl_signal_pending, 0); dev->num_crtcs = num_crtcs; dev->vblank = malloc(sizeof(struct drm_vblank_info) * num_crtcs, @@ -134,7 +133,6 @@ int drm_vblank_init(struct drm_device *d /* Zero per-crtc vblank stuff */ for (i = 0; i < num_crtcs; i++) { DRM_INIT_WAITQUEUE(&dev->vblank[i].queue); - TAILQ_INIT(&dev->vblank[i].sigs); atomic_set(&dev->vblank[i].count, 0); atomic_set(&dev->vblank[i].refcount, 0); } @@ -442,23 +440,7 @@ int drm_wait_vblank(struct drm_device *d } if (flags & _DRM_VBLANK_SIGNAL) { -#if 0 /* disabled */ - drm_vbl_sig_t *vbl_sig = malloc(sizeof(drm_vbl_sig_t), - DRM_MEM_DRIVER, M_NOWAIT | M_ZERO); - if (vbl_sig == NULL) - return ENOMEM; - - vbl_sig->sequence = vblwait->request.sequence; - vbl_sig->signo = vblwait->request.signal; - vbl_sig->pid = DRM_CURRENTPID; - - vblwait->reply.sequence = atomic_read(&dev->vbl_received); - - DRM_SPINLOCK(&dev->vbl_lock); - TAILQ_INSERT_HEAD(&dev->vbl_sig_list, vbl_sig, link); - DRM_SPINUNLOCK(&dev->vbl_lock); - ret = 0; -#endif + /* There have never been any consumers */ ret = EINVAL; } else { DRM_DEBUG("waiting on vblank count %d, crtc %d\n", @@ -495,38 +477,9 @@ done: return ret; } -void drm_vbl_send_signals(struct drm_device *dev, int crtc) -{ -} - -#if 0 /* disabled */ -void drm_vbl_send_signals(struct drm_device *dev, int crtc ) -{ - drm_vbl_sig_t *vbl_sig; - unsigned int vbl_seq = atomic_read( &dev->vbl_received ); - struct proc *p; - - vbl_sig = TAILQ_FIRST(&dev->vbl_sig_list); - while (vbl_sig != NULL) { - drm_vbl_sig_t *next = TAILQ_NEXT(vbl_sig, link); - - if ((vbl_seq - vbl_sig->sequence) <= (1 << 23)) { - p = pfind(vbl_sig->pid); - if (p != NULL) - psignal(p, vbl_sig->signo); - - TAILQ_REMOVE(&dev->vbl_sig_list, vbl_sig, link); - DRM_FREE(vbl_sig,sizeof(*vbl_sig)); - } - vbl_sig = next; - } -} -#endif - void drm_handle_vblank(struct drm_device *dev, int crtc) { atomic_inc(&dev->vblank[crtc].count); DRM_WAKEUP(&dev->vblank[crtc].queue); - drm_vbl_send_signals(dev, crtc); } From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 18:24:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0DE9106568B; Tue, 23 Jun 2009 18:24:09 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE7DA8FC18; Tue, 23 Jun 2009 18:24:09 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NIO9Dt085810; Tue, 23 Jun 2009 18:24:09 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NIO9IZ085808; Tue, 23 Jun 2009 18:24:09 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200906231824.n5NIO9IZ085808@svn.freebsd.org> From: Robert Noland Date: Tue, 23 Jun 2009 18:24: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: r194749 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 18:24:10 -0000 Author: rnoland Date: Tue Jun 23 18:24:09 2009 New Revision: 194749 URL: http://svn.freebsd.org/changeset/base/194749 Log: Only release irq resources if we were actually using them. MFC after: 3 days Modified: head/sys/dev/drm/drm_drv.c Modified: head/sys/dev/drm/drm_drv.c ============================================================================== --- head/sys/dev/drm/drm_drv.c Tue Jun 23 18:09:35 2009 (r194748) +++ head/sys/dev/drm/drm_drv.c Tue Jun 23 18:24:09 2009 (r194749) @@ -273,11 +273,14 @@ int drm_detach(device_t kdev) drm_unload(dev); - bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, dev->irqr); - - if (dev->msi_enabled) { - pci_release_msi(dev->device); - DRM_INFO("MSI released\n"); + if (dev->irqr) { + bus_release_resource(dev->device, SYS_RES_IRQ, dev->irqrid, + dev->irqr); + + if (dev->msi_enabled) { + pci_release_msi(dev->device); + DRM_INFO("MSI released\n"); + } } return 0; From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 18:36:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC7C61065672; Tue, 23 Jun 2009 18:36:42 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAB538FC13; Tue, 23 Jun 2009 18:36:42 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NIagpQ086366; Tue, 23 Jun 2009 18:36:42 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NIagmi086364; Tue, 23 Jun 2009 18:36:42 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <200906231836.n5NIagmi086364@svn.freebsd.org> From: Olivier Houchard Date: Tue, 23 Jun 2009 18:36:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194750 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 18:36:43 -0000 Author: cognet Date: Tue Jun 23 18:36:42 2009 New Revision: 194750 URL: http://svn.freebsd.org/changeset/base/194750 Log: Include sys/lock.h before sys/rwlock.h. If anything used to bring it for us before, it does not anymore. Modified: head/sys/netipx/ipx_input.c Modified: head/sys/netipx/ipx_input.c ============================================================================== --- head/sys/netipx/ipx_input.c Tue Jun 23 18:24:09 2009 (r194749) +++ head/sys/netipx/ipx_input.c Tue Jun 23 18:36:42 2009 (r194750) @@ -72,6 +72,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 19:04:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14964106570A; Tue, 23 Jun 2009 19:04:26 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB6718FC17; Tue, 23 Jun 2009 19:04:25 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NJ4PgT086985; Tue, 23 Jun 2009 19:04:25 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NJ4PrY086983; Tue, 23 Jun 2009 19:04:25 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <200906231904.n5NJ4PrY086983@svn.freebsd.org> From: Andrew Gallatin Date: Tue, 23 Jun 2009 19:04:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194751 - head/sys/dev/mxge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 19:04:26 -0000 Author: gallatin Date: Tue Jun 23 19:04:25 2009 New Revision: 194751 URL: http://svn.freebsd.org/changeset/base/194751 Log: Revert most of 193311 so as to track mxge transmit stats on a per-ring basis and avoid racy (and costly) updates to the ifp stats via drbr by defining NO_SLOW_STATS Discussed with: kmacy Modified: head/sys/dev/mxge/if_mxge.c head/sys/dev/mxge/if_mxge_var.h Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Tue Jun 23 18:36:42 2009 (r194750) +++ head/sys/dev/mxge/if_mxge.c Tue Jun 23 19:04:25 2009 (r194751) @@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$"); #include #include +/* count xmits ourselves, rather than via drbr */ +#define NO_SLOW_STATS #include #include #include @@ -2200,7 +2202,6 @@ mxge_transmit_locked(struct mxge_slice_s BPF_MTAP(ifp, m); /* give it to the nic */ mxge_encap(ss, m); - drbr_stats_update(ifp, m->m_pkthdr.len, m->m_flags); } else if ((err = drbr_enqueue(ifp, tx->br, m)) != 0) { return (err); } @@ -2661,6 +2662,9 @@ mxge_tx_done(struct mxge_slice_state *ss /* mbuf and DMA map only attached to the first segment per-mbuf */ if (m != NULL) { + ss->obytes += m->m_pkthdr.len; + if (m->m_flags & M_MCAST) + ss->omcasts++; ss->opackets++; tx->info[idx].m = NULL; map = tx->info[idx].map; @@ -3787,6 +3791,11 @@ mxge_update_stats(mxge_softc_t *sc) struct mxge_slice_state *ss; u_long ipackets = 0; u_long opackets = 0; +#ifdef IFNET_BUF_RING + u_long obytes = 0; + u_long omcasts = 0; + u_long odrops = 0; +#endif u_long oerrors = 0; int slice; @@ -3794,10 +3803,20 @@ mxge_update_stats(mxge_softc_t *sc) ss = &sc->ss[slice]; ipackets += ss->ipackets; opackets += ss->opackets; +#ifdef IFNET_BUF_RING + obytes += ss->obytes; + omcasts += ss->omcasts; + odrops += ss->tx.br->br_drops; +#endif oerrors += ss->oerrors; } sc->ifp->if_ipackets = ipackets; sc->ifp->if_opackets = opackets; +#ifdef IFNET_BUF_RING + sc->ifp->if_obytes = obytes; + sc->ifp->if_omcasts = omcasts; + sc->ifp->if_snd.ifq_drops = odrops; +#endif sc->ifp->if_oerrors = oerrors; } Modified: head/sys/dev/mxge/if_mxge_var.h ============================================================================== --- head/sys/dev/mxge/if_mxge_var.h Tue Jun 23 18:36:42 2009 (r194750) +++ head/sys/dev/mxge/if_mxge_var.h Tue Jun 23 19:04:25 2009 (r194751) @@ -196,6 +196,8 @@ struct mxge_slice_state { volatile uint32_t *irq_claim; u_long ipackets; u_long opackets; + u_long obytes; + u_long omcasts; u_long oerrors; int if_drv_flags; struct lro_head lro_active; From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 19:05:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BAEB106567C; Tue, 23 Jun 2009 19:05:02 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 89D118FC13; Tue, 23 Jun 2009 19:05:02 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NJ52ZO087034; Tue, 23 Jun 2009 19:05:02 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NJ52qI087032; Tue, 23 Jun 2009 19:05:02 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906231905.n5NJ52qI087032@svn.freebsd.org> From: Sam Leffler Date: Tue, 23 Jun 2009 19:05: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: r194752 - head/sys/arm/xscale/ixp425 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 19:05:03 -0000 Author: sam Date: Tue Jun 23 19:05:02 2009 New Revision: 194752 URL: http://svn.freebsd.org/changeset/base/194752 Log: use consistent style Modified: head/sys/arm/xscale/ixp425/ixp425.c Modified: head/sys/arm/xscale/ixp425/ixp425.c ============================================================================== --- head/sys/arm/xscale/ixp425/ixp425.c Tue Jun 23 19:04:25 2009 (r194751) +++ head/sys/arm/xscale/ixp425/ixp425.c Tue Jun 23 19:05:02 2009 (r194752) @@ -247,7 +247,7 @@ arm_get_next_irq(int last) last += 1; /* always advance fwd, NB: handles -1 */ if (last < 32) { mask = ixp425_irq_read() >> last; - for (; mask != 0; mask >>= 1, last += 1) { + for (; mask != 0; mask >>= 1, last++) { if (mask & 1) return last; } From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 19:15:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82B4C1065676; Tue, 23 Jun 2009 19:15:09 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3]) by mx1.freebsd.org (Postfix) with ESMTP id 3404F8FC1B; Tue, 23 Jun 2009 19:15:09 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id EA39C41C7CC; Tue, 23 Jun 2009 21:15:07 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([195.88.108.3]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id 1lRSWqdGbQ38; Tue, 23 Jun 2009 21:15:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id 862F941C7D7; Tue, 23 Jun 2009 21:15:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id 8C87D4448E6; Tue, 23 Jun 2009 19:12:10 +0000 (UTC) Date: Tue, 23 Jun 2009 19:12:10 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Andrew Gallatin In-Reply-To: <200906231742.n5NHg766084738@svn.freebsd.org> Message-ID: <20090623191104.V22887@maildrop.int.zabbadoz.net> References: <200906231742.n5NHg766084738@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 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: r194743 - in head/sys: conf dev/mxge modules/mxge/mxge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 19:15:10 -0000 On Tue, 23 Jun 2009, Andrew Gallatin wrote: > Author: gallatin > Date: Tue Jun 23 17:42:06 2009 > New Revision: 194743 > URL: http://svn.freebsd.org/changeset/base/194743 > > Log: > Implement minimal set of changes suggested by bz to make > mxge no longer depend on INET. Weeee:) That looks good so far. Thanks a lot! /bz -- Bjoern A. Zeeb The greatest risk is not taking one. From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 19:29:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9B6C1065673; Tue, 23 Jun 2009 19:29:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 967118FC16; Tue, 23 Jun 2009 19:29:23 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NJTNAe087540; Tue, 23 Jun 2009 19:29:23 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NJTNP7087537; Tue, 23 Jun 2009 19:29:23 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906231929.n5NJTNP7087537@svn.freebsd.org> From: Sam Leffler Date: Tue, 23 Jun 2009 19:29:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194753 - head/sys/arm/xscale/ixp425 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 19:29:24 -0000 Author: sam Date: Tue Jun 23 19:29:23 2009 New Revision: 194753 URL: http://svn.freebsd.org/changeset/base/194753 Log: Now that we have UARTs running with fast interrupt handlers the ata driver's i/o ops must be locked to avoid chaos. Extend the cambria bus tag to support ata and add a spin lock. The ata driver is hacked to use that instead of it's builtin hack for ixp425. Once the ata driver is fixed to not be confused about byte order we can generalize the cambria bus tag code and make it generally useful. While here take advantage of our being ixp435-specific to remove delays when switching between byte+word accesses and to eliminate the 2us delay for the uarts (the spin lock overhead looks to do this for us). Modified: head/sys/arm/xscale/ixp425/avila_ata.c head/sys/arm/xscale/ixp425/cambria_exp_space.c Modified: head/sys/arm/xscale/ixp425/avila_ata.c ============================================================================== --- head/sys/arm/xscale/ixp425/avila_ata.c Tue Jun 23 19:05:02 2009 (r194752) +++ head/sys/arm/xscale/ixp425/avila_ata.c Tue Jun 23 19:29:23 2009 (r194753) @@ -119,7 +119,7 @@ ata_getconfig(struct ixp425_softc *sa) /* XXX honor hint? (but then no multi-board support) */ /* XXX total hack */ - if ((cpu_id() & CPU_ID_CPU_MASK) == CPU_ID_IXP435) + if (cpu_is_ixp43x()) return &configs[1]; /* Cambria */ if (EXP_BUS_READ_4(sa, EXP_TIMING_CS2_OFFSET) != 0) return &configs[0]; /* Avila */ @@ -191,31 +191,41 @@ ata_avila_attach(device_t dev) __func__, config->basealt, config->sizealt); sc->sc_16bit_off = config->off16; - /* - * Craft special resource for ATA bus space ops - * that go through the expansion bus and require - * special hackery to ena/dis 16-bit operations. - * - * XXX probably should just make this generic for - * accessing the expansion bus. - */ - sc->sc_expbus_tag.bs_cookie = sc; /* NB: backpointer */ - /* read single */ - sc->sc_expbus_tag.bs_r_1 = ata_bs_r_1, - sc->sc_expbus_tag.bs_r_2 = ata_bs_r_2, - /* read multiple */ - sc->sc_expbus_tag.bs_rm_2 = ata_bs_rm_2, - sc->sc_expbus_tag.bs_rm_2_s = ata_bs_rm_2_s, - /* write (single) */ - sc->sc_expbus_tag.bs_w_1 = ata_bs_w_1, - sc->sc_expbus_tag.bs_w_2 = ata_bs_w_2, - /* write multiple */ - sc->sc_expbus_tag.bs_wm_2 = ata_bs_wm_2, - sc->sc_expbus_tag.bs_wm_2_s = ata_bs_wm_2_s, - - rman_set_bustag(&sc->sc_ata, &sc->sc_expbus_tag); + if (config->base16 != CAMBRIA_CFSEL0_HWBASE) { + /* + * Craft special resource for ATA bus space ops + * that go through the expansion bus and require + * special hackery to ena/dis 16-bit operations. + * + * XXX probably should just make this generic for + * accessing the expansion bus. + */ + sc->sc_expbus_tag.bs_cookie = sc; /* NB: backpointer */ + /* read single */ + sc->sc_expbus_tag.bs_r_1 = ata_bs_r_1, + sc->sc_expbus_tag.bs_r_2 = ata_bs_r_2, + /* read multiple */ + sc->sc_expbus_tag.bs_rm_2 = ata_bs_rm_2, + sc->sc_expbus_tag.bs_rm_2_s = ata_bs_rm_2_s, + /* write (single) */ + sc->sc_expbus_tag.bs_w_1 = ata_bs_w_1, + sc->sc_expbus_tag.bs_w_2 = ata_bs_w_2, + /* write multiple */ + sc->sc_expbus_tag.bs_wm_2 = ata_bs_wm_2, + sc->sc_expbus_tag.bs_wm_2_s = ata_bs_wm_2_s, + + rman_set_bustag(&sc->sc_ata, &sc->sc_expbus_tag); + rman_set_bustag(&sc->sc_alt_ata, &sc->sc_expbus_tag); + } else { + /* + * On Cambria use the shared CS3 expansion bus tag + * that handles interlock for sharing access with the + * optional UART's. + */ + rman_set_bustag(&sc->sc_ata, &cambria_exp_bs_tag); + rman_set_bustag(&sc->sc_alt_ata, &cambria_exp_bs_tag); + } rman_set_bushandle(&sc->sc_ata, sc->sc_ioh); - rman_set_bustag(&sc->sc_alt_ata, &sc->sc_expbus_tag); rman_set_bushandle(&sc->sc_alt_ata, sc->sc_alt_ioh); ixp425_set_gpio(sa, config->gpin, GPIO_TYPE_EDG_RISING); Modified: head/sys/arm/xscale/ixp425/cambria_exp_space.c ============================================================================== --- head/sys/arm/xscale/ixp425/cambria_exp_space.c Tue Jun 23 19:05:02 2009 (r194752) +++ head/sys/arm/xscale/ixp425/cambria_exp_space.c Tue Jun 23 19:29:23 2009 (r194753) @@ -23,8 +23,16 @@ */ /* - * Hack bus space tag for slow devices on the Cambria expansion bus; - * we slow the timing and add a 2us delay between r/w ops. + * Bus space tag for devices on the Cambria expansion bus. + * This interlocks accesses to allow the optional GPS+RS485 UART's + * to share access with the CF-IDE adapter. Note this does not + * slow the timing UART r/w ops because the lock operation does + * this implicitly for us. Also note we do not DELAY after byte/word + * chip select changes; this doesn't seem necessary (as required + * for IXP425/Avila boards). + * + * XXX should make this generic so all expansion bus devices can + * use it but probably not until we eliminate the ATA hacks */ #include @@ -32,7 +40,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include +#include #include #include @@ -43,23 +54,160 @@ __FBSDID("$FreeBSD$"); /* Prototypes for all the bus_space structure functions */ bs_protos(exp); bs_protos(generic); -bs_protos(generic_armv4); + +struct expbus_softc { + struct ixp425_softc *sc; /* bus space tag */ + struct mtx lock; /* i/o interlock */ + bus_size_t csoff; /* CS offset for 8/16 enable */ +}; +#define EXP_LOCK_INIT(exp) \ + mtx_init(&(exp)->lock, "ExpBus", NULL, MTX_SPIN) +#define EXP_LOCK_DESTROY(exp) \ + mtx_destroy(&(exp)->lock) +#define EXP_LOCK(exp) mtx_lock_spin(&(exp)->lock) +#define EXP_UNLOCK(exp) mtx_unlock_spin(&(exp)->lock) + +/* + * Enable/disable 16-bit ops on the expansion bus. + */ +static __inline void +enable_16(struct ixp425_softc *sc, bus_size_t cs) +{ + EXP_BUS_WRITE_4(sc, cs, EXP_BUS_READ_4(sc, cs) &~ EXP_BYTE_EN); +} + +static __inline void +disable_16(struct ixp425_softc *sc, bus_size_t cs) +{ + EXP_BUS_WRITE_4(sc, cs, EXP_BUS_READ_4(sc, cs) | EXP_BYTE_EN); +} static uint8_t cambria_bs_r_1(void *t, bus_space_handle_t h, bus_size_t o) { - DELAY(2); - return bus_space_read_1((struct bus_space *)t, h, o); + struct expbus_softc *exp = t; + struct ixp425_softc *sc = exp->sc; + uint8_t v; + + EXP_LOCK(exp); + v = bus_space_read_1(sc->sc_iot, h, o); + EXP_UNLOCK(exp); + return v; } static void cambria_bs_w_1(void *t, bus_space_handle_t h, bus_size_t o, u_int8_t v) { - DELAY(2); - bus_space_write_1((struct bus_space *)t, h, o, v); + struct expbus_softc *exp = t; + struct ixp425_softc *sc = exp->sc; + + EXP_LOCK(exp); + bus_space_write_1(sc->sc_iot, h, o, v); + EXP_UNLOCK(exp); +} + +static uint16_t +cambria_bs_r_2(void *t, bus_space_handle_t h, bus_size_t o) +{ + struct expbus_softc *exp = t; + struct ixp425_softc *sc = exp->sc; + uint16_t v; + + EXP_LOCK(exp); + enable_16(sc, exp->csoff); + v = bus_space_read_2(sc->sc_iot, h, o); + disable_16(sc, exp->csoff); + EXP_UNLOCK(exp); + return v; +} + +static void +cambria_bs_w_2(void *t, bus_space_handle_t h, bus_size_t o, uint16_t v) +{ + struct expbus_softc *exp = t; + struct ixp425_softc *sc = exp->sc; + + EXP_LOCK(exp); + enable_16(sc, exp->csoff); + bus_space_write_2(sc->sc_iot, h, o, v); + disable_16(sc, exp->csoff); + EXP_UNLOCK(exp); } -/* NB: we only define what's needed by uart */ +static void +cambria_bs_rm_2(void *t, bus_space_handle_t h, bus_size_t o, + u_int16_t *d, bus_size_t c) +{ + struct expbus_softc *exp = t; + struct ixp425_softc *sc = exp->sc; + + EXP_LOCK(exp); + enable_16(sc, exp->csoff); + bus_space_read_multi_2(sc->sc_iot, h, o, d, c); + disable_16(sc, exp->csoff); + EXP_UNLOCK(exp); +} + +static void +cambria_bs_wm_2(void *t, bus_space_handle_t h, bus_size_t o, + const u_int16_t *d, bus_size_t c) +{ + struct expbus_softc *exp = t; + struct ixp425_softc *sc = exp->sc; + + EXP_LOCK(exp); + enable_16(sc, exp->csoff); + bus_space_write_multi_2(sc->sc_iot, h, o, d, c); + disable_16(sc, exp->csoff); + EXP_UNLOCK(exp); +} + +/* XXX workaround ata driver by (incorrectly) byte swapping stream cases */ + +static void +cambria_bs_rm_2_s(void *t, bus_space_handle_t h, bus_size_t o, + u_int16_t *d, bus_size_t c) +{ + struct expbus_softc *exp = t; + struct ixp425_softc *sc = exp->sc; + uint16_t v; + bus_size_t i; + + EXP_LOCK(exp); + enable_16(sc, exp->csoff); +#if 1 + for (i = 0; i < c; i++) { + v = bus_space_read_2(sc->sc_iot, h, o); + d[i] = bswap16(v); + } +#else + bus_space_read_multi_stream_2(sc->sc_iot, h, o, d, c); +#endif + disable_16(sc, exp->csoff); + EXP_UNLOCK(exp); +} + +static void +cambria_bs_wm_2_s(void *t, bus_space_handle_t h, bus_size_t o, + const u_int16_t *d, bus_size_t c) +{ + struct expbus_softc *exp = t; + struct ixp425_softc *sc = exp->sc; + bus_size_t i; + + EXP_LOCK(exp); + enable_16(sc, exp->csoff); +#if 1 + for (i = 0; i < c; i++) + bus_space_write_2(sc->sc_iot, h, o, bswap16(d[i])); +#else + bus_space_write_multi_stream_2(sc->sc_iot, h, o, d, c); +#endif + disable_16(sc, exp->csoff); + EXP_UNLOCK(exp); +} + +/* NB: we only define what's needed by ata+uart */ struct bus_space cambria_exp_bs_tag = { /* mapping/unmapping */ .bs_map = generic_bs_map, @@ -70,24 +218,39 @@ struct bus_space cambria_exp_bs_tag = { /* read (single) */ .bs_r_1 = cambria_bs_r_1, + .bs_r_2 = cambria_bs_r_2, /* write (single) */ .bs_w_1 = cambria_bs_w_1, + .bs_w_2 = cambria_bs_w_2, + + /* read multiple */ + .bs_rm_2 = cambria_bs_rm_2, + .bs_rm_2_s = cambria_bs_rm_2_s, + + /* write multiple */ + .bs_wm_2 = cambria_bs_wm_2, + .bs_wm_2_s = cambria_bs_wm_2_s, }; void cambria_exp_bus_init(struct ixp425_softc *sc) { + static struct expbus_softc c3; /* NB: no need to malloc */ uint32_t cs3; KASSERT(cpu_is_ixp43x(), ("wrong cpu type")); - cambria_exp_bs_tag.bs_cookie = sc->sc_iot; + c3.sc = sc; + c3.csoff = EXP_TIMING_CS3_OFFSET; + EXP_LOCK_INIT(&c3); + cambria_exp_bs_tag.bs_cookie = &c3; cs3 = EXP_BUS_READ_4(sc, EXP_TIMING_CS3_OFFSET); /* XXX force slowest possible timings and byte mode */ EXP_BUS_WRITE_4(sc, EXP_TIMING_CS3_OFFSET, - cs3 | (EXP_T1|EXP_T2|EXP_T3|EXP_T4|EXP_T5) | EXP_BYTE_EN); + cs3 | (EXP_T1|EXP_T2|EXP_T3|EXP_T4|EXP_T5) | + EXP_BYTE_EN | EXP_WR_EN | EXP_BYTE_RD16 | EXP_CS_EN); /* XXX force GPIO 3+4 for GPS+RS485 uarts */ ixp425_set_gpio(sc, 3, GPIO_TYPE_EDG_RISING); From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 20:19:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE541106564A; Tue, 23 Jun 2009 20:19:02 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A63D18FC17; Tue, 23 Jun 2009 20:19:02 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NKJ2e6088836; Tue, 23 Jun 2009 20:19:02 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NKJ2IY088834; Tue, 23 Jun 2009 20:19:02 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200906232019.n5NKJ2IY088834@svn.freebsd.org> From: Robert Noland Date: Tue, 23 Jun 2009 20:19: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: r194759 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 20:19:03 -0000 Author: rnoland Date: Tue Jun 23 20:19:02 2009 New Revision: 194759 URL: http://svn.freebsd.org/changeset/base/194759 Log: Add some sysctl info so that we can see what is going on with vblanks. MFC after: 3 days Modified: head/sys/dev/drm/drm_sysctl.c Modified: head/sys/dev/drm/drm_sysctl.c ============================================================================== --- head/sys/dev/drm/drm_sysctl.c Tue Jun 23 20:17:24 2009 (r194758) +++ head/sys/dev/drm/drm_sysctl.c Tue Jun 23 20:19:02 2009 (r194759) @@ -38,6 +38,7 @@ static int drm_name_info DRM_SYSCTL_H static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS; static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS; static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS; +static int drm_vblank_info DRM_SYSCTL_HANDLER_ARGS; struct drm_sysctl_list { const char *name; @@ -47,6 +48,7 @@ struct drm_sysctl_list { {"vm", drm_vm_info}, {"clients", drm_clients_info}, {"bufs", drm_bufs_info}, + {"vblank", drm_vblank_info}, }; #define DRM_SYSCTL_ENTRIES (sizeof(drm_sysctl_list)/sizeof(drm_sysctl_list[0])) @@ -313,3 +315,25 @@ done: free(tempprivs, DRM_MEM_DRIVER); return retcode; } + +static int drm_vblank_info DRM_SYSCTL_HANDLER_ARGS +{ + struct drm_device *dev = arg1; + char buf[128]; + int retcode; + int i; + + DRM_SYSCTL_PRINT("\ncrtc ref count last enabled inmodeset\n"); + for(i = 0 ; i < dev->num_crtcs ; i++) { + DRM_SYSCTL_PRINT(" %02d %02d %08d %08d %02d %02d\n", + i, atomic_load_acq_32(&dev->vblank[i].refcount), + atomic_load_acq_32(&dev->vblank[i].count), + atomic_load_acq_32(&dev->vblank[i].last), + atomic_load_acq_int(&dev->vblank[i].enabled), + atomic_load_acq_int(&dev->vblank[i].inmodeset)); + } + + SYSCTL_OUT(req, "", -1); +done: + return retcode; +} From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 20:19:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8143A1065764; Tue, 23 Jun 2009 20:19:10 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D2D48FC1D; Tue, 23 Jun 2009 20:19:10 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NKJAZT088891; Tue, 23 Jun 2009 20:19:10 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NKJ9XZ088872; Tue, 23 Jun 2009 20:19:09 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906232019.n5NKJ9XZ088872@svn.freebsd.org> From: Robert Watson Date: Tue, 23 Jun 2009 20:19: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: r194760 - in head/sys: contrib/rdma net net80211 netinet netinet6 netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 20:19:11 -0000 Author: rwatson Date: Tue Jun 23 20:19:09 2009 New Revision: 194760 URL: http://svn.freebsd.org/changeset/base/194760 Log: Modify most routines returning 'struct ifaddr *' to return references rather than pointers, requiring callers to properly dispose of those references. The following routines now return references: ifaddr_byindex ifa_ifwithaddr ifa_ifwithbroadaddr ifa_ifwithdstaddr ifa_ifwithnet ifaof_ifpforaddr ifa_ifwithroute ifa_ifwithroute_fib rt_getifa rt_getifa_fib IFP_TO_IA ip_rtaddr in6_ifawithifp in6ifa_ifpforlinklocal in6ifa_ifpwithaddr in6_ifadd carp_iamatch6 ip6_getdstifaddr Remove unused macro which didn't have required referencing: IFP_TO_IA6 This closes many small races in which changes to interface or address lists while an ifaddr was in use could lead to use of freed memory (etc). In a few cases, add missing if_addr_list locking required to safely acquire references. Because of a lack of deep copying support, we accept a race in which an in6_ifaddr pointed to by mbuf tags and extracted with ip6_getdstifaddr() doesn't hold a reference while in transmit. Once we have mbuf tag deep copy support, this can be fixed. Reviewed by: bz Obtained from: Apple, Inc. (portions) MFC after: 6 weeks (portions) Modified: head/sys/contrib/rdma/rdma_addr.c head/sys/contrib/rdma/rdma_cma.c head/sys/net/if.c head/sys/net/route.c head/sys/net/rtsock.c head/sys/net80211/ieee80211.c head/sys/netinet/igmp.c head/sys/netinet/in.c head/sys/netinet/in_mcast.c head/sys/netinet/in_pcb.c head/sys/netinet/in_var.h head/sys/netinet/ip_carp.c head/sys/netinet/ip_divert.c head/sys/netinet/ip_icmp.c head/sys/netinet/ip_input.c head/sys/netinet/ip_mroute.c head/sys/netinet/ip_options.c head/sys/netinet/ip_output.c head/sys/netinet/tcp_input.c head/sys/netinet6/frag6.c head/sys/netinet6/icmp6.c head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_src.c head/sys/netinet6/in6_var.h head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_output.c head/sys/netinet6/mld6.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6_nbr.c head/sys/netinet6/nd6_rtr.c head/sys/netinet6/raw_ip6.c head/sys/netipx/ipx_pcb.c Modified: head/sys/contrib/rdma/rdma_addr.c ============================================================================== --- head/sys/contrib/rdma/rdma_addr.c Tue Jun 23 20:19:02 2009 (r194759) +++ head/sys/contrib/rdma/rdma_addr.c Tue Jun 23 20:19:09 2009 (r194760) @@ -129,13 +129,16 @@ int rdma_translate_ip(struct sockaddr *a struct ifaddr *ifa; struct sockaddr_in *sin = (struct sockaddr_in *)addr; uint16_t port = sin->sin_port; + int ret; sin->sin_port = 0; ifa = ifa_ifwithaddr(addr); sin->sin_port = port; if (!ifa) return (EADDRNOTAVAIL); - return rdma_copy_addr(dev_addr, ifa->ifa_ifp, NULL); + ret = rdma_copy_addr(dev_addr, ifa->ifa_ifp, NULL); + ifa_free(ifa); + return (ret); } static void queue_req(struct addr_req *req) Modified: head/sys/contrib/rdma/rdma_cma.c ============================================================================== --- head/sys/contrib/rdma/rdma_cma.c Tue Jun 23 20:19:02 2009 (r194759) +++ head/sys/contrib/rdma/rdma_cma.c Tue Jun 23 20:19:09 2009 (r194760) @@ -1337,6 +1337,7 @@ static int iw_conn_req_handler(struct iw } dev = ifa->ifa_ifp; ret = rdma_copy_addr(&conn_id->id.route.addr.dev_addr, dev, NULL); + ifa_free(ifa); if (ret) { cma_enable_remove(conn_id); rdma_destroy_id(new_cm_id); Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Jun 23 20:19:02 2009 (r194759) +++ head/sys/net/if.c Tue Jun 23 20:19:09 2009 (r194760) @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -261,6 +262,8 @@ ifaddr_byindex(u_short idx) IFNET_RLOCK(); ifa = ifnet_byindex_locked(idx)->if_addr; + if (ifa != NULL) + ifa_ref(ifa); IFNET_RUNLOCK(); return (ifa); } @@ -1464,7 +1467,7 @@ ifa_free(struct ifaddr *ifa) */ /*ARGSUSED*/ static struct ifaddr * -ifa_ifwithaddr_internal(struct sockaddr *addr) +ifa_ifwithaddr_internal(struct sockaddr *addr, int getref) { INIT_VNET_NET(curvnet); struct ifnet *ifp; @@ -1477,6 +1480,8 @@ ifa_ifwithaddr_internal(struct sockaddr if (ifa->ifa_addr->sa_family != addr->sa_family) continue; if (sa_equal(addr, ifa->ifa_addr)) { + if (getref) + ifa_ref(ifa); IF_ADDR_UNLOCK(ifp); goto done; } @@ -1485,6 +1490,8 @@ ifa_ifwithaddr_internal(struct sockaddr ifa->ifa_broadaddr && ifa->ifa_broadaddr->sa_len != 0 && sa_equal(ifa->ifa_broadaddr, addr)) { + if (getref) + ifa_ref(ifa); IF_ADDR_UNLOCK(ifp); goto done; } @@ -1501,14 +1508,14 @@ struct ifaddr * ifa_ifwithaddr(struct sockaddr *addr) { - return (ifa_ifwithaddr_internal(addr)); + return (ifa_ifwithaddr_internal(addr, 1)); } int ifa_ifwithaddr_check(struct sockaddr *addr) { - return (ifa_ifwithaddr_internal(addr) != NULL); + return (ifa_ifwithaddr_internal(addr, 0) != NULL); } /* @@ -1532,6 +1539,7 @@ ifa_ifwithbroadaddr(struct sockaddr *add ifa->ifa_broadaddr && ifa->ifa_broadaddr->sa_len != 0 && sa_equal(ifa->ifa_broadaddr, addr)) { + ifa_ref(ifa); IF_ADDR_UNLOCK(ifp); goto done; } @@ -1565,6 +1573,7 @@ ifa_ifwithdstaddr(struct sockaddr *addr) continue; if (ifa->ifa_dstaddr != NULL && sa_equal(addr, ifa->ifa_dstaddr)) { + ifa_ref(ifa); IF_ADDR_UNLOCK(ifp); goto done; } @@ -1587,7 +1596,7 @@ ifa_ifwithnet(struct sockaddr *addr) INIT_VNET_NET(curvnet); struct ifnet *ifp; struct ifaddr *ifa; - struct ifaddr *ifa_maybe = (struct ifaddr *) 0; + struct ifaddr *ifa_maybe = NULL; u_int af = addr->sa_family; char *addr_data = addr->sa_data, *cplim; @@ -1602,8 +1611,10 @@ ifa_ifwithnet(struct sockaddr *addr) } /* - * Scan though each interface, looking for ones that have - * addresses in this address family. + * Scan though each interface, looking for ones that have addresses + * in this address family. Maintain a reference on ifa_maybe once + * we find one, as we release the IF_ADDR_LOCK() that kept it stable + * when we move onto the next interface. */ IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { @@ -1624,6 +1635,7 @@ next: continue; */ if (ifa->ifa_dstaddr != NULL && sa_equal(addr, ifa->ifa_dstaddr)) { + ifa_ref(ifa); IF_ADDR_UNLOCK(ifp); goto done; } @@ -1634,6 +1646,7 @@ next: continue; */ if (ifa->ifa_claim_addr) { if ((*ifa->ifa_claim_addr)(ifa, addr)) { + ifa_ref(ifa); IF_ADDR_UNLOCK(ifp); goto done; } @@ -1664,17 +1677,24 @@ next: continue; * before continuing to search * for an even better one. */ - if (ifa_maybe == 0 || + if (ifa_maybe == NULL || rn_refines((caddr_t)ifa->ifa_netmask, - (caddr_t)ifa_maybe->ifa_netmask)) + (caddr_t)ifa_maybe->ifa_netmask)) { + if (ifa_maybe != NULL) + ifa_free(ifa_maybe); ifa_maybe = ifa; + ifa_ref(ifa_maybe); + } } } IF_ADDR_UNLOCK(ifp); } ifa = ifa_maybe; + ifa_maybe = NULL; done: IFNET_RUNLOCK(); + if (ifa_maybe != NULL) + ifa_free(ifa_maybe); return (ifa); } @@ -1688,7 +1708,7 @@ ifaof_ifpforaddr(struct sockaddr *addr, struct ifaddr *ifa; char *cp, *cp2, *cp3; char *cplim; - struct ifaddr *ifa_maybe = 0; + struct ifaddr *ifa_maybe = NULL; u_int af = addr->sa_family; if (af >= AF_MAX) @@ -1697,7 +1717,7 @@ ifaof_ifpforaddr(struct sockaddr *addr, TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != af) continue; - if (ifa_maybe == 0) + if (ifa_maybe == NULL) ifa_maybe = ifa; if (ifa->ifa_netmask == 0) { if (sa_equal(addr, ifa->ifa_addr) || @@ -1723,6 +1743,8 @@ ifaof_ifpforaddr(struct sockaddr *addr, } ifa = ifa_maybe; done: + if (ifa != NULL) + ifa_ref(ifa); IF_ADDR_UNLOCK(ifp); return (ifa); } @@ -1748,7 +1770,6 @@ link_rtrequest(int cmd, struct rtentry * return; ifa = ifaof_ifpforaddr(dst, ifp); if (ifa) { - ifa_ref(ifa); /* XXX */ oifa = rt->rt_ifa; rt->rt_ifa = ifa; ifa_free(oifa); Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Tue Jun 23 20:19:02 2009 (r194759) +++ head/sys/net/route.c Tue Jun 23 20:19:09 2009 (r194760) @@ -559,6 +559,7 @@ rtredirect_fib(struct sockaddr *dst, struct ifaddr *ifa; struct radix_node_head *rnh; + ifa = NULL; rnh = rt_tables_get_rnh(fibnum, dst->sa_family); if (rnh == NULL) { error = EAFNOSUPPORT; @@ -664,6 +665,8 @@ out: info.rti_info[RTAX_NETMASK] = netmask; info.rti_info[RTAX_AUTHOR] = src; rt_missmsg(RTM_REDIRECT, &info, flags, error); + if (ifa != NULL) + ifa_free(ifa); } int @@ -693,6 +696,9 @@ rtioctl_fib(u_long req, caddr_t data, u_ #endif /* INET */ } +/* + * For both ifa_ifwithroute() routines, 'ifa' is returned referenced. + */ struct ifaddr * ifa_ifwithroute(int flags, struct sockaddr *dst, struct sockaddr *gateway) { @@ -749,11 +755,13 @@ ifa_ifwithroute_fib(int flags, struct so default: break; } + if (!not_found && rt->rt_ifa != NULL) { + ifa = rt->rt_ifa; + ifa_ref(ifa); + } RT_REMREF(rt); RT_UNLOCK(rt); - if (not_found) - return (NULL); - if ((ifa = rt->rt_ifa) == NULL) + if (not_found || ifa == NULL) return (NULL); } if (ifa->ifa_addr->sa_family != dst->sa_family) { @@ -761,6 +769,8 @@ ifa_ifwithroute_fib(int flags, struct so ifa = ifaof_ifpforaddr(dst, ifa->ifa_ifp); if (ifa == NULL) ifa = oifa; + else + ifa_free(oifa); } return (ifa); } @@ -819,6 +829,10 @@ rt_getifa(struct rt_addrinfo *info) return (rt_getifa_fib(info, 0)); } +/* + * Look up rt_addrinfo for a specific fib. Note that if rti_ifa is defined, + * it will be referenced so the caller must free it. + */ int rt_getifa_fib(struct rt_addrinfo *info, u_int fibnum) { @@ -831,8 +845,10 @@ rt_getifa_fib(struct rt_addrinfo *info, */ if (info->rti_ifp == NULL && ifpaddr != NULL && ifpaddr->sa_family == AF_LINK && - (ifa = ifa_ifwithnet(ifpaddr)) != NULL) + (ifa = ifa_ifwithnet(ifpaddr)) != NULL) { info->rti_ifp = ifa->ifa_ifp; + ifa_free(ifa); + } if (info->rti_ifa == NULL && ifaaddr != NULL) info->rti_ifa = ifa_ifwithaddr(ifaaddr); if (info->rti_ifa == NULL) { @@ -1123,12 +1139,19 @@ rtrequest1_fib(int req, struct rt_addrin (gateway->sa_family != AF_UNSPEC) && (gateway->sa_family != AF_LINK)) senderr(EINVAL); - if (info->rti_ifa == NULL && (error = rt_getifa_fib(info, fibnum))) - senderr(error); + if (info->rti_ifa == NULL) { + error = rt_getifa_fib(info, fibnum); + if (error) + senderr(error); + } else + ifa_ref(info->rti_ifa); ifa = info->rti_ifa; rt = uma_zalloc(V_rtzone, M_NOWAIT | M_ZERO); - if (rt == NULL) + if (rt == NULL) { + if (ifa != NULL) + ifa_free(ifa); senderr(ENOBUFS); + } RT_LOCK_INIT(rt); rt->rt_flags = RTF_UP | flags; rt->rt_fibnum = fibnum; @@ -1139,6 +1162,8 @@ rtrequest1_fib(int req, struct rt_addrin RT_LOCK(rt); if ((error = rt_setgate(rt, dst, gateway)) != 0) { RT_LOCK_DESTROY(rt); + if (ifa != NULL) + ifa_free(ifa); uma_zfree(V_rtzone, rt); senderr(error); } @@ -1157,11 +1182,10 @@ rtrequest1_fib(int req, struct rt_addrin bcopy(dst, ndst, dst->sa_len); /* - * Note that we now have a reference to the ifa. + * We use the ifa reference returned by rt_getifa_fib(). * This moved from below so that rnh->rnh_addaddr() can * examine the ifa and ifa->ifa_ifp if it so desires. */ - ifa_ref(ifa); rt->rt_ifa = ifa; rt->rt_ifp = ifa->ifa_ifp; rt->rt_rmx.rmx_weight = 1; Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Tue Jun 23 20:19:02 2009 (r194759) +++ head/sys/net/rtsock.c Tue Jun 23 20:19:09 2009 (r194760) @@ -683,6 +683,13 @@ route_output(struct mbuf *m, struct sock RT_UNLOCK(rt); RADIX_NODE_HEAD_LOCK(rnh); error = rt_getifa_fib(&info, rt->rt_fibnum); + /* + * XXXRW: Really we should release this + * reference later, but this maintains + * historical behavior. + */ + if (info.rti_ifa != NULL) + ifa_free(info.rti_ifa); RADIX_NODE_HEAD_UNLOCK(rnh); if (error != 0) senderr(error); Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Tue Jun 23 20:19:02 2009 (r194759) +++ head/sys/net80211/ieee80211.c Tue Jun 23 20:19:09 2009 (r194760) @@ -301,6 +301,7 @@ ieee80211_ifattach(struct ieee80211com * sdl->sdl_type = IFT_ETHER; /* XXX IFT_IEEE80211? */ sdl->sdl_alen = IEEE80211_ADDR_LEN; IEEE80211_ADDR_COPY(LLADDR(sdl), macaddr); + ifa_free(ifa); } /* Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Tue Jun 23 20:19:02 2009 (r194759) +++ head/sys/netinet/igmp.c Tue Jun 23 20:19:09 2009 (r194760) @@ -1233,8 +1233,10 @@ igmp_input_v1_report(struct ifnet *ifp, */ if (V_igmp_recvifkludge && in_nullhost(ip->ip_src)) { IFP_TO_IA(ifp, ia); - if (ia != NULL) + if (ia != NULL) { ip->ip_src.s_addr = htonl(ia->ia_subnet); + ifa_free(&ia->ia_ifa); + } } CTR3(KTR_IGMPV3, "process v1 report %s on ifp %p(%s)", @@ -1326,16 +1328,23 @@ igmp_input_v2_report(struct ifnet *ifp, * group. */ IFP_TO_IA(ifp, ia); - if (ia != NULL && in_hosteq(ip->ip_src, IA_SIN(ia)->sin_addr)) + if (ia != NULL && in_hosteq(ip->ip_src, IA_SIN(ia)->sin_addr)) { + ifa_free(&ia->ia_ifa); return (0); + } IGMPSTAT_INC(igps_rcv_reports); - if (ifp->if_flags & IFF_LOOPBACK) + if (ifp->if_flags & IFF_LOOPBACK) { + if (ia != NULL) + ifa_free(&ia->ia_ifa); return (0); + } if (!IN_MULTICAST(ntohl(igmp->igmp_group.s_addr)) || !in_hosteq(igmp->igmp_group, ip->ip_dst)) { + if (ia != NULL) + ifa_free(&ia->ia_ifa); IGMPSTAT_INC(igps_rcv_badreports); return (EINVAL); } @@ -1351,6 +1360,8 @@ igmp_input_v2_report(struct ifnet *ifp, if (ia != NULL) ip->ip_src.s_addr = htonl(ia->ia_subnet); } + if (ia != NULL) + ifa_free(&ia->ia_ifa); CTR3(KTR_IGMPV3, "process v2 report %s on ifp %p(%s)", inet_ntoa(igmp->igmp_group), ifp, ifp->if_xname); @@ -3534,8 +3545,10 @@ igmp_v3_encap_report(struct ifnet *ifp, struct in_ifaddr *ia; IFP_TO_IA(ifp, ia); - if (ia != NULL) + if (ia != NULL) { ip->ip_src = ia->ia_addr.sin_addr; + ifa_free(&ia->ia_ifa); + } } ip->ip_dst.s_addr = htonl(INADDR_ALLRPTS_GROUP); Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Tue Jun 23 20:19:02 2009 (r194759) +++ head/sys/netinet/in.c Tue Jun 23 20:19:09 2009 (r194760) @@ -219,7 +219,6 @@ in_control(struct socket *so, u_long cmd register struct ifaddr *ifa; struct in_addr allhosts_addr; struct in_addr dst; - struct in_ifaddr *oia; struct in_ifinfo *ii; struct in_aliasreq *ifra = (struct in_aliasreq *)data; struct sockaddr_in oldaddr; @@ -323,8 +322,10 @@ in_control(struct socket *so, u_long cmd break; } } - IF_ADDR_LOCK(ifp); + if (ia != NULL) + ifa_ref(&ia->ia_ifa); if (ia == NULL) { + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { iap = ifatoia(ifa); if (iap->ia_addr.sin_family == AF_INET) { @@ -336,6 +337,9 @@ in_control(struct socket *so, u_long cmd break; } } + if (ia != NULL) + ifa_ref(&ia->ia_ifa); + IF_ADDR_UNLOCK(ifp); } if (ia == NULL) iaIsFirst = 1; @@ -345,23 +349,29 @@ in_control(struct socket *so, u_long cmd case SIOCAIFADDR: case SIOCDIFADDR: if (ifra->ifra_addr.sin_family == AF_INET) { + struct in_ifaddr *oia; + for (oia = ia; ia; ia = TAILQ_NEXT(ia, ia_link)) { if (ia->ia_ifp == ifp && ia->ia_addr.sin_addr.s_addr == ifra->ifra_addr.sin_addr.s_addr) break; } + if (ia != NULL && ia != oia) + ifa_ref(&ia->ia_ifa); + if (oia != NULL && ia != oia) + ifa_free(&oia->ia_ifa); if ((ifp->if_flags & IFF_POINTOPOINT) && (cmd == SIOCAIFADDR) && (ifra->ifra_dstaddr.sin_addr.s_addr == INADDR_ANY)) { error = EDESTADDRREQ; - goto out_unlock; + goto out; } } if (cmd == SIOCDIFADDR && ia == NULL) { error = EADDRNOTAVAIL; - goto out_unlock; + goto out; } /* FALLTHROUGH */ case SIOCSIFADDR: @@ -373,7 +383,7 @@ in_control(struct socket *so, u_long cmd M_ZERO); if (ia == NULL) { error = ENOBUFS; - goto out_unlock; + goto out; } ifa = &ia->ia_ifa; @@ -390,7 +400,11 @@ in_control(struct socket *so, u_long cmd } ia->ia_ifp = ifp; + ifa_ref(ifa); /* if_addrhead */ + IF_ADDR_LOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); + IF_ADDR_UNLOCK(ifp); + ifa_ref(ifa); /* in_ifaddrhead */ s = splnet(); TAILQ_INSERT_TAIL(&V_in_ifaddrhead, ia, ia_link); splx(s); @@ -405,64 +419,53 @@ in_control(struct socket *so, u_long cmd case SIOCGIFBRDADDR: if (ia == NULL) { error = EADDRNOTAVAIL; - goto out_unlock; + goto out; } break; } /* - * Most paths in this switch return directly or via out_unlock. Only - * paths that remove the address break in order to hit common removal - * code. - * - * XXXRW: We enter the switch with IF_ADDR_LOCK() held, but leave - * without it. This is a bug. + * Most paths in this switch return directly or via out. Only paths + * that remove the address break in order to hit common removal code. */ - IF_ADDR_LOCK_ASSERT(ifp); switch (cmd) { case SIOCGIFADDR: *((struct sockaddr_in *)&ifr->ifr_addr) = ia->ia_addr; - goto out_unlock; + goto out; case SIOCGIFBRDADDR: if ((ifp->if_flags & IFF_BROADCAST) == 0) { error = EINVAL; - goto out_unlock; + goto out; } *((struct sockaddr_in *)&ifr->ifr_dstaddr) = ia->ia_broadaddr; - goto out_unlock; + goto out; case SIOCGIFDSTADDR: if ((ifp->if_flags & IFF_POINTOPOINT) == 0) { error = EINVAL; - goto out_unlock; + goto out; } *((struct sockaddr_in *)&ifr->ifr_dstaddr) = ia->ia_dstaddr; - goto out_unlock; + goto out; case SIOCGIFNETMASK: *((struct sockaddr_in *)&ifr->ifr_addr) = ia->ia_sockmask; - goto out_unlock; + goto out; case SIOCSIFDSTADDR: if ((ifp->if_flags & IFF_POINTOPOINT) == 0) { error = EINVAL; - goto out_unlock; + goto out; } oldaddr = ia->ia_dstaddr; ia->ia_dstaddr = *(struct sockaddr_in *)&ifr->ifr_dstaddr; - IF_ADDR_UNLOCK(ifp); - - /* - * XXXRW: Locks dropped for if_ioctl and rtinit, but ia is - * still being used. - */ if (ifp->if_ioctl != NULL) { error = (*ifp->if_ioctl)(ifp, SIOCSIFDSTADDR, (caddr_t)ia); if (error) { ia->ia_dstaddr = oldaddr; - return (error); + goto out; } } if (ia->ia_flags & IFA_ROUTE) { @@ -472,23 +475,17 @@ in_control(struct socket *so, u_long cmd (struct sockaddr *)&ia->ia_dstaddr; rtinit(&(ia->ia_ifa), (int)RTM_ADD, RTF_HOST|RTF_UP); } - return (0); + goto out; case SIOCSIFBRDADDR: if ((ifp->if_flags & IFF_BROADCAST) == 0) { error = EINVAL; - goto out_unlock; + goto out; } ia->ia_broadaddr = *(struct sockaddr_in *)&ifr->ifr_broadaddr; - goto out_unlock; + goto out; case SIOCSIFADDR: - IF_ADDR_UNLOCK(ifp); - - /* - * XXXRW: Locks dropped for in_ifinit and in_joingroup, but ia - * is still being used. - */ error = in_ifinit(ifp, ia, (struct sockaddr_in *) &ifr->ifr_addr, 1); if (error != 0 && iaIsNew) @@ -502,12 +499,13 @@ in_control(struct socket *so, u_long cmd } EVENTHANDLER_INVOKE(ifaddr_event, ifp); } - return (0); + error = 0; + goto out; case SIOCSIFNETMASK: ia->ia_sockmask.sin_addr = ifra->ifra_addr.sin_addr; ia->ia_subnetmask = ntohl(ia->ia_sockmask.sin_addr.s_addr); - goto out_unlock; + goto out; case SIOCAIFADDR: maskIsNew = 0; @@ -521,12 +519,6 @@ in_control(struct socket *so, u_long cmd ia->ia_addr.sin_addr.s_addr) hostIsNew = 0; } - IF_ADDR_UNLOCK(ifp); - - /* - * XXXRW: Locks dropped for in_ifscrub and in_ifinit, but ia - * is still being used. - */ if (ifra->ifra_mask.sin_len) { in_ifscrub(ifp, ia); ia->ia_sockmask = ifra->ifra_mask; @@ -545,7 +537,7 @@ in_control(struct socket *so, u_long cmd (hostIsNew || maskIsNew)) error = in_ifinit(ifp, ia, &ifra->ifra_addr, 0); if (error != 0 && iaIsNew) - break; + goto out; if ((ifp->if_flags & IFF_BROADCAST) && (ifra->ifra_broadaddr.sin_family == AF_INET)) @@ -559,15 +551,10 @@ in_control(struct socket *so, u_long cmd } EVENTHANDLER_INVOKE(ifaddr_event, ifp); } - return (error); + goto out; case SIOCDIFADDR: - IF_ADDR_UNLOCK(ifp); - /* - * XXXRW: Locks dropped for in_ifscrub and in_ifadown, but ia - * is still being used. - * * in_ifscrub kills the interface route. */ in_ifscrub(ifp, ia); @@ -587,25 +574,25 @@ in_control(struct socket *so, u_long cmd panic("in_control: unsupported ioctl"); } - /* - * XXXRW: In a more ideal world, we would still be holding - * IF_ADDR_LOCK here. - */ IF_ADDR_LOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_UNLOCK(ifp); + ifa_free(&ia->ia_ifa); /* if_addrhead */ s = splnet(); TAILQ_REMOVE(&V_in_ifaddrhead, ia, ia_link); + ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ if (ia->ia_addr.sin_family == AF_INET) { + struct in_ifaddr *if_ia; + LIST_REMOVE(ia, ia_hash); /* * If this is the last IPv4 address configured on this * interface, leave the all-hosts group. * No state-change report need be transmitted. */ - oia = NULL; - IFP_TO_IA(ifp, oia); - if (oia == NULL) { + if_ia = NULL; + IFP_TO_IA(ifp, if_ia); + if (if_ia == NULL) { ii = ((struct in_ifinfo *)ifp->if_afdata[AF_INET]); IN_MULTI_LOCK(); if (ii->ii_allhosts) { @@ -614,15 +601,13 @@ in_control(struct socket *so, u_long cmd ii->ii_allhosts = NULL; } IN_MULTI_UNLOCK(); - } + } else + ifa_free(&if_ia->ia_ifa); } - ifa_free(&ia->ia_ifa); splx(s); - - return (error); - -out_unlock: - IF_ADDR_UNLOCK(ifp); +out: + if (ia != NULL) + ifa_free(&ia->ia_ifa); return (error); } Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Tue Jun 23 20:19:02 2009 (r194759) +++ head/sys/netinet/in_mcast.c Tue Jun 23 20:19:09 2009 (r194760) @@ -1722,6 +1722,7 @@ inp_getmoptions(struct inpcb *inp, struc if (ia != NULL) { mreqn.imr_address = IA_SIN(ia)->sin_addr; + ifa_free(&ia->ia_ifa); } } } Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Tue Jun 23 20:19:02 2009 (r194759) +++ head/sys/netinet/in_pcb.c Tue Jun 23 20:19:09 2009 (r194760) @@ -549,7 +549,6 @@ static int in_pcbladdr(struct inpcb *inp, struct in_addr *faddr, struct in_addr *laddr, struct ucred *cred) { - struct in_ifaddr *ia; struct ifaddr *ifa; struct sockaddr *sa; struct sockaddr_in *sin; @@ -559,7 +558,6 @@ in_pcbladdr(struct inpcb *inp, struct in KASSERT(laddr != NULL, ("%s: laddr NULL", __func__)); error = 0; - ia = NULL; bzero(&sro, sizeof(sro)); sin = (struct sockaddr_in *)&sro.ro_dst; @@ -585,6 +583,7 @@ in_pcbladdr(struct inpcb *inp, struct in * the source address from. */ if (sro.ro_rt == NULL || sro.ro_rt->rt_ifp == NULL) { + struct in_ifaddr *ia; struct ifnet *ifp; ia = ifatoia(ifa_ifwithdstaddr((struct sockaddr *)sin)); @@ -597,10 +596,12 @@ in_pcbladdr(struct inpcb *inp, struct in if (cred == NULL || !prison_flag(cred, PR_IP4)) { laddr->s_addr = ia->ia_addr.sin_addr.s_addr; + ifa_free(&ia->ia_ifa); goto done; } ifp = ia->ia_ifp; + ifa_free(&ia->ia_ifa); ia = NULL; IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { @@ -636,6 +637,7 @@ in_pcbladdr(struct inpcb *inp, struct in * 3. as a last resort return the 'default' jail address. */ if ((sro.ro_rt->rt_ifp->if_flags & IFF_LOOPBACK) == 0) { + struct in_ifaddr *ia; struct ifnet *ifp; /* If not jailed, use the default returned. */ @@ -658,10 +660,10 @@ in_pcbladdr(struct inpcb *inp, struct in * 2. Check if we have any address on the outgoing interface * belonging to this jail. */ + ia = NULL; ifp = sro.ro_rt->rt_ifp; IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - sa = ifa->ifa_addr; if (sa->sa_family != AF_INET) continue; @@ -694,6 +696,7 @@ in_pcbladdr(struct inpcb *inp, struct in */ if ((sro.ro_rt->rt_ifp->if_flags & IFF_LOOPBACK) != 0) { struct sockaddr_in sain; + struct in_ifaddr *ia; bzero(&sain, sizeof(struct sockaddr_in)); sain.sin_family = AF_INET; @@ -710,6 +713,7 @@ in_pcbladdr(struct inpcb *inp, struct in goto done; } laddr->s_addr = ia->ia_addr.sin_addr.s_addr; + ifa_free(&ia->ia_ifa); goto done; } @@ -718,6 +722,7 @@ in_pcbladdr(struct inpcb *inp, struct in struct ifnet *ifp; ifp = ia->ia_ifp; + ifa_free(&ia->ia_ifa); ia = NULL; IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { Modified: head/sys/netinet/in_var.h ============================================================================== --- head/sys/netinet/in_var.h Tue Jun 23 20:19:02 2009 (r194759) +++ head/sys/netinet/in_var.h Tue Jun 23 20:19:09 2009 (r194760) @@ -146,14 +146,16 @@ do { \ * Macro for finding the internet address structure (in_ifaddr) corresponding * to a given interface (ifnet structure). */ -#define IFP_TO_IA(ifp, ia) \ - /* struct ifnet *ifp; */ \ - /* struct in_ifaddr *ia; */ \ -{ \ - for ((ia) = TAILQ_FIRST(&V_in_ifaddrhead); \ - (ia) != NULL && (ia)->ia_ifp != (ifp); \ - (ia) = TAILQ_NEXT((ia), ia_link)) \ - continue; \ +#define IFP_TO_IA(ifp, ia) \ + /* struct ifnet *ifp; */ \ + /* struct in_ifaddr *ia; */ \ +{ \ + for ((ia) = TAILQ_FIRST(&V_in_ifaddrhead); \ + (ia) != NULL && (ia)->ia_ifp != (ifp); \ + (ia) = TAILQ_NEXT((ia), ia_link)) \ + continue; \ + if ((ia) != NULL) \ + ifa_ref(&(ia)->ia_ifa); \ } #endif Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Tue Jun 23 20:19:02 2009 (r194759) +++ head/sys/netinet/ip_carp.c Tue Jun 23 20:19:09 2009 (r194760) @@ -1239,6 +1239,7 @@ carp_iamatch6(void *v, struct in6_addr * (SC2IFP(vh)->if_flags & IFF_UP) && (SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING) && vh->sc_state == MASTER) { + ifa_ref(ifa); IF_ADDR_UNLOCK(SC2IFP(vh)); CARP_UNLOCK(cif); return (ifa); Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Tue Jun 23 20:19:02 2009 (r194759) +++ head/sys/netinet/ip_divert.c Tue Jun 23 20:19:09 2009 (r194760) @@ -464,6 +464,7 @@ div_output(struct socket *so, struct mbu goto cantsend; } m->m_pkthdr.rcvif = ifa->ifa_ifp; + ifa_free(ifa); } #ifdef MAC mac_socket_create_mbuf(so, m); Modified: head/sys/netinet/ip_icmp.c ============================================================================== --- head/sys/netinet/ip_icmp.c Tue Jun 23 20:19:02 2009 (r194759) +++ head/sys/netinet/ip_icmp.c Tue Jun 23 20:19:09 2009 (r194760) @@ -536,10 +536,12 @@ icmp_input(struct mbuf *m, int off) } ia = (struct in_ifaddr *)ifaof_ifpforaddr( (struct sockaddr *)&icmpdst, m->m_pkthdr.rcvif); - if (ia == 0) + if (ia == NULL) break; - if (ia->ia_ifp == 0) + if (ia->ia_ifp == NULL) { + ifa_free(&ia->ia_ifa); break; + } icp->icmp_type = ICMP_MASKREPLY; if (V_icmpmaskfake == 0) icp->icmp_mask = ia->ia_sockmask.sin_addr.s_addr; @@ -551,6 +553,7 @@ icmp_input(struct mbuf *m, int off) else if (ia->ia_ifp->if_flags & IFF_POINTOPOINT) ip->ip_src = satosin(&ia->ia_dstaddr)->sin_addr; } + ifa_free(&ia->ia_ifa); reflect: ip->ip_len += hlen; /* since ip_input deducts this */ ICMPSTAT_INC(icps_reflect); @@ -748,6 +751,7 @@ icmp_reflect(struct mbuf *m) goto done; } t = IA_SIN(ia)->sin_addr; + ifa_free(&ia->ia_ifa); match: #ifdef MAC mac_netinet_icmp_replyinplace(m); Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Tue Jun 23 20:19:02 2009 (r194759) +++ head/sys/netinet/ip_input.c Tue Jun 23 20:19:09 2009 (r194760) @@ -622,8 +622,10 @@ passin: * enabled. */ if (IA_SIN(ia)->sin_addr.s_addr == ip->ip_dst.s_addr && - (!checkif || ia->ia_ifp == ifp)) + (!checkif || ia->ia_ifp == ifp)) { + ifa_ref(&ia->ia_ifa); goto ours; + } } /* * Check for broadcast addresses. @@ -641,15 +643,18 @@ passin: ia = ifatoia(ifa); if (satosin(&ia->ia_broadaddr)->sin_addr.s_addr == ip->ip_dst.s_addr) { + ifa_ref(ifa); IF_ADDR_UNLOCK(ifp); goto ours; } if (ia->ia_netbroadcast.s_addr == ip->ip_dst.s_addr) { + ifa_ref(ifa); IF_ADDR_UNLOCK(ifp); goto ours; } #ifdef BOOTP_COMPAT if (IA_SIN(ia)->sin_addr.s_addr == INADDR_ANY) { + ifa_ref(ifa); IF_ADDR_UNLOCK(ifp); goto ours; } @@ -742,6 +747,7 @@ ours: if (ia != NULL) { ia->ia_ifa.if_ipackets++; ia->ia_ifa.if_ibytes += m->m_pkthdr.len; + ifa_free(&ia->ia_ifa); } /* @@ -1335,8 +1341,8 @@ ipproto_unregister(u_char ipproto) } /* - * Given address of next destination (final or next hop), - * return internet address info of interface to be used to get there. + * Given address of next destination (final or next hop), return (referenced) + * internet address info of interface to be used to get there. */ struct in_ifaddr * ip_rtaddr(struct in_addr dst, u_int fibnum) @@ -1356,6 +1362,7 @@ ip_rtaddr(struct in_addr dst, u_int fibn return (NULL); ifa = ifatoia(sro.ro_rt->rt_ifa); + ifa_ref(&ifa->ia_ifa); RTFREE(sro.ro_rt); return (ifa); } @@ -1530,11 +1537,16 @@ ip_forward(struct mbuf *m, int srcrt) else { if (mcopy) m_freem(mcopy); + if (ia != NULL) + ifa_free(&ia->ia_ifa); return; } } - if (mcopy == NULL) + if (mcopy == NULL) { + if (ia != NULL) + ifa_free(&ia->ia_ifa); return; + } switch (error) { @@ -1592,6 +1604,8 @@ ip_forward(struct mbuf *m, int srcrt) */ if (V_ip_sendsourcequench == 0) { m_freem(mcopy); + if (ia != NULL) + ifa_free(&ia->ia_ifa); return; } else { type = ICMP_SOURCEQUENCH; @@ -1601,8 +1615,12 @@ ip_forward(struct mbuf *m, int srcrt) case EACCES: /* ipfw denied packet */ m_freem(mcopy); + if (ia != NULL) + ifa_free(&ia->ia_ifa); return; } + if (ia != NULL) + ifa_free(&ia->ia_ifa); icmp_error(mcopy, type, code, dest.s_addr, mtu); } Modified: head/sys/netinet/ip_mroute.c ============================================================================== --- head/sys/netinet/ip_mroute.c Tue Jun 23 20:19:02 2009 (r194759) +++ head/sys/netinet/ip_mroute.c Tue Jun 23 20:19:09 2009 (r194760) @@ -883,6 +883,7 @@ add_vif(struct vifctl *vifcp) return EADDRNOTAVAIL; } ifp = ifa->ifa_ifp; + ifa_free(ifa); } if ((vifcp->vifc_flags & VIFF_TUNNEL) != 0) { Modified: head/sys/netinet/ip_options.c ============================================================================== --- head/sys/netinet/ip_options.c Tue Jun 23 20:19:02 2009 (r194759) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 20:22:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A3A21065675; Tue, 23 Jun 2009 20:22:36 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC4DF8FC1E; Tue, 23 Jun 2009 20:22:35 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NKMYNm089009; Tue, 23 Jun 2009 20:22:34 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NKMY1Q089007; Tue, 23 Jun 2009 20:22:34 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <200906232022.n5NKMY1Q089007@svn.freebsd.org> From: Andrew Gallatin Date: Tue, 23 Jun 2009 20:22:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194761 - head/sys/dev/mxge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 20:22:36 -0000 Author: gallatin Date: Tue Jun 23 20:22:34 2009 New Revision: 194761 URL: http://svn.freebsd.org/changeset/base/194761 Log: - Fix bug where device would loose promisc setting when reset. - Allow all rss hash modes to be chosen Modified: head/sys/dev/mxge/if_mxge.c Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Tue Jun 23 20:19:09 2009 (r194760) +++ head/sys/dev/mxge/if_mxge.c Tue Jun 23 20:22:34 2009 (r194761) @@ -1310,7 +1310,7 @@ mxge_reset(mxge_softc_t *sc, int interru } sc->rdma_tags_available = 15; status = mxge_update_mac_address(sc); - mxge_change_promisc(sc, 0); + mxge_change_promisc(sc, sc->ifp->if_flags & IFF_PROMISC); mxge_change_pause(sc, sc->pause); mxge_set_multicast_list(sc); return status; @@ -4020,7 +4020,7 @@ mxge_fetch_tunables(mxge_softc_t *sc) mxge_ticks = hz / 2; sc->pause = mxge_flow_control; if (mxge_rss_hash_type < MXGEFW_RSS_HASH_TYPE_IPV4 - || mxge_rss_hash_type > MXGEFW_RSS_HASH_TYPE_SRC_PORT) { + || mxge_rss_hash_type > MXGEFW_RSS_HASH_TYPE_MAX) { mxge_rss_hash_type = MXGEFW_RSS_HASH_TYPE_SRC_PORT; } } From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 20:35:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 804101065670; Tue, 23 Jun 2009 20:35:51 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C9E98FC08; Tue, 23 Jun 2009 20:35:51 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NKZpte089297; Tue, 23 Jun 2009 20:35:51 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NKZpNX089292; Tue, 23 Jun 2009 20:35:51 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200906232035.n5NKZpNX089292@svn.freebsd.org> From: Jamie Gritton Date: Tue, 23 Jun 2009 20:35: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: r194762 - in head: lib/libc/sys sys/kern sys/sys usr.sbin/jail X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 20:35:51 -0000 Author: jamie Date: Tue Jun 23 20:35:51 2009 New Revision: 194762 URL: http://svn.freebsd.org/changeset/base/194762 Log: Add a limit for child jails via the "children.cur" and "children.max" parameters. This replaces the simple "allow.jails" permission. Approved by: bz (mentor) Modified: head/lib/libc/sys/jail.2 head/sys/kern/kern_jail.c head/sys/sys/jail.h head/usr.sbin/jail/jail.8 Modified: head/lib/libc/sys/jail.2 ============================================================================== --- head/lib/libc/sys/jail.2 Tue Jun 23 20:22:34 2009 (r194761) +++ head/lib/libc/sys/jail.2 Tue Jun 23 20:35:51 2009 (r194762) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 27, 2009 +.Dd June 23, 2009 .Dt JAIL 2 .Os .Sh NAME @@ -293,9 +293,9 @@ will fail if: .Bl -tag -width Er .It Bq Er EPERM This process is not allowed to create a jail, either because it is not -the super-user, or because it is in a jail where the -.Va allow.jails -parameter is not set. +the super-user, or because it would exceed the jail's +.Va children.max +limit. .It Bq Er EFAULT .Fa jail points to an address outside the allocated address space of the process. @@ -312,9 +312,9 @@ will fail if: .Bl -tag -width Er .It Bq Er EPERM This process is not allowed to create a jail, either because it is not -the super-user, or because it is in a jail where the -.Va allow.jails -parameter is not set. +the super-user, or because it would exceed the jail's +.Va children.max +limit. .It Bq Er EPERM A jail parameter was set to a less restrictive value then the current environment. Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Tue Jun 23 20:22:34 2009 (r194761) +++ head/sys/kern/kern_jail.c Tue Jun 23 20:35:51 2009 (r194762) @@ -80,6 +80,7 @@ struct prison prison0 = { .pr_uref = 1, .pr_path = "/", .pr_securelevel = -1, + .pr_childmax = JAIL_MAX, .pr_hostuuid = "00000000-0000-0000-0000-000000000000", .pr_children = LIST_HEAD_INITIALIZER(&prison0.pr_children), .pr_flags = PR_HOST, @@ -152,7 +153,6 @@ static char *pr_allow_names[] = { "allow.chflags", "allow.mount", "allow.quotas", - "allow.jails", "allow.socket_af", }; @@ -163,7 +163,6 @@ static char *pr_allow_nonames[] = { "allow.nochflags", "allow.nomount", "allow.noquotas", - "allow.nojails", "allow.nosocket_af", }; @@ -479,8 +478,8 @@ kern_jail_set(struct thread *td, struct unsigned long hid; size_t namelen, onamelen; int created, cuflags, descend, enforce, error, errmsg_len, errmsg_pos; - int gotenforce, gothid, gotslevel, fi, jid, len; - int slevel, vfslocked; + int gotchildmax, gotenforce, gothid, gotslevel, fi, jid, len, level; + int childmax, slevel, vfslocked; #if defined(INET) || defined(INET6) int ii, ij; #endif @@ -500,7 +499,7 @@ kern_jail_set(struct thread *td, struct if (error) return (error); mypr = ppr = td->td_ucred->cr_prison; - if ((flags & JAIL_CREATE) && !(mypr->pr_allow & PR_ALLOW_JAILS)) + if ((flags & JAIL_CREATE) && mypr->pr_childmax == 0) return (EPERM); if (flags & ~JAIL_SET_MASK) return (EINVAL); @@ -544,6 +543,15 @@ kern_jail_set(struct thread *td, struct else gotslevel = 1; + error = + vfs_copyopt(opts, "children.max", &childmax, sizeof(childmax)); + if (error == ENOENT) + gotchildmax = 0; + else if (error != 0) + goto done_free; + else + gotchildmax = 1; + error = vfs_copyopt(opts, "enforce_statfs", &enforce, sizeof(enforce)); gotenforce = (error == 0); if (gotenforce) { @@ -1023,6 +1031,12 @@ kern_jail_set(struct thread *td, struct /* If there's no prison to update, create a new one and link it in. */ if (pr == NULL) { + for (tpr = mypr; tpr != NULL; tpr = tpr->pr_parent) + if (tpr->pr_childcount >= tpr->pr_childmax) { + error = EPERM; + vfs_opterror(opts, "prison limit exceeded"); + goto done_unlock_list; + } created = 1; mtx_lock(&ppr->pr_mtx); if (ppr->pr_ref == 0 || (ppr->pr_flags & PR_REMOVE)) { @@ -1076,7 +1090,7 @@ kern_jail_set(struct thread *td, struct TAILQ_INSERT_TAIL(&allprison, pr, pr_list); LIST_INSERT_HEAD(&ppr->pr_children, pr, pr_sibling); for (tpr = ppr; tpr != NULL; tpr = tpr->pr_parent) - tpr->pr_prisoncount++; + tpr->pr_childcount++; pr->pr_parent = ppr; pr->pr_id = jid; @@ -1163,6 +1177,12 @@ kern_jail_set(struct thread *td, struct goto done_deref_locked; } } + if (gotchildmax) { + if (childmax >= ppr->pr_childmax) { + error = EPERM; + goto done_deref_locked; + } + } if (gotenforce) { if (enforce < ppr->pr_enforce_statfs) { error = EPERM; @@ -1506,6 +1526,14 @@ kern_jail_set(struct thread *td, struct if (tpr->pr_securelevel < slevel) tpr->pr_securelevel = slevel; } + if (gotchildmax) { + pr->pr_childmax = childmax; + /* Set all child jails to under this limit. */ + FOREACH_PRISON_DESCENDANT_LOCKED_LEVEL(pr, tpr, descend, level) + if (tpr->pr_childmax > childmax - level) + tpr->pr_childmax = childmax > level + ? childmax - level : 0; + } if (gotenforce) { pr->pr_enforce_statfs = enforce; /* Pass this restriction on to the children. */ @@ -1895,6 +1923,14 @@ kern_jail_get(struct thread *td, struct sizeof(pr->pr_securelevel)); if (error != 0 && error != ENOENT) goto done_deref; + error = vfs_setopt(opts, "children.cur", &pr->pr_childcount, + sizeof(pr->pr_childcount)); + if (error != 0 && error != ENOENT) + goto done_deref; + error = vfs_setopt(opts, "children.max", &pr->pr_childmax, + sizeof(pr->pr_childmax)); + if (error != 0 && error != ENOENT) + goto done_deref; error = vfs_setopts(opts, "host.hostname", pr->pr_hostname); if (error != 0 && error != ENOENT) goto done_deref; @@ -2425,7 +2461,7 @@ prison_deref(struct prison *pr, int flag LIST_REMOVE(pr, pr_sibling); ppr = pr->pr_parent; for (tpr = ppr; tpr != NULL; tpr = tpr->pr_parent) - tpr->pr_prisoncount--; + tpr->pr_childcount--; sx_downgrade(&allprison_lock); #ifdef VIMAGE @@ -3878,6 +3914,12 @@ SYSCTL_JAIL_PARAM(, vnet, CTLTYPE_INT | SYSCTL_JAIL_PARAM(, dying, CTLTYPE_INT | CTLFLAG_RD, "B", "Jail is in the process of shutting down"); +SYSCTL_JAIL_PARAM_NODE(children, "Number of child jails"); +SYSCTL_JAIL_PARAM(_children, cur, CTLTYPE_INT | CTLFLAG_RD, + "I", "Current number of child jails"); +SYSCTL_JAIL_PARAM(_children, max, CTLTYPE_INT | CTLFLAG_RW, + "I", "Maximum number of child jails"); + SYSCTL_JAIL_PARAM_NODE(host, "Jail host info"); SYSCTL_JAIL_PARAM(, nohost, CTLTYPE_INT | CTLFLAG_RW, "BN", "Jail w/ no host info"); @@ -3921,8 +3963,6 @@ SYSCTL_JAIL_PARAM(_allow, mount, CTLTYPE "B", "Jail may mount/unmount jail-friendly file systems"); SYSCTL_JAIL_PARAM(_allow, quotas, CTLTYPE_INT | CTLFLAG_RW, "B", "Jail may set file quotas"); -SYSCTL_JAIL_PARAM(_allow, jails, CTLTYPE_INT | CTLFLAG_RW, - "B", "Jail may create child jails"); SYSCTL_JAIL_PARAM(_allow, socket_af, CTLTYPE_INT | CTLFLAG_RW, "B", "Jail may create sockets other than just UNIX/IPv4/IPv6/route"); @@ -3954,6 +3994,7 @@ db_show_prison(struct prison *pr) #endif db_printf(" root = %p\n", pr->pr_root); db_printf(" securelevel = %d\n", pr->pr_securelevel); + db_printf(" childcount = %d\n", pr->pr_childcount); db_printf(" child = %p\n", LIST_FIRST(&pr->pr_children)); db_printf(" sibling = %p\n", LIST_NEXT(pr, pr_sibling)); db_printf(" flags = %x", pr->pr_flags); Modified: head/sys/sys/jail.h ============================================================================== --- head/sys/sys/jail.h Tue Jun 23 20:22:34 2009 (r194761) +++ head/sys/sys/jail.h Tue Jun 23 20:35:51 2009 (r194762) @@ -165,13 +165,14 @@ struct prison { struct in6_addr *pr_ip6; /* (p) v6 IPs of jail */ LIST_HEAD(, prison) pr_children; /* (a) list of child jails */ LIST_ENTRY(prison) pr_sibling; /* (a) next in parent's list */ - int pr_prisoncount; /* (a) number of child jails */ + int pr_childcount; /* (a) number of child jails */ unsigned pr_allow; /* (p) PR_ALLOW_* flags */ int pr_enforce_statfs; /* (p) statfs permission */ char pr_domainname[MAXHOSTNAMELEN]; /* (p) jail domainname */ char pr_hostuuid[HOSTUUIDLEN]; /* (p) jail hostuuid */ unsigned long pr_hostid; /* (p) jail hostid */ struct vnet *pr_vnet; /* (c) network stack */ + int pr_childmax; /* (p) maximum child jails */ }; #endif /* _KERNEL || _WANT_PRISON */ @@ -197,9 +198,8 @@ struct prison { #define PR_ALLOW_CHFLAGS 0x0008 #define PR_ALLOW_MOUNT 0x0010 #define PR_ALLOW_QUOTAS 0x0020 -#define PR_ALLOW_JAILS 0x0040 -#define PR_ALLOW_SOCKET_AF 0x0080 -#define PR_ALLOW_ALL 0x00ff +#define PR_ALLOW_SOCKET_AF 0x0040 +#define PR_ALLOW_ALL 0x007f /* * OSD methods @@ -271,6 +271,23 @@ prison_unlock(struct prison *pr) else /* + * As above, but also keep track of the level descended to. + */ +#define FOREACH_PRISON_DESCENDANT_LOCKED_LEVEL(ppr, cpr, descend, level)\ + for ((cpr) = (ppr), (descend) = 1, (level) = 0; \ + ((cpr) = (((descend) && !LIST_EMPTY(&(cpr)->pr_children)) \ + ? (level++, LIST_FIRST(&(cpr)->pr_children)) \ + : ((cpr) == (ppr) \ + ? NULL \ + : ((prison_unlock(cpr), \ + (descend) = LIST_NEXT(cpr, pr_sibling) != NULL) \ + ? LIST_NEXT(cpr, pr_sibling) \ + : (level--, (cpr)->pr_parent)))));) \ + if ((descend) ? (prison_lock(cpr), 0) : 1) \ + ; \ + else + +/* * Attributes of the physical system, and the root of the jail tree. */ extern struct prison prison0; Modified: head/usr.sbin/jail/jail.8 ============================================================================== --- head/usr.sbin/jail/jail.8 Tue Jun 23 20:22:34 2009 (r194761) +++ head/usr.sbin/jail/jail.8 Tue Jun 23 20:35:51 2009 (r194762) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 29, 2009 +.Dd June 23, 2009 .Dt JAIL 8 .Os .Sh NAME @@ -279,6 +279,17 @@ A jail never has a lower securelevel tha setting this parameter it may have a higher one. If the system securelevel is changed, any jail securelevels will be at least as secure. +.It Va children.max +The number of child jails allowed to be created by this jail (or by +other jails under this jail). +This limit is zero by default, indicating the jail is not allowed to +create child jails. +See the +.Va "Hierarchical Jails" +section for more information. +.It Va children.cur +The number of descendents of this jail, including its own child jails +and any jails created under them. .It Va enforce_statfs This determines which information processes in a jail are able to get about mount points. @@ -368,10 +379,6 @@ with non-jailed parts of the system. Sockets within a jail are normally restricted to IPv4, IPv6, local (UNIX), and route. This allows access to other protocol stacks that have not had jail functionality added to them. -.It Va allow.jails -The prison root may create child jails under this jail. See the -.Va "Hierarchical Jails" -section for more information. .El .El .Pp @@ -756,7 +763,7 @@ and .Va kern.hostuuid . .Ss "Hierarchical Jails" By setting a jail's -.Va allow.jails +.Va children.max parameter, processes within a jail may be able to create jails of their own. These child jails are kept in a hierarchy, with jails only able to see and/or modify the jails they created (or those jails' children). @@ -782,8 +789,8 @@ and may not be bypassed in child jails. .Pp A child jail may in turn create its own child jails if its own -.Va allow.jails -parameter is set (remember it is off by default). +.Va children.max +parameter is set (remember it is zero by default). These jails are visible to and can be modified by their parent and all ancestors. .Pp From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 20:37:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 039FF1065675; Tue, 23 Jun 2009 20:37:00 +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 E40E88FC08; Tue, 23 Jun 2009 20:36:59 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NKaxrp089361; Tue, 23 Jun 2009 20:36:59 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NKax9O089354; Tue, 23 Jun 2009 20:36:59 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200906232036.n5NKax9O089354@svn.freebsd.org> From: Marius Strobl Date: Tue, 23 Jun 2009 20:36:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194763 - in head/sys: conf dev/gem modules/gem X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 20:37:00 -0000 Author: marius Date: Tue Jun 23 20:36:59 2009 New Revision: 194763 URL: http://svn.freebsd.org/changeset/base/194763 Log: - Initialize the ifnet structure, especially if_dname, before probing the PHYs as some PHY drivers use it (but probably shouldn't). How gem(4) has worked with brgphy(4) on powerpc without this so far is unclear to me. - Introduce a dying flag which is set during detach and checked in gem_ioctl() in order to prevent active BPF listeners to clear promiscuous mode which may lead to the tick callout being restarted which will trigger a panic once it's actually gone. - In gem_stop() reset rather than just disable the transmitter and receiver in order to ensure we're not unloading DMA maps still in use by the hardware. [1] - The blanking time is specified in PCI clocks so we should use twice the value when operating at 66MHz. - Spell some 2 as ETHER_ALIGN and a 19 as GEM_STATUS_TX_COMPLETION_SHFT to make the actual intentions clear. - As we don't unload the peak attempts counter ignore its overflow interrupts. - Remove a stale setting of a variable to GEM_TD_INTERRUPT_ME which isn't used afterwards. - For optimum performance increment the TX kick register in multiples of 4 if possible as suggested by the documentation. - Partially revert r164931; drivers should only clear the watchdog timer if all outstanding TX descriptors are done. - Fix some debugging strings. - Add a missing BUS_DMASYNC_POSTWRITE in gem_rint(). - As the error paths in the interrupt handler are generally unlikely predict them as false. - Add support for the SBus version of the GEM controller. [2] - Add some lock assertions. - Improve some comments. - Fix some more or less cosmetic issues in the code of the PCI front-end. - Change some softc members to be unsigned where more appropriate and remove unused ones. Approved by: re (kib) Obtained from: NetBSD (partially) [2], OpenBSD [1] MFC after: 2 weeks Added: head/sys/dev/gem/if_gem_sbus.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/gem/if_gem.c head/sys/dev/gem/if_gem_pci.c head/sys/dev/gem/if_gemreg.h head/sys/dev/gem/if_gemvar.h head/sys/modules/gem/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Jun 23 20:35:51 2009 (r194762) +++ head/sys/conf/files Tue Jun 23 20:36:59 2009 (r194763) @@ -923,6 +923,7 @@ dev/flash/at45d.c optional at45d dev/fxp/if_fxp.c optional fxp inet dev/gem/if_gem.c optional gem dev/gem/if_gem_pci.c optional gem pci +dev/gem/if_gem_sbus.c optional gem sbus dev/hatm/if_hatm.c optional hatm pci dev/hatm/if_hatm_intr.c optional hatm pci dev/hatm/if_hatm_ioctl.c optional hatm pci Modified: head/sys/dev/gem/if_gem.c ============================================================================== --- head/sys/dev/gem/if_gem.c Tue Jun 23 20:35:51 2009 (r194762) +++ head/sys/dev/gem/if_gem.c Tue Jun 23 20:36:59 2009 (r194763) @@ -84,7 +84,7 @@ __FBSDID("$FreeBSD$"); CTASSERT(powerof2(GEM_NRXDESC) && GEM_NRXDESC >= 32 && GEM_NRXDESC <= 8192); CTASSERT(powerof2(GEM_NTXDESC) && GEM_NTXDESC >= 32 && GEM_NTXDESC <= 8192); -#define TRIES 10000 +#define GEM_TRIES 10000 /* * The hardware supports basic TCP/UDP checksum offloading. However, @@ -119,7 +119,7 @@ static void gem_rint(struct gem_softc *s #ifdef GEM_RINT_TIMEOUT static void gem_rint_timeout(void *arg); #endif -static __inline void gem_rxcksum(struct mbuf *m, uint64_t flags); +static inline void gem_rxcksum(struct mbuf *m, uint64_t flags); static void gem_rxdrain(struct gem_softc *sc); static void gem_setladrf(struct gem_softc *sc); static void gem_start(struct ifnet *ifp); @@ -127,6 +127,7 @@ static void gem_start_locked(struct ifne static void gem_stop(struct ifnet *ifp, int disable); static void gem_tick(void *arg); static void gem_tint(struct gem_softc *sc); +static inline void gem_txkick(struct gem_softc *sc); static int gem_watchdog(struct gem_softc *sc); devclass_t gem_devclass; @@ -151,9 +152,24 @@ gem_attach(struct gem_softc *sc) int error, i; uint32_t v; + if (bootverbose) + device_printf(sc->sc_dev, "flags=0x%x\n", sc->sc_flags); + + /* Set up ifnet structure. */ ifp = sc->sc_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) return (ENOSPC); + sc->sc_csum_features = GEM_CSUM_FEATURES; + ifp->if_softc = sc; + if_initname(ifp, device_get_name(sc->sc_dev), + device_get_unit(sc->sc_dev)); + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_start = gem_start; + ifp->if_ioctl = gem_ioctl; + ifp->if_init = gem_init; + IFQ_SET_MAXLEN(&ifp->if_snd, GEM_TXQUEUELEN); + ifp->if_snd.ifq_drv_maxlen = GEM_TXQUEUELEN; + IFQ_SET_READY(&ifp->if_snd); callout_init_mtx(&sc->sc_tick_ch, &sc->sc_mtx, 0); #ifdef GEM_RINT_TIMEOUT @@ -161,27 +177,26 @@ gem_attach(struct gem_softc *sc) #endif /* Make sure the chip is stopped. */ - ifp->if_softc = sc; gem_reset(sc); error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, &sc->sc_pdmatag); - if (error) + if (error != 0) goto fail_ifnet; error = bus_dma_tag_create(sc->sc_pdmatag, 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, 1, MCLBYTES, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->sc_rdmatag); - if (error) + if (error != 0) goto fail_ptag; error = bus_dma_tag_create(sc->sc_pdmatag, 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES * GEM_NTXSEGS, GEM_NTXSEGS, MCLBYTES, BUS_DMA_ALLOCNOW, NULL, NULL, &sc->sc_tdmatag); - if (error) + if (error != 0) goto fail_rtag; error = bus_dma_tag_create(sc->sc_pdmatag, PAGE_SIZE, 0, @@ -189,7 +204,7 @@ gem_attach(struct gem_softc *sc) sizeof(struct gem_control_data), 1, sizeof(struct gem_control_data), 0, NULL, NULL, &sc->sc_cdmatag); - if (error) + if (error != 0) goto fail_ttag; /* @@ -199,7 +214,7 @@ gem_attach(struct gem_softc *sc) if ((error = bus_dmamem_alloc(sc->sc_cdmatag, (void **)&sc->sc_control_data, BUS_DMA_WAITOK | BUS_DMA_COHERENT | BUS_DMA_ZERO, - &sc->sc_cddmamap))) { + &sc->sc_cddmamap)) != 0) { device_printf(sc->sc_dev, "unable to allocate control data, error = %d\n", error); goto fail_ctag; @@ -338,19 +353,6 @@ gem_attach(struct gem_softc *sc) device_printf(sc->sc_dev, "%ukB RX FIFO, %ukB TX FIFO\n", sc->sc_rxfifosize / 1024, v / 16); - sc->sc_csum_features = GEM_CSUM_FEATURES; - /* Initialize ifnet structure. */ - ifp->if_softc = sc; - if_initname(ifp, device_get_name(sc->sc_dev), - device_get_unit(sc->sc_dev)); - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_start = gem_start; - ifp->if_ioctl = gem_ioctl; - ifp->if_init = gem_init; - IFQ_SET_MAXLEN(&ifp->if_snd, GEM_TXQUEUELEN); - ifp->if_snd.ifq_drv_maxlen = GEM_TXQUEUELEN; - IFQ_SET_READY(&ifp->if_snd); - /* Attach the interface. */ ether_ifattach(ifp, sc->sc_enaddr); @@ -402,6 +404,7 @@ gem_detach(struct gem_softc *sc) int i; GEM_LOCK(sc); + sc->sc_flags |= GEM_DYING; gem_stop(ifp, 1); GEM_UNLOCK(sc); callout_drain(&sc->sc_tick_ch); @@ -456,7 +459,7 @@ gem_resume(struct gem_softc *sc) GEM_UNLOCK(sc); } -static __inline void +static inline void gem_rxcksum(struct mbuf *m, uint64_t flags) { struct ether_header *eh; @@ -535,12 +538,11 @@ static void gem_tick(void *arg) { struct gem_softc *sc = arg; - struct ifnet *ifp; + struct ifnet *ifp = sc->sc_ifp; uint32_t v; GEM_LOCK_ASSERT(sc, MA_OWNED); - ifp = sc->sc_ifp; /* * Unload collision and error counters. */ @@ -584,7 +586,7 @@ gem_bitwait(struct gem_softc *sc, u_int int i; uint32_t reg; - for (i = TRIES; i--; DELAY(100)) { + for (i = GEM_TRIES; i--; DELAY(100)) { reg = GEM_BANKN_READ_M(bank, 4, sc, r); if ((reg & clr) == 0 && (reg & set) == set) return (1); @@ -593,8 +595,7 @@ gem_bitwait(struct gem_softc *sc, u_int } static void -gem_reset(sc) - struct gem_softc *sc; +gem_reset(struct gem_softc *sc) { #ifdef GEM_DEBUG @@ -644,9 +645,8 @@ gem_stop(struct ifnet *ifp, int disable) callout_stop(&sc->sc_rx_ch); #endif - /* XXX should we reset these instead? */ - gem_disable_tx(sc); - gem_disable_rx(sc); + gem_reset_tx(sc); + gem_reset_rx(sc); /* * Release any queued transmit buffers. @@ -721,7 +721,7 @@ gem_reset_rxdma(struct gem_softc *sc) if (sc->sc_rxsoft[i].rxs_mbuf != NULL) GEM_UPDATE_RXDESC(sc, i); sc->sc_rxptr = 0; - GEM_CDSYNC(sc, BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); + GEM_CDSYNC(sc, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); /* NOTE: we use only 32-bit DMA addresses here. */ GEM_BANK1_WRITE_4(sc, GEM_RX_RING_PTR_HI, 0); @@ -732,9 +732,11 @@ gem_reset_rxdma(struct gem_softc *sc) ((ETHER_HDR_LEN + sizeof(struct ip)) << GEM_RX_CONFIG_CXM_START_SHFT) | (GEM_THRSH_1024 << GEM_RX_CONFIG_FIFO_THRS_SHIFT) | - (2 << GEM_RX_CONFIG_FBOFF_SHFT)); + (ETHER_ALIGN << GEM_RX_CONFIG_FBOFF_SHFT)); + /* Adjust for the SBus clock probably isn't worth the fuzz. */ GEM_BANK1_WRITE_4(sc, GEM_RX_BLANKING, - (6 << GEM_RX_BLANKING_TIME_SHIFT) | 6); + ((6 * (sc->sc_flags & GEM_PCI66) != 0 ? 2 : 1) << + GEM_RX_BLANKING_TIME_SHIFT) | 6); GEM_BANK1_WRITE_4(sc, GEM_RX_PAUSE_THRESH, (3 * sc->sc_rxfifosize / 256) | ((sc->sc_rxfifosize / 256) << 12)); @@ -798,12 +800,13 @@ gem_disable_tx(struct gem_softc *sc) } static int -gem_meminit(sc) - struct gem_softc *sc; +gem_meminit(struct gem_softc *sc) { struct gem_rxsoft *rxs; int error, i; + GEM_LOCK_ASSERT(sc, MA_OWNED); + /* * Initialize the transmit descriptor ring. */ @@ -837,7 +840,8 @@ gem_meminit(sc) GEM_INIT_RXDESC(sc, i); } sc->sc_rxptr = 0; - GEM_CDSYNC(sc, BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD); + + GEM_CDSYNC(sc, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); return (0); } @@ -938,6 +942,20 @@ gem_init_locked(struct gem_softc *sc) #endif /* step 8. Global Configuration & Interrupt Mask */ + + /* + * Set the internal arbitration to "infinite" bursts of the + * maximum length of 31 * 64 bytes so DMA transfers aren't + * split up in cache line size chunks. This greatly improves + * RX performance. + * Enable silicon bug workarounds for the Apple variants. + */ + GEM_BANK1_WRITE_4(sc, GEM_CONFIG, + GEM_CONFIG_TXDMA_LIMIT | GEM_CONFIG_RXDMA_LIMIT | + ((sc->sc_flags & GEM_PCI) != 0 ? GEM_CONFIG_BURST_INF : + GEM_CONFIG_BURST_64) | (GEM_IS_APPLE(sc) ? + GEM_CONFIG_RONPAULBIT | GEM_CONFIG_BUG2FIX : 0)); + GEM_BANK1_WRITE_4(sc, GEM_INTMASK, ~(GEM_INTR_TX_INTME | GEM_INTR_TX_EMPTY | GEM_INTR_RX_DONE | GEM_INTR_RX_NOBUF | GEM_INTR_RX_TAG_ERR | GEM_INTR_PERR | @@ -949,7 +967,8 @@ gem_init_locked(struct gem_softc *sc) GEM_BANK1_WRITE_4(sc, GEM_MAC_RX_MASK, GEM_MAC_RX_DONE | GEM_MAC_RX_FRAME_CNT); GEM_BANK1_WRITE_4(sc, GEM_MAC_TX_MASK, - GEM_MAC_TX_XMIT_DONE | GEM_MAC_TX_DEFER_EXP); + GEM_MAC_TX_XMIT_DONE | GEM_MAC_TX_DEFER_EXP | + GEM_MAC_TX_PEAK_EXP); #ifdef GEM_DEBUG GEM_BANK1_WRITE_4(sc, GEM_MAC_CONTROL_MASK, ~(GEM_MAC_PAUSED | GEM_MAC_PAUSE | GEM_MAC_RESUME)); @@ -961,7 +980,8 @@ gem_init_locked(struct gem_softc *sc) /* step 9. ETX Configuration: use mostly default values. */ /* Enable DMA. */ - v = gem_ringsize(GEM_NTXDESC /* XXX */); + v = gem_ringsize(GEM_NTXDESC); + /* Set TX FIFO threshold and enable DMA. */ v |= ((sc->sc_variant == GEM_SUN_ERI ? 0x100 : 0x4ff) << 10) & GEM_TX_CONFIG_TXFIFO_TH; GEM_BANK1_WRITE_4(sc, GEM_TX_CONFIG, v | GEM_TX_CONFIG_TXDMA_EN); @@ -973,14 +993,16 @@ gem_init_locked(struct gem_softc *sc) /* RX TCP/UDP checksum offset */ v |= ((ETHER_HDR_LEN + sizeof(struct ip)) << GEM_RX_CONFIG_CXM_START_SHFT); - - /* Enable DMA. */ + /* Set RX FIFO threshold, set first byte offset and enable DMA. */ GEM_BANK1_WRITE_4(sc, GEM_RX_CONFIG, v | (GEM_THRSH_1024 << GEM_RX_CONFIG_FIFO_THRS_SHIFT) | - (2 << GEM_RX_CONFIG_FBOFF_SHFT) | GEM_RX_CONFIG_RXDMA_EN); + (ETHER_ALIGN << GEM_RX_CONFIG_FBOFF_SHFT) | + GEM_RX_CONFIG_RXDMA_EN); + /* Adjust for the SBus clock probably isn't worth the fuzz. */ GEM_BANK1_WRITE_4(sc, GEM_RX_BLANKING, - (6 << GEM_RX_BLANKING_TIME_SHIFT) | 6); + ((6 * (sc->sc_flags & GEM_PCI66) != 0 ? 2 : 1) << + GEM_RX_BLANKING_TIME_SHIFT) | 6); /* * The following value is for an OFF Threshold of about 3/4 full @@ -1002,7 +1024,7 @@ gem_init_locked(struct gem_softc *sc) device_printf(sc->sc_dev, "cannot configure RX MAC\n"); GEM_BANK1_WRITE_4(sc, GEM_MAC_RX_CONFIG, v); - /* step 13. TX_MAC Configuration Register */ + /* step 13. TX_MAC Configuration Register */ v = GEM_BANK1_READ_4(sc, GEM_MAC_TX_CONFIG); v |= GEM_MAC_TX_ENABLE; GEM_BANK1_WRITE_4(sc, GEM_MAC_TX_CONFIG, 0); @@ -1037,6 +1059,8 @@ gem_load_txmbuf(struct gem_softc *sc, st uint64_t cflags, flags; int error, nexttx, nsegs, offset, seg; + GEM_LOCK_ASSERT(sc, MA_OWNED); + /* Get a work queue entry. */ if ((txs = STAILQ_FIRST(&sc->sc_txfreeq)) == NULL) { /* Ran out of descriptors. */ @@ -1143,7 +1167,6 @@ gem_load_txmbuf(struct gem_softc *sc, st #endif if (++sc->sc_txwin > GEM_NTXSEGS * 2 / 3) { sc->sc_txwin = 0; - flags |= GEM_TD_INTERRUPT_ME; sc->sc_txdescs[txs->txs_firstdesc].gd_flags |= GEM_DMA_WRITE(sc, GEM_TD_INTERRUPT_ME | GEM_TD_START_OF_PACKET); @@ -1175,6 +1198,8 @@ gem_init_regs(struct gem_softc *sc) { const u_char *laddr = IF_LLADDR(sc->sc_ifp); + GEM_LOCK_ASSERT(sc, MA_OWNED); + /* These registers are not cleared on reset. */ if ((sc->sc_flags & GEM_INITED) == 0) { /* magic values */ @@ -1182,16 +1207,19 @@ gem_init_regs(struct gem_softc *sc) GEM_BANK1_WRITE_4(sc, GEM_MAC_IPG1, 8); GEM_BANK1_WRITE_4(sc, GEM_MAC_IPG2, 4); + /* min frame length */ GEM_BANK1_WRITE_4(sc, GEM_MAC_MAC_MIN_FRAME, ETHER_MIN_LEN); - /* max frame and max burst size */ + /* max frame length and max burst size */ GEM_BANK1_WRITE_4(sc, GEM_MAC_MAC_MAX_FRAME, (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN) | (0x2000 << 16)); + /* more magic values */ GEM_BANK1_WRITE_4(sc, GEM_MAC_PREAMBLE_LEN, 0x7); GEM_BANK1_WRITE_4(sc, GEM_MAC_JAM_SIZE, 0x4); GEM_BANK1_WRITE_4(sc, GEM_MAC_ATTEMPT_LIMIT, 0x10); - /* dunno... */ GEM_BANK1_WRITE_4(sc, GEM_MAC_CONTROL_TYPE, 0x8088); + + /* random number seed */ GEM_BANK1_WRITE_4(sc, GEM_MAC_RANDOM_SEED, ((laddr[5] << 8) | laddr[4]) & 0x3ff); @@ -1209,7 +1237,6 @@ gem_init_regs(struct gem_softc *sc) GEM_BANK1_WRITE_4(sc, GEM_MAC_ADDR_FILTER0, 0); GEM_BANK1_WRITE_4(sc, GEM_MAC_ADDR_FILTER1, 0); GEM_BANK1_WRITE_4(sc, GEM_MAC_ADDR_FILTER2, 0); - GEM_BANK1_WRITE_4(sc, GEM_MAC_ADR_FLT_MASK1_2, 0); GEM_BANK1_WRITE_4(sc, GEM_MAC_ADR_FLT_MASK0, 0); @@ -1232,18 +1259,6 @@ gem_init_regs(struct gem_softc *sc) /* Set XOFF PAUSE time. */ GEM_BANK1_WRITE_4(sc, GEM_MAC_SEND_PAUSE_CMD, 0x1BF0); - /* - * Set the internal arbitration to "infinite" bursts of the - * maximum length of 31 * 64 bytes so DMA transfers aren't - * split up in cache line size chunks. This greatly improves - * especially RX performance. - * Enable silicon bug workarounds for the Apple variants. - */ - GEM_BANK1_WRITE_4(sc, GEM_CONFIG, - GEM_CONFIG_TXDMA_LIMIT | GEM_CONFIG_RXDMA_LIMIT | - GEM_CONFIG_BURST_INF | (GEM_IS_APPLE(sc) ? - GEM_CONFIG_RONPAULBIT | GEM_CONFIG_BUG2FIX : 0)); - /* Set the station address. */ GEM_BANK1_WRITE_4(sc, GEM_MAC_ADDR0, (laddr[4] << 8) | laddr[5]); GEM_BANK1_WRITE_4(sc, GEM_MAC_ADDR1, (laddr[2] << 8) | laddr[3]); @@ -1263,12 +1278,32 @@ gem_start(struct ifnet *ifp) GEM_UNLOCK(sc); } +static inline void +gem_txkick(struct gem_softc *sc) +{ + + /* + * Update the TX kick register. This register has to point to the + * descriptor after the last valid one and for optimum performance + * should be incremented in multiples of 4 (the DMA engine fetches/ + * updates descriptors in batches of 4). + */ +#ifdef GEM_DEBUG + CTR3(KTR_GEM, "%s: %s: kicking TX %d", + device_get_name(sc->sc_dev), __func__, sc->sc_txnext); +#endif + GEM_CDSYNC(sc, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + GEM_BANK1_WRITE_4(sc, GEM_TX_KICK, sc->sc_txnext); +} + static void gem_start_locked(struct ifnet *ifp) { struct gem_softc *sc = ifp->if_softc; struct mbuf *m; - int ntx; + int kicked, ntx; + + GEM_LOCK_ASSERT(sc, MA_OWNED); if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING || (sc->sc_flags & GEM_LINK) == 0) @@ -1280,6 +1315,7 @@ gem_start_locked(struct ifnet *ifp) sc->sc_txnext); #endif ntx = 0; + kicked = 0; for (; !IFQ_DRV_IS_EMPTY(&ifp->if_snd) && sc->sc_txfree > 1;) { IFQ_DRV_DEQUEUE(&ifp->if_snd, m); if (m == NULL) @@ -1291,19 +1327,18 @@ gem_start_locked(struct ifnet *ifp) IFQ_DRV_PREPEND(&ifp->if_snd, m); break; } + if ((sc->sc_txnext % 4) == 0) { + gem_txkick(sc); + kicked = 1; + } else + kicked = 0; ntx++; - /* Kick the transmitter. */ -#ifdef GEM_DEBUG - CTR3(KTR_GEM, "%s: %s: kicking TX %d", - device_get_name(sc->sc_dev), __func__, sc->sc_txnext); -#endif - GEM_CDSYNC(sc, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - GEM_BANK1_WRITE_4(sc, GEM_TX_KICK, sc->sc_txnext); - BPF_MTAP(ifp, m); } if (ntx > 0) { + if (kicked == 0) + gem_txkick(sc); #ifdef GEM_DEBUG CTR2(KTR_GEM, "%s: packets enqueued, OWN on %d", device_get_name(sc->sc_dev), sc->sc_txnext); @@ -1324,10 +1359,13 @@ gem_tint(struct gem_softc *sc) { struct ifnet *ifp = sc->sc_ifp; struct gem_txsoft *txs; - int txlast, progress; + int progress; + uint32_t txlast; #ifdef GEM_DEBUG int i; + GEM_LOCK_ASSERT(sc, MA_OWNED); + CTR2(KTR_GEM, "%s: %s", device_get_name(sc->sc_dev), __func__); #endif @@ -1338,7 +1376,6 @@ gem_tint(struct gem_softc *sc) progress = 0; GEM_CDSYNC(sc, BUS_DMASYNC_POSTREAD); while ((txs = STAILQ_FIRST(&sc->sc_txdirtyq)) != NULL) { - #ifdef GEM_DEBUG if ((ifp->if_flags & IFF_DEBUG) != 0) { printf(" txsoft %p transmit chain:\n", txs); @@ -1419,8 +1456,8 @@ gem_tint(struct gem_softc *sc) * and restart. */ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - sc->sc_wdog_timer = STAILQ_EMPTY(&sc->sc_txdirtyq) ? 0 : 5; - + if (STAILQ_EMPTY(&sc->sc_txdirtyq)) + sc->sc_wdog_timer = 0; gem_start_locked(ifp); } @@ -1437,6 +1474,7 @@ gem_rint_timeout(void *arg) struct gem_softc *sc = arg; GEM_LOCK_ASSERT(sc, MA_OWNED); + gem_rint(sc); } #endif @@ -1449,6 +1487,8 @@ gem_rint(struct gem_softc *sc) uint64_t rxstat; uint32_t rxcomp; + GEM_LOCK_ASSERT(sc, MA_OWNED); + #ifdef GEM_RINT_TIMEOUT callout_stop(&sc->sc_rx_ch); #endif @@ -1461,12 +1501,11 @@ gem_rint(struct gem_softc *sc) * how long the following loop can execute. */ rxcomp = GEM_BANK1_READ_4(sc, GEM_RX_COMPLETION); - #ifdef GEM_DEBUG - CTR3(KTR_GEM, "%s: sc->rxptr %d, complete %d", + CTR3(KTR_GEM, "%s: sc->sc_rxptr %d, complete %d", __func__, sc->sc_rxptr, rxcomp); #endif - GEM_CDSYNC(sc, BUS_DMASYNC_POSTREAD); + GEM_CDSYNC(sc, BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); for (; sc->sc_rxptr != rxcomp;) { m = sc->sc_rxsoft[sc->sc_rxptr].rxs_mbuf; rxstat = GEM_DMA_READ(sc, @@ -1525,9 +1564,9 @@ gem_rint(struct gem_softc *sc) /* * Update the RX kick register. This register has to point * to the descriptor after the last valid one (before the - * current batch) and must be incremented in multiples of - * 4 (because the DMA engine fetches/updates descriptors - * in batches of 4). + * current batch) and for optimum performance should be + * incremented in multiples of 4 (the DMA engine fetches/ + * updates descriptors in batches of 4). */ sc->sc_rxptr = GEM_NEXTRX(sc->sc_rxptr); if ((sc->sc_rxptr % 4) == 0) { @@ -1545,7 +1584,7 @@ gem_rint(struct gem_softc *sc) } ifp->if_ipackets++; - m->m_data += 2; /* We're already off by two */ + m->m_data += ETHER_ALIGN; /* first byte offset */ m->m_pkthdr.rcvif = ifp; m->m_pkthdr.len = m->m_len = GEM_RD_BUFLEN(rxstat); @@ -1559,7 +1598,7 @@ gem_rint(struct gem_softc *sc) } #ifdef GEM_DEBUG - CTR3(KTR_GEM, "%s: done sc->rxptr %d, complete %d", __func__, + CTR3(KTR_GEM, "%s: done sc->sc_rxptr %d, complete %d", __func__, sc->sc_rxptr, GEM_BANK1_READ_4(sc, GEM_RX_COMPLETION)); #endif } @@ -1572,6 +1611,8 @@ gem_add_rxbuf(struct gem_softc *sc, int bus_dma_segment_t segs[1]; int error, nsegs; + GEM_LOCK_ASSERT(sc, MA_OWNED); + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); if (m == NULL) return (ENOBUFS); @@ -1620,7 +1661,15 @@ gem_eint(struct gem_softc *sc, u_int sta return; } - device_printf(sc->sc_dev, "%s: status=%x\n", __func__, status); + device_printf(sc->sc_dev, "%s: status 0x%x", __func__, status); + if ((status & GEM_INTR_BERR) != 0) { + if ((sc->sc_flags & GEM_PCI) != 0) + printf(", PCI bus error 0x%x\n", + GEM_BANK1_READ_4(sc, GEM_PCI_ERROR_STATUS)); + else + printf(", SBus error 0x%x\n", + GEM_BANK1_READ_4(sc, GEM_SBUS_STATUS)); + } } void @@ -1634,8 +1683,8 @@ gem_intr(void *v) #ifdef GEM_DEBUG CTR4(KTR_GEM, "%s: %s: cplt %x, status %x", - device_get_name(sc->sc_dev), __func__, (status >> 19), - (u_int)status); + device_get_name(sc->sc_dev), __func__, + (status >> GEM_STATUS_TX_COMPLETION_SHFT), (u_int)status); /* * PCS interrupts must be cleared, otherwise no traffic is passed! @@ -1665,7 +1714,7 @@ gem_intr(void *v) device_printf(sc->sc_dev, "%s: MIF interrupt\n", __func__); #endif - if ((status & + if (__predict_false(status & (GEM_INTR_RX_TAG_ERR | GEM_INTR_PERR | GEM_INTR_BERR)) != 0) gem_eint(sc, status); @@ -1675,17 +1724,20 @@ gem_intr(void *v) if ((status & (GEM_INTR_TX_EMPTY | GEM_INTR_TX_INTME)) != 0) gem_tint(sc); - if (status & GEM_INTR_TX_MAC) { + if (__predict_false((status & GEM_INTR_TX_MAC) != 0)) { status2 = GEM_BANK1_READ_4(sc, GEM_MAC_TX_STATUS); if ((status2 & - ~(GEM_MAC_TX_XMIT_DONE | GEM_MAC_TX_DEFER_EXP)) != 0) + ~(GEM_MAC_TX_XMIT_DONE | GEM_MAC_TX_DEFER_EXP | + GEM_MAC_TX_PEAK_EXP)) != 0) device_printf(sc->sc_dev, "MAC TX fault, status %x\n", status2); if ((status2 & - (GEM_MAC_TX_UNDERRUN | GEM_MAC_TX_PKT_TOO_LONG)) != 0) + (GEM_MAC_TX_UNDERRUN | GEM_MAC_TX_PKT_TOO_LONG)) != 0) { + sc->sc_ifp->if_oerrors++; gem_init_locked(sc); + } } - if (status & GEM_INTR_RX_MAC) { + if (__predict_false((status & GEM_INTR_RX_MAC) != 0)) { status2 = GEM_BANK1_READ_4(sc, GEM_MAC_RX_STATUS); /* * At least with GEM_SUN_GEM and some GEM_SUN_ERI @@ -1906,6 +1958,8 @@ gem_mii_statchg(device_t dev) sc = device_get_softc(dev); + GEM_LOCK_ASSERT(sc, MA_OWNED); + #ifdef GEM_DEBUG if ((sc->sc_ifp->if_flags & IFF_DEBUG) != 0) device_printf(sc->sc_dev, "%s: status change: PHY = %d\n", @@ -1985,7 +2039,7 @@ gem_mii_statchg(device_t dev) if ((GEM_BANK1_READ_4(sc, GEM_MIF_CONFIG) & GEM_MIF_CONFIG_PHY_SEL) != 0) { /* External MII needs echo disable if half duplex. */ - if ((IFM_OPTIONS(sc->sc_mii->mii_media_active) & + if ((IFM_OPTIONS(sc->sc_mii->mii_media_active) & IFM_FDX) == 0) v |= GEM_MAC_XIF_ECHO_DISABL; } else @@ -2053,6 +2107,11 @@ gem_ioctl(struct ifnet *ifp, u_long cmd, switch (cmd) { case SIOCSIFFLAGS: GEM_LOCK(sc); + if ((sc->sc_flags & GEM_DYING) != 0) { + error = EINVAL; + GEM_UNLOCK(sc); + break; + } if ((ifp->if_flags & IFF_UP) != 0) { if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 && ((ifp->if_flags ^ sc->sc_ifflags) & Modified: head/sys/dev/gem/if_gem_pci.c ============================================================================== --- head/sys/dev/gem/if_gem_pci.c Tue Jun 23 20:35:51 2009 (r194762) +++ head/sys/dev/gem/if_gem_pci.c Tue Jun 23 20:36:59 2009 (r194763) @@ -90,7 +90,7 @@ static device_method_t gem_pci_methods[] DEVMETHOD(miibus_writereg, gem_mii_writereg), DEVMETHOD(miibus_statchg, gem_mii_statchg), - { 0, 0 } + KOBJMETHOD_END }; static driver_t gem_pci_driver = { @@ -107,7 +107,7 @@ static const struct gem_pci_dev { uint32_t gpd_devid; int gpd_variant; const char *gpd_desc; -} gem_pci_devlist[] = { +} const gem_pci_devlist[] = { { 0x1101108e, GEM_SUN_ERI, "Sun ERI 10/100 Ethernet" }, { 0x2bad108e, GEM_SUN_GEM, "Sun GEM Gigabit Ethernet" }, { 0x0021106b, GEM_APPLE_GMAC, "Apple UniNorth GMAC Ethernet" }, @@ -200,13 +200,18 @@ gem_pci_attach(device_t dev) GEM_PCI_BANK2_OFFSET, GEM_PCI_BANK2_SIZE, &sc->sc_res[GEM_RES_BANK2]->r_bushandle); + /* Determine whether we're running at 66MHz. */ + if ((GEM_BANK2_READ_4(sc, GEM_PCI_BIF_CONFIG) & + GEM_PCI_BIF_CNF_M66EN) != 0) + sc->sc_flags |= GEM_PCI66; + #if defined(__powerpc__) || defined(__sparc64__) OF_getetheraddr(dev, sc->sc_enaddr); #else /* * Dig out VPD (vital product data) and read NA (network address). - * The VPD of GEM resides in the PCI Expansion ROM (PCI FCode) and - * can't be accessed via the PCI capability pointer. + * The VPD resides in the PCI Expansion ROM (PCI FCode) and can't + * be accessed via the PCI capability pointer. * ``Writing FCode 3.x Programs'' (newer ones, dated 1997 and later) * chapter 2 describes the data structure. */ @@ -225,22 +230,21 @@ gem_pci_attach(device_t dev) #define PCI_VPDRES_BYTE0 0x00 #define PCI_VPDRES_ISLARGE(x) ((x) & 0x80) #define PCI_VPDRES_LARGE_NAME(x) ((x) & 0x7f) -#define PCI_VPDRES_TYPE_VPD 0x10 /* large */ #define PCI_VPDRES_LARGE_LEN_LSB 0x01 #define PCI_VPDRES_LARGE_LEN_MSB 0x02 -#define PCI_VPDRES_LARGE_DATA 0x03 -#define PCI_VPD_SIZE 0x03 +#define PCI_VPDRES_LARGE_SIZE 0x03 +#define PCI_VPDRES_TYPE_VPD 0x10 /* large */ #define PCI_VPD_KEY0 0x00 #define PCI_VPD_KEY1 0x01 #define PCI_VPD_LEN 0x02 -#define PCI_VPD_DATA 0x03 +#define PCI_VPD_SIZE 0x03 #define GEM_ROM_READ_1(sc, offs) \ - GEM_BANK1_READ_1((sc), GEM_PCI_ROM_OFFSET + (offs)) + GEM_BANK1_READ_1((sc), GEM_PCI_ROM_OFFSET + (offs)) #define GEM_ROM_READ_2(sc, offs) \ - GEM_BANK1_READ_2((sc), GEM_PCI_ROM_OFFSET + (offs)) + GEM_BANK1_READ_2((sc), GEM_PCI_ROM_OFFSET + (offs)) #define GEM_ROM_READ_4(sc, offs) \ - GEM_BANK1_READ_4((sc), GEM_PCI_ROM_OFFSET + (offs)) + GEM_BANK1_READ_4((sc), GEM_PCI_ROM_OFFSET + (offs)) /* Read PCI Expansion ROM header. */ if (GEM_ROM_READ_2(sc, PCI_ROMHDR_SIG) != PCI_ROMHDR_SIG_MAGIC || @@ -273,22 +277,22 @@ gem_pci_attach(device_t dev) j + PCI_VPDRES_BYTE0)) == 0 || PCI_VPDRES_LARGE_NAME(GEM_ROM_READ_1(sc, j + PCI_VPDRES_BYTE0)) != PCI_VPDRES_TYPE_VPD || - (GEM_ROM_READ_1(sc, j + PCI_VPDRES_LARGE_LEN_LSB) << 8 | + ((GEM_ROM_READ_1(sc, j + PCI_VPDRES_LARGE_LEN_LSB) << 8) | GEM_ROM_READ_1(sc, j + PCI_VPDRES_LARGE_LEN_MSB)) != PCI_VPD_SIZE + ETHER_ADDR_LEN || - GEM_ROM_READ_1(sc, j + PCI_VPDRES_LARGE_DATA + PCI_VPD_KEY0) != + GEM_ROM_READ_1(sc, j + PCI_VPDRES_LARGE_SIZE + PCI_VPD_KEY0) != 0x4e /* N */ || - GEM_ROM_READ_1(sc, j + PCI_VPDRES_LARGE_DATA + PCI_VPD_KEY1) != + GEM_ROM_READ_1(sc, j + PCI_VPDRES_LARGE_SIZE + PCI_VPD_KEY1) != 0x41 /* A */ || - GEM_ROM_READ_1(sc, j + PCI_VPDRES_LARGE_DATA + PCI_VPD_LEN) != + GEM_ROM_READ_1(sc, j + PCI_VPDRES_LARGE_SIZE + PCI_VPD_LEN) != ETHER_ADDR_LEN || - GEM_ROM_READ_1(sc, j + PCI_VPDRES_LARGE_DATA + PCI_VPD_DATA + + GEM_ROM_READ_1(sc, j + PCI_VPDRES_LARGE_SIZE + PCI_VPD_SIZE + ETHER_ADDR_LEN) != 0x79) { device_printf(dev, "unexpected PCI VPD\n"); goto fail; } bus_read_region_1(sc->sc_res[GEM_RES_BANK1], - GEM_PCI_ROM_OFFSET + j + PCI_VPDRES_LARGE_DATA + PCI_VPD_DATA, + GEM_PCI_ROM_OFFSET + j + PCI_VPDRES_LARGE_SIZE + PCI_VPD_SIZE, sc->sc_enaddr, ETHER_ADDR_LEN); #endif @@ -330,19 +334,15 @@ gem_pci_detach(device_t dev) static int gem_pci_suspend(device_t dev) { - struct gem_softc *sc; - sc = device_get_softc(dev); - gem_suspend(sc); + gem_suspend(device_get_softc(dev)); return (0); } static int gem_pci_resume(device_t dev) { - struct gem_softc *sc; - sc = device_get_softc(dev); - gem_resume(sc); + gem_resume(device_get_softc(dev)); return (0); } Added: head/sys/dev/gem/if_gem_sbus.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/gem/if_gem_sbus.c Tue Jun 23 20:36:59 2009 (r194763) @@ -0,0 +1,210 @@ +/*- + * Copyright (C) 2001 Eduardo Horvath. + * Copyright (c) 2007 Marius Strobl + * All rights reserved. + * + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: NetBSD: if_gem_pci.c,v 1.7 2001/10/18 15:09:15 thorpej Exp + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * SBus bindings for Sun GEM Ethernet controllers + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + +#include + +#include +#include + +#include "miibus_if.h" + +static device_probe_t gem_sbus_probe; +static device_attach_t gem_sbus_attach; +static device_detach_t gem_sbus_detach; +static device_suspend_t gem_sbus_suspend; +static device_resume_t gem_sbus_resume; + +static device_method_t gem_sbus_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, gem_sbus_probe), + DEVMETHOD(device_attach, gem_sbus_attach), + DEVMETHOD(device_detach, gem_sbus_detach), + DEVMETHOD(device_suspend, gem_sbus_suspend), + DEVMETHOD(device_resume, gem_sbus_resume), + /* Use the suspend handler here, it is all that is required. */ + DEVMETHOD(device_shutdown, gem_sbus_suspend), + + /* bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_driver_added, bus_generic_driver_added), + + /* MII interface */ + DEVMETHOD(miibus_readreg, gem_mii_readreg), + DEVMETHOD(miibus_writereg, gem_mii_writereg), + DEVMETHOD(miibus_statchg, gem_mii_statchg), + + KOBJMETHOD_END +}; + +static driver_t gem_sbus_driver = { + "gem", + gem_sbus_methods, + sizeof(struct gem_softc) +}; + +DRIVER_MODULE(gem, sbus, gem_sbus_driver, gem_devclass, 0, 0); +MODULE_DEPEND(gem, sbus, 1, 1, 1); +MODULE_DEPEND(gem, ether, 1, 1, 1); + +static int +gem_sbus_probe(device_t dev) +{ + + if (strcmp(ofw_bus_get_name(dev), "network") == 0 && + ofw_bus_get_compat(dev) != NULL && + strcmp(ofw_bus_get_compat(dev), "SUNW,sbus-gem") == 0) { + device_set_desc(dev, "Sun GEM Gigabit Ethernet"); + return (0); + } + + return (ENXIO); +} + +static struct resource_spec gem_sbus_res_spec[] = { + { SYS_RES_IRQ, 0, RF_SHAREABLE | RF_ACTIVE }, /* GEM_RES_INTR */ + { SYS_RES_MEMORY, 1, RF_ACTIVE }, /* GEM_RES_BANK1 */ + { SYS_RES_MEMORY, 0, RF_ACTIVE }, /* GEM_RES_BANK2 */ + { -1, 0 } +}; + +static int +gem_sbus_attach(device_t dev) +{ + struct gem_softc *sc; + int burst; + uint32_t val; + + sc = device_get_softc(dev); + sc->sc_variant = GEM_SUN_GEM; + sc->sc_dev = dev; + + if (bus_alloc_resources(dev, gem_sbus_res_spec, sc->sc_res)) { + device_printf(dev, "failed to allocate resources\n"); + bus_release_resources(dev, gem_sbus_res_spec, sc->sc_res); + return (ENXIO); + } + + GEM_LOCK_INIT(sc, device_get_nameunit(dev)); + + OF_getetheraddr(dev, sc->sc_enaddr); + + burst = sbus_get_burstsz(dev); + val = GEM_SBUS_CFG_PARITY; + if ((burst & SBUS_BURST64_MASK) != 0) { + val |= GEM_SBUS_CFG_64BIT; + burst >>= SBUS_BURST64_SHIFT; + } + if ((burst & SBUS_BURST_64) != 0) + val |= GEM_SBUS_CFG_BURST_64; + else if ((burst & SBUS_BURST_32) != 0) + val |= GEM_SBUS_CFG_BURST_32; + else { + device_printf(dev, "unsupported burst size\n"); + goto fail; + } + /* Reset the SBus interface only. */ + (void)GEM_BANK2_READ_4(sc, GEM_SBUS_BIF_RESET); + DELAY(100); + GEM_BANK2_WRITE_4(sc, GEM_SBUS_CONFIG, val); + + if (gem_attach(sc) != 0) { + device_printf(dev, "could not be attached\n"); + goto fail; + } + + if (bus_setup_intr(dev, sc->sc_res[GEM_RES_INTR], INTR_TYPE_NET | + INTR_MPSAFE, NULL, gem_intr, sc, &sc->sc_ih) != 0) { + device_printf(dev, "failed to set up interrupt\n"); + gem_detach(sc); + goto fail; + } + return (0); + + fail: + GEM_LOCK_DESTROY(sc); + bus_release_resources(dev, gem_sbus_res_spec, sc->sc_res); + return (ENXIO); +} + +static int +gem_sbus_detach(device_t dev) +{ + struct gem_softc *sc; + + sc = device_get_softc(dev); + bus_teardown_intr(dev, sc->sc_res[GEM_RES_INTR], sc->sc_ih); + gem_detach(sc); + GEM_LOCK_DESTROY(sc); + bus_release_resources(dev, gem_sbus_res_spec, sc->sc_res); + return (0); +} + +static int +gem_sbus_suspend(device_t dev) +{ + + gem_suspend(device_get_softc(dev)); + return (0); +} + +static int +gem_sbus_resume(device_t dev) +{ + + gem_resume(device_get_softc(dev)); + return (0); +} Modified: head/sys/dev/gem/if_gemreg.h ============================================================================== --- head/sys/dev/gem/if_gemreg.h Tue Jun 23 20:35:51 2009 (r194762) +++ head/sys/dev/gem/if_gemreg.h Tue Jun 23 20:36:59 2009 (r194763) @@ -32,7 +32,7 @@ #ifndef _IF_GEMREG_H #define _IF_GEMREG_H -/* Register definitions for Sun GEM gigabit ethernet */ +/* register definitions for Apple GMAC, Sun ERI and Sun GEM */ /* *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 20:38:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3D4A410656E5; Tue, 23 Jun 2009 20:38:36 +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 10AAF8FC08; Tue, 23 Jun 2009 20:38:36 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NKcZem089436; Tue, 23 Jun 2009 20:38:35 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NKcZqw089434; Tue, 23 Jun 2009 20:38:35 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200906232038.n5NKcZqw089434@svn.freebsd.org> From: Marius Strobl Date: Tue, 23 Jun 2009 20:38: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: r194764 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 20:38:36 -0000 Author: marius Date: Tue Jun 23 20:38:35 2009 New Revision: 194764 URL: http://svn.freebsd.org/changeset/base/194764 Log: - Update regarding the support for SBus GEM added in r194763. - Improve the description a bit and add a reference to vlan(4). Modified: head/share/man/man4/gem.4 Modified: head/share/man/man4/gem.4 ============================================================================== --- head/share/man/man4/gem.4 Tue Jun 23 20:36:59 2009 (r194763) +++ head/share/man/man4/gem.4 Tue Jun 23 20:38:35 2009 (r194764) @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 15, 2009 +.Dd June 14, 2009 .Dt GEM 4 .Os .Sh NAME @@ -57,9 +57,16 @@ if_gem_load="YES" .Sh DESCRIPTION The .Nm -driver provides support for the GMac Ethernet hardware found mostly in +driver provides support for the GMAC Ethernet hardware found mostly in the last Apple PowerBooks G3s and most G4-based Apple hardware, as -well as many Sun UltraSPARCs. +well as Sun UltraSPARC machines. +.Pp +All controllers supported by the +.Nm +driver have TCP checksum offload capability for both receive and transmit, +support for the reception and transmission of extended frames for +.Xr vlan 4 +and a 512-bit multicast hash filter. .Sh HARDWARE .Pp Chips supported by the @@ -84,6 +91,9 @@ driver at this time: .It Sun Gigabit Ethernet PCI 2.0/3.0 (GBE/P) (part no.\& 501-4373) +.It +Sun Gigabit Ethernet SBus 2.0/3.0 (GBE/S) +(part no.\& 501-4375) .El .Sh NOTES On sparc64 the @@ -108,15 +118,11 @@ the system's default MAC address. Supported interfaces having their own MAC address include the on-board Sun ERI 10/100 Mbps on boards equipped with more than one Ethernet interface and the Sun Gigabit Ethernet 2.0/3.0 GBE add-on cards. -.Sh CAVEATS -Currently the -.Nm -driver fails to attach to Sun Gigabit Ethernet SBus 2.0/3.0 (GBE/S) cards, -as no SBus front-end has been written so far. .Sh SEE ALSO .Xr altq 4 , .Xr miibus 4 , .Xr netintro 4 , +.Xr vlan 4 , .Xr eeprom 8 , .Xr ifconfig 8 .Sh HISTORY @@ -132,9 +138,19 @@ version to include it was .An -nosplit The .Nm -driver was written by +driver was written for +.Nx +by .An Eduardo Horvath .Aq eeh@NetBSD.org . +It was ported to +.Fx +by +.An Thomas Moestl +.Aq tmm@FreeBSD.org +and later on improved by +.An Marius Strobl +.Aq marus@FreeBSD.org . The man page was written by .An Thomas Klausner .Aq wiz@NetBSD.org . From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 20:45:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 607A7106566C; Tue, 23 Jun 2009 20:45:12 +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 4E86E8FC1D; Tue, 23 Jun 2009 20:45:12 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NKjCuS089613; Tue, 23 Jun 2009 20:45:12 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NKjCw6089608; Tue, 23 Jun 2009 20:45:12 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200906232045.n5NKjCw6089608@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 23 Jun 2009 20:45:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194765 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 20:45:13 -0000 Author: jilles Date: Tue Jun 23 20:45:12 2009 New Revision: 194765 URL: http://svn.freebsd.org/changeset/base/194765 Log: sh: Improve handling of setjmp/longjmp volatile: - remove ineffective and unnecessary (void) &var; [1] - remove some unnecessary volatile keywords - add a necessary volatile keyword - save the old handler before doing something that could use the saved value Submitted by: Christoph Mallon [1] Approved by: ed (mentor) Modified: head/bin/sh/eval.c head/bin/sh/histedit.c head/bin/sh/parser.c head/bin/sh/var.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Tue Jun 23 20:38:35 2009 (r194764) +++ head/bin/sh/eval.c Tue Jun 23 20:45:12 2009 (r194765) @@ -589,22 +589,14 @@ evalcommand(union node *cmd, int flags, struct cmdentry cmdentry; struct job *jp; struct jmploc jmploc; - struct jmploc *volatile savehandler; - char *volatile savecmdname; - volatile struct shparam saveparam; - struct localvar *volatile savelocalvars; + struct jmploc *savehandler; + char *savecmdname; + struct shparam saveparam; + struct localvar *savelocalvars; volatile int e; char *lastarg; int realstatus; int do_clearcmdentry; -#ifdef __GNUC__ - /* Avoid longjmp clobbering */ - (void) &argv; - (void) &argc; - (void) &lastarg; - (void) &flags; - (void) &do_clearcmdentry; -#endif /* First expand the arguments. */ TRACE(("evalcommand(%p, %d) called\n", (void *)cmd, flags)); @@ -779,9 +771,10 @@ evalcommand(union node *cmd, int flags, savelocalvars = localvars; localvars = NULL; INTON; + savehandler = handler; if (setjmp(jmploc.loc)) { if (exception == EXSHELLPROC) - freeparam((struct shparam *)&saveparam); + freeparam(&saveparam); else { freeparam(&shellparam); shellparam = saveparam; @@ -791,7 +784,6 @@ evalcommand(union node *cmd, int flags, handler = savehandler; longjmp(handler->loc, 1); } - savehandler = handler; handler = &jmploc; for (sp = varlist.list ; sp ; sp = sp->next) mklocal(sp->text); @@ -830,12 +822,12 @@ evalcommand(union node *cmd, int flags, savecmdname = commandname; cmdenviron = varlist.list; e = -1; + savehandler = handler; if (setjmp(jmploc.loc)) { e = exception; exitstatus = (e == EXINT)? SIGINT+128 : 2; goto cmddone; } - savehandler = handler; handler = &jmploc; redirect(cmd->ncmd.redirect, mode); if (cmdentry.special) Modified: head/bin/sh/histedit.c ============================================================================== --- head/bin/sh/histedit.c Tue Jun 23 20:38:35 2009 (r194764) +++ head/bin/sh/histedit.c Tue Jun 23 20:45:12 2009 (r194765) @@ -173,25 +173,11 @@ histcmd(int argc, char **argv) char *pat = NULL, *repl; static int active = 0; struct jmploc jmploc; - struct jmploc *volatile savehandler; - char editfile[PATH_MAX]; + struct jmploc *savehandler; + char editfilestr[PATH_MAX]; + char *volatile editfile; FILE *efp; int oldhistnum; -#ifdef __GNUC__ - /* Avoid longjmp clobbering */ - (void) &editor; - (void) &lflg; - (void) &nflg; - (void) &rflg; - (void) &sflg; - (void) &firststr; - (void) &laststr; - (void) &pat; - (void) &repl; - (void) &efp; - (void) &argc; - (void) &argv; -#endif if (hist == NULL) error("history not active"); @@ -232,19 +218,19 @@ histcmd(int argc, char **argv) */ if (lflg == 0 || editor || sflg) { lflg = 0; /* ignore */ - editfile[0] = '\0'; + editfile = NULL; /* * Catch interrupts to reset active counter and * cleanup temp files. */ + savehandler = handler; if (setjmp(jmploc.loc)) { active = 0; - if (*editfile) + if (editfile) unlink(editfile); handler = savehandler; longjmp(handler->loc, 1); } - savehandler = handler; handler = &jmploc; if (++active > MAXHISTLOOPS) { active = 0; @@ -318,9 +304,10 @@ histcmd(int argc, char **argv) if (editor) { int fd; INTOFF; /* easier */ - sprintf(editfile, "%s/_shXXXXXX", _PATH_TMP); - if ((fd = mkstemp(editfile)) < 0) + sprintf(editfilestr, "%s/_shXXXXXX", _PATH_TMP); + if ((fd = mkstemp(editfilestr)) < 0) error("can't create temporary file %s", editfile); + editfile = editfilestr; if ((efp = fdopen(fd, "w")) == NULL) { close(fd); error("can't allocate stdio buffer for temp"); Modified: head/bin/sh/parser.c ============================================================================== --- head/bin/sh/parser.c Tue Jun 23 20:38:35 2009 (r194764) +++ head/bin/sh/parser.c Tue Jun 23 20:45:12 2009 (r194765) @@ -898,19 +898,6 @@ readtoken1(int firstc, char const *synta int oldstyle; char const *prevsyntax; /* syntax before arithmetic */ int synentry; -#ifdef __GNUC__ - /* Avoid longjmp clobbering */ - (void) &out; - (void) "ef; - (void) &dblquote; - (void) &varnest; - (void) &arinest; - (void) &parenlevel; - (void) &oldstyle; - (void) &prevsyntax; - (void) &syntax; - (void) &synentry; -#endif startlinno = plinno; dblquote = 0; @@ -1320,13 +1307,9 @@ parsebackq: { union node *n; char *volatile str; struct jmploc jmploc; - struct jmploc *volatile savehandler; + struct jmploc *const savehandler = handler; int savelen; int saveprompt; -#ifdef __GNUC__ - /* Avoid longjmp clobbering */ - (void) &saveprompt; -#endif savepbq = parsebackquote; if (setjmp(jmploc.loc)) { @@ -1343,7 +1326,6 @@ parsebackq: { str = ckmalloc(savelen); memcpy(str, stackblock(), savelen); } - savehandler = handler; handler = &jmploc; INTON; if (oldstyle) { Modified: head/bin/sh/var.c ============================================================================== --- head/bin/sh/var.c Tue Jun 23 20:38:35 2009 (r194764) +++ head/bin/sh/var.c Tue Jun 23 20:45:12 2009 (r194765) @@ -193,12 +193,8 @@ int setvarsafe(char *name, char *val, int flags) { struct jmploc jmploc; - struct jmploc *volatile savehandler = handler; + struct jmploc *const savehandler = handler; int err = 0; -#ifdef __GNUC__ - /* Avoid longjmp clobbering */ - (void) &err; -#endif if (setjmp(jmploc.loc)) err = 1; From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 20:45:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EDD61065694; Tue, 23 Jun 2009 20:45:23 +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 3A8D38FC0C; Tue, 23 Jun 2009 20:45:23 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NKjNwp089676; Tue, 23 Jun 2009 20:45:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NKjMMC089652; Tue, 23 Jun 2009 20:45:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200906232045.n5NKjMMC089652@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 23 Jun 2009 20:45: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: r194766 - in head/sys: dev/md fs/procfs fs/tmpfs kern security/mac_biba security/mac_lomac sys vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 20:45:23 -0000 Author: kib Date: Tue Jun 23 20:45:22 2009 New Revision: 194766 URL: http://svn.freebsd.org/changeset/base/194766 Log: Implement global and per-uid accounting of the anonymous memory. Add rlimit RLIMIT_SWAP that limits the amount of swap that may be reserved for the uid. The accounting information (charge) is associated with either map entry, or vm object backing the entry, assuming the object is the first one in the shadow chain and entry does not require COW. Charge is moved from entry to object on allocation of the object, e.g. during the mmap, assuming the object is allocated, or on the first page fault on the entry. It moves back to the entry on forks due to COW setup. The per-entry granularity of accounting makes the charge process fair for processes that change uid during lifetime, and decrements charge for proper uid when region is unmapped. The interface of vm_pager_allocate(9) is extended by adding struct ucred *, that is used to charge appropriate uid when allocation if performed by kernel, e.g. md(4). Several syscalls, among them is fork(2), may now return ENOMEM when global or per-uid limits are enforced. In collaboration with: pho Reviewed by: alc Approved by: re (kensmith) Modified: head/sys/dev/md/md.c head/sys/fs/procfs/procfs_map.c head/sys/fs/tmpfs/tmpfs_subr.c head/sys/kern/kern_fork.c head/sys/kern/kern_resource.c head/sys/kern/sys_process.c head/sys/kern/sysv_shm.c head/sys/kern/uipc_shm.c head/sys/security/mac_biba/mac_biba.c head/sys/security/mac_lomac/mac_lomac.c head/sys/sys/priv.h head/sys/sys/resource.h head/sys/sys/resourcevar.h head/sys/vm/default_pager.c head/sys/vm/device_pager.c head/sys/vm/phys_pager.c head/sys/vm/swap_pager.c head/sys/vm/vm.h head/sys/vm/vm_extern.h head/sys/vm/vm_fault.c head/sys/vm/vm_kern.c head/sys/vm/vm_map.c head/sys/vm/vm_map.h head/sys/vm/vm_mmap.c head/sys/vm/vm_object.c head/sys/vm/vm_object.h head/sys/vm/vm_pager.c head/sys/vm/vm_pager.h head/sys/vm/vnode_pager.c Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/dev/md/md.c Tue Jun 23 20:45:22 2009 (r194766) @@ -1042,18 +1042,18 @@ mdcreate_swap(struct md_s *sc, struct md if (mdio->md_fwheads != 0) sc->fwheads = mdio->md_fwheads; sc->object = vm_pager_allocate(OBJT_SWAP, NULL, PAGE_SIZE * npage, - VM_PROT_DEFAULT, 0); + VM_PROT_DEFAULT, 0, td->td_ucred); if (sc->object == NULL) return (ENOMEM); sc->flags = mdio->md_options & MD_FORCE; if (mdio->md_options & MD_RESERVE) { if (swap_pager_reserve(sc->object, 0, npage) < 0) { - vm_object_deallocate(sc->object); - sc->object = NULL; - return (EDOM); + error = EDOM; + goto finish; } } error = mdsetcred(sc, td->td_ucred); + finish: if (error != 0) { vm_object_deallocate(sc->object); sc->object = NULL; Modified: head/sys/fs/procfs/procfs_map.c ============================================================================== --- head/sys/fs/procfs/procfs_map.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/fs/procfs/procfs_map.c Tue Jun 23 20:45:22 2009 (r194766) @@ -45,6 +45,7 @@ #include #include #include +#include #include #ifdef COMPAT_IA32 #include @@ -82,6 +83,7 @@ procfs_doprocmap(PFS_FILL_ARGS) vm_map_entry_t entry, tmp_entry; struct vnode *vp; char *fullpath, *freepath; + struct uidinfo *uip; int error, vfslocked; unsigned int last_timestamp; #ifdef COMPAT_IA32 @@ -134,6 +136,7 @@ procfs_doprocmap(PFS_FILL_ARGS) if (obj->shadow_count == 1) privateresident = obj->resident_page_count; } + uip = (entry->uip) ? entry->uip : (obj ? obj->uip : NULL); resident = 0; addr = entry->start; @@ -198,10 +201,11 @@ procfs_doprocmap(PFS_FILL_ARGS) /* * format: - * start, end, resident, private resident, cow, access, type. + * start, end, resident, private resident, cow, access, type, + * charged, charged uid. */ error = sbuf_printf(sb, - "0x%lx 0x%lx %d %d %p %s%s%s %d %d 0x%x %s %s %s %s\n", + "0x%lx 0x%lx %d %d %p %s%s%s %d %d 0x%x %s %s %s %s %s %d\n", (u_long)e_start, (u_long)e_end, resident, privateresident, #ifdef COMPAT_IA32 @@ -215,7 +219,8 @@ procfs_doprocmap(PFS_FILL_ARGS) ref_count, shadow_count, flags, (e_eflags & MAP_ENTRY_COW)?"COW":"NCOW", (e_eflags & MAP_ENTRY_NEEDS_COPY)?"NC":"NNC", - type, fullpath); + type, fullpath, + uip ? "CH":"NCH", uip ? uip->ui_uid : -1); if (freepath != NULL) free(freepath, M_TEMP); Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/fs/tmpfs/tmpfs_subr.c Tue Jun 23 20:45:22 2009 (r194766) @@ -142,7 +142,8 @@ tmpfs_alloc_node(struct tmpfs_mount *tmp case VREG: nnode->tn_reg.tn_aobj = - vm_pager_allocate(OBJT_SWAP, NULL, 0, VM_PROT_DEFAULT, 0); + vm_pager_allocate(OBJT_SWAP, NULL, 0, VM_PROT_DEFAULT, 0, + NULL /* XXXKIB - tmpfs needs swap reservation */); nnode->tn_reg.tn_aobj_pages = 0; break; Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/kern/kern_fork.c Tue Jun 23 20:45:22 2009 (r194766) @@ -214,6 +214,7 @@ fork1(td, flags, pages, procp) struct thread *td2; struct sigacts *newsigacts; struct vmspace *vm2; + vm_ooffset_t mem_charged; int error; /* Can't copy and clear. */ @@ -274,6 +275,7 @@ norfproc_fail: * however it proved un-needed and caused problems */ + mem_charged = 0; vm2 = NULL; /* Allocate new proc. */ newproc = uma_zalloc(proc_zone, M_WAITOK); @@ -295,12 +297,24 @@ norfproc_fail: } } if ((flags & RFMEM) == 0) { - vm2 = vmspace_fork(p1->p_vmspace); + vm2 = vmspace_fork(p1->p_vmspace, &mem_charged); if (vm2 == NULL) { error = ENOMEM; goto fail1; } - } + if (!swap_reserve(mem_charged)) { + /* + * The swap reservation failed. The accounting + * from the entries of the copied vm2 will be + * substracted in vmspace_free(), so force the + * reservation there. + */ + swap_reserve_force(mem_charged); + error = ENOMEM; + goto fail1; + } + } else + vm2 = NULL; #ifdef MAC mac_proc_init(newproc); #endif Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/kern/kern_resource.c Tue Jun 23 20:45:22 2009 (r194766) @@ -1213,6 +1213,8 @@ uifind(uid) } else { refcount_init(&uip->ui_ref, 0); uip->ui_uid = uid; + mtx_init(&uip->ui_vmsize_mtx, "ui_vmsize", NULL, + MTX_DEF); LIST_INSERT_HEAD(UIHASH(uid), uip, ui_hash); } } @@ -1269,6 +1271,10 @@ uifree(uip) if (uip->ui_proccnt != 0) printf("freeing uidinfo: uid = %d, proccnt = %ld\n", uip->ui_uid, uip->ui_proccnt); + if (uip->ui_vmsize != 0) + printf("freeing uidinfo: uid = %d, swapuse = %lld\n", + uip->ui_uid, (unsigned long long)uip->ui_vmsize); + mtx_destroy(&uip->ui_vmsize_mtx); free(uip, M_UIDINFO); return; } Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/kern/sys_process.c Tue Jun 23 20:45:22 2009 (r194766) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef COMPAT_IA32 #include @@ -270,7 +271,10 @@ proc_rwmem(struct proc *p, struct uio *u */ error = vm_fault(map, pageno, reqprot, fault_flags); if (error) { - error = EFAULT; + if (error == KERN_RESOURCE_SHORTAGE) + error = ENOMEM; + else + error = EFAULT; break; } Modified: head/sys/kern/sysv_shm.c ============================================================================== --- head/sys/kern/sysv_shm.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/kern/sysv_shm.c Tue Jun 23 20:45:22 2009 (r194766) @@ -770,13 +770,10 @@ shmget_allocate_segment(td, uap, mode) * We make sure that we have allocated a pager before we need * to. */ - if (shm_use_phys) { - shm_object = - vm_pager_allocate(OBJT_PHYS, 0, size, VM_PROT_DEFAULT, 0); - } else { - shm_object = - vm_pager_allocate(OBJT_SWAP, 0, size, VM_PROT_DEFAULT, 0); - } + shm_object = vm_pager_allocate(shm_use_phys ? OBJT_PHYS : OBJT_SWAP, + 0, size, VM_PROT_DEFAULT, 0, cred); + if (shm_object == NULL) + return (ENOMEM); VM_OBJECT_LOCK(shm_object); vm_object_clear_flag(shm_object, OBJ_ONEMAPPING); vm_object_set_flag(shm_object, OBJ_NOSPLIT); Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/kern/uipc_shm.c Tue Jun 23 20:45:22 2009 (r194766) @@ -110,7 +110,7 @@ static struct shmfd *shm_hold(struct shm static void shm_insert(char *path, Fnv32_t fnv, struct shmfd *shmfd); static struct shmfd *shm_lookup(char *path, Fnv32_t fnv); static int shm_remove(char *path, Fnv32_t fnv, struct ucred *ucred); -static void shm_dotruncate(struct shmfd *shmfd, off_t length); +static int shm_dotruncate(struct shmfd *shmfd, off_t length); static fo_rdwr_t shm_read; static fo_rdwr_t shm_write; @@ -167,8 +167,7 @@ shm_truncate(struct file *fp, off_t leng if (error) return (error); #endif - shm_dotruncate(shmfd, length); - return (0); + return (shm_dotruncate(shmfd, length)); } static int @@ -242,23 +241,26 @@ shm_close(struct file *fp, struct thread return (0); } -static void +static int shm_dotruncate(struct shmfd *shmfd, off_t length) { vm_object_t object; vm_page_t m; vm_pindex_t nobjsize; + vm_ooffset_t delta; object = shmfd->shm_object; VM_OBJECT_LOCK(object); if (length == shmfd->shm_size) { VM_OBJECT_UNLOCK(object); - return; + return (0); } nobjsize = OFF_TO_IDX(length + PAGE_MASK); /* Are we shrinking? If so, trim the end. */ if (length < shmfd->shm_size) { + delta = ptoa(object->size - nobjsize); + /* Toss in memory pages. */ if (nobjsize < object->size) vm_object_page_remove(object, nobjsize, object->size, @@ -266,8 +268,11 @@ shm_dotruncate(struct shmfd *shmfd, off_ /* Toss pages from swap. */ if (object->type == OBJT_SWAP) - swap_pager_freespace(object, nobjsize, - object->size - nobjsize); + swap_pager_freespace(object, nobjsize, delta); + + /* Free the swap accounted for shm */ + swap_release_by_uid(delta, object->uip); + object->charge -= delta; /* * If the last page is partially mapped, then zero out @@ -307,6 +312,15 @@ shm_dotruncate(struct shmfd *shmfd, off_ vm_page_cache_free(object, OFF_TO_IDX(length), nobjsize); } + } else { + + /* Attempt to reserve the swap */ + delta = ptoa(nobjsize - object->size); + if (!swap_reserve_by_uid(delta, object->uip)) { + VM_OBJECT_UNLOCK(object); + return (ENOMEM); + } + object->charge += delta; } shmfd->shm_size = length; mtx_lock(&shm_timestamp_lock); @@ -315,6 +329,7 @@ shm_dotruncate(struct shmfd *shmfd, off_ mtx_unlock(&shm_timestamp_lock); object->size = nobjsize; VM_OBJECT_UNLOCK(object); + return (0); } /* @@ -332,7 +347,7 @@ shm_alloc(struct ucred *ucred, mode_t mo shmfd->shm_gid = ucred->cr_gid; shmfd->shm_mode = mode; shmfd->shm_object = vm_pager_allocate(OBJT_DEFAULT, NULL, - shmfd->shm_size, VM_PROT_DEFAULT, 0); + shmfd->shm_size, VM_PROT_DEFAULT, 0, ucred); KASSERT(shmfd->shm_object != NULL, ("shm_create: vm_pager_allocate")); VM_OBJECT_LOCK(shmfd->shm_object); vm_object_clear_flag(shmfd->shm_object, OBJ_ONEMAPPING); Modified: head/sys/security/mac_biba/mac_biba.c ============================================================================== --- head/sys/security/mac_biba/mac_biba.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/security/mac_biba/mac_biba.c Tue Jun 23 20:45:22 2009 (r194766) @@ -1830,6 +1830,8 @@ biba_priv_check(struct ucred *cred, int case PRIV_VM_MADV_PROTECT: case PRIV_VM_MLOCK: case PRIV_VM_MUNLOCK: + case PRIV_VM_SWAP_NOQUOTA: + case PRIV_VM_SWAP_NORLIMIT: /* * Allow some but not all network privileges. In general, dont allow Modified: head/sys/security/mac_lomac/mac_lomac.c ============================================================================== --- head/sys/security/mac_lomac/mac_lomac.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/security/mac_lomac/mac_lomac.c Tue Jun 23 20:45:22 2009 (r194766) @@ -1822,6 +1822,8 @@ lomac_priv_check(struct ucred *cred, int case PRIV_VM_MADV_PROTECT: case PRIV_VM_MLOCK: case PRIV_VM_MUNLOCK: + case PRIV_VM_SWAP_NOQUOTA: + case PRIV_VM_SWAP_NORLIMIT: /* * Allow some but not all network privileges. In general, dont allow Modified: head/sys/sys/priv.h ============================================================================== --- head/sys/sys/priv.h Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/sys/priv.h Tue Jun 23 20:45:22 2009 (r194766) @@ -283,6 +283,14 @@ #define PRIV_VM_MADV_PROTECT 360 /* Can set MADV_PROTECT. */ #define PRIV_VM_MLOCK 361 /* Can mlock(), mlockall(). */ #define PRIV_VM_MUNLOCK 362 /* Can munlock(), munlockall(). */ +#define PRIV_VM_SWAP_NOQUOTA 363 /* + * Can override the global + * swap reservation limits. + */ +#define PRIV_VM_SWAP_NORLIMIT 364 /* + * Can override the per-uid + * swap reservation limits. + */ /* * Device file system privileges. Modified: head/sys/sys/resource.h ============================================================================== --- head/sys/sys/resource.h Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/sys/resource.h Tue Jun 23 20:45:22 2009 (r194766) @@ -94,8 +94,9 @@ struct rusage { #define RLIMIT_VMEM 10 /* virtual process size (inclusive of mmap) */ #define RLIMIT_AS RLIMIT_VMEM /* standard name for RLIMIT_VMEM */ #define RLIMIT_NPTS 11 /* pseudo-terminals */ +#define RLIMIT_SWAP 12 /* swap used */ -#define RLIM_NLIMITS 12 /* number of resource limits */ +#define RLIM_NLIMITS 13 /* number of resource limits */ #define RLIM_INFINITY ((rlim_t)(((uint64_t)1 << 63) - 1)) /* XXX Missing: RLIM_SAVED_MAX, RLIM_SAVED_CUR */ @@ -119,6 +120,7 @@ static char *rlimit_ident[RLIM_NLIMITS] "sbsize", "vmem", "npts", + "swap", }; #endif Modified: head/sys/sys/resourcevar.h ============================================================================== --- head/sys/sys/resourcevar.h Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/sys/resourcevar.h Tue Jun 23 20:45:22 2009 (r194766) @@ -86,9 +86,12 @@ struct plimit { * (a) Constant from inception * (b) Lockless, updated using atomics * (c) Locked by global uihashtbl_mtx + * (d) Locked by the ui_vmsize_mtx */ struct uidinfo { LIST_ENTRY(uidinfo) ui_hash; /* (c) hash chain of uidinfos */ + struct mtx ui_vmsize_mtx; + vm_ooffset_t ui_vmsize; /* (d) swap reservation by uid */ long ui_sbsize; /* (b) socket buffer space consumed */ long ui_proccnt; /* (b) number of processes */ long ui_ptscnt; /* (b) number of pseudo-terminals */ @@ -96,6 +99,9 @@ struct uidinfo { u_int ui_ref; /* (b) reference count */ }; +#define UIDINFO_VMSIZE_LOCK(ui) mtx_lock(&((ui)->ui_vmsize_mtx)) +#define UIDINFO_VMSIZE_UNLOCK(ui) mtx_unlock(&((ui)->ui_vmsize_mtx)) + struct proc; struct rusage_ext; struct thread; Modified: head/sys/vm/default_pager.c ============================================================================== --- head/sys/vm/default_pager.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/vm/default_pager.c Tue Jun 23 20:45:22 2009 (r194766) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -53,7 +54,7 @@ __FBSDID("$FreeBSD$"); #include static vm_object_t default_pager_alloc(void *, vm_ooffset_t, vm_prot_t, - vm_ooffset_t); + vm_ooffset_t, struct ucred *); static void default_pager_dealloc(vm_object_t); static int default_pager_getpages(vm_object_t, vm_page_t *, int, int); static void default_pager_putpages(vm_object_t, vm_page_t *, int, @@ -76,12 +77,28 @@ struct pagerops defaultpagerops = { */ static vm_object_t default_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, - vm_ooffset_t offset) + vm_ooffset_t offset, struct ucred *cred) { + vm_object_t object; + struct uidinfo *uip; + if (handle != NULL) panic("default_pager_alloc: handle specified"); - - return vm_object_allocate(OBJT_DEFAULT, OFF_TO_IDX(round_page(offset + size))); + if (cred != NULL) { + uip = cred->cr_ruidinfo; + if (!swap_reserve_by_uid(size, uip)) + return (NULL); + uihold(uip); + } + object = vm_object_allocate(OBJT_DEFAULT, + OFF_TO_IDX(round_page(offset + size))); + if (cred != NULL) { + VM_OBJECT_LOCK(object); + object->uip = uip; + object->charge = size; + VM_OBJECT_UNLOCK(object); + } + return (object); } /* Modified: head/sys/vm/device_pager.c ============================================================================== --- head/sys/vm/device_pager.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/vm/device_pager.c Tue Jun 23 20:45:22 2009 (r194766) @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD$"); static void dev_pager_init(void); static vm_object_t dev_pager_alloc(void *, vm_ooffset_t, vm_prot_t, - vm_ooffset_t); + vm_ooffset_t, struct ucred *); static void dev_pager_dealloc(vm_object_t); static int dev_pager_getpages(vm_object_t, vm_page_t *, int, int); static void dev_pager_putpages(vm_object_t, vm_page_t *, int, @@ -97,7 +97,8 @@ dev_pager_init() * MPSAFE */ static vm_object_t -dev_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t foff) +dev_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, + vm_ooffset_t foff, struct ucred *cred) { struct cdev *dev; vm_object_t object, object1; Modified: head/sys/vm/phys_pager.c ============================================================================== --- head/sys/vm/phys_pager.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/vm/phys_pager.c Tue Jun 23 20:45:22 2009 (r194766) @@ -60,7 +60,7 @@ phys_pager_init(void) */ static vm_object_t phys_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, - vm_ooffset_t foff) + vm_ooffset_t foff, struct ucred *cred) { vm_object_t object, object1; vm_pindex_t pindex; Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/vm/swap_pager.c Tue Jun 23 20:45:22 2009 (r194766) @@ -86,6 +86,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -152,6 +154,127 @@ static int nswapdev; /* Number of swap int swap_pager_avail; static int swdev_syscall_active = 0; /* serialize swap(on|off) */ +static vm_ooffset_t swap_total; +SYSCTL_QUAD(_vm, OID_AUTO, swap_total, CTLFLAG_RD, &swap_total, 0, ""); +static vm_ooffset_t swap_reserved; +SYSCTL_QUAD(_vm, OID_AUTO, swap_reserved, CTLFLAG_RD, &swap_reserved, 0, ""); +static int overcommit = 0; +SYSCTL_INT(_vm, OID_AUTO, overcommit, CTLFLAG_RW, &overcommit, 0, ""); + +/* bits from overcommit */ +#define SWAP_RESERVE_FORCE_ON (1 << 0) +#define SWAP_RESERVE_RLIMIT_ON (1 << 1) +#define SWAP_RESERVE_ALLOW_NONWIRED (1 << 2) + +int +swap_reserve(vm_ooffset_t incr) +{ + + return (swap_reserve_by_uid(incr, curthread->td_ucred->cr_ruidinfo)); +} + +int +swap_reserve_by_uid(vm_ooffset_t incr, struct uidinfo *uip) +{ + vm_ooffset_t r, s, max; + int res, error; + static int curfail; + static struct timeval lastfail; + + if (incr & PAGE_MASK) + panic("swap_reserve: & PAGE_MASK"); + + res = 0; + error = priv_check(curthread, PRIV_VM_SWAP_NOQUOTA); + mtx_lock(&sw_dev_mtx); + r = swap_reserved + incr; + if (overcommit & SWAP_RESERVE_ALLOW_NONWIRED) { + s = cnt.v_page_count - cnt.v_free_reserved - cnt.v_wire_count; + s *= PAGE_SIZE; + } else + s = 0; + s += swap_total; + if ((overcommit & SWAP_RESERVE_FORCE_ON) == 0 || r <= s || + (error = priv_check(curthread, PRIV_VM_SWAP_NOQUOTA)) == 0) { + res = 1; + swap_reserved = r; + } + mtx_unlock(&sw_dev_mtx); + + if (res) { + PROC_LOCK(curproc); + UIDINFO_VMSIZE_LOCK(uip); + error = priv_check(curthread, PRIV_VM_SWAP_NORLIMIT); + max = (error != 0) ? lim_cur(curproc, RLIMIT_SWAP) : 0; + if (max != 0 && uip->ui_vmsize + incr > max && + (overcommit & SWAP_RESERVE_RLIMIT_ON) != 0) + res = 0; + else + uip->ui_vmsize += incr; + UIDINFO_VMSIZE_UNLOCK(uip); + PROC_UNLOCK(curproc); + if (!res) { + mtx_lock(&sw_dev_mtx); + swap_reserved -= incr; + mtx_unlock(&sw_dev_mtx); + } + } + if (!res && ppsratecheck(&lastfail, &curfail, 1)) { + printf("uid %d, pid %d: swap reservation for %jd bytes failed\n", + curproc->p_pid, uip->ui_uid, incr); + } + + return (res); +} + +void +swap_reserve_force(vm_ooffset_t incr) +{ + struct uidinfo *uip; + + mtx_lock(&sw_dev_mtx); + swap_reserved += incr; + mtx_unlock(&sw_dev_mtx); + + uip = curthread->td_ucred->cr_ruidinfo; + PROC_LOCK(curproc); + UIDINFO_VMSIZE_LOCK(uip); + uip->ui_vmsize += incr; + UIDINFO_VMSIZE_UNLOCK(uip); + PROC_UNLOCK(curproc); +} + +void +swap_release(vm_ooffset_t decr) +{ + struct uidinfo *uip; + + PROC_LOCK(curproc); + uip = curthread->td_ucred->cr_ruidinfo; + swap_release_by_uid(decr, uip); + PROC_UNLOCK(curproc); +} + +void +swap_release_by_uid(vm_ooffset_t decr, struct uidinfo *uip) +{ + + if (decr & PAGE_MASK) + panic("swap_release: & PAGE_MASK"); + + mtx_lock(&sw_dev_mtx); + if (swap_reserved < decr) + panic("swap_reserved < decr"); + swap_reserved -= decr; + mtx_unlock(&sw_dev_mtx); + + UIDINFO_VMSIZE_LOCK(uip); + if (uip->ui_vmsize < decr) + printf("negative vmsize for uid = %d\n", uip->ui_uid); + uip->ui_vmsize -= decr; + UIDINFO_VMSIZE_UNLOCK(uip); +} + static void swapdev_strategy(struct buf *, struct swdevt *sw); #define SWM_FREE 0x02 /* free, period */ @@ -198,7 +321,7 @@ static struct vm_object swap_zone_obj; */ static vm_object_t swap_pager_alloc(void *handle, vm_ooffset_t size, - vm_prot_t prot, vm_ooffset_t offset); + vm_prot_t prot, vm_ooffset_t offset, struct ucred *); static void swap_pager_dealloc(vm_object_t object); static int swap_pager_getpages(vm_object_t, vm_page_t *, int, int); static void swap_pager_putpages(vm_object_t, vm_page_t *, int, boolean_t, int *); @@ -440,13 +563,13 @@ swap_pager_swap_init(void) */ static vm_object_t swap_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, - vm_ooffset_t offset) + vm_ooffset_t offset, struct ucred *cred) { vm_object_t object; vm_pindex_t pindex; + struct uidinfo *uip; pindex = OFF_TO_IDX(offset + PAGE_MASK + size); - if (handle) { mtx_lock(&Giant); /* @@ -457,21 +580,41 @@ swap_pager_alloc(void *handle, vm_ooffse */ sx_xlock(&sw_alloc_sx); object = vm_pager_object_lookup(NOBJLIST(handle), handle); - if (object == NULL) { + if (cred != NULL) { + uip = cred->cr_ruidinfo; + if (!swap_reserve_by_uid(size, uip)) { + sx_xunlock(&sw_alloc_sx); + mtx_unlock(&Giant); + return (NULL); + } + uihold(uip); + } object = vm_object_allocate(OBJT_DEFAULT, pindex); - object->handle = handle; - VM_OBJECT_LOCK(object); + object->handle = handle; + if (cred != NULL) { + object->uip = uip; + object->charge = size; + } swp_pager_meta_build(object, 0, SWAPBLK_NONE); VM_OBJECT_UNLOCK(object); } sx_xunlock(&sw_alloc_sx); mtx_unlock(&Giant); } else { + if (cred != NULL) { + uip = cred->cr_ruidinfo; + if (!swap_reserve_by_uid(size, uip)) + return (NULL); + uihold(uip); + } object = vm_object_allocate(OBJT_DEFAULT, pindex); - VM_OBJECT_LOCK(object); + if (cred != NULL) { + object->uip = uip; + object->charge = size; + } swp_pager_meta_build(object, 0, SWAPBLK_NONE); VM_OBJECT_UNLOCK(object); } @@ -2039,6 +2182,7 @@ swaponsomething(struct vnode *vp, void * TAILQ_INSERT_TAIL(&swtailq, sp, sw_list); nswapdev++; swap_pager_avail += nblks; + swap_total += (vm_ooffset_t)nblks * PAGE_SIZE; swp_sizecheck(); mtx_unlock(&sw_dev_mtx); } @@ -2143,6 +2287,7 @@ swapoff_one(struct swdevt *sp, struct uc swap_pager_avail -= blist_fill(sp->sw_blist, dvbase, dmmax); } + swap_total -= (vm_ooffset_t)nblks * PAGE_SIZE; mtx_unlock(&sw_dev_mtx); /* Modified: head/sys/vm/vm.h ============================================================================== --- head/sys/vm/vm.h Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/vm/vm.h Tue Jun 23 20:45:22 2009 (r194766) @@ -133,5 +133,12 @@ struct kva_md_info { extern struct kva_md_info kmi; extern void vm_ksubmap_init(struct kva_md_info *); +struct uidinfo; +int swap_reserve(vm_ooffset_t incr); +int swap_reserve_by_uid(vm_ooffset_t incr, struct uidinfo *uip); +void swap_reserve_force(vm_ooffset_t incr); +void swap_release(vm_ooffset_t decr); +void swap_release_by_uid(vm_ooffset_t decr, struct uidinfo *uip); + #endif /* VM_H */ Modified: head/sys/vm/vm_extern.h ============================================================================== --- head/sys/vm/vm_extern.h Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/vm/vm_extern.h Tue Jun 23 20:45:22 2009 (r194766) @@ -63,7 +63,7 @@ void vm_waitproc(struct proc *); int vm_mmap(vm_map_t, vm_offset_t *, vm_size_t, vm_prot_t, vm_prot_t, int, objtype_t, void *, vm_ooffset_t); void vm_set_page_size(void); struct vmspace *vmspace_alloc(vm_offset_t, vm_offset_t); -struct vmspace *vmspace_fork(struct vmspace *); +struct vmspace *vmspace_fork(struct vmspace *, vm_ooffset_t *); int vmspace_exec(struct proc *, vm_offset_t, vm_offset_t); int vmspace_unshare(struct proc *); void vmspace_exit(struct thread *); Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/vm/vm_fault.c Tue Jun 23 20:45:22 2009 (r194766) @@ -1163,7 +1163,11 @@ vm_fault_copy_entry(dst_map, src_map, ds VM_OBJECT_LOCK(dst_object); dst_entry->object.vm_object = dst_object; dst_entry->offset = 0; - + if (dst_entry->uip != NULL) { + dst_object->uip = dst_entry->uip; + dst_object->charge = dst_entry->end - dst_entry->start; + dst_entry->uip = NULL; + } prot = dst_entry->max_protection; /* Modified: head/sys/vm/vm_kern.c ============================================================================== --- head/sys/vm/vm_kern.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/vm/vm_kern.c Tue Jun 23 20:45:22 2009 (r194766) @@ -235,7 +235,8 @@ kmem_suballoc(vm_map_t parent, vm_offset *min = vm_map_min(parent); ret = vm_map_find(parent, NULL, 0, min, size, superpage_align ? - VMFS_ALIGNED_SPACE : VMFS_ANY_SPACE, VM_PROT_ALL, VM_PROT_ALL, 0); + VMFS_ALIGNED_SPACE : VMFS_ANY_SPACE, VM_PROT_ALL, VM_PROT_ALL, + MAP_ACC_NO_CHARGE); if (ret != KERN_SUCCESS) panic("kmem_suballoc: bad status return of %d", ret); *max = *min + size; @@ -422,6 +423,8 @@ kmem_alloc_wait(map, size) vm_offset_t addr; size = round_page(size); + if (!swap_reserve(size)) + return (0); for (;;) { /* @@ -434,12 +437,14 @@ kmem_alloc_wait(map, size) /* no space now; see if we can ever get space */ if (vm_map_max(map) - vm_map_min(map) < size) { vm_map_unlock(map); + swap_release(size); return (0); } map->needs_wakeup = TRUE; vm_map_unlock_and_wait(map, 0); } - vm_map_insert(map, NULL, 0, addr, addr + size, VM_PROT_ALL, VM_PROT_ALL, 0); + vm_map_insert(map, NULL, 0, addr, addr + size, VM_PROT_ALL, + VM_PROT_ALL, MAP_ACC_CHARGED); vm_map_unlock(map); return (addr); } Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Tue Jun 23 20:45:12 2009 (r194765) +++ head/sys/vm/vm_map.c Tue Jun 23 20:45:22 2009 (r194766) @@ -149,6 +149,10 @@ static void vm_map_zdtor(void *mem, int static void vmspace_zdtor(void *mem, int size, void *arg); #endif +#define ENTRY_CHARGED(e) ((e)->uip != NULL || \ + ((e)->object.vm_object != NULL && (e)->object.vm_object->uip != NULL && \ + !((e)->eflags & MAP_ENTRY_NEEDS_COPY))) + /* * PROC_VMSPACE_{UN,}LOCK() can be a noop as long as vmspaces are type * stable. @@ -1076,6 +1080,8 @@ vm_map_insert(vm_map_t map, vm_object_t vm_map_entry_t prev_entry; vm_map_entry_t temp_entry; vm_eflags_t protoeflags; + struct uidinfo *uip; + boolean_t charge_prev_obj; VM_MAP_ASSERT_LOCKED(map); @@ -1103,6 +1109,7 @@ vm_map_insert(vm_map_t map, vm_object_t return (KERN_NO_SPACE); protoeflags = 0; + charge_prev_obj = FALSE; if (cow & MAP_COPY_ON_WRITE) protoeflags |= MAP_ENTRY_COW|MAP_ENTRY_NEEDS_COPY; @@ -1118,6 +1125,27 @@ vm_map_insert(vm_map_t map, vm_object_t if (cow & MAP_DISABLE_COREDUMP) protoeflags |= MAP_ENTRY_NOCOREDUMP; + uip = NULL; + KASSERT((object != kmem_object && object != kernel_object) || + ((object == kmem_object || object == kernel_object) && + !(protoeflags & MAP_ENTRY_NEEDS_COPY)), + ("kmem or kernel object and cow")); + if (cow & (MAP_ACC_NO_CHARGE | MAP_NOFAULT)) + goto charged; + if ((cow & MAP_ACC_CHARGED) || ((prot & VM_PROT_WRITE) && + ((protoeflags & MAP_ENTRY_NEEDS_COPY) || object == NULL))) { + if (!(cow & MAP_ACC_CHARGED) && !swap_reserve(end - start)) + return (KERN_RESOURCE_SHORTAGE); + KASSERT(object == NULL || (cow & MAP_ENTRY_NEEDS_COPY) || + object->uip == NULL, + ("OVERCOMMIT: vm_map_insert o %p", object)); + uip = curthread->td_ucred->cr_ruidinfo; + uihold(uip); + if (object == NULL && !(protoeflags & MAP_ENTRY_NEEDS_COPY)) + charge_prev_obj = TRUE; + } + +charged: if (object != NULL) { /* * OBJ_ONEMAPPING must be cleared unless this mapping @@ -1135,11 +1163,13 @@ vm_map_insert(vm_map_t map, vm_object_t (prev_entry->eflags == protoeflags) && (prev_entry->end == start) && (prev_entry->wired_count == 0) && - ((prev_entry->object.vm_object == NULL) || - vm_object_coalesce(prev_entry->object.vm_object, - prev_entry->offset, - (vm_size_t)(prev_entry->end - prev_entry->start), - (vm_size_t)(end - prev_entry->end)))) { + (prev_entry->uip == uip || + (prev_entry->object.vm_object != NULL && + (prev_entry->object.vm_object->uip == uip))) && + vm_object_coalesce(prev_entry->object.vm_object, + prev_entry->offset, + (vm_size_t)(prev_entry->end - prev_entry->start), + (vm_size_t)(end - prev_entry->end), charge_prev_obj)) { /* * We were able to extend the object. Determine if we * can extend the previous map entry to include the @@ -1152,6 +1182,8 @@ vm_map_insert(vm_map_t map, vm_object_t prev_entry->end = end; vm_map_entry_resize_free(map, prev_entry); vm_map_simplify_entry(map, prev_entry); + if (uip != NULL) + uifree(uip); return (KERN_SUCCESS); } @@ -1165,6 +1197,12 @@ vm_map_insert(vm_map_t map, vm_object_t offset = prev_entry->offset + (prev_entry->end - prev_entry->start); vm_object_reference(object); + if (uip != NULL && object != NULL && object->uip != NULL && + !(prev_entry->eflags & MAP_ENTRY_NEEDS_COPY)) { + /* Object already accounts for this uid. */ + uifree(uip); + uip = NULL; + } } /* @@ -1179,6 +1217,7 @@ vm_map_insert(vm_map_t map, vm_object_t new_entry = vm_map_entry_create(map); new_entry->start = start; new_entry->end = end; + new_entry->uip = NULL; new_entry->eflags = protoeflags; new_entry->object.vm_object = object; @@ -1190,6 +1229,10 @@ vm_map_insert(vm_map_t map, vm_object_t new_entry->max_protection = max; new_entry->wired_count = 0; + KASSERT(uip == NULL || !ENTRY_CHARGED(new_entry), + ("OVERCOMMIT: vm_map_insert leaks vm_map %p", new_entry)); + new_entry->uip = uip; + /* * Insert the new entry into the list */ @@ -1398,7 +1441,8 @@ vm_map_simplify_entry(vm_map_t map, vm_m (prev->protection == entry->protection) && (prev->max_protection == entry->max_protection) && (prev->inheritance == entry->inheritance) && - (prev->wired_count == entry->wired_count)) { + (prev->wired_count == entry->wired_count) && + (prev->uip == entry->uip)) { vm_map_entry_unlink(map, prev); entry->start = prev->start; entry->offset = prev->offset; @@ -1416,6 +1460,8 @@ vm_map_simplify_entry(vm_map_t map, vm_m */ if (prev->object.vm_object) vm_object_deallocate(prev->object.vm_object); + if (prev->uip != NULL) + uifree(prev->uip); vm_map_entry_dispose(map, prev); } } @@ -1431,7 +1477,8 @@ vm_map_simplify_entry(vm_map_t map, vm_m (next->protection == entry->protection) && (next->max_protection == entry->max_protection) && (next->inheritance == entry->inheritance) && - (next->wired_count == entry->wired_count)) { + (next->wired_count == entry->wired_count) && + (next->uip == entry->uip)) { vm_map_entry_unlink(map, next); entry->end = next->end; vm_map_entry_resize_free(map, entry); @@ -1441,6 +1488,8 @@ vm_map_simplify_entry(vm_map_t map, vm_m */ if (next->object.vm_object) vm_object_deallocate(next->object.vm_object); + if (next->uip != NULL) + uifree(next->uip); vm_map_entry_dispose(map, next); } } @@ -1489,6 +1538,21 @@ _vm_map_clip_start(vm_map_t map, vm_map_ atop(entry->end - entry->start)); entry->object.vm_object = object; entry->offset = 0; + if (entry->uip != NULL) { + object->uip = entry->uip; + object->charge = entry->end - entry->start; + entry->uip = NULL; + } + } else if (entry->object.vm_object != NULL && + ((entry->eflags & MAP_ENTRY_NEEDS_COPY) == 0) && + entry->uip != NULL) { + VM_OBJECT_LOCK(entry->object.vm_object); + KASSERT(entry->object.vm_object->uip == NULL, + ("OVERCOMMIT: vm_entry_clip_start: both uip e %p", entry)); + entry->object.vm_object->uip = entry->uip; + entry->object.vm_object->charge = entry->end - entry->start; + VM_OBJECT_UNLOCK(entry->object.vm_object); + entry->uip = NULL; } new_entry = vm_map_entry_create(map); @@ -1497,6 +1561,8 @@ _vm_map_clip_start(vm_map_t map, vm_map_ new_entry->end = start; entry->offset += (start - entry->start); entry->start = start; + if (new_entry->uip != NULL) + uihold(entry->uip); vm_map_entry_link(map, entry->prev, new_entry); @@ -1542,6 +1608,21 @@ _vm_map_clip_end(vm_map_t map, vm_map_en atop(entry->end - entry->start)); entry->object.vm_object = object; entry->offset = 0; + if (entry->uip != NULL) { + object->uip = entry->uip; + object->charge = entry->end - entry->start; + entry->uip = NULL; + } + } else if (entry->object.vm_object != NULL && + ((entry->eflags & MAP_ENTRY_NEEDS_COPY) == 0) && + entry->uip != NULL) { + VM_OBJECT_LOCK(entry->object.vm_object); + KASSERT(entry->object.vm_object->uip == NULL, + ("OVERCOMMIT: vm_entry_clip_end: both uip e %p", entry)); + entry->object.vm_object->uip = entry->uip; + entry->object.vm_object->charge = entry->end - entry->start; + VM_OBJECT_UNLOCK(entry->object.vm_object); + entry->uip = NULL; } /* @@ -1552,6 +1633,8 @@ _vm_map_clip_end(vm_map_t map, vm_map_en new_entry->start = entry->end = end; new_entry->offset += (end - entry->start); + if (new_entry->uip != NULL) + uihold(entry->uip); vm_map_entry_link(map, entry, new_entry); @@ -1724,6 +1807,8 @@ vm_map_protect(vm_map_t map, vm_offset_t { vm_map_entry_t current; vm_map_entry_t entry; + vm_object_t obj; + struct uidinfo *uip; vm_map_lock(map); @@ -1751,6 +1836,61 @@ vm_map_protect(vm_map_t map, vm_offset_t current = current->next; } + + /* + * Do an accounting pass for private read-only mappings that + * now will do cow due to allowed write (e.g. debugger sets *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 20:57:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D1E91065670; Tue, 23 Jun 2009 20:57:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 084858FC08; Tue, 23 Jun 2009 20:57:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NKvRQs089949; Tue, 23 Jun 2009 20:57:27 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NKvRDE089939; Tue, 23 Jun 2009 20:57:27 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200906232057.n5NKvRDE089939@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 23 Jun 2009 20:57:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194767 - in head: bin/sh contrib/tcsh etc lib/libc/sys lib/libutil share/man/man7 share/man/man9 usr.bin/limits X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 20:57:28 -0000 Author: kib Date: Tue Jun 23 20:57:27 2009 New Revision: 194767 URL: http://svn.freebsd.org/changeset/base/194767 Log: Usermode portion of the support for swap allocation accounting: - update for getrlimit(2) manpage; - support for setting RLIMIT_SWAP in login class; - addition to the limits(1) and sh and csh limit-setting builtins; - tuning(7) documentation on the sysctls controlling overcommit. In collaboration with: pho Reviewed by: alc Approved by: re (kensmith) Modified: head/bin/sh/miscbltin.c head/contrib/tcsh/sh.func.c head/contrib/tcsh/tcsh.man head/etc/login.conf head/lib/libc/sys/getrlimit.2 head/lib/libutil/login_class.c head/share/man/man7/tuning.7 head/share/man/man9/vm_map.9 head/usr.bin/limits/limits.c Modified: head/bin/sh/miscbltin.c ============================================================================== --- head/bin/sh/miscbltin.c Tue Jun 23 20:45:22 2009 (r194766) +++ head/bin/sh/miscbltin.c Tue Jun 23 20:57:27 2009 (r194767) @@ -403,7 +403,7 @@ ulimitcmd(int argc __unused, char **argv struct rlimit limit; what = 'f'; - while ((optc = nextopt("HSatfdsmcnuvlbp")) != '\0') + while ((optc = nextopt("HSatfdsmcnuvlbpw")) != '\0') switch (optc) { case 'H': how = HARD; Modified: head/contrib/tcsh/sh.func.c ============================================================================== --- head/contrib/tcsh/sh.func.c Tue Jun 23 20:45:22 2009 (r194766) +++ head/contrib/tcsh/sh.func.c Tue Jun 23 20:57:27 2009 (r194767) @@ -1796,6 +1796,10 @@ struct limits limits[] = { RLIMIT_SBSIZE, "sbsize", 1, "" }, # endif /* RLIMIT_SBSIZE */ +# ifdef RLIMIT_SWAP + { RLIMIT_SWAP, "swaplimit", 1024, "kbytes" }, +# endif /* RLIMIT_SWAP */ + { -1, NULL, 0, NULL } }; Modified: head/contrib/tcsh/tcsh.man ============================================================================== --- head/contrib/tcsh/tcsh.man Tue Jun 23 20:45:22 2009 (r194766) +++ head/contrib/tcsh/tcsh.man Tue Jun 23 20:57:27 2009 (r194767) @@ -2921,6 +2921,9 @@ the maximum number of simultaneous proce .TP \fIsbsize\fR the maximum size of socket buffer usage for this user +.TP +\fIswaplimit\fR +the maximum amount of swap space reserved or used for this user .PP \fImaximum-use\fR may be given as a (floating point or integer) number followed by a scale factor. For all limits Modified: head/etc/login.conf ============================================================================== --- head/etc/login.conf Tue Jun 23 20:45:22 2009 (r194766) +++ head/etc/login.conf Tue Jun 23 20:57:27 2009 (r194767) @@ -40,6 +40,7 @@ default:\ :maxproc=unlimited:\ :sbsize=unlimited:\ :vmemoryuse=unlimited:\ + :swapuse=unlimited:\ :pseudoterminals=unlimited:\ :priority=0:\ :ignoretime@:\ Modified: head/lib/libc/sys/getrlimit.2 ============================================================================== --- head/lib/libc/sys/getrlimit.2 Tue Jun 23 20:45:22 2009 (r194766) +++ head/lib/libc/sys/getrlimit.2 Tue Jun 23 20:57:27 2009 (r194767) @@ -97,6 +97,15 @@ mbufs, that this user may hold at any ti The maximum size (in bytes) of the stack segment for a process; this defines how far a program's stack segment may be extended. Stack extension is performed automatically by the system. +.It Dv RLIMIT_SWAP +The maximum size (in bytes) of the swap space that may be reserved or +used by all of this user id's processes. +This limit is enforced only if bit 1 of the +.Va vm.overcommit +sysctl is set. +Please see +.Xr tuning 7 +for a complete description of this sysctl. .It Dv RLIMIT_NPTS The maximum number of pseudo-terminals created by this user id. .El Modified: head/lib/libutil/login_class.c ============================================================================== --- head/lib/libutil/login_class.c Tue Jun 23 20:45:22 2009 (r194766) +++ head/lib/libutil/login_class.c Tue Jun 23 20:57:27 2009 (r194767) @@ -64,6 +64,7 @@ static struct login_res { { "sbsize", login_getcapsize, RLIMIT_SBSIZE }, { "vmemoryuse", login_getcapsize, RLIMIT_VMEM }, { "pseudoterminals", login_getcapnum, RLIMIT_NPTS }, + { "swapuse", login_getcapsize, RLIMIT_SWAP }, { NULL, 0, 0 } }; Modified: head/share/man/man7/tuning.7 ============================================================================== --- head/share/man/man7/tuning.7 Tue Jun 23 20:45:22 2009 (r194766) +++ head/share/man/man7/tuning.7 Tue Jun 23 20:57:27 2009 (r194767) @@ -404,6 +404,35 @@ In this document we will only cover the on the system. .Pp The +.Va vm.overcommit +sysctl defines the overcommit behaviour of the vm subsystem. +The virtual memory system always does accounting of the swap space +reservation, both total for system and per-user. Corresponding values +are available through sysctl +.Va vm.swap_total, +that gives the total bytes available for swapping, and +.Va vm.swap_reserved, +that gives number of bytes that may be needed to back all currently +allocated anonymous memory. +.Pp +Setting bit 0 of the +.Va vm.overcommit +sysctl causes the virtual memory system to return failure +to the process when allocation of memory causes vm.swap_reserved +to exceed vm.swap_total. +Bit 1 of the sysctl enforces RLIMIT_SWAP limit +(see +.Xr getrlimit 2 ). +Root is exempt from this limit. +Bit 2 allows to count most of the physical +memory as allocatable, except wired and free reserved pages +(accounted by +.Va vm.stats.vm.v_free_target +and +.Va vm.stats.vm.v_wire_count +sysctls, respectively). +.Pp +The .Va kern.ipc.maxpipekva loader tunable is used to set a hard limit on the amount of kernel address space allocated to mapping of pipe buffers. Modified: head/share/man/man9/vm_map.9 ============================================================================== --- head/share/man/man9/vm_map.9 Tue Jun 23 20:45:22 2009 (r194766) +++ head/share/man/man9/vm_map.9 Tue Jun 23 20:57:27 2009 (r194767) @@ -146,6 +146,10 @@ Do not include the mapping in a core dum .It Dv MAP_PREFAULT_MADVISE Specify that the request is from a user process calling .Xr madvise 2 . +.It Dv MAP_ACC_CHARGED +Region is already charged to the requestor by some means. +.It Dv MAP_ACC_NO_CHARGE +Do not charge for allocated region. .El .Pp The Modified: head/usr.bin/limits/limits.c ============================================================================== --- head/usr.bin/limits/limits.c Tue Jun 23 20:45:22 2009 (r194766) +++ head/usr.bin/limits/limits.c Tue Jun 23 20:57:27 2009 (r194767) @@ -87,7 +87,8 @@ static struct { { " openfiles%-4s %8s", "\n", 1 }, { " sbsize%-4s %8s", " bytes\n", 1 }, { " vmemoryuse%-4s %8s", " kB\n", 1024 }, - { " pseudo-terminals%-4s %8s", "\n", 1 } + { " pseudo-terminals%-4s %8s", "\n", 1 }, + { " swapuse%-4s %8s", " kB\n", 1024 } } }, { "sh", "unlimited", "", " -H", " -S", "", @@ -103,7 +104,8 @@ static struct { { "ulimit%s -n %s", ";\n", 1 }, { "ulimit%s -b %s", ";\n", 1 }, { "ulimit%s -v %s", ";\n", 1024 }, - { "ulimit%s -p %s", ";\n", 1 } + { "ulimit%s -p %s", ";\n", 1 }, + { "ulimit%s -w %s", ";\n", 1024 } } }, { "csh", "unlimited", "", " -h", "", NULL, @@ -119,7 +121,8 @@ static struct { { "limit%s openfiles %s", ";\n", 1 }, { "limit%s sbsize %s", ";\n", 1 }, { "limit%s vmemoryuse %s", ";\n", 1024 }, - { "limit%s pseudoterminals %s", ";\n", 1 } + { "limit%s pseudoterminals %s", ";\n", 1 }, + { "limit%s swapuse %s", ";\n", 1024 } } }, { "bash|bash2", "unlimited", "", " -H", " -S", "", @@ -135,7 +138,8 @@ static struct { { "ulimit%s -n %s", ";\n", 1 }, { "ulimit%s -b %s", ";\n", 1 }, { "ulimit%s -v %s", ";\n", 1024 }, - { "ulimit%s -p %s", ";\n", 1 } + { "ulimit%s -p %s", ";\n", 1 }, + { "ulimit%s -w %s", ";\n", 1024 } } }, { "tcsh", "unlimited", "", " -h", "", NULL, @@ -151,7 +155,8 @@ static struct { { "limit%s descriptors %s", ";\n", 1 }, { "limit%s sbsize %s", ";\n", 1 }, { "limit%s vmemoryuse %s", ";\n", 1024 }, - { "limit%s pseudoterminals %s", ";\n", 1 } + { "limit%s pseudoterminals %s", ";\n", 1 }, + { "limit%s swapuse %s", ";\n", 1024 } } }, { "ksh|pdksh", "unlimited", "", " -H", " -S", "", @@ -167,7 +172,8 @@ static struct { { "ulimit%s -n %s", ";\n", 1 }, { "ulimit%s -b %s", ";\n", 1 }, { "ulimit%s -v %s", ";\n", 1024 }, - { "ulimit%s -p %s", ";\n", 1 } + { "ulimit%s -p %s", ";\n", 1 }, + { "ulimit%s -w %s", ";\n", 1024 } } }, { "zsh", "unlimited", "", " -H", " -S", "", @@ -183,7 +189,8 @@ static struct { { "ulimit%s -n %s", ";\n", 1 }, { "ulimit%s -b %s", ";\n", 1 }, { "ulimit%s -v %s", ";\n", 1024 }, - { "ulimit%s -p %s", ";\n", 1 } + { "ulimit%s -p %s", ";\n", 1 }, + { "ulimit%s -w %s", ";\n", 1024 } } }, { "rc|es", "unlimited", "", " -h", "", NULL, @@ -199,7 +206,8 @@ static struct { { "limit%s descriptors %s", ";\n", 1 }, { "limit%s sbsize %s", ";\n", 1 }, { "limit%s vmemoryuse %s", ";\n", 1024 }, - { "limit%s pseudoterminals %s", ";\n", 1 } + { "limit%s pseudoterminals %s", ";\n", 1 }, + { "limit%s swapuse %s", ";\n", 1024 } } }, { NULL, NULL, NULL, NULL, NULL, NULL, @@ -220,9 +228,10 @@ static struct { { "memorylocked", login_getcapsize }, { "maxproc", login_getcapnum }, { "openfiles", login_getcapnum }, - { "sbsize", login_getcapsize }, - { "vmemoryuse", login_getcapsize }, + { "sbsize", login_getcapsize }, + { "vmemoryuse", login_getcapsize }, { "pseudoterminals",login_getcapnum }, + { "swapuse", login_getcapsize } }; /* @@ -233,7 +242,7 @@ static struct { * to be modified accordingly! */ -#define RCS_STRING "tfdscmlunbvp" +#define RCS_STRING "tfdscmlunbvpw" static rlim_t resource_num(int which, int ch, const char *str); static void usage(void); @@ -270,7 +279,7 @@ main(int argc, char *argv[]) } optarg = NULL; - while ((ch = getopt(argc, argv, ":EeC:U:BSHab:c:d:f:l:m:n:s:t:u:v:p:")) != -1) { + while ((ch = getopt(argc, argv, ":EeC:U:BSHab:c:d:f:l:m:n:s:t:u:v:p:w:")) != -1) { switch(ch) { case 'a': doall = 1; @@ -484,7 +493,7 @@ static void usage(void) { (void)fprintf(stderr, -"usage: limits [-C class|-U user] [-eaSHBE] [-bcdflmnstuvp [val]] [[name=val ...] cmd]\n"); +"usage: limits [-C class|-U user] [-eaSHBE] [-bcdflmnstuvpw [val]] [[name=val ...] cmd]\n"); exit(EXIT_FAILURE); } @@ -556,6 +565,7 @@ resource_num(int which, int ch, const ch case RLIMIT_MEMLOCK: case RLIMIT_SBSIZE: case RLIMIT_VMEM: + case RLIMIT_SWAP: errno = 0; res = 0; while (*s) { From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 21:06:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32A5710656AD; Tue, 23 Jun 2009 21:06:48 +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 021898FC1B; Tue, 23 Jun 2009 21:06:48 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id AA4B346B99; Tue, 23 Jun 2009 17:06:47 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id A1ECC8A083; Tue, 23 Jun 2009 17:06:46 -0400 (EDT) From: John Baldwin To: Marius Strobl Date: Tue, 23 Jun 2009 17:03:20 -0400 User-Agent: KMail/1.9.7 References: <200906232036.n5NKax9O089354@svn.freebsd.org> In-Reply-To: <200906232036.n5NKax9O089354@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906231703.20496.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 23 Jun 2009 17:06:46 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194763 - in head/sys: conf dev/gem modules/gem X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 21:06:48 -0000 On Tuesday 23 June 2009 4:36:59 pm Marius Strobl wrote: > Author: marius > Date: Tue Jun 23 20:36:59 2009 > New Revision: 194763 > URL: http://svn.freebsd.org/changeset/base/194763 > > Log: > - Initialize the ifnet structure, especially if_dname, before probing > the PHYs as some PHY drivers use it (but probably shouldn't). How > gem(4) has worked with brgphy(4) on powerpc without this so far is > unclear to me. > - Introduce a dying flag which is set during detach and checked in > gem_ioctl() in order to prevent active BPF listeners to clear > promiscuous mode which may lead to the tick callout being restarted > which will trigger a panic once it's actually gone. This should not be needed assuming you follow a model of: gem_detach() { ether_ifdetach(ifp); /* calls bpfdetach() */ GEM_LOCK(sc); gem_stop(sc); GEM_UNLOCK(sc); ... } If you are invoking gem_stop() prior to ether_ifdetach() then that is your real bug. :) -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 21:24:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF9C61065674; Tue, 23 Jun 2009 21:24:21 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9D2738FC0A; Tue, 23 Jun 2009 21:24:21 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NLOLci090533; Tue, 23 Jun 2009 21:24:21 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NLOLIm090531; Tue, 23 Jun 2009 21:24:21 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <200906232124.n5NLOLIm090531@svn.freebsd.org> From: Joel Dahl Date: Tue, 23 Jun 2009 21:24: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: r194768 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 21:24:22 -0000 Author: joel (doc committer) Date: Tue Jun 23 21:24:21 2009 New Revision: 194768 URL: http://svn.freebsd.org/changeset/base/194768 Log: Bring in a few mdoc/language fixes. Submitted by: ru Modified: head/share/man/man4/pcm.4 Modified: head/share/man/man4/pcm.4 ============================================================================== --- head/share/man/man4/pcm.4 Tue Jun 23 20:57:27 2009 (r194767) +++ head/share/man/man4/pcm.4 Tue Jun 23 21:24:21 2009 (r194768) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 22, 2009 +.Dd June 23, 2009 .Dt SOUND 4 .Os .Sh NAME @@ -288,7 +288,9 @@ File names and versions of the currently Various messages intended for debugging. .El .It Va hw.snd.vpc_0db -Default value for pcm volume. +Default value for +.Nm +volume. Increase to give more room for attenuation control. Decrease for more amplification, with the possible cost of sound clipping. .It Va hw.snd.vpc_autoreset @@ -298,8 +300,10 @@ Enabling this will preserve the volume, when applications tries to re-open the same device. .It Va hw.snd.vpc_mixer_bypass The recommended way to use the vpc feature is to teach applications to use -the correct ioctl(): SNDCTL_DSP_GETPLAYVOL, SNDCTL_DSP_SETPLAYVOL, -SNDCTL_DSP_SETRECVOL, SNDCTL_DSP_SETRECVOL. +the correct +.Fn ioctl : +.Dv SNDCTL_DSP_GETPLAYVOL, SNDCTL_DSP_SETPLAYVOL, +.Dv SNDCTL_DSP_SETRECVOL, SNDCTL_DSP_SETRECVOL. This is however not always possible. Enable this to allow applications to use their own existing mixer logic to control their own channel volume. @@ -309,7 +313,9 @@ Enable to restore all channel volumes ba Enable or disable bitperfect mode. When enabled, channels will skip all dsp processing, such as channel matrixing, rate converting and equalizing. -The pure pcm stream will be fed directly to the hardware. +The pure +.Nm +stream will be fed directly to the hardware. If .Tn VCHANs are enabled, the bitperfect mode will use the @@ -341,26 +347,32 @@ process begins. format/rate selection. Available options include: .Bl -tag -width 2n -.It fixed / 0 +.It fixed Channel mixing is done using fixed format/rate. Advanced operations such as digital passthrough will not work. -Can be considered as a 'legacy' mode. +Can be considered as a +.Dq legacy +mode. This is the default mode for hardware channels which lack support for digital formats. -.It passthrough / 1 +.It passthrough Channel mixing is done using fixed format/rate, but advanced operations such -as digital passthrough also works. +as digital passthrough also work. All channels will produce sound as usual until a digital format playback is requested. When this happens all other channels will be muted and the latest incoming digital format will be allowed to pass through undisturbed. Multiple concurrent digital streams are supported, but the latest stream will take precedence and mute all other streams. -.It adaptive / 2 -Works like the 'passthrough' mode, but is a bit smarter, especially for -multiple pcm channels with different format/rate. +.It adaptive +Works like the +.Dq passthrough +mode, but is a bit smarter, especially for +multiple +.Nm +channels with different format/rate. When a new channel is about to start, the entire list of virtual channels will -be scanned and the channel with the best format/rate (usuallay the +be scanned, and the channel with the best format/rate (usually the highest/biggest) will be selected. This ensures that mixing quality depends on the best channel. The downside is that the hardware DMA mode needs to be restarted, which may From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 21:33:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E843106564A; Tue, 23 Jun 2009 21:33:27 +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 4D02F8FC08; Tue, 23 Jun 2009 21:33:27 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NLXQfi090767; Tue, 23 Jun 2009 21:33:26 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NLXQXf090765; Tue, 23 Jun 2009 21:33:26 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200906232133.n5NLXQXf090765@svn.freebsd.org> From: Ed Schouten Date: Tue, 23 Jun 2009 21:33: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: r194769 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 21:33:27 -0000 Author: ed Date: Tue Jun 23 21:33:26 2009 New Revision: 194769 URL: http://svn.freebsd.org/changeset/base/194769 Log: Use dcdwait to block threads to serialize writes. I suspect the usage of bgwait causes a lot of spurious wakeups when threads are blocked in the background, because they will be woken up each time a write() call is performed. Also wakeup dcdwait when the TTY is abandoned. Modified: head/sys/kern/tty.c Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Tue Jun 23 21:24:21 2009 (r194768) +++ head/sys/kern/tty.c Tue Jun 23 21:33:26 2009 (r194769) @@ -335,6 +335,7 @@ ttydev_close(struct cdev *dev, int fflag tp->t_revokecnt++; tty_wakeup(tp, FREAD|FWRITE); cv_broadcast(&tp->t_bgwait); + cv_broadcast(&tp->t_dcdwait); ttydev_leave(tp); @@ -455,7 +456,7 @@ ttydev_write(struct cdev *dev, struct ui } else { /* Serialize write() calls. */ while (tp->t_flags & TF_BUSY_OUT) { - error = tty_wait(tp, &tp->t_bgwait); + error = tty_wait(tp, &tp->t_dcdwait); if (error) goto done; } @@ -463,7 +464,7 @@ ttydev_write(struct cdev *dev, struct ui tp->t_flags |= TF_BUSY_OUT; error = ttydisc_write(tp, uio, ioflag); tp->t_flags &= ~TF_BUSY_OUT; - cv_broadcast(&tp->t_bgwait); + cv_broadcast(&tp->t_dcdwait); } done: tty_unlock(tp); From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 21:37:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11689106566C; Tue, 23 Jun 2009 21:37:13 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F3DE48FC1D; Tue, 23 Jun 2009 21:37:12 +0000 (UTC) (envelope-from joel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NLbCUV090890; Tue, 23 Jun 2009 21:37:12 GMT (envelope-from joel@svn.freebsd.org) Received: (from joel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NLbCus090888; Tue, 23 Jun 2009 21:37:12 GMT (envelope-from joel@svn.freebsd.org) Message-Id: <200906232137.n5NLbCus090888@svn.freebsd.org> From: Joel Dahl Date: Tue, 23 Jun 2009 21:37:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194770 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 21:37:13 -0000 Author: joel (doc committer) Date: Tue Jun 23 21:37:12 2009 New Revision: 194770 URL: http://svn.freebsd.org/changeset/base/194770 Log: Add one more reference to SEE ALSO. Sort while here. Submitted by: ariff Modified: head/share/man/man4/pcm.4 Modified: head/share/man/man4/pcm.4 ============================================================================== --- head/share/man/man4/pcm.4 Tue Jun 23 21:33:26 2009 (r194769) +++ head/share/man/man4/pcm.4 Tue Jun 23 21:37:12 2009 (r194770) @@ -516,8 +516,8 @@ A device node is not created properly. .Xr kldload 8 , .Xr sysctl 8 .Rs -.%T "The OSS API" -.%O "http://www.opensound.com/pguide/oss.pdf" +.%T "Cookbook formulae for audio EQ biquad filter coefficients, by Robert Bristow-Johnson" +.%O "http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt" .Re .Rs .%T "Julius O'Smith's Digital Audio Resampling" @@ -527,6 +527,10 @@ A device node is not created properly. .%T "Polynomial Interpolators for High-Quality Resampling of Oversampled Audio, by Olli Niemitalo" .%O "http://www.student.oulu.fi/~oniemita/dsp/deip.pdf" .Re +.Rs +.%T "The OSS API" +.%O "http://www.opensound.com/pguide/oss.pdf" +.Re .Sh HISTORY The .Nm From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 21:42:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4604E106568E; Tue, 23 Jun 2009 21:42:45 +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 BF37A8FC17; Tue, 23 Jun 2009 21:42:44 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.3/8.14.3/ALCHEMY.FRANKEN.DE) with ESMTP id n5NLDgeS046976; Tue, 23 Jun 2009 23:13:43 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.3/8.14.3/Submit) id n5NLDgDT046975; Tue, 23 Jun 2009 23:13:42 +0200 (CEST) (envelope-from marius) Date: Tue, 23 Jun 2009 23:13:42 +0200 From: Marius Strobl To: John Baldwin , yongari@freebsd.org Message-ID: <20090623211342.GJ71667@alchemy.franken.de> References: <200906232036.n5NKax9O089354@svn.freebsd.org> <200906231703.20496.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200906231703.20496.jhb@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: r194763 - in head/sys: conf dev/gem modules/gem X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 21:42:45 -0000 On Tue, Jun 23, 2009 at 05:03:20PM -0400, John Baldwin wrote: > On Tuesday 23 June 2009 4:36:59 pm Marius Strobl wrote: > > Author: marius > > Date: Tue Jun 23 20:36:59 2009 > > New Revision: 194763 > > URL: http://svn.freebsd.org/changeset/base/194763 > > > > Log: > > - Initialize the ifnet structure, especially if_dname, before probing > > the PHYs as some PHY drivers use it (but probably shouldn't). How > > gem(4) has worked with brgphy(4) on powerpc without this so far is > > unclear to me. > > - Introduce a dying flag which is set during detach and checked in > > gem_ioctl() in order to prevent active BPF listeners to clear > > promiscuous mode which may lead to the tick callout being restarted > > which will trigger a panic once it's actually gone. > > This should not be needed assuming you follow a model of: > > gem_detach() > { > > ether_ifdetach(ifp); /* calls bpfdetach() */ > GEM_LOCK(sc); > gem_stop(sc); > GEM_UNLOCK(sc); > ... > } > > If you are invoking gem_stop() prior to ether_ifdetach() then that is your > real bug. :) > Okay, I'll let yongari@ comment on this as he was the one who claimed that either clearing IFF_UP in the driver before calling ether_ifdetach(9) (which I think is a layering violation) or the committed approach is necessary in order to solve the problem :) Marius From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 21:43:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 712A0106564A; Tue, 23 Jun 2009 21:43:03 +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 4506C8FC12; Tue, 23 Jun 2009 21:43:03 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NLh3OE091049; Tue, 23 Jun 2009 21:43:03 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NLh3FY091046; Tue, 23 Jun 2009 21:43:03 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200906232143.n5NLh3FY091046@svn.freebsd.org> From: Ed Schouten Date: Tue, 23 Jun 2009 21:43: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: r194771 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 21:43:03 -0000 Author: ed Date: Tue Jun 23 21:43:02 2009 New Revision: 194771 URL: http://svn.freebsd.org/changeset/base/194771 Log: Improve my last commit: use a separate condvar to serialize. The advantage of using a separate condvar is that we can just use cv_signal(9) instead of cv_broadcast(9). It makes no sense to wake up multiple threads. It also makes the TTY code easier to understand. t_dcdwait sounds totally unrelated. Modified: head/sys/kern/tty.c head/sys/sys/tty.h Modified: head/sys/kern/tty.c ============================================================================== --- head/sys/kern/tty.c Tue Jun 23 21:37:12 2009 (r194770) +++ head/sys/kern/tty.c Tue Jun 23 21:43:02 2009 (r194771) @@ -456,7 +456,7 @@ ttydev_write(struct cdev *dev, struct ui } else { /* Serialize write() calls. */ while (tp->t_flags & TF_BUSY_OUT) { - error = tty_wait(tp, &tp->t_dcdwait); + error = tty_wait(tp, &tp->t_outserwait); if (error) goto done; } @@ -464,7 +464,7 @@ ttydev_write(struct cdev *dev, struct ui tp->t_flags |= TF_BUSY_OUT; error = ttydisc_write(tp, uio, ioflag); tp->t_flags &= ~TF_BUSY_OUT; - cv_broadcast(&tp->t_dcdwait); + cv_signal(&tp->t_outserwait); } done: tty_unlock(tp); @@ -916,6 +916,7 @@ tty_alloc_mutex(struct ttydevsw *tsw, vo cv_init(&tp->t_inwait, "ttyin"); cv_init(&tp->t_outwait, "ttyout"); + cv_init(&tp->t_outserwait, "ttyosr"); cv_init(&tp->t_bgwait, "ttybg"); cv_init(&tp->t_dcdwait, "ttydcd"); @@ -959,6 +960,7 @@ tty_dealloc(void *arg) cv_destroy(&tp->t_outwait); cv_destroy(&tp->t_bgwait); cv_destroy(&tp->t_dcdwait); + cv_destroy(&tp->t_outserwait); if (tp->t_mtx == &tp->t_mtxobj) mtx_destroy(&tp->t_mtxobj); Modified: head/sys/sys/tty.h ============================================================================== --- head/sys/sys/tty.h Tue Jun 23 21:37:12 2009 (r194770) +++ head/sys/sys/tty.h Tue Jun 23 21:43:02 2009 (r194771) @@ -97,6 +97,7 @@ struct tty { /* Sleeping mechanisms. */ struct cv t_inwait; /* (t) Input wait queue. */ struct cv t_outwait; /* (t) Output wait queue. */ + struct cv t_outserwait; /* (t) Serial output wait queue. */ struct cv t_bgwait; /* (t) Background wait queue. */ struct cv t_dcdwait; /* (t) Carrier Detect wait queue. */ From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 21:45:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA91E1065675; Tue, 23 Jun 2009 21:45:33 +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 8E3738FC26; Tue, 23 Jun 2009 21:45:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NLjXnW091165; Tue, 23 Jun 2009 21:45:33 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NLjXQI091162; Tue, 23 Jun 2009 21:45:33 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200906232145.n5NLjXQI091162@svn.freebsd.org> From: Alexander Motin Date: Tue, 23 Jun 2009 21:45: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: r194772 - in head/sys: amd64/isa i386/isa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 21:45:34 -0000 Author: mav Date: Tue Jun 23 21:45:33 2009 New Revision: 194772 URL: http://svn.freebsd.org/changeset/base/194772 Log: Rework r193814: While general idea of patch was good, it was not working properly due the way it was implemented. When we are using same timer interrupt for several of hard/prof/stat purposes we should not send several IPIs same time to other CPUs. Sending several IPIs same time leads to terrible accounting/profiling results due to strong synchronization effect, when the second interrupt handler accounts processing of the first one. Interlink timer events in a such way, that no more then one IPI is sent for any original timer interrupt. Modified: head/sys/amd64/isa/clock.c head/sys/i386/isa/clock.c Modified: head/sys/amd64/isa/clock.c ============================================================================== --- head/sys/amd64/isa/clock.c Tue Jun 23 21:43:02 2009 (r194771) +++ head/sys/amd64/isa/clock.c Tue Jun 23 21:45:33 2009 (r194772) @@ -93,9 +93,6 @@ static int i8254_ticked; static int using_atrtc_timer; static int using_lapic_timer; -static u_int stat_ticks = 0; -static u_int prof_ticks = 0; - /* Values for timerX_state: */ #define RELEASED 0 #define RELEASE_PENDING 1 @@ -132,6 +129,7 @@ int statclockintr(struct trapframe *frame) { + profclockintr(frame); statclock(TRAPF_USERMODE(frame)); return (FILTER_HANDLED); } @@ -140,7 +138,10 @@ int profclockintr(struct trapframe *frame) { - profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); + if (!using_atrtc_timer) + hardclockintr(frame); + if (profprocs != 0) + profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); return (FILTER_HANDLED); } @@ -160,32 +161,27 @@ clkintr(struct trapframe *frame) mtx_unlock_spin(&clock_lock); } KASSERT(!using_lapic_timer, ("clk interrupt enabled with lapic timer")); -#ifdef SMP - if (smp_started) - ipi_all_but_self(IPI_HARDCLOCK); -#endif - hardclockintr(frame); - if (!using_atrtc_timer) { - prof_ticks += profhz; - if (prof_ticks >= hz) { - prof_ticks -= hz; - if (profprocs != 0) { + if (using_atrtc_timer) { #ifdef SMP - if (smp_started) - ipi_all_but_self(IPI_PROFCLOCK); + if (smp_started) + ipi_all_but_self(IPI_HARDCLOCK); #endif - profclockintr(frame); - } - } - stat_ticks += stathz; - if (stat_ticks >= hz) { - stat_ticks -= hz; + hardclockintr(frame); + } else { + if (--pscnt == 0) { + pscnt = psrate; #ifdef SMP if (smp_started) ipi_all_but_self(IPI_STATCLOCK); #endif statclockintr(frame); + } else { +#ifdef SMP + if (smp_started) + ipi_all_but_self(IPI_PROFCLOCK); +#endif + profclockintr(frame); } } @@ -266,21 +262,19 @@ rtcintr(struct trapframe *frame) while (rtcin(RTC_INTR) & RTCIR_PERIOD) { flag = 1; - if (profprocs != 0) { - if (--pscnt == 0) - pscnt = psdiv; + if (--pscnt == 0) { + pscnt = psdiv; #ifdef SMP - if (pscnt != psdiv && smp_started) - ipi_all_but_self(IPI_PROFCLOCK); + if (smp_started) + ipi_all_but_self(IPI_STATCLOCK); #endif - profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); - } - if (pscnt == psdiv) { + statclockintr(frame); + } else { #ifdef SMP if (smp_started) - ipi_all_but_self(IPI_STATCLOCK); + ipi_all_but_self(IPI_PROFCLOCK); #endif - statclock(TRAPF_USERMODE(frame)); + profclockintr(frame); } } return(flag ? FILTER_HANDLED : FILTER_STRAY); @@ -523,8 +517,11 @@ cpu_initclocks() INTR_TYPE_CLK, NULL); atrtc_enable_intr(); } else { - profhz = min(RTC_PROFRATE, hz); - stathz = min(RTC_NOPROFRATE, hz); + profhz = hz; + if (hz < 128) + stathz = hz; + else + stathz = hz / (hz / 128); } } Modified: head/sys/i386/isa/clock.c ============================================================================== --- head/sys/i386/isa/clock.c Tue Jun 23 21:43:02 2009 (r194771) +++ head/sys/i386/isa/clock.c Tue Jun 23 21:45:33 2009 (r194772) @@ -108,9 +108,6 @@ static int i8254_ticked; static int using_atrtc_timer; static int using_lapic_timer; -static u_int stat_ticks = 0; -static u_int prof_ticks = 0; - /* Values for timerX_state: */ #define RELEASED 0 #define RELEASE_PENDING 1 @@ -147,6 +144,7 @@ int statclockintr(struct trapframe *frame) { + profclockintr(frame); statclock(TRAPF_USERMODE(frame)); return (FILTER_HANDLED); } @@ -155,7 +153,10 @@ int profclockintr(struct trapframe *frame) { - profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); + if (!using_atrtc_timer) + hardclockintr(frame); + if (profprocs != 0) + profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); return (FILTER_HANDLED); } @@ -187,32 +188,26 @@ clkintr(struct trapframe *frame) (*lapic_cyclic_clock_func[cpu])(frame); #endif + if (using_atrtc_timer) { #ifdef SMP - if (smp_started) - ipi_all_but_self(IPI_HARDCLOCK); -#endif - hardclockintr(frame); - - if (!using_atrtc_timer) { - prof_ticks += profhz; - if (prof_ticks >= hz) { - prof_ticks -= hz; - if (profprocs != 0) { -#ifdef SMP - if (smp_started) - ipi_all_but_self(IPI_PROFCLOCK); + if (smp_started) + ipi_all_but_self(IPI_HARDCLOCK); #endif - profclockintr(frame); - } - } - stat_ticks += stathz; - if (stat_ticks >= hz) { - stat_ticks -= hz; + hardclockintr(frame); + } else { + if (--pscnt == 0) { + pscnt = psratio; #ifdef SMP if (smp_started) ipi_all_but_self(IPI_STATCLOCK); #endif statclockintr(frame); + } else { +#ifdef SMP + if (smp_started) + ipi_all_but_self(IPI_PROFCLOCK); +#endif + profclockintr(frame); } } @@ -298,21 +293,19 @@ rtcintr(struct trapframe *frame) while (rtcin(RTC_INTR) & RTCIR_PERIOD) { flag = 1; - if (profprocs != 0) { - if (--pscnt == 0) - pscnt = psdiv; + if (--pscnt == 0) { + pscnt = psdiv; #ifdef SMP - if (pscnt != psdiv && smp_started) - ipi_all_but_self(IPI_PROFCLOCK); + if (smp_started) + ipi_all_but_self(IPI_STATCLOCK); #endif - profclock(TRAPF_USERMODE(frame), TRAPF_PC(frame)); - } - if (pscnt == psdiv) { + statclockintr(frame); + } else { #ifdef SMP - if (smp_started) - ipi_all_but_self(IPI_STATCLOCK); + if (smp_started) + ipi_all_but_self(IPI_PROFCLOCK); #endif - statclock(TRAPF_USERMODE(frame)); + profclockintr(frame); } } return(flag ? FILTER_HANDLED : FILTER_STRAY); @@ -572,8 +565,11 @@ cpu_initclocks() INTR_TYPE_CLK, NULL); atrtc_enable_intr(); } else { - profhz = min(RTC_PROFRATE, hz); - stathz = min(RTC_NOPROFRATE, hz); + profhz = hz; + if (hz < 128) + stathz = hz; + else + stathz = hz / (hz / 128); } } From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 21:48:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26643106564A; Tue, 23 Jun 2009 21:48: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 149E58FC18; Tue, 23 Jun 2009 21:48:05 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NLm4pW091250; Tue, 23 Jun 2009 21:48:04 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NLm4fX091248; Tue, 23 Jun 2009 21:48:04 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200906232148.n5NLm4fX091248@svn.freebsd.org> From: Rick Macklem Date: Tue, 23 Jun 2009 21:48: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: r194773 - head/usr.sbin/mountd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 21:48:05 -0000 Author: rmacklem Date: Tue Jun 23 21:48:04 2009 New Revision: 194773 URL: http://svn.freebsd.org/changeset/base/194773 Log: When mountd.c parses the nfsv4 root line(s) in /etc/exports, it allocates data structures that are never linked into the tree or free'd. As such, mountd would leak memory every time it parsed an nfsv4 root line. This patch frees up those structures to plug the leak. Approved by: kib (mentor) Modified: head/usr.sbin/mountd/mountd.c Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Tue Jun 23 21:45:33 2009 (r194772) +++ head/usr.sbin/mountd/mountd.c Tue Jun 23 21:48:04 2009 (r194773) @@ -1414,8 +1414,20 @@ get_exportlist_one() /* * For V4: don't enter in mount lists. */ - if (v4root_phase > 0 && v4root_phase <= 2) + if (v4root_phase > 0 && v4root_phase <= 2) { + /* + * Since these structures aren't used by mountd, + * free them up now. + */ + if (ep != NULL) + free_exp(ep); + while (tgrp != NULL) { + grp = tgrp; + tgrp = tgrp->gr_next; + free_grp(grp); + } goto nextline; + } /* * Success. Update the data structures. From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 21:50:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EDDEC106568A; Tue, 23 Jun 2009 21:50:06 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DC1F18FC1F; Tue, 23 Jun 2009 21:50:06 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NLo6iP091322; Tue, 23 Jun 2009 21:50:06 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NLo6ws091320; Tue, 23 Jun 2009 21:50:06 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200906232150.n5NLo6ws091320@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 23 Jun 2009 21:50: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: r194774 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 21:50:08 -0000 Author: jilles Date: Tue Jun 23 21:50:06 2009 New Revision: 194774 URL: http://svn.freebsd.org/changeset/base/194774 Log: Do not fork for a subshell if it is the last thing this shell is doing (EV_EXIT). The fork is still done as normal if any traps are active. In many cases, the fork can be avoided even without this change by using {} instead of (), but in practice many scripts use (), likely because the syntax is simpler. Example: sh -c '(/bin/sleep 10)& sleep 1;ps -p $! -o comm=' Now prints "sleep" instead of "sh". $! is more useful this way. Most shells (dash, bash, pdksh, ksh93, zsh) seem to print "sleep" for this. Example: sh -c '( ( ( (ps jT))))' Now shows no waiting shell processes instead of four. Most shells (dash, bash, pdksh, ksh93, zsh) seem to show zero or one. PR: bin/74404 Approved by: ed (mentor) (implicit) Modified: head/bin/sh/eval.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Tue Jun 23 21:48:04 2009 (r194773) +++ head/bin/sh/eval.c Tue Jun 23 21:50:06 2009 (r194774) @@ -401,8 +401,8 @@ evalsubshell(union node *n, int flags) int backgnd = (n->type == NBACKGND); expredir(n->nredir.redirect); - jp = makejob(n, 1); - if (forkshell(jp, n, backgnd) == 0) { + if ((!backgnd && flags & EV_EXIT && !have_traps()) || + forkshell(jp = makejob(n, 1), n, backgnd) == 0) { if (backgnd) flags &=~ EV_TESTED; redirect(n->nredir.redirect, 0); From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 21:59:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5900E106564A; Tue, 23 Jun 2009 21:59:39 +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 276258FC0A; Tue, 23 Jun 2009 21:59:39 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id CF43C46B3B; Tue, 23 Jun 2009 17:59:38 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id C285F8A079; Tue, 23 Jun 2009 17:59:37 -0400 (EDT) From: John Baldwin To: Marius Strobl Date: Tue, 23 Jun 2009 17:58:07 -0400 User-Agent: KMail/1.9.7 References: <200906232036.n5NKax9O089354@svn.freebsd.org> <200906231703.20496.jhb@freebsd.org> <20090623211342.GJ71667@alchemy.franken.de> In-Reply-To: <20090623211342.GJ71667@alchemy.franken.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906231758.07994.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 23 Jun 2009 17:59:37 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, yongari@freebsd.org Subject: Re: svn commit: r194763 - in head/sys: conf dev/gem modules/gem X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 21:59:39 -0000 On Tuesday 23 June 2009 5:13:42 pm Marius Strobl wrote: > On Tue, Jun 23, 2009 at 05:03:20PM -0400, John Baldwin wrote: > > On Tuesday 23 June 2009 4:36:59 pm Marius Strobl wrote: > > > Author: marius > > > Date: Tue Jun 23 20:36:59 2009 > > > New Revision: 194763 > > > URL: http://svn.freebsd.org/changeset/base/194763 > > > > > > Log: > > > - Initialize the ifnet structure, especially if_dname, before probing > > > the PHYs as some PHY drivers use it (but probably shouldn't). How > > > gem(4) has worked with brgphy(4) on powerpc without this so far is > > > unclear to me. > > > - Introduce a dying flag which is set during detach and checked in > > > gem_ioctl() in order to prevent active BPF listeners to clear > > > promiscuous mode which may lead to the tick callout being restarted > > > which will trigger a panic once it's actually gone. > > > > This should not be needed assuming you follow a model of: > > > > gem_detach() > > { > > > > ether_ifdetach(ifp); /* calls bpfdetach() */ > > GEM_LOCK(sc); > > gem_stop(sc); > > GEM_UNLOCK(sc); > > ... > > } > > > > If you are invoking gem_stop() prior to ether_ifdetach() then that is your > > real bug. :) > > > > Okay, I'll let yongari@ comment on this as he was the one > who claimed that either clearing IFF_UP in the driver before > calling ether_ifdetach(9) (which I think is a layering > violation) or the committed approach is necessary in order > to solve the problem :) I don't think one needs to clear IFF_UP explicitly. if_detach() will if_down() the interface as parts of its internal teardown. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 22:03:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9993A1065672; Tue, 23 Jun 2009 22:03:45 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 36AFB8FC15; Tue, 23 Jun 2009 22:03:44 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id E25631CC63; Wed, 24 Jun 2009 00:03:43 +0200 (CEST) Date: Wed, 24 Jun 2009 00:03:43 +0200 From: Ed Schouten To: Alexander Motin Message-ID: <20090623220343.GQ48776@hoeg.nl> References: <200906232145.n5NLjXQI091162@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="X+eNnNyFGSMeeS0J" Content-Disposition: inline In-Reply-To: <200906232145.n5NLjXQI091162@svn.freebsd.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194772 - in head/sys: amd64/isa i386/isa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 22:03:46 -0000 --X+eNnNyFGSMeeS0J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Alexander, * Alexander Motin wrote: > + pscnt =3D psrate; It seems the psrate variable is nonexistent. Yours, --=20 Ed Schouten WWW: http://80386.nl/ --X+eNnNyFGSMeeS0J Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkpBUT8ACgkQ52SDGA2eCwWv7ACeMZ9LsDttRKPgr8X9llUmCkMj t/AAnApoqeb02wcsBhO9EzbHTqQMc7ot =UDks -----END PGP SIGNATURE----- --X+eNnNyFGSMeeS0J-- From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 22:03:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50D1A10656A8; Tue, 23 Jun 2009 22:03:57 +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 3E87F8FC2A; Tue, 23 Jun 2009 22:03:57 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NM3u8H091667; Tue, 23 Jun 2009 22:03:56 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NM3u4k091666; Tue, 23 Jun 2009 22:03:56 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200906232203.n5NM3u4k091666@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 23 Jun 2009 22:03: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: r194775 - head/tools/regression/bin/sh/execution X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 22:03:58 -0000 Author: jilles Date: Tue Jun 23 22:03:56 2009 New Revision: 194775 URL: http://svn.freebsd.org/changeset/base/194775 Log: Add tests for r194774. Approved by: ed (mentor) (implicit) Added: head/tools/regression/bin/sh/execution/fork2.0 (contents, props changed) Added: head/tools/regression/bin/sh/execution/fork2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/execution/fork2.0 Tue Jun 23 22:03:56 2009 (r194775) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +result=$(sh -c '(/bin/sleep 1)& sleep 0.1; ps -p $! -o comm=; kill $!') +test "$result" = sleep || exit 1 + +result=$(sh -c '{ trap "echo trapped" EXIT; (/usr/bin/true); } & wait') +test "$result" = trapped || exit 1 + +exit 0 From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 22:06:24 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12B99106567D; Tue, 23 Jun 2009 22:06:24 +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 BFC358FC08; Tue, 23 Jun 2009 22:06:23 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n5NMCm49005522; Tue, 23 Jun 2009 18:12:48 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n5NMCmg1005521; Tue, 23 Jun 2009 18:12:48 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Tue, 23 Jun 2009 18:12:48 -0400 From: David Schultz To: Kostik Belousov Message-ID: <20090623221248.GA5445@zim.MIT.EDU> Mail-Followup-To: Kostik Belousov , Ed Schouten , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <200906201639.n5KGdPhO081114@svn.freebsd.org> <20090620174158.GG2884@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090620174158.GG2884@deviant.kiev.zoral.com.ua> Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Ed Schouten Subject: Re: svn commit: r194538 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 22:06:25 -0000 On Sat, Jun 20, 2009, Kostik Belousov wrote: > On Sat, Jun 20, 2009 at 04:39:25PM +0000, Ed Schouten wrote: > > Author: ed > > Date: Sat Jun 20 16:39:25 2009 > > New Revision: 194538 > > URL: http://svn.freebsd.org/changeset/base/194538 > > > > Log: > > Add placeholder to prevent reuse of privilege 254. > > > > Requested by: rwatson > > > > Modified: > > head/sys/sys/priv.h > > > > Modified: head/sys/sys/priv.h > > ============================================================================== > > --- head/sys/sys/priv.h Sat Jun 20 16:37:24 2009 (r194537) > > +++ head/sys/sys/priv.h Sat Jun 20 16:39:25 2009 (r194538) > > @@ -211,6 +211,7 @@ > > #define PRIV_TTY_DRAINWAIT 251 /* Set tty drain wait time. */ > > #define PRIV_TTY_DTRWAIT 252 /* Set DTR wait on tty. */ > > #define PRIV_TTY_EXCLUSIVE 253 /* Override tty exclusive flag. */ > > +#define _PRIV_TTY_PRISON 254 /* Removed. */ > > #define PRIV_TTY_STI 255 /* Simulate input on another tty. */ > > #define PRIV_TTY_SETA 256 /* Set tty termios structure. */ > > > Names starting with two underscores or underscore and upper-case letter > are reserved to the C language implementation. We should not use it > in the code. Applications are not supposed to use such symbols, but we use them pervasively in system headers specifically to avoid conflicting with symbols an application might define. (Effectively, we consider system headers to be part of the language implementation.) From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 22:08:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B86010656A7; Tue, 23 Jun 2009 22:08:26 +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 3968C8FC13; Tue, 23 Jun 2009 22:08:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NM8QFo091815; Tue, 23 Jun 2009 22:08:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NM8Qv0091813; Tue, 23 Jun 2009 22:08:26 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200906232208.n5NM8Qv0091813@svn.freebsd.org> From: Alexander Motin Date: Tue, 23 Jun 2009 22:08: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: r194776 - head/sys/amd64/isa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 22:08:27 -0000 Author: mav Date: Tue Jun 23 22:08:25 2009 New Revision: 194776 URL: http://svn.freebsd.org/changeset/base/194776 Log: Fix variable name. Modified: head/sys/amd64/isa/clock.c Modified: head/sys/amd64/isa/clock.c ============================================================================== --- head/sys/amd64/isa/clock.c Tue Jun 23 22:03:56 2009 (r194775) +++ head/sys/amd64/isa/clock.c Tue Jun 23 22:08:25 2009 (r194776) @@ -170,7 +170,7 @@ clkintr(struct trapframe *frame) hardclockintr(frame); } else { if (--pscnt == 0) { - pscnt = psrate; + pscnt = psratio; #ifdef SMP if (smp_started) ipi_all_but_self(IPI_STATCLOCK); From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 22:08:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E11210656A5; Tue, 23 Jun 2009 22:08:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1AC398FC1C; Tue, 23 Jun 2009 22:08:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NM8udR091870; Tue, 23 Jun 2009 22:08:56 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NM8tTB091860; Tue, 23 Jun 2009 22:08:55 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200906232208.n5NM8tTB091860@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 23 Jun 2009 22:08: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: r194777 - in head/sys: netinet netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 22:08:57 -0000 Author: bz Date: Tue Jun 23 22:08:55 2009 New Revision: 194777 URL: http://svn.freebsd.org/changeset/base/194777 Log: Make callers to in6_selectsrc() and in6_pcbladdr() pass in memory to save the selected source address rather than returning an unreferenced copy to a pointer that might long be gone by the time we use the pointer for anything meaningful. Asked for by: rwatson Reviewed by: rwatson Modified: head/sys/netinet/tcp_usrreq.c head/sys/netinet6/icmp6.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_pcb.h head/sys/netinet6/in6_src.c head/sys/netinet6/ip6_var.h head/sys/netinet6/nd6_nbr.c head/sys/netinet6/raw_ip6.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Tue Jun 23 22:08:25 2009 (r194776) +++ head/sys/netinet/tcp_usrreq.c Tue Jun 23 22:08:55 2009 (r194777) @@ -1137,7 +1137,7 @@ tcp6_connect(struct tcpcb *tp, struct so struct socket *so = inp->inp_socket; INIT_VNET_INET(so->so_vnet); struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam; - struct in6_addr *addr6; + struct in6_addr addr6; int error; INP_INFO_WLOCK_ASSERT(&V_tcbinfo); @@ -1161,13 +1161,13 @@ tcp6_connect(struct tcpcb *tp, struct so oinp = in6_pcblookup_hash(inp->inp_pcbinfo, &sin6->sin6_addr, sin6->sin6_port, IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) - ? addr6 + ? &addr6 : &inp->in6p_laddr, inp->inp_lport, 0, NULL); if (oinp) return EADDRINUSE; if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) - inp->in6p_laddr = *addr6; + inp->in6p_laddr = addr6; inp->in6p_faddr = sin6->sin6_addr; inp->inp_fport = sin6->sin6_port; /* update flowinfo - draft-itojun-ipv6-flowlabel-api-00 */ Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Tue Jun 23 22:08:25 2009 (r194776) +++ head/sys/netinet6/icmp6.c Tue Jun 23 22:08:55 2009 (r194777) @@ -2080,7 +2080,7 @@ icmp6_reflect(struct mbuf *m, size_t off int plen; int type, code; struct ifnet *outif = NULL; - struct in6_addr origdst, *src = NULL; + struct in6_addr origdst, src, *srcp = NULL; /* too short to reflect */ if (off < sizeof(struct ip6_hdr)) { @@ -2148,7 +2148,7 @@ icmp6_reflect(struct mbuf *m, size_t off if ((ia = ip6_getdstifaddr(m))) { if (!(ia->ia6_flags & (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY))) - src = &ia->ia_addr.sin6_addr; + srcp = &ia->ia_addr.sin6_addr; } else { struct sockaddr_in6 d; @@ -2161,12 +2161,12 @@ icmp6_reflect(struct mbuf *m, size_t off if (ia && !(ia->ia6_flags & (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY))) { - src = &ia->ia_addr.sin6_addr; + srcp = &ia->ia_addr.sin6_addr; } } } - if (src == NULL) { + if (srcp == NULL) { int e; struct sockaddr_in6 sin6; struct route_in6 ro; @@ -2182,10 +2182,10 @@ icmp6_reflect(struct mbuf *m, size_t off sin6.sin6_addr = ip6->ip6_dst; /* zone ID should be embedded */ bzero(&ro, sizeof(ro)); - src = in6_selectsrc(&sin6, NULL, NULL, &ro, NULL, &outif, &e); + e = in6_selectsrc(&sin6, NULL, NULL, &ro, NULL, &outif, &src); if (ro.ro_rt) RTFREE(ro.ro_rt); /* XXX: we could use this */ - if (src == NULL) { + if (e) { char ip6buf[INET6_ADDRSTRLEN]; nd6log((LOG_DEBUG, "icmp6_reflect: source can't be determined: " @@ -2193,9 +2193,10 @@ icmp6_reflect(struct mbuf *m, size_t off ip6_sprintf(ip6buf, &sin6.sin6_addr), e)); goto bad; } + srcp = &src; } - ip6->ip6_src = *src; + ip6->ip6_src = *srcp; ip6->ip6_flow = 0; ip6->ip6_vfc &= ~IPV6_VERSION_MASK; ip6->ip6_vfc |= IPV6_VERSION; Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Tue Jun 23 22:08:25 2009 (r194776) +++ head/sys/netinet6/in6_pcb.c Tue Jun 23 22:08:55 2009 (r194777) @@ -289,13 +289,14 @@ in6_pcbbind(register struct inpcb *inp, */ int in6_pcbladdr(register struct inpcb *inp, struct sockaddr *nam, - struct in6_addr **plocal_addr6) + struct in6_addr *plocal_addr6) { INIT_VNET_INET6(inp->inp_vnet); register struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam; int error = 0; struct ifnet *ifp = NULL; int scope_ambiguous = 0; + struct in6_addr in6a; INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); INP_WLOCK_ASSERT(inp); @@ -323,25 +324,25 @@ in6_pcbladdr(register struct inpcb *inp, if ((error = prison_remote_ip6(inp->inp_cred, &sin6->sin6_addr)) != 0) return (error); - /* - * XXX: in6_selectsrc might replace the bound local address - * with the address specified by setsockopt(IPV6_PKTINFO). - * Is it the intended behavior? - */ - *plocal_addr6 = in6_selectsrc(sin6, inp->in6p_outputopts, - inp, NULL, - inp->inp_cred, - &ifp, &error); + error = in6_selectsrc(sin6, inp->in6p_outputopts, + inp, NULL, inp->inp_cred, &ifp, &in6a); + if (error) + return (error); + if (ifp && scope_ambiguous && (error = in6_setscope(&sin6->sin6_addr, ifp, NULL)) != 0) { return(error); } - if (*plocal_addr6 == NULL) { - if (error == 0) - error = EADDRNOTAVAIL; - return (error); - } + /* + * Do not update this earlier, in case we return with an error. + * + * XXX: this in6_selectsrc result might replace the bound local + * aaddress with the address specified by setsockopt(IPV6_PKTINFO). + * Is it the intended behavior? + */ + *plocal_addr6 = in6a; + /* * Don't do pcblookup call here; return interface in * plocal_addr6 @@ -362,8 +363,8 @@ int in6_pcbconnect(register struct inpcb *inp, struct sockaddr *nam, struct ucred *cred) { - struct in6_addr *addr6; register struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam; + struct in6_addr addr6; int error; INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); @@ -379,7 +380,7 @@ in6_pcbconnect(register struct inpcb *in if (in6_pcblookup_hash(inp->inp_pcbinfo, &sin6->sin6_addr, sin6->sin6_port, IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) - ? addr6 : &inp->in6p_laddr, + ? &addr6 : &inp->in6p_laddr, inp->inp_lport, 0, NULL) != NULL) { return (EADDRINUSE); } @@ -389,7 +390,7 @@ in6_pcbconnect(register struct inpcb *in if (error) return (error); } - inp->in6p_laddr = *addr6; + inp->in6p_laddr = addr6; } inp->in6p_faddr = sin6->sin6_addr; inp->inp_fport = sin6->sin6_port; Modified: head/sys/netinet6/in6_pcb.h ============================================================================== --- head/sys/netinet6/in6_pcb.h Tue Jun 23 22:08:25 2009 (r194776) +++ head/sys/netinet6/in6_pcb.h Tue Jun 23 22:08:55 2009 (r194777) @@ -74,8 +74,7 @@ void in6_losing __P((struct inpcb *)); int in6_pcbbind __P((struct inpcb *, struct sockaddr *, struct ucred *)); int in6_pcbconnect __P((struct inpcb *, struct sockaddr *, struct ucred *)); void in6_pcbdisconnect __P((struct inpcb *)); -int in6_pcbladdr __P((struct inpcb *, struct sockaddr *, - struct in6_addr **)); +int in6_pcbladdr(struct inpcb *, struct sockaddr *, struct in6_addr *); struct inpcb * in6_pcblookup_local __P((struct inpcbinfo *, struct in6_addr *, u_short, int, Modified: head/sys/netinet6/in6_src.c ============================================================================== --- head/sys/netinet6/in6_src.c Tue Jun 23 22:08:25 2009 (r194776) +++ head/sys/netinet6/in6_src.c Tue Jun 23 22:08:55 2009 (r194777) @@ -179,10 +179,10 @@ static struct in6_addrpolicy *match_addr goto out; /* XXX: we can't use 'break' here */ \ } while(0) -struct in6_addr * +int in6_selectsrc(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, struct inpcb *inp, struct route_in6 *ro, struct ucred *cred, - struct ifnet **ifpp, int *errorp) + struct ifnet **ifpp, struct in6_addr *srcp) { INIT_VNET_INET6(curvnet); struct in6_addr dst; @@ -193,10 +193,12 @@ in6_selectsrc(struct sockaddr_in6 *dstso struct in6_addrpolicy *dst_policy = NULL, *best_policy = NULL; u_int32_t odstzone; int prefer_tempaddr; + int error; struct ip6_moptions *mopts; + KASSERT(srcp != NULL, ("%s: srcp is NULL", __func__)); + dst = dstsock->sin6_addr; /* make a copy for local operation */ - *errorp = 0; if (ifpp) *ifpp = NULL; @@ -219,10 +221,8 @@ in6_selectsrc(struct sockaddr_in6 *dstso struct in6_ifaddr *ia6; /* get the outgoing interface */ - if ((*errorp = in6_selectif(dstsock, opts, mopts, ro, &ifp)) - != 0) { - return (NULL); - } + if ((error = in6_selectif(dstsock, opts, mopts, ro, &ifp)) != 0) + return (error); /* * determine the appropriate zone id of the source based on @@ -236,14 +236,14 @@ in6_selectsrc(struct sockaddr_in6 *dstso srcsock.sin6_len = sizeof(srcsock); srcsock.sin6_addr = pi->ipi6_addr; if (ifp) { - *errorp = in6_setscope(&srcsock.sin6_addr, ifp, NULL); - if (*errorp != 0) - return (NULL); + error = in6_setscope(&srcsock.sin6_addr, ifp, NULL); + if (error) + return (error); } - if (cred != NULL && (*errorp = prison_local_ip6(cred, + if (cred != NULL && (error = prison_local_ip6(cred, &srcsock.sin6_addr, (inp != NULL && (inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0) - return (NULL); + return (error); ia6 = (struct in6_ifaddr *)ifa_ifwithaddr( (struct sockaddr *)&srcsock); @@ -251,21 +251,14 @@ in6_selectsrc(struct sockaddr_in6 *dstso (ia6->ia6_flags & (IN6_IFF_ANYCAST | IN6_IFF_NOTREADY))) { if (ia6 != NULL) ifa_free(&ia6->ia_ifa); - *errorp = EADDRNOTAVAIL; - return (NULL); + return (EADDRNOTAVAIL); } pi->ipi6_addr = srcsock.sin6_addr; /* XXX: this overrides pi */ if (ifpp) *ifpp = ifp; - - /* - * XXXRW: This returns a pointer into a structure with no - * refcount. in6_selectsrc() should return it to caller- - * provided memory using call-by-reference rather than - * returning pointers into other memory. - */ + bcopy(&ia6->ia_addr.sin6_addr, srcp, sizeof(*srcp)); ifa_free(&ia6->ia_ifa); - return (&ia6->ia_addr.sin6_addr); + return (0); } /* @@ -273,10 +266,11 @@ in6_selectsrc(struct sockaddr_in6 *dstso */ if (inp != NULL && !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) { if (cred != NULL && - (*errorp = prison_local_ip6(cred, &inp->in6p_laddr, + (error = prison_local_ip6(cred, &inp->in6p_laddr, ((inp->inp_flags & IN6P_IPV6_V6ONLY) != 0))) != 0) - return (NULL); - return (&inp->in6p_laddr); + return (error); + bcopy(&inp->in6p_laddr, srcp, sizeof(*srcp)); + return (0); } /* @@ -284,16 +278,16 @@ in6_selectsrc(struct sockaddr_in6 *dstso * the outgoing interface and the destination address. */ /* get the outgoing interface */ - if ((*errorp = in6_selectif(dstsock, opts, mopts, ro, &ifp)) != 0) - return (NULL); + if ((error = in6_selectif(dstsock, opts, mopts, ro, &ifp)) != 0) + return (error); #ifdef DIAGNOSTIC if (ifp == NULL) /* this should not happen */ panic("in6_selectsrc: NULL ifp"); #endif - *errorp = in6_setscope(&dst, ifp, &odstzone); - if (*errorp != 0) - return (NULL); + error = in6_setscope(&dst, ifp, &odstzone); + if (error) + return (error); for (ia = V_in6_ifaddr; ia; ia = ia->ia_next) { int new_scope = -1, new_matchlen = -1; @@ -472,15 +466,14 @@ in6_selectsrc(struct sockaddr_in6 *dstso break; } - if ((ia = ia_best) == NULL) { - *errorp = EADDRNOTAVAIL; - return (NULL); - } + if ((ia = ia_best) == NULL) + return (EADDRNOTAVAIL); if (ifpp) *ifpp = ifp; - return (&ia->ia_addr.sin6_addr); + bcopy(&ia->ia_addr.sin6_addr, srcp, sizeof(*srcp)); + return (0); } /* Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Tue Jun 23 22:08:25 2009 (r194776) +++ head/sys/netinet6/ip6_var.h Tue Jun 23 22:08:55 2009 (r194777) @@ -402,9 +402,9 @@ int rip6_usrreq __P((struct socket *, int dest6_input __P((struct mbuf **, int *, int)); int none_input __P((struct mbuf **, int *, int)); -struct in6_addr *in6_selectsrc __P((struct sockaddr_in6 *, struct ip6_pktopts *, +int in6_selectsrc(struct sockaddr_in6 *, struct ip6_pktopts *, struct inpcb *inp, struct route_in6 *, struct ucred *cred, - struct ifnet **, int *)); + struct ifnet **, struct in6_addr *); int in6_selectroute __P((struct sockaddr_in6 *, struct ip6_pktopts *, struct ip6_moptions *, struct route_in6 *, struct ifnet **, struct rtentry **)); Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Tue Jun 23 22:08:25 2009 (r194776) +++ head/sys/netinet6/nd6_nbr.c Tue Jun 23 22:08:55 2009 (r194777) @@ -505,9 +505,9 @@ nd6_ns_output(struct ifnet *ifp, const s dst_sa.sin6_len = sizeof(dst_sa); dst_sa.sin6_addr = ip6->ip6_dst; - src = in6_selectsrc(&dst_sa, NULL, - NULL, &ro, NULL, NULL, &error); - if (src == NULL) { + error = in6_selectsrc(&dst_sa, NULL, + NULL, &ro, NULL, NULL, &src_in); + if (error) { char ip6buf[INET6_ADDRSTRLEN]; nd6log((LOG_DEBUG, "nd6_ns_output: source can't be " @@ -516,6 +516,7 @@ nd6_ns_output(struct ifnet *ifp, const s error)); goto bad; } + src = &src_in; } } else { /* @@ -933,7 +934,7 @@ nd6_na_output(struct ifnet *ifp, const s struct ip6_hdr *ip6; struct nd_neighbor_advert *nd_na; struct ip6_moptions im6o; - struct in6_addr *src, daddr6; + struct in6_addr src, daddr6; struct sockaddr_in6 dst_sa; int icmp6len, maxlen, error; caddr_t mac = NULL; @@ -1006,15 +1007,15 @@ nd6_na_output(struct ifnet *ifp, const s * Select a source whose scope is the same as that of the dest. */ bcopy(&dst_sa, &ro.ro_dst, sizeof(dst_sa)); - src = in6_selectsrc(&dst_sa, NULL, NULL, &ro, NULL, NULL, &error); - if (src == NULL) { + error = in6_selectsrc(&dst_sa, NULL, NULL, &ro, NULL, NULL, &src); + if (error) { char ip6buf[INET6_ADDRSTRLEN]; nd6log((LOG_DEBUG, "nd6_na_output: source can't be " "determined: dst=%s, error=%d\n", ip6_sprintf(ip6buf, &dst_sa.sin6_addr), error)); goto bad; } - ip6->ip6_src = *src; + ip6->ip6_src = src; nd_na = (struct nd_neighbor_advert *)(ip6 + 1); nd_na->nd_na_type = ND_NEIGHBOR_ADVERT; nd_na->nd_na_code = 0; Modified: head/sys/netinet6/raw_ip6.c ============================================================================== --- head/sys/netinet6/raw_ip6.c Tue Jun 23 22:08:25 2009 (r194776) +++ head/sys/netinet6/raw_ip6.c Tue Jun 23 22:08:55 2009 (r194777) @@ -389,7 +389,7 @@ rip6_output(m, va_alist) struct ifnet *oifp = NULL; int type = 0, code = 0; /* for ICMPv6 output statistics only */ int scope_ambiguous = 0; - struct in6_addr *in6a; + struct in6_addr in6a; va_list ap; va_start(ap, m); @@ -450,16 +450,14 @@ rip6_output(m, va_alist) /* * Source address selection. */ - if ((in6a = in6_selectsrc(dstsock, optp, in6p, NULL, so->so_cred, - &oifp, &error)) == NULL) { - if (error == 0) - error = EADDRNOTAVAIL; + error = in6_selectsrc(dstsock, optp, in6p, NULL, so->so_cred, + &oifp, &in6a); + if (error) goto bad; - } - error = prison_get_ip6(in6p->inp_cred, in6a); + error = prison_get_ip6(in6p->inp_cred, &in6a); if (error != 0) goto bad; - ip6->ip6_src = *in6a; + ip6->ip6_src = in6a; if (oifp && scope_ambiguous) { /* @@ -757,7 +755,7 @@ rip6_connect(struct socket *so, struct s INIT_VNET_INET6(so->so_vnet); struct inpcb *inp; struct sockaddr_in6 *addr = (struct sockaddr_in6 *)nam; - struct in6_addr *in6a = NULL; + struct in6_addr in6a; struct ifnet *ifp = NULL; int error = 0, scope_ambiguous = 0; @@ -787,13 +785,12 @@ rip6_connect(struct socket *so, struct s INP_INFO_WLOCK(&V_ripcbinfo); INP_WLOCK(inp); /* Source address selection. XXX: need pcblookup? */ - in6a = in6_selectsrc(addr, inp->in6p_outputopts, - inp, NULL, so->so_cred, - &ifp, &error); - if (in6a == NULL) { + error = in6_selectsrc(addr, inp->in6p_outputopts, + inp, NULL, so->so_cred, &ifp, &in6a); + if (error) { INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_ripcbinfo); - return (error ? error : EADDRNOTAVAIL); + return (error); } /* XXX: see above */ @@ -804,7 +801,7 @@ rip6_connect(struct socket *so, struct s return (error); } inp->in6p_faddr = addr->sin6_addr; - inp->in6p_laddr = *in6a; + inp->in6p_laddr = in6a; soisconnected(so); INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_ripcbinfo); Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Tue Jun 23 22:08:25 2009 (r194776) +++ head/sys/netinet6/udp6_usrreq.c Tue Jun 23 22:08:55 2009 (r194777) @@ -552,7 +552,7 @@ udp6_output(struct inpcb *inp, struct mb u_int32_t plen = sizeof(struct udphdr) + ulen; struct ip6_hdr *ip6; struct udphdr *udp6; - struct in6_addr *laddr, *faddr; + struct in6_addr *laddr, *faddr, in6a; struct sockaddr_in6 *sin6 = NULL; struct ifnet *oifp = NULL; int scope_ambiguous = 0; @@ -650,13 +650,16 @@ udp6_output(struct inpcb *inp, struct mb } if (!IN6_IS_ADDR_V4MAPPED(faddr)) { - laddr = in6_selectsrc(sin6, optp, inp, NULL, - td->td_ucred, &oifp, &error); + error = in6_selectsrc(sin6, optp, inp, NULL, + td->td_ucred, &oifp, &in6a); + if (error) + goto release; if (oifp && scope_ambiguous && (error = in6_setscope(&sin6->sin6_addr, oifp, NULL))) { goto release; } + laddr = &in6a; } else laddr = &inp->in6p_laddr; /* XXX */ if (laddr == NULL) { From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 22:10:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B5911065670; Tue, 23 Jun 2009 22:10:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id 7558B8FC16; Tue, 23 Jun 2009 22:10:25 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from [212.86.226.226] (account mav@alkar.net HELO mavbook.mavhome.dp.ua) by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9) with ESMTPSA id 246603965; Wed, 24 Jun 2009 01:10:22 +0300 Message-ID: <4A4152CA.4050107@FreeBSD.org> Date: Wed, 24 Jun 2009 01:10:18 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.21 (X11/20090405) MIME-Version: 1.0 To: Ed Schouten References: <200906232145.n5NLjXQI091162@svn.freebsd.org> <20090623220343.GQ48776@hoeg.nl> In-Reply-To: <20090623220343.GQ48776@hoeg.nl> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194772 - in head/sys: amd64/isa i386/isa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 22:10:28 -0000 Ed Schouten wrote: > * Alexander Motin wrote: >> + pscnt = psrate; > > It seems the psrate variable is nonexistent. Oops. There should be psratio. Forgot to recreate patch after fixing it. Thanks! -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 22:10:58 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 569361065698; Tue, 23 Jun 2009 22:10:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by mx1.freebsd.org (Postfix) with ESMTP id C61E58FC2B; Tue, 23 Jun 2009 22:10:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n5NMArP0009628 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Jun 2009 01:10:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n5NMArpC089973; Wed, 24 Jun 2009 01:10:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n5NMAroL089972; Wed, 24 Jun 2009 01:10:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 24 Jun 2009 01:10:53 +0300 From: Kostik Belousov To: Ed Schouten , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG Message-ID: <20090623221053.GT2884@deviant.kiev.zoral.com.ua> References: <200906201639.n5KGdPhO081114@svn.freebsd.org> <20090620174158.GG2884@deviant.kiev.zoral.com.ua> <20090623221248.GA5445@zim.MIT.EDU> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="QCC2I/2CckNfI+Tr" Content-Disposition: inline In-Reply-To: <20090623221248.GA5445@zim.MIT.EDU> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.1 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 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: Subject: Re: svn commit: r194538 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 22:10:59 -0000 --QCC2I/2CckNfI+Tr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 23, 2009 at 06:12:48PM -0400, David Schultz wrote: > On Sat, Jun 20, 2009, Kostik Belousov wrote: > > On Sat, Jun 20, 2009 at 04:39:25PM +0000, Ed Schouten wrote: > > > Author: ed > > > Date: Sat Jun 20 16:39:25 2009 > > > New Revision: 194538 > > > URL: http://svn.freebsd.org/changeset/base/194538 > > >=20 > > > Log: > > > Add placeholder to prevent reuse of privilege 254. > > > =20 > > > Requested by: rwatson > > >=20 > > > Modified: > > > head/sys/sys/priv.h > > >=20 > > > Modified: head/sys/sys/priv.h > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > > --- head/sys/sys/priv.h Sat Jun 20 16:37:24 2009 (r194537) > > > +++ head/sys/sys/priv.h Sat Jun 20 16:39:25 2009 (r194538) > > > @@ -211,6 +211,7 @@ > > > #define PRIV_TTY_DRAINWAIT 251 /* Set tty drain wait time. */ > > > #define PRIV_TTY_DTRWAIT 252 /* Set DTR wait on tty. */ > > > #define PRIV_TTY_EXCLUSIVE 253 /* Override tty exclusive flag. */ > > > +#define _PRIV_TTY_PRISON 254 /* Removed. */ > > > #define PRIV_TTY_STI 255 /* Simulate input on another tty. */ > > > #define PRIV_TTY_SETA 256 /* Set tty termios structure. */ > > > =20 > > Names starting with two underscores or underscore and upper-case letter > > are reserved to the C language implementation. We should not use it > > in the code. >=20 > Applications are not supposed to use such symbols, but we use them > pervasively in system headers specifically to avoid conflicting > with symbols an application might define. (Effectively, we > consider system headers to be part of the language implementation.) My interpretation is that we use freestanding environment for the kernel, and appropriate requirements shall be fullfilled by kernel code. --QCC2I/2CckNfI+Tr Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkpBUuwACgkQC3+MBN1Mb4hIAwCgkDNJzKhmf/Pszx2lHuisJlkL ciIAnioxWZicaeQu+IT4FjLMYJ6In7T9 =xhz7 -----END PGP SIGNATURE----- --QCC2I/2CckNfI+Tr-- From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 22:12:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4F91106566C; Tue, 23 Jun 2009 22:12:37 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B33038FC15; Tue, 23 Jun 2009 22:12:37 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NMCbcE092063; Tue, 23 Jun 2009 22:12:37 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NMCbxt092061; Tue, 23 Jun 2009 22:12:37 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200906232212.n5NMCbxt092061@svn.freebsd.org> From: Jeff Roberson Date: Tue, 23 Jun 2009 22:12: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: r194779 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 22:12:38 -0000 Author: jeff Date: Tue Jun 23 22:12:37 2009 New Revision: 194779 URL: http://svn.freebsd.org/changeset/base/194779 Log: - Use cpuset_t and the CPU_ macros in place of cpumask_t so that ULE supports arbitrary numbers of cpus rather than being limited by cpumask_t to the number of bits in a long. Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Tue Jun 23 22:09:53 2009 (r194778) +++ head/sys/kern/sched_ule.c Tue Jun 23 22:12:37 2009 (r194779) @@ -540,7 +540,7 @@ tdq_setlowpri(struct tdq *tdq, struct th #ifdef SMP struct cpu_search { - cpumask_t cs_mask; /* Mask of valid cpus. */ + cpuset_t cs_mask; u_int cs_load; u_int cs_cpu; int cs_limit; /* Min priority for low min load for high. */ @@ -550,8 +550,8 @@ struct cpu_search { #define CPU_SEARCH_HIGHEST 0x2 #define CPU_SEARCH_BOTH (CPU_SEARCH_LOWEST|CPU_SEARCH_HIGHEST) -#define CPUMASK_FOREACH(cpu, mask) \ - for ((cpu) = 0; (cpu) < sizeof((mask)) * 8; (cpu)++) \ +#define CPUSET_FOREACH(cpu, mask) \ + for ((cpu) = 0; (cpu) <= mp_maxid; (cpu)++) \ if ((mask) & 1 << (cpu)) static __inline int cpu_search(struct cpu_group *cg, struct cpu_search *low, @@ -574,14 +574,14 @@ cpu_compare(int cpu, struct cpu_search * tdq = TDQ_CPU(cpu); if (match & CPU_SEARCH_LOWEST) - if (low->cs_mask & (1 << cpu) && + if (CPU_ISSET(cpu, &low->cs_mask) && tdq->tdq_load < low->cs_load && tdq->tdq_lowpri > low->cs_limit) { low->cs_cpu = cpu; low->cs_load = tdq->tdq_load; } if (match & CPU_SEARCH_HIGHEST) - if (high->cs_mask & (1 << cpu) && + if (CPU_ISSET(cpu, &high->cs_mask) && tdq->tdq_load >= high->cs_limit && tdq->tdq_load > high->cs_load && tdq->tdq_transferable) { @@ -656,7 +656,7 @@ cpu_search(struct cpu_group *cg, struct } else { int cpu; - CPUMASK_FOREACH(cpu, cg->cg_mask) + CPUSET_FOREACH(cpu, cg->cg_mask) total += cpu_compare(cpu, low, high, match); } return (total); @@ -691,7 +691,7 @@ cpu_search_both(struct cpu_group *cg, st * acceptable. */ static inline int -sched_lowest(struct cpu_group *cg, cpumask_t mask, int pri) +sched_lowest(struct cpu_group *cg, cpuset_t mask, int pri) { struct cpu_search low; @@ -707,7 +707,7 @@ sched_lowest(struct cpu_group *cg, cpuma * Find the cpu with the highest load via the highest loaded path. */ static inline int -sched_highest(struct cpu_group *cg, cpumask_t mask, int minload) +sched_highest(struct cpu_group *cg, cpuset_t mask, int minload) { struct cpu_search high; @@ -724,7 +724,7 @@ sched_highest(struct cpu_group *cg, cpum * cg. */ static inline void -sched_both(struct cpu_group *cg, cpumask_t mask, int *lowcpu, int *highcpu) +sched_both(struct cpu_group *cg, cpuset_t mask, int *lowcpu, int *highcpu) { struct cpu_search high; struct cpu_search low; @@ -746,12 +746,12 @@ sched_both(struct cpu_group *cg, cpumask static void sched_balance_group(struct cpu_group *cg) { - cpumask_t mask; + cpuset_t mask; int high; int low; int i; - mask = -1; + CPU_FILL(&mask); for (;;) { sched_both(cg, mask, &low, &high); if (low == high || low == -1 || high == -1) @@ -763,9 +763,9 @@ sched_balance_group(struct cpu_group *cg * to kick out of the set and try again. */ if (TDQ_CPU(high)->tdq_transferable == 0) - mask &= ~(1 << high); + CPU_CLR(high, &mask); else - mask &= ~(1 << low); + CPU_CLR(low, &mask); } for (i = 0; i < cg->cg_children; i++) @@ -900,14 +900,14 @@ tdq_idled(struct tdq *tdq) { struct cpu_group *cg; struct tdq *steal; - cpumask_t mask; + cpuset_t mask; int thresh; int cpu; if (smp_started == 0 || steal_idle == 0) return (1); - mask = -1; - mask &= ~PCPU_GET(cpumask); + CPU_FILL(&mask); + CPU_CLR(PCPU_GET(cpuid), &mask); /* We don't want to be preempted while we're iterating. */ spinlock_enter(); for (cg = tdq->tdq_cg; cg != NULL; ) { @@ -921,7 +921,7 @@ tdq_idled(struct tdq *tdq) continue; } steal = TDQ_CPU(cpu); - mask &= ~(1 << cpu); + CPU_CLR(cpu, &mask); tdq_lock_pair(tdq, steal); if (steal->tdq_load < thresh || steal->tdq_transferable == 0) { tdq_unlock_pair(tdq, steal); @@ -1124,7 +1124,7 @@ sched_pickcpu(struct thread *td, int fla struct cpu_group *cg; struct td_sched *ts; struct tdq *tdq; - cpumask_t mask; + cpuset_t mask; int self; int pri; int cpu; @@ -1171,7 +1171,7 @@ sched_pickcpu(struct thread *td, int fla if (SCHED_AFFINITY(ts, cg->cg_level)) break; cpu = -1; - mask = td->td_cpuset->cs_mask.__bits[0]; + mask = td->td_cpuset->cs_mask; if (cg) cpu = sched_lowest(cg, mask, pri); if (cpu == -1) From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 22:19:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A92951065675; Tue, 23 Jun 2009 22:19:27 +0000 (UTC) (envelope-from davidch@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 95ED78FC18; Tue, 23 Jun 2009 22:19:27 +0000 (UTC) (envelope-from davidch@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NMJRxn092374; Tue, 23 Jun 2009 22:19:27 GMT (envelope-from davidch@svn.freebsd.org) Received: (from davidch@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NMJRbm092371; Tue, 23 Jun 2009 22:19:27 GMT (envelope-from davidch@svn.freebsd.org) Message-Id: <200906232219.n5NMJRbm092371@svn.freebsd.org> From: David Christensen Date: Tue, 23 Jun 2009 22:19:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194781 - head/sys/dev/bce X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 22:19:28 -0000 Author: davidch Date: Tue Jun 23 22:19:27 2009 New Revision: 194781 URL: http://svn.freebsd.org/changeset/base/194781 Log: - Added code to read bootcode firwmare version. - Created dedicated shared memory access routines. MFC after: One week Modified: head/sys/dev/bce/if_bce.c head/sys/dev/bce/if_bcereg.h Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Tue Jun 23 22:16:07 2009 (r194780) +++ head/sys/dev/bce/if_bce.c Tue Jun 23 22:19:27 2009 (r194781) @@ -329,6 +329,8 @@ static void bce_breakpoint (struct bce /****************************************************************************/ static u32 bce_reg_rd_ind (struct bce_softc *, u32); static void bce_reg_wr_ind (struct bce_softc *, u32, u32); +static void bce_shmem_wr (struct bce_softc *, u32, u32); +static u32 bce_shmem_rd (struct bce_softc *, u32); static void bce_ctx_wr (struct bce_softc *, u32, u32, u32); static int bce_miibus_read_reg (device_t, int, int); static int bce_miibus_write_reg (device_t, int, int, int); @@ -574,6 +576,8 @@ bce_probe(device_t dev) static void bce_print_adapter_info(struct bce_softc *sc) { + int i = 0; + DBENTER(BCE_VERBOSE_LOAD); BCE_PRINTF("ASIC (0x%08X); ", sc->bce_chipid); @@ -596,19 +600,33 @@ bce_print_adapter_info(struct bce_softc } /* Firmware version and device features. */ - printf("B/C (0x%08X); Flags( ", sc->bce_bc_ver); + printf("B/C (%s); Flags (", sc->bce_bc_ver); + #ifdef ZERO_COPY_SOCKETS printf("SPLT "); + i++; #endif - if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) - printf("MFW "); - if (sc->bce_flags & BCE_USING_MSI_FLAG) - printf("MSI "); - if (sc->bce_flags & BCE_USING_MSIX_FLAG) - printf("MSI-X "); - if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) - printf("2.5G "); - printf(")\n"); + if (sc->bce_flags & BCE_USING_MSI_FLAG) { + if (i > 0) printf("|"); + printf("MSI"); i++; + } + + if (sc->bce_flags & BCE_USING_MSIX_FLAG) { + if (i > 0) printf("|"); + printf("MSI-X "); i++; + } + + if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) { + if (i > 0) printf("|"); + printf("2.5G"); i++; + } + + if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) { + if (i > 0) printf("|"); + printf("MFW); MFW (%s)\n", sc->bce_mfw_ver); + } else { + printf(")\n"); + } DBEXIT(BCE_VERBOSE_LOAD); } @@ -847,13 +865,50 @@ bce_attach(device_t dev) __FUNCTION__, sc->bce_shmem_base); /* Fetch the bootcode revision. */ - sc->bce_bc_ver = REG_RD_IND(sc, sc->bce_shmem_base + - BCE_DEV_INFO_BC_REV); + val = bce_shmem_rd(sc, BCE_DEV_INFO_BC_REV); + for (int i = 0, j = 0; i < 3; i++) { + u8 num; + + num = (u8) (val >> (24 - (i * 8))); + for (int k = 100, skip0 = 1; k >= 1; num %= k, k /= 10) { + if (num >= k || !skip0 || k == 1) { + sc->bce_bc_ver[j++] = (num / k) + '0'; + skip0 = 0; + } + } + if (i != 2) + sc->bce_bc_ver[j++] = '.'; + } + + /* Check if any management firwmare is running. */ + val = bce_shmem_rd(sc, BCE_PORT_FEATURE); + if (val & BCE_PORT_FEATURE_ASF_ENABLED) { + sc->bce_flags |= BCE_MFW_ENABLE_FLAG; + + /* Allow time for firmware to enter the running state. */ + for (int i = 0; i < 30; i++) { + val = bce_shmem_rd(sc, BCE_BC_STATE_CONDITION); + if (val & BCE_CONDITION_MFW_RUN_MASK) + break; + DELAY(10000); + } + } - /* Check if any management firmware is running. */ - val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_PORT_FEATURE); - if (val & (BCE_PORT_FEATURE_ASF_ENABLED | BCE_PORT_FEATURE_IMD_ENABLED)) - sc->bce_flags |= BCE_MFW_ENABLE_FLAG; + /* Check the current bootcode state. */ + val = bce_shmem_rd(sc, BCE_BC_STATE_CONDITION); + val &= BCE_CONDITION_MFW_RUN_MASK; + if (val != BCE_CONDITION_MFW_RUN_UNKNOWN && + val != BCE_CONDITION_MFW_RUN_NONE) { + u32 addr = bce_shmem_rd(sc, BCE_MFW_VER_PTR); + int i = 0; + + for (int j = 0; j < 3; j++) { + val = bce_reg_rd_ind(sc, addr + j * 4); + val = bswap32(val); + memcpy(&sc->bce_mfw_ver[i], &val, 4); + i += 4; + } + } /* Get PCI bus information (speed and type). */ val = REG_RD(sc, BCE_PCICFG_MISC_STATUS); @@ -967,10 +1022,8 @@ bce_attach(device_t dev) bce_get_media(sc); /* Store data needed by PHY driver for backplane applications */ - sc->bce_shared_hw_cfg = REG_RD_IND(sc, sc->bce_shmem_base + - BCE_SHARED_HW_CFG_CONFIG); - sc->bce_port_hw_cfg = REG_RD_IND(sc, sc->bce_shmem_base + - BCE_PORT_HW_CFG_CONFIG); + sc->bce_shared_hw_cfg = bce_shmem_rd(sc, BCE_SHARED_HW_CFG_CONFIG); + sc->bce_port_hw_cfg = bce_shmem_rd(sc, BCE_PORT_HW_CFG_CONFIG); /* Allocate DMA memory resources. */ if (bce_dma_alloc(dev)) { @@ -1293,6 +1346,36 @@ bce_reg_wr_ind(struct bce_softc *sc, u32 } +/****************************************************************************/ +/* Shared memory write. */ +/* */ +/* Writes NetXtreme II shared memory region. */ +/* */ +/* Returns: */ +/* Nothing. */ +/****************************************************************************/ +static void +bce_shmem_wr(struct bce_softc *sc, u32 offset, u32 val) +{ + bce_reg_wr_ind(sc, sc->bce_shmem_base + offset, val); +} + + +/****************************************************************************/ +/* Shared memory read. */ +/* */ +/* Reads NetXtreme II shared memory region. */ +/* */ +/* Returns: */ +/* The 32 bit value read. */ +/****************************************************************************/ +static u32 +bce_shmem_rd(struct bce_softc *sc, u32 offset) +{ + return (bce_reg_rd_ind(sc, sc->bce_shmem_base + offset)); +} + + #ifdef BCE_DEBUG /****************************************************************************/ /* Context memory read. */ @@ -2094,7 +2177,7 @@ bce_init_nvram(struct bce_softc *sc) bce_init_nvram_get_flash_size: /* Write the flash config data to the shared memory interface. */ - val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_SHARED_HW_CFG_CONFIG2); + val = bce_shmem_rd(sc, BCE_SHARED_HW_CFG_CONFIG2); val &= BCE_SHARED_HW_CFG2_NVM_SIZE_MASK; if (val) sc->bce_flash_size = val; @@ -2583,8 +2666,7 @@ bce_get_media(struct bce_softc *sc) sc->bce_flags |= BCE_NO_WOL_FLAG; if (BCE_CHIP_NUM(sc) != BCE_CHIP_NUM_5706) { sc->bce_phy_addr = 2; - val = REG_RD_IND(sc, sc->bce_shmem_base + - BCE_SHARED_HW_CFG_CONFIG); + val = bce_shmem_rd(sc, BCE_SHARED_HW_CFG_CONFIG); if (val & BCE_SHARED_HW_CFG_PHY_2_5G) { sc->bce_phy_flags |= BCE_PHY_2_5G_CAPABLE_FLAG; DBPRINT(sc, BCE_INFO_LOAD, "Found 2.5Gb capable adapter\n"); @@ -3487,12 +3569,12 @@ bce_fw_sync(struct bce_softc *sc, u32 ms msg_data); /* Send the message to the bootcode driver mailbox. */ - REG_WR_IND(sc, sc->bce_shmem_base + BCE_DRV_MB, msg_data); + bce_shmem_wr(sc, BCE_DRV_MB, msg_data); /* Wait for the bootcode to acknowledge the message. */ for (i = 0; i < FW_ACK_TIME_OUT_MS; i++) { /* Check for a response in the bootcode firmware mailbox. */ - val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_FW_MB); + val = bce_shmem_rd(sc, BCE_FW_MB); if ((val & BCE_FW_MSG_ACK) == (msg_data & BCE_DRV_MSG_SEQ)) break; DELAY(1000); @@ -3509,7 +3591,7 @@ bce_fw_sync(struct bce_softc *sc, u32 ms msg_data &= ~BCE_DRV_MSG_CODE; msg_data |= BCE_DRV_MSG_CODE_FW_TIMEOUT; - REG_WR_IND(sc, sc->bce_shmem_base + BCE_DRV_MB, msg_data); + bce_shmem_wr(sc, BCE_DRV_MB, msg_data); sc->bce_fw_timed_out = 1; rc = EBUSY; @@ -4309,10 +4391,8 @@ bce_get_mac_addr(struct bce_softc *sc) * shared memory for speed. */ - mac_hi = REG_RD_IND(sc, sc->bce_shmem_base + - BCE_PORT_HW_CFG_MAC_UPPER); - mac_lo = REG_RD_IND(sc, sc->bce_shmem_base + - BCE_PORT_HW_CFG_MAC_LOWER); + mac_hi = bce_shmem_rd(sc, BCE_PORT_HW_CFG_MAC_UPPER); + mac_lo = bce_shmem_rd(sc, BCE_PORT_HW_CFG_MAC_LOWER); if ((mac_lo == 0) && (mac_hi == 0)) { BCE_PRINTF("%s(%d): Invalid Ethernet address!\n", @@ -4467,8 +4547,7 @@ bce_reset(struct bce_softc *sc, u32 rese goto bce_reset_exit; /* Set a firmware reminder that this is a soft reset. */ - REG_WR_IND(sc, sc->bce_shmem_base + BCE_DRV_RESET_SIGNATURE, - BCE_DRV_RESET_SIGNATURE_MAGIC); + bce_shmem_wr(sc, BCE_DRV_RESET_SIGNATURE, BCE_DRV_RESET_SIGNATURE_MAGIC); /* Dummy read to force the chip to complete all current transactions. */ val = REG_RD(sc, BCE_MISC_ID); @@ -4735,7 +4814,7 @@ bce_blockinit(struct bce_softc *sc) REG_WR(sc, BCE_HC_COMMAND, BCE_HC_COMMAND_CLR_STAT_NOW); /* Verify that bootcode is running. */ - reg = REG_RD_IND(sc, sc->bce_shmem_base + BCE_DEV_INFO_SIGNATURE); + reg = bce_shmem_rd(sc, BCE_DEV_INFO_SIGNATURE); DBRUNIF(DB_RANDOMTRUE(bootcode_running_failure_sim_control), BCE_PRINTF("%s(%d): Simulating bootcode failure.\n", @@ -7470,7 +7549,7 @@ bce_pulse(void *xsc) /* Tell the firmware that the driver is still running. */ msg = (u32) ++sc->bce_fw_drv_pulse_wr_seq; - REG_WR_IND(sc, sc->bce_shmem_base + BCE_DRV_PULSE_MB, msg); + bce_shmem_wr(sc, BCE_DRV_PULSE_MB, msg); /* Schedule the next pulse. */ callout_reset(&sc->bce_pulse_callout, hz, bce_pulse, sc); @@ -9824,7 +9903,7 @@ bce_dump_hw_state(struct bce_softc *sc) " Hardware State " "----------------------------\n"); - BCE_PRINTF("0x%08X - bootcode version\n", sc->bce_bc_ver); + BCE_PRINTF("%s - bootcode version\n", sc->bce_bc_ver); val = REG_RD(sc, BCE_MISC_ENABLE_STATUS_BITS); BCE_PRINTF("0x%08X - (0x%06X) misc_enable_status_bits\n", @@ -9949,21 +10028,21 @@ bce_dump_bc_state(struct bce_softc *sc) " Bootcode State " "----------------------------\n"); - BCE_PRINTF("0x%08X - bootcode version\n", sc->bce_bc_ver); + BCE_PRINTF("%s - bootcode version\n", sc->bce_bc_ver); - val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_BC_RESET_TYPE); + val = bce_shmem_rd(sc, BCE_BC_RESET_TYPE); BCE_PRINTF("0x%08X - (0x%06X) reset_type\n", val, BCE_BC_RESET_TYPE); - val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_BC_STATE); + val = bce_shmem_rd(sc, BCE_BC_STATE); BCE_PRINTF("0x%08X - (0x%06X) state\n", val, BCE_BC_STATE); - val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_BC_CONDITION); + val = bce_shmem_rd(sc, BCE_BC_CONDITION); BCE_PRINTF("0x%08X - (0x%06X) condition\n", val, BCE_BC_CONDITION); - val = REG_RD_IND(sc, sc->bce_shmem_base + BCE_BC_STATE_DEBUG_CMD); + val = bce_shmem_rd(sc, BCE_BC_STATE_DEBUG_CMD); BCE_PRINTF("0x%08X - (0x%06X) debug_cmd\n", val, BCE_BC_STATE_DEBUG_CMD); Modified: head/sys/dev/bce/if_bcereg.h ============================================================================== --- head/sys/dev/bce/if_bcereg.h Tue Jun 23 22:16:07 2009 (r194780) +++ head/sys/dev/bce/if_bcereg.h Tue Jun 23 22:19:27 2009 (r194781) @@ -999,6 +999,8 @@ struct flash_spec { #define BCE_PORT_FEATURE_MBA_VLAN_TAG_MASK 0xffff #define BCE_PORT_FEATURE_MBA_VLAN_ENABLE 0x10000 +#define BCE_MFW_VER_PTR 0x00000014c + #define BCE_BC_STATE_RESET_TYPE 0x000001c0 #define BCE_BC_STATE_RESET_TYPE_SIG 0x00005254 #define BCE_BC_STATE_RESET_TYPE_SIG_MASK 0x0000ffff @@ -1054,7 +1056,13 @@ struct flash_spec { #define BCE_BC_STATE_ERR_NO_RXP (BCE_BC_STATE_SIGN | 0x0600) #define BCE_BC_STATE_ERR_TOO_MANY_RBUF (BCE_BC_STATE_SIGN | 0x0700) -#define BCE_BC_CONDITION 0x000001c8 +#define BCE_BC_STATE_CONDITION 0x000001c8 +#define BCE_CONDITION_MFW_RUN_UNKNOWN 0x00000000 +#define BCE_CONDITION_MFW_RUN_IPMI 0x00002000 +#define BCE_CONDITION_MFW_RUN_UMP 0x00004000 +#define BCE_CONDITION_MFW_RUN_NCSI 0x00006000 +#define BCE_CONDITION_MFW_RUN_NONE 0x0000e000 +#define BCE_CONDITION_MFW_RUN_MASK 0x0000e000 #define BCE_BC_STATE_DEBUG_CMD 0x1dc #define BCE_BC_STATE_BC_DBG_CMD_SIGNATURE 0x42440000 @@ -6457,7 +6465,8 @@ struct bce_softc char * bce_name; /* Name string */ /* Tracks the version of bootcode firmware. */ - u32 bce_bc_ver; + char bce_bc_ver[32]; + char bce_mfw_ver[32]; /* Tracks the state of the firmware. 0 = Running while any */ /* other value indicates that the firmware is not responding. */ From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 22:28:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72D5F1065679; Tue, 23 Jun 2009 22:28:45 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6108A8FC1E; Tue, 23 Jun 2009 22:28:45 +0000 (UTC) (envelope-from edwin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NMSjEd092837; Tue, 23 Jun 2009 22:28:45 GMT (envelope-from edwin@svn.freebsd.org) Received: (from edwin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NMSjH8092835; Tue, 23 Jun 2009 22:28:45 GMT (envelope-from edwin@svn.freebsd.org) Message-Id: <200906232228.n5NMSjH8092835@svn.freebsd.org> From: Edwin Groothuis Date: Tue, 23 Jun 2009 22:28: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: r194783 - head/lib/libc/stdtime X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 22:28:46 -0000 Author: edwin Date: Tue Jun 23 22:28:44 2009 New Revision: 194783 URL: http://svn.freebsd.org/changeset/base/194783 Log: Remove duplicate if-statement on gmt_is_set in gmtsub(). MFC after: 1 week Modified: head/lib/libc/stdtime/localtime.c Modified: head/lib/libc/stdtime/localtime.c ============================================================================== --- head/lib/libc/stdtime/localtime.c Tue Jun 23 22:22:20 2009 (r194782) +++ head/lib/libc/stdtime/localtime.c Tue Jun 23 22:28:44 2009 (r194783) @@ -1472,18 +1472,16 @@ struct tm * const tmp; { register struct tm * result; + _MUTEX_LOCK(&gmt_mutex); if (!gmt_is_set) { - _MUTEX_LOCK(&gmt_mutex); - if (!gmt_is_set) { #ifdef ALL_STATE - gmtptr = (struct state *) malloc(sizeof *gmtptr); - if (gmtptr != NULL) + gmtptr = (struct state *) malloc(sizeof *gmtptr); + if (gmtptr != NULL) #endif /* defined ALL_STATE */ - gmtload(gmtptr); - gmt_is_set = TRUE; - } - _MUTEX_UNLOCK(&gmt_mutex); + gmtload(gmtptr); + gmt_is_set = TRUE; } + _MUTEX_UNLOCK(&gmt_mutex); result = timesub(timep, offset, gmtptr, tmp); #ifdef TM_ZONE /* From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 22:42:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 818D21065670; Tue, 23 Jun 2009 22:42:40 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6B0EC8FC17; Tue, 23 Jun 2009 22:42:40 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NMgeuL093159; Tue, 23 Jun 2009 22:42:40 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NMgeZe093128; Tue, 23 Jun 2009 22:42:40 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200906232242.n5NMgeZe093128@svn.freebsd.org> From: Jeff Roberson Date: Tue, 23 Jun 2009 22:42: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: r194784 - in head/sys: amd64/amd64 arm/arm arm/at91 arm/mv arm/sa11x0 arm/xscale/i80321 arm/xscale/i8134x arm/xscale/ixp425 arm/xscale/pxa i386/i386 i386/xen ia64/ia64 kern mips/mips pc... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 22:42:40 -0000 Author: jeff Date: Tue Jun 23 22:42:39 2009 New Revision: 194784 URL: http://svn.freebsd.org/changeset/base/194784 Log: Implement a facility for dynamic per-cpu variables. - Modules and kernel code alike may use DPCPU_DEFINE(), DPCPU_GET(), DPCPU_SET(), etc. akin to the statically defined PCPU_*. Requires only one extra instruction more than PCPU_* and is virtually the same as __thread for builtin and much faster for shared objects. DPCPU variables can be initialized when defined. - Modules are supported by relocating the module's per-cpu linker set over space reserved in the kernel. Modules may fail to load if there is insufficient space available. - Track space available for modules with a one-off extent allocator. Free may block for memory to allocate space for an extent. Reviewed by: jhb, rwatson, kan, sam, grehan, marius, marcel, stas Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/mp_machdep.c head/sys/arm/arm/elf_machdep.c head/sys/arm/at91/at91_machdep.c head/sys/arm/mv/mv_machdep.c head/sys/arm/sa11x0/assabet_machdep.c head/sys/arm/xscale/i80321/ep80219_machdep.c head/sys/arm/xscale/i80321/iq31244_machdep.c head/sys/arm/xscale/i8134x/crb_machdep.c head/sys/arm/xscale/ixp425/avila_machdep.c head/sys/arm/xscale/pxa/pxa_machdep.c head/sys/i386/i386/elf_machdep.c head/sys/i386/i386/machdep.c head/sys/i386/i386/mp_machdep.c head/sys/i386/xen/mp_machdep.c head/sys/ia64/ia64/elf_machdep.c head/sys/ia64/ia64/machdep.c head/sys/ia64/ia64/mp_machdep.c head/sys/kern/link_elf.c head/sys/kern/link_elf_obj.c head/sys/kern/subr_pcpu.c head/sys/mips/mips/elf_machdep.c head/sys/mips/mips/mp_machdep.c head/sys/mips/mips/pmap.c head/sys/pc98/pc98/machdep.c head/sys/powerpc/aim/mmu_oea.c head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/booke/pmap.c head/sys/powerpc/powerpc/elf_machdep.c head/sys/powerpc/powerpc/mp_machdep.c head/sys/sparc64/include/pcpu.h head/sys/sparc64/sparc64/elf_machdep.c head/sys/sparc64/sparc64/machdep.c head/sys/sparc64/sparc64/mp_machdep.c head/sys/sparc64/sparc64/pmap.c head/sys/sun4v/include/pcpu.h head/sys/sun4v/sun4v/machdep.c head/sys/sun4v/sun4v/mp_machdep.c head/sys/sun4v/sun4v/pmap.c head/sys/sys/linker.h head/sys/sys/pcpu.h head/sys/sys/sysctl.h Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/amd64/amd64/machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -1501,6 +1501,8 @@ hammer_time(u_int64_t modulep, u_int64_t wrmsr(MSR_KGSBASE, 0); /* User value while in the kernel */ pcpu_init(pc, 0, sizeof(struct pcpu)); + dpcpu_init((void *)(physfree + KERNBASE), 0); + physfree += DPCPU_SIZE; PCPU_SET(prvspace, pc); PCPU_SET(curthread, &thread0); PCPU_SET(curpcb, thread0.td_pcb); Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/amd64/amd64/mp_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -93,9 +93,10 @@ static int bootAP; /* Free these after use */ void *bootstacks[MAXCPU]; -/* Temporary holder for double fault stack */ +/* Temporary variables for init_secondary() */ char *doublefault_stack; char *nmi_stack; +void *dpcpu; /* Hotwire a 0->4MB V==P mapping */ extern pt_entry_t *KPTphys; @@ -590,6 +591,7 @@ init_secondary(void) /* prime data page for it to use */ pcpu_init(pc, cpu, sizeof(struct pcpu)); + dpcpu_init(dpcpu, cpu); pc->pc_apic_id = cpu_apic_ids[cpu]; pc->pc_prvspace = pc; pc->pc_curthread = 0; @@ -885,6 +887,7 @@ start_all_aps(void) bootstacks[cpu] = (void *)kmem_alloc(kernel_map, KSTACK_PAGES * PAGE_SIZE); doublefault_stack = (char *)kmem_alloc(kernel_map, PAGE_SIZE); nmi_stack = (char *)kmem_alloc(kernel_map, PAGE_SIZE); + dpcpu = (void *)kmem_alloc(kernel_map, DPCPU_SIZE); bootSTK = (char *)bootstacks[cpu] + KSTACK_PAGES * PAGE_SIZE - 8; bootAP = cpu; Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/arm/arm/elf_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -149,7 +149,7 @@ elf_reloc_internal(linker_file_t lf, Elf if (local) { if (rtype == R_ARM_RELATIVE) { /* A + B */ - addr = relocbase + addend; + addr = elf_relocaddr(lf, relocbase + addend); if (*where != addr) *where = addr; } Modified: head/sys/arm/at91/at91_machdep.c ============================================================================== --- head/sys/arm/at91/at91_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/arm/at91/at91_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -215,6 +215,7 @@ void * initarm(void *arg, void *arg2) { struct pv_addr kernel_l1pt; + struct pv_addr dpcpu; int loop, i; u_int l1pagetable; vm_offset_t freemempos; @@ -264,6 +265,10 @@ initarm(void *arg, void *arg2) */ valloc_pages(systempage, 1); + /* Allocate dynamic per-cpu area. */ + valloc_pages(dpcpu, DPCPU_SIZE / PAGE_SIZE); + dpcpu_init((void *)dpcpu.pv_va, 0); + /* Allocate stacks for all modes */ valloc_pages(irqstack, IRQ_STACK_SIZE); valloc_pages(abtstack, ABT_STACK_SIZE); Modified: head/sys/arm/mv/mv_machdep.c ============================================================================== --- head/sys/arm/mv/mv_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/arm/mv/mv_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -358,6 +358,7 @@ void * initarm(void *mdp, void *unused __unused) { struct pv_addr kernel_l1pt; + struct pv_addr dpcpu; vm_offset_t freemempos, l2_start, lastaddr; uint32_t memsize, l2size; struct bi_mem_region *mr; @@ -479,6 +480,10 @@ initarm(void *mdp, void *unused __unused */ valloc_pages(systempage, 1); + /* Allocate dynamic per-cpu area. */ + valloc_pages(dpcpu, DPCPU_SIZE / PAGE_SIZE); + dpcpu_init((void *)dpcpu.pv_va, 0); + /* Allocate stacks for all modes */ valloc_pages(irqstack, IRQ_STACK_SIZE); valloc_pages(abtstack, ABT_STACK_SIZE); Modified: head/sys/arm/sa11x0/assabet_machdep.c ============================================================================== --- head/sys/arm/sa11x0/assabet_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/arm/sa11x0/assabet_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -209,6 +209,7 @@ initarm(void *arg, void *arg2) struct pv_addr kernel_l1pt; struct pv_addr md_addr; struct pv_addr md_bla; + struct pv_addr dpcpu; int loop; u_int l1pagetable; vm_offset_t freemempos; @@ -268,6 +269,10 @@ initarm(void *arg, void *arg2) */ valloc_pages(systempage, 1); + /* Allocate dynamic per-cpu area. */ + valloc_pages(dpcpu, DPCPU_SIZE / PAGE_SIZE); + dpcpu_init((void *)dpcpu.pv_va, 0); + /* Allocate stacks for all modes */ valloc_pages(irqstack, IRQ_STACK_SIZE); valloc_pages(abtstack, ABT_STACK_SIZE); Modified: head/sys/arm/xscale/i80321/ep80219_machdep.c ============================================================================== --- head/sys/arm/xscale/i80321/ep80219_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/arm/xscale/i80321/ep80219_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -186,6 +186,7 @@ void * initarm(void *arg, void *arg2) { struct pv_addr kernel_l1pt; + struct pv_addr dpcpu; int loop, i; u_int l1pagetable; vm_offset_t freemempos; @@ -236,6 +237,10 @@ initarm(void *arg, void *arg2) */ valloc_pages(systempage, 1); + /* Allocate dynamic per-cpu area. */ + valloc_pages(dpcpu, DPCPU_SIZE / PAGE_SIZE); + dpcpu_init((void *)dpcpu.pv_va, 0); + /* Allocate stacks for all modes */ valloc_pages(irqstack, IRQ_STACK_SIZE); valloc_pages(abtstack, ABT_STACK_SIZE); Modified: head/sys/arm/xscale/i80321/iq31244_machdep.c ============================================================================== --- head/sys/arm/xscale/i80321/iq31244_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/arm/xscale/i80321/iq31244_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -187,6 +187,7 @@ void * initarm(void *arg, void *arg2) { struct pv_addr kernel_l1pt; + struct pv_addr dpcpu; int loop, i; u_int l1pagetable; vm_offset_t freemempos; @@ -236,6 +237,10 @@ initarm(void *arg, void *arg2) */ valloc_pages(systempage, 1); + /* Allocate dynamic per-cpu area. */ + valloc_pages(dpcpu, DPCPU_SIZE / PAGE_SIZE); + dpcpu_init((void *)dpcpu.pv_va, 0); + /* Allocate stacks for all modes */ valloc_pages(irqstack, IRQ_STACK_SIZE); valloc_pages(abtstack, ABT_STACK_SIZE); Modified: head/sys/arm/xscale/i8134x/crb_machdep.c ============================================================================== --- head/sys/arm/xscale/i8134x/crb_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/arm/xscale/i8134x/crb_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -183,6 +183,7 @@ void * initarm(void *arg, void *arg2) { struct pv_addr kernel_l1pt; + struct pv_addr dpcpu; int loop, i; u_int l1pagetable; vm_offset_t freemempos; @@ -232,6 +233,10 @@ initarm(void *arg, void *arg2) */ valloc_pages(systempage, 1); + /* Allocate dynamic per-cpu area. */ + valloc_pages(dpcpu, DPCPU_SIZE / PAGE_SIZE); + dpcpu_init((void *)dpcpu.pv_va, 0); + /* Allocate stacks for all modes */ valloc_pages(irqstack, IRQ_STACK_SIZE); valloc_pages(abtstack, ABT_STACK_SIZE); Modified: head/sys/arm/xscale/ixp425/avila_machdep.c ============================================================================== --- head/sys/arm/xscale/ixp425/avila_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/arm/xscale/ixp425/avila_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -232,6 +232,7 @@ initarm(void *arg, void *arg2) #define next_chunk2(a,b) (((a) + (b)) &~ ((b)-1)) #define next_page(a) next_chunk2(a,PAGE_SIZE) struct pv_addr kernel_l1pt; + struct pv_addr dpcpu; int loop, i; u_int l1pagetable; vm_offset_t freemempos; @@ -303,6 +304,10 @@ initarm(void *arg, void *arg2) */ valloc_pages(systempage, 1); + /* Allocate dynamic per-cpu area. */ + valloc_pages(dpcpu, DPCPU_SIZE / PAGE_SIZE); + dpcpu_init((void *)dpcpu.pv_va, 0); + /* Allocate stacks for all modes */ valloc_pages(irqstack, IRQ_STACK_SIZE); valloc_pages(abtstack, ABT_STACK_SIZE); Modified: head/sys/arm/xscale/pxa/pxa_machdep.c ============================================================================== --- head/sys/arm/xscale/pxa/pxa_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/arm/xscale/pxa/pxa_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -166,6 +166,7 @@ void * initarm(void *arg, void *arg2) { struct pv_addr kernel_l1pt; + struct pv_addr dpcpu; int loop; u_int l1pagetable; vm_offset_t freemempos; @@ -218,6 +219,10 @@ initarm(void *arg, void *arg2) */ valloc_pages(systempage, 1); + /* Allocate dynamic per-cpu area. */ + valloc_pages(dpcpu, DPCPU_SIZE / PAGE_SIZE); + dpcpu_init((void *)dpcpu.pv_va, 0); + /* Allocate stacks for all modes */ valloc_pages(irqstack, IRQ_STACK_SIZE); valloc_pages(abtstack, ABT_STACK_SIZE); Modified: head/sys/i386/i386/elf_machdep.c ============================================================================== --- head/sys/i386/i386/elf_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/i386/i386/elf_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -149,7 +149,7 @@ elf_reloc_internal(linker_file_t lf, Elf if (local) { if (rtype == R_386_RELATIVE) { /* A + B */ - addr = relocbase + addend; + addr = elf_relocaddr(lf, relocbase + addend); if (*where != addr) *where = addr; } Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/i386/i386/machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -2448,7 +2448,7 @@ init386(first) int first; { unsigned long gdtmachpfn; - int error, gsel_tss, metadata_missing, x; + int error, gsel_tss, metadata_missing, x, pa; struct pcpu *pc; struct callback_register event = { .type = CALLBACKTYPE_event, @@ -2532,6 +2532,11 @@ init386(first) GSEL(GCODE_SEL, SEL_KPL), (unsigned long)failsafe_callback); #endif pcpu_init(pc, 0, sizeof(struct pcpu)); + for (pa = first; pa < first + DPCPU_SIZE; pa += PAGE_SIZE) + pmap_kenter(pa + KERNBASE, pa); + dpcpu_init((void *)(first + KERNBASE), 0); + first += DPCPU_SIZE; + PCPU_SET(prvspace, pc); PCPU_SET(curthread, &thread0); PCPU_SET(curpcb, thread0.td_pcb); @@ -2665,7 +2670,7 @@ init386(first) int first; { struct gate_descriptor *gdp; - int gsel_tss, metadata_missing, x; + int gsel_tss, metadata_missing, x, pa; struct pcpu *pc; thread0.td_kstack = proc0kstack; @@ -2718,6 +2723,10 @@ init386(first) lgdt(&r_gdt); pcpu_init(pc, 0, sizeof(struct pcpu)); + for (pa = first; pa < first + DPCPU_SIZE; pa += PAGE_SIZE) + pmap_kenter(pa + KERNBASE, pa); + dpcpu_init((void *)(first + KERNBASE), 0); + first += DPCPU_SIZE; PCPU_SET(prvspace, pc); PCPU_SET(curthread, &thread0); PCPU_SET(curpcb, thread0.td_pcb); Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/i386/i386/mp_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -143,6 +143,7 @@ static int bootAP; /* Free these after use */ void *bootstacks[MAXCPU]; +static void *dpcpu; /* Hotwire a 0->4MB V==P mapping */ extern pt_entry_t *KPTphys; @@ -610,6 +611,7 @@ init_secondary(void) /* prime data page for it to use */ pcpu_init(pc, myid, sizeof(struct pcpu)); + dpcpu_init(dpcpu, myid); pc->pc_apic_id = cpu_apic_ids[myid]; pc->pc_prvspace = pc; pc->pc_curthread = 0; @@ -897,8 +899,9 @@ start_all_aps(void) apic_id = cpu_apic_ids[cpu]; /* allocate and set up a boot stack data page */ - bootstacks[cpu] = (char *)kmem_alloc(kernel_map, KSTACK_PAGES * PAGE_SIZE); - + bootstacks[cpu] = + (char *)kmem_alloc(kernel_map, KSTACK_PAGES * PAGE_SIZE); + dpcpu = (void *)kmem_alloc(kernel_map, DPCPU_SIZE); /* setup a vector to our boot code */ *((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET; *((volatile u_short *) WARMBOOT_SEG) = (boot_address >> 4); Modified: head/sys/i386/xen/mp_machdep.c ============================================================================== --- head/sys/i386/xen/mp_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/i386/xen/mp_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -744,6 +744,7 @@ start_all_aps(void) /* Get per-cpu data */ pc = &__pcpu[bootAP]; pcpu_init(pc, bootAP, sizeof(struct pcpu)); + dpcpu_init((void *)kmem_alloc(kernel_map, DPCPU_SIZE), bootAP); pc->pc_apic_id = cpu_apic_ids[bootAP]; pc->pc_prvspace = pc; pc->pc_curthread = 0; Modified: head/sys/ia64/ia64/elf_machdep.c ============================================================================== --- head/sys/ia64/ia64/elf_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/ia64/ia64/elf_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -211,7 +211,7 @@ elf_reloc_internal(linker_file_t lf, Elf if (local) { if (rtype == R_IA_64_REL64LSB) - *where = relocbase + addend; + *where = elf_relocaddr(lf, relocbase + addend); return (0); } Modified: head/sys/ia64/ia64/machdep.c ============================================================================== --- head/sys/ia64/ia64/machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/ia64/ia64/machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -647,6 +647,21 @@ ia64_init(void) bootverbose = 1; /* + * Find the beginning and end of the kernel. + */ + kernstart = trunc_page(kernel_text); +#ifdef DDB + ksym_start = bootinfo.bi_symtab; + ksym_end = bootinfo.bi_esymtab; + kernend = (vm_offset_t)round_page(ksym_end); +#else + kernend = (vm_offset_t)round_page(_end); +#endif + /* But if the bootstrap tells us otherwise, believe it! */ + if (bootinfo.bi_kernend) + kernend = round_page(bootinfo.bi_kernend); + + /* * Setup the PCPU data for the bootstrap processor. It is needed * by printf(). Also, since printf() has critical sections, we * need to initialize at least pc_curthread. @@ -654,6 +669,8 @@ ia64_init(void) pcpup = &pcpu0; ia64_set_k4((u_int64_t)pcpup); pcpu_init(pcpup, 0, sizeof(pcpu0)); + dpcpu_init((void *)kernend, 0); + kernend += DPCPU_SIZE; PCPU_SET(curthread, &thread0); /* @@ -682,21 +699,6 @@ ia64_init(void) ia64_sal_init(); calculate_frequencies(); - /* - * Find the beginning and end of the kernel. - */ - kernstart = trunc_page(kernel_text); -#ifdef DDB - ksym_start = bootinfo.bi_symtab; - ksym_end = bootinfo.bi_esymtab; - kernend = (vm_offset_t)round_page(ksym_end); -#else - kernend = (vm_offset_t)round_page(_end); -#endif - - /* But if the bootstrap tells us otherwise, believe it! */ - if (bootinfo.bi_kernend) - kernend = round_page(bootinfo.bi_kernend); if (metadata_missing) printf("WARNING: loader(8) metadata is missing!\n"); Modified: head/sys/ia64/ia64/mp_machdep.c ============================================================================== --- head/sys/ia64/ia64/mp_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/ia64/ia64/mp_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -207,6 +207,7 @@ cpu_mp_add(u_int acpiid, u_int apicid, u { struct pcpu *pc; u_int64_t lid; + void *dpcpu; /* Ignore any processor numbers outside our range */ if (acpiid > mp_maxid) @@ -224,7 +225,9 @@ cpu_mp_add(u_int acpiid, u_int apicid, u if (acpiid != 0) { pc = (struct pcpu *)malloc(sizeof(*pc), M_SMP, M_WAITOK); + dpcpu = (void *)kmem_alloc(kernel_map, DPCPU_SIZE); pcpu_init(pc, acpiid, sizeof(*pc)); + dpcpu_init(dpcpu, acpiid); } else pc = pcpup; Modified: head/sys/kern/link_elf.c ============================================================================== --- head/sys/kern/link_elf.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/kern/link_elf.c Tue Jun 23 22:42:39 2009 (r194784) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -107,6 +108,9 @@ typedef struct elf_file { caddr_t ctfoff; /* CTF offset table */ caddr_t typoff; /* Type offset table */ long typlen; /* Number of type entries. */ + Elf_Addr pcpu_start; /* Pre-relocation pcpu set start. */ + Elf_Addr pcpu_stop; /* Pre-relocation pcpu set stop. */ + Elf_Addr pcpu_base; /* Relocated pcpu set address. */ #ifdef GDB struct link_map gdb; /* hooks for gdb */ #endif @@ -475,6 +479,34 @@ parse_dynamic(elf_file_t ef) } static int +parse_dpcpu(elf_file_t ef) +{ + int count; + int error; + + ef->pcpu_start = 0; + ef->pcpu_stop = 0; + error = link_elf_lookup_set(&ef->lf, "pcpu", (void ***)&ef->pcpu_start, + (void ***)&ef->pcpu_stop, &count); + /* Error just means there is no pcpu set to relocate. */ + if (error) + return (0); + count *= sizeof(void *); + /* + * Allocate space in the primary pcpu area. Copy in our initialization + * from the data section and then initialize all per-cpu storage from + * that. + */ + ef->pcpu_base = (Elf_Addr)(uintptr_t)dpcpu_alloc(count); + if (ef->pcpu_base == (Elf_Addr)NULL) + return (ENOSPC); + memcpy((void *)ef->pcpu_base, (void *)ef->pcpu_start, count); + dpcpu_copy((void *)ef->pcpu_base, count); + + return (0); +} + +static int link_elf_link_preload(linker_class_t cls, const char* filename, linker_file_t *result) { @@ -519,6 +551,8 @@ link_elf_link_preload(linker_class_t cls lf->size = *(size_t *)sizeptr; error = parse_dynamic(ef); + if (error == 0) + error = parse_dpcpu(ef); if (error) { linker_file_unload(lf, LINKER_UNLOAD_FORCE); return error; @@ -801,6 +835,9 @@ link_elf_load_file(linker_class_t cls, c error = parse_dynamic(ef); if (error) goto out; + error = parse_dpcpu(ef); + if (error) + goto out; link_elf_reloc_local(lf); VOP_UNLOCK(nd.ni_vp, 0); @@ -897,11 +934,26 @@ out: return error; } +Elf_Addr +elf_relocaddr(linker_file_t lf, Elf_Addr x) +{ + elf_file_t ef; + + ef = (elf_file_t)lf; + if (x >= ef->pcpu_start && x < ef->pcpu_stop) + return ((x - ef->pcpu_start) + ef->pcpu_base); + return (x); +} + + static void link_elf_unload_file(linker_file_t file) { elf_file_t ef = (elf_file_t) file; + if (ef->pcpu_base) { + dpcpu_free((void *)ef->pcpu_base, ef->pcpu_stop - ef->pcpu_start); + } #ifdef GDB if (ef->gdb.l_ld) { GDB_STATE(RT_DELETE); Modified: head/sys/kern/link_elf_obj.c ============================================================================== --- head/sys/kern/link_elf_obj.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/kern/link_elf_obj.c Tue Jun 23 22:42:39 2009 (r194784) @@ -333,6 +333,20 @@ link_elf_link_preload(linker_class_t cls if (ef->shstrtab && shdr[i].sh_name != 0) ef->progtab[pb].name = ef->shstrtab + shdr[i].sh_name; + if (ef->progtab[pb].name != NULL && + !strcmp(ef->progtab[pb].name, "set_pcpu")) { + void *dpcpu; + + dpcpu = dpcpu_alloc(shdr[i].sh_size); + if (dpcpu == NULL) { + error = ENOSPC; + goto out; + } + memcpy(dpcpu, ef->progtab[pb].addr, + ef->progtab[pb].size); + dpcpu_copy(dpcpu, shdr[i].sh_size); + ef->progtab[pb].addr = dpcpu; + } /* Update all symbol values with the offset. */ for (j = 0; j < ef->ddbsymcnt; j++) { @@ -712,9 +726,27 @@ link_elf_load_file(linker_class_t cls, c alignmask = shdr[i].sh_addralign - 1; mapbase += alignmask; mapbase &= ~alignmask; - ef->progtab[pb].addr = (void *)(uintptr_t)mapbase; - if (shdr[i].sh_type == SHT_PROGBITS) { + if (ef->shstrtab && shdr[i].sh_name != 0) + ef->progtab[pb].name = + ef->shstrtab + shdr[i].sh_name; + else if (shdr[i].sh_type == SHT_PROGBITS) ef->progtab[pb].name = "<>"; + else + ef->progtab[pb].name = "<>"; + if (ef->progtab[pb].name != NULL && + !strcmp(ef->progtab[pb].name, "set_pcpu")) + ef->progtab[pb].addr = + dpcpu_alloc(shdr[i].sh_size); + else + ef->progtab[pb].addr = + (void *)(uintptr_t)mapbase; + if (ef->progtab[pb].addr == NULL) { + error = ENOSPC; + goto out; + } + ef->progtab[pb].size = shdr[i].sh_size; + ef->progtab[pb].sec = i; + if (shdr[i].sh_type == SHT_PROGBITS) { error = vn_rdwr(UIO_READ, nd.ni_vp, ef->progtab[pb].addr, shdr[i].sh_size, shdr[i].sh_offset, @@ -726,15 +758,12 @@ link_elf_load_file(linker_class_t cls, c error = EINVAL; goto out; } - } else { - ef->progtab[pb].name = "<>"; + /* Initialize the per-cpu area. */ + if (ef->progtab[pb].addr != (void *)mapbase) + dpcpu_copy(ef->progtab[pb].addr, + shdr[i].sh_size); + } else bzero(ef->progtab[pb].addr, shdr[i].sh_size); - } - ef->progtab[pb].size = shdr[i].sh_size; - ef->progtab[pb].sec = i; - if (ef->shstrtab && shdr[i].sh_name != 0) - ef->progtab[pb].name = - ef->shstrtab + shdr[i].sh_name; /* Update all symbol values with the offset. */ for (j = 0; j < ef->ddbsymcnt; j++) { @@ -839,6 +868,17 @@ link_elf_unload_file(linker_file_t file) /* Notify MD code that a module is being unloaded. */ elf_cpu_unload_file(file); + if (ef->progtab) { + for (i = 0; i < ef->nprogtab; i++) { + if (ef->progtab[i].size == 0) + continue; + if (ef->progtab[i].name == NULL) + continue; + if (!strcmp(ef->progtab[i].name, "set_pcpu")) + dpcpu_free(ef->progtab[i].addr, + ef->progtab[i].size); + } + } if (ef->preloaded) { if (ef->reltab) free(ef->reltab, M_LINKER); Modified: head/sys/kern/subr_pcpu.c ============================================================================== --- head/sys/kern/subr_pcpu.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/kern/subr_pcpu.c Tue Jun 23 22:42:39 2009 (r194784) @@ -3,6 +3,9 @@ * All rights reserved. * Written by: John Baldwin * + * Copyright (c) 2009 Jeffrey Roberson + * All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -49,13 +52,28 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include +#include #include #include #include +#include #include +MALLOC_DEFINE(M_PCPU, "Per-cpu", "Per-cpu resource accouting."); + +struct dpcpu_free { + uintptr_t df_start; + int df_len; + TAILQ_ENTRY(dpcpu_free) df_link; +}; + +static DPCPU_DEFINE(char, modspace[DPCPU_MODMIN]); +static TAILQ_HEAD(, dpcpu_free) dpcpu_head = TAILQ_HEAD_INITIALIZER(dpcpu_head); +static struct sx dpcpu_lock; +uintptr_t dpcpu_off[MAXCPU]; struct pcpu *cpuid_to_pcpu[MAXCPU]; struct cpuhead cpuhead = SLIST_HEAD_INITIALIZER(cpuhead); @@ -79,7 +97,146 @@ pcpu_init(struct pcpu *pcpu, int cpuid, #ifdef KTR snprintf(pcpu->pc_name, sizeof(pcpu->pc_name), "CPU %d", cpuid); #endif +} + +void +dpcpu_init(void *dpcpu, int cpuid) +{ + struct pcpu *pcpu; + + pcpu = pcpu_find(cpuid); + pcpu->pc_dynamic = (uintptr_t)dpcpu - DPCPU_START; + + /* + * Initialize defaults from our linker section. + */ + memcpy(dpcpu, (void *)DPCPU_START, DPCPU_BYTES); + + /* + * Place it in the global pcpu offset array. + */ + dpcpu_off[cpuid] = pcpu->pc_dynamic; +} + +static void +dpcpu_startup(void *dummy __unused) +{ + struct dpcpu_free *df; + + df = malloc(sizeof(*df), M_PCPU, M_WAITOK | M_ZERO); + df->df_start = (uintptr_t)&DPCPU_NAME(modspace); + df->df_len = DPCPU_MODSIZE; + TAILQ_INSERT_HEAD(&dpcpu_head, df, df_link); + sx_init(&dpcpu_lock, "dpcpu alloc lock"); +} +SYSINIT(dpcpu, SI_SUB_KLD, SI_ORDER_FIRST, dpcpu_startup, 0); + +/* + * First-fit extent based allocator for allocating space in the per-cpu + * region reserved for modules. This is only intended for use by the + * kernel linkers to place module linker sets. + */ +void * +dpcpu_alloc(int size) +{ + struct dpcpu_free *df; + void *s; + + s = NULL; + size = roundup2(size, sizeof(void *)); + sx_xlock(&dpcpu_lock); + TAILQ_FOREACH(df, &dpcpu_head, df_link) { + if (df->df_len < size) + continue; + if (df->df_len == size) { + s = (void *)df->df_start; + TAILQ_REMOVE(&dpcpu_head, df, df_link); + free(df, M_PCPU); + break; + } + s = (void *)df->df_start; + df->df_len -= size; + df->df_start = df->df_start + size; + break; + } + sx_xunlock(&dpcpu_lock); + + return (s); +} + +/* + * Free dynamic per-cpu space at module unload time. + */ +void +dpcpu_free(void *s, int size) +{ + struct dpcpu_free *df; + struct dpcpu_free *dn; + uintptr_t start; + uintptr_t end; + + size = roundup2(size, sizeof(void *)); + start = (uintptr_t)s; + end = start + size; + /* + * Free a region of space and merge it with as many neighbors as + * possible. Keeping the list sorted simplifies this operation. + */ + sx_xlock(&dpcpu_lock); + TAILQ_FOREACH(df, &dpcpu_head, df_link) { + if (df->df_start > end) + break; + /* + * If we expand at the end of an entry we may have to + * merge it with the one following it as well. + */ + if (df->df_start + df->df_len == start) { + df->df_len += size; + dn = TAILQ_NEXT(df, df_link); + if (df->df_start + df->df_len == dn->df_start) { + df->df_len += dn->df_len; + TAILQ_REMOVE(&dpcpu_head, dn, df_link); + free(dn, M_PCPU); + } + sx_xunlock(&dpcpu_lock); + return; + } + if (df->df_start == end) { + df->df_start = start; + df->df_len += size; + sx_xunlock(&dpcpu_lock); + return; + } + } + dn = malloc(sizeof(*df), M_PCPU, M_WAITOK | M_ZERO); + dn->df_start = start; + dn->df_len = size; + if (df) + TAILQ_INSERT_BEFORE(df, dn, df_link); + else + TAILQ_INSERT_TAIL(&dpcpu_head, dn, df_link); + sx_xunlock(&dpcpu_lock); +} +/* + * Initialize the per-cpu storage from an updated linker-set region. + */ +void +dpcpu_copy(void *s, int size) +{ +#ifdef SMP + uintptr_t dpcpu; + int i; + + for (i = 0; i < mp_ncpus; ++i) { + dpcpu = dpcpu_off[i]; + if (dpcpu == 0) + continue; + memcpy((void *)(dpcpu + (uintptr_t)s), s, size); + } +#else + memcpy((void *)(dpcpu_off[0] + (uintptr_t)s), s, size); +#endif } /* @@ -91,6 +248,7 @@ pcpu_destroy(struct pcpu *pcpu) SLIST_REMOVE(&cpuhead, pcpu, pcpu, pc_allcpu); cpuid_to_pcpu[pcpu->pc_cpuid] = NULL; + dpcpu_off[pcpu->pc_cpuid] = 0; } /* @@ -103,6 +261,48 @@ pcpu_find(u_int cpuid) return (cpuid_to_pcpu[cpuid]); } +int +sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS) +{ + int64_t count; +#ifdef SMP + uintptr_t dpcpu; + int i; + + count = 0; + for (i = 0; i < mp_ncpus; ++i) { + dpcpu = dpcpu_off[i]; + if (dpcpu == 0) + continue; + count += *(int64_t *)(dpcpu + (uintptr_t)arg1); + } +#else + count = *(int64_t *)(dpcpu_off[0] + (uintptr_t)arg1); +#endif + return (SYSCTL_OUT(req, &count, sizeof(count))); +} + +int +sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS) +{ + int count; +#ifdef SMP + uintptr_t dpcpu; + int i; + + count = 0; + for (i = 0; i < mp_ncpus; ++i) { + dpcpu = dpcpu_off[i]; + if (dpcpu == 0) + continue; + count += *(int *)(dpcpu + (uintptr_t)arg1); + } +#else + count = *(int *)(dpcpu_off[0] + (uintptr_t)arg1); +#endif + return (SYSCTL_OUT(req, &count, sizeof(count))); +} + #ifdef DDB static void @@ -111,6 +311,7 @@ show_pcpu(struct pcpu *pc) struct thread *td; db_printf("cpuid = %d\n", pc->pc_cpuid); + db_printf("dynamic pcpu = %p\n", (void *)pc->pc_dynamic); db_printf("curthread = "); td = pc->pc_curthread; if (td != NULL) Modified: head/sys/mips/mips/elf_machdep.c ============================================================================== --- head/sys/mips/mips/elf_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/mips/mips/elf_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -134,7 +134,7 @@ elf_reloc_internal(linker_file_t lf, Elf if (local) { #if 0 /* TBD */ if (rtype == R_386_RELATIVE) { /* A + B */ - addr = relocbase + addend; + addr = elf_relocaddr(lf, relocbase + addend); if (*where != addr) *where = addr; } Modified: head/sys/mips/mips/mp_machdep.c ============================================================================== --- head/sys/mips/mips/mp_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/mips/mips/mp_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -224,12 +224,15 @@ static int smp_start_secondary(int cpuid) { struct pcpu *pcpu; + void *dpcpu; int i; if (bootverbose) printf("smp_start_secondary: starting cpu %d\n", cpuid); + dpcpu = (void *)kmem_alloc(kernel_map, DPCPU_SIZE); pcpu_init(&__pcpu[cpuid], cpuid, sizeof(struct pcpu)); + dpcpu_init(dpcpu, cpuid); if (bootverbose) printf("smp_start_secondary: cpu %d started\n", cpuid); Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/mips/mips/pmap.c Tue Jun 23 22:42:39 2009 (r194784) @@ -331,6 +331,9 @@ again: msgbufp = (struct msgbuf *)pmap_steal_memory(MSGBUF_SIZE); msgbufinit(msgbufp, MSGBUF_SIZE); + /* Steal memory for the dynamic per-cpu area. */ + dpcpu_init((void *)pmap_steal_memory(DPCPU_SIZE), 0); + /* * Steal thread0 kstack. */ Modified: head/sys/pc98/pc98/machdep.c ============================================================================== --- head/sys/pc98/pc98/machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/pc98/pc98/machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -1954,6 +1954,7 @@ init386(first) struct gate_descriptor *gdp; int gsel_tss, metadata_missing, x; struct pcpu *pc; + int pa; thread0.td_kstack = proc0kstack; thread0.td_pcb = (struct pcb *) @@ -2010,6 +2011,11 @@ init386(first) lgdt(&r_gdt); pcpu_init(pc, 0, sizeof(struct pcpu)); + for (pa = first; pa < first + DPCPU_SIZE; pa += PAGE_SIZE) + pmap_kenter(pa + KERNBASE, pa); + dpcpu_init((void *)(first + KERNBASE), 0); + first += DPCPU_SIZE; + PCPU_SET(prvspace, pc); PCPU_SET(curthread, &thread0); PCPU_SET(curpcb, thread0.td_pcb); Modified: head/sys/powerpc/aim/mmu_oea.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/powerpc/aim/mmu_oea.c Tue Jun 23 22:42:39 2009 (r194784) @@ -669,6 +669,7 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k int ofw_mappings; vm_size_t size, physsz, hwphyssz; vm_offset_t pa, va, off; + void *dpcpu; /* * Set up BAT0 to map the lowest 256 MB area @@ -938,6 +939,20 @@ moea_bootstrap(mmu_t mmup, vm_offset_t k pa += PAGE_SIZE; va += PAGE_SIZE; } + + /* + * Allocate virtual address space for the dynamic percpu area. + */ + pa = moea_bootstrap_alloc(DPCPU_SIZE, PAGE_SIZE); + dpcpu = (void *)virtual_avail; + va = virtual_avail; + virtual_avail += DPCPU_SIZE; + while (va < virtual_avail) { + moea_kenter(mmup, va, pa);; + pa += PAGE_SIZE; + va += PAGE_SIZE; + } + dpcpu_init(dpcpu, 0); } /* Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/powerpc/aim/mmu_oea64.c Tue Jun 23 22:42:39 2009 (r194784) @@ -726,6 +726,7 @@ moea64_bridge_bootstrap(mmu_t mmup, vm_o vm_size_t size, physsz, hwphyssz; vm_offset_t pa, va, off; uint32_t msr; + void *dpcpu; /* We don't have a direct map since there is no BAT */ hw_direct_map = 0; @@ -1027,6 +1028,20 @@ moea64_bridge_bootstrap(mmu_t mmup, vm_o pa += PAGE_SIZE; va += PAGE_SIZE; } + + /* + * Allocate virtual address space for the dynamic percpu area. + */ + pa = moea64_bootstrap_alloc(DPCPU_SIZE, PAGE_SIZE); + dpcpu = (void *)virtual_avail; + va = virtual_avail; + virtual_avail += DPCPU_SIZE; + while (va < virtual_avail) { + moea64_kenter(mmup, va, pa);; + pa += PAGE_SIZE; + va += PAGE_SIZE; + } + dpcpu_init(dpcpu, 0); } /* Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/powerpc/booke/pmap.c Tue Jun 23 22:42:39 2009 (r194784) @@ -963,6 +963,7 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset vm_size_t physsz, hwphyssz, kstack0_sz; vm_offset_t kernel_pdir, kstack0, va; vm_paddr_t kstack0_phys; + void *dpcpu; pte_t *pte; debugf("mmu_booke_bootstrap: entered\n"); @@ -988,6 +989,11 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset data_end = round_page(data_end); + /* Allocate the dynamic per-cpu area. */ + dpcpu = (void *)data_end; + data_end += DPCPU_SIZE; + dpcpu_init(dpcpu, 0); + /* Allocate space for ptbl_bufs. */ ptbl_bufs = (struct ptbl_buf *)data_end; data_end += sizeof(struct ptbl_buf) * PTBL_BUFS; Modified: head/sys/powerpc/powerpc/elf_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf_machdep.c Tue Jun 23 22:28:44 2009 (r194783) +++ head/sys/powerpc/powerpc/elf_machdep.c Tue Jun 23 22:42:39 2009 (r194784) @@ -194,7 +194,7 @@ elf_reloc_internal(linker_file_t lf, Elf break; case R_PPC_RELATIVE: /* word32 B + A */ - *where = relocbase + addend; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 22:53:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BDFBF1065672; Tue, 23 Jun 2009 22:53:34 +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 ABCDB8FC08; Tue, 23 Jun 2009 22:53:34 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NMrYrT093490; Tue, 23 Jun 2009 22:53:34 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NMrYpp093488; Tue, 23 Jun 2009 22:53:34 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200906232253.n5NMrYpp093488@svn.freebsd.org> From: Jilles Tjoelker Date: Tue, 23 Jun 2009 22:53:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194786 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 22:53:35 -0000 Author: jilles Date: Tue Jun 23 22:53:34 2009 New Revision: 194786 URL: http://svn.freebsd.org/changeset/base/194786 Log: Quote -x tracing output so it is unambiguous. It is usually but not always suitable for re-input to the shell. Approved by: ed (mentor) (implicit) Modified: head/bin/sh/eval.c Modified: head/bin/sh/eval.c ============================================================================== --- head/bin/sh/eval.c Tue Jun 23 22:47:34 2009 (r194785) +++ head/bin/sh/eval.c Tue Jun 23 22:53:34 2009 (r194786) @@ -642,17 +642,32 @@ evalcommand(union node *cmd, int flags, /* Print the command if xflag is set. */ if (xflag) { char sep = 0; + const char *p; out2str(ps4val()); for (sp = varlist.list ; sp ; sp = sp->next) { if (sep != 0) outc(' ', &errout); - out2str(sp->text); + p = sp->text; + while (*p != '=' && *p != '\0') + out2c(*p++); + if (*p != '\0') { + out2c(*p++); + out2qstr(p); + } sep = ' '; } for (sp = arglist.list ; sp ; sp = sp->next) { if (sep != 0) outc(' ', &errout); - out2str(sp->text); + /* Disambiguate command looking like assignment. */ + if (sp == arglist.list && + strchr(sp->text, '=') != NULL && + strchr(sp->text, '\'') == NULL) { + out2c('\''); + out2str(sp->text); + out2c('\''); + } else + out2qstr(sp->text); sep = ' '; } outc('\n', &errout); From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 23:16:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 366221065672; Tue, 23 Jun 2009 23:16:01 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24A6F8FC18; Tue, 23 Jun 2009 23:16:01 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NNG1JE094291; Tue, 23 Jun 2009 23:16:01 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NNG1iT094289; Tue, 23 Jun 2009 23:16:01 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906232316.n5NNG1iT094289@svn.freebsd.org> From: Xin LI Date: Tue, 23 Jun 2009 23:16: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: r194789 - head/usr.bin/usbhidctl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 23:16:01 -0000 Author: delphij Date: Tue Jun 23 23:16:00 2009 New Revision: 194789 URL: http://svn.freebsd.org/changeset/base/194789 Log: Use getprogname() instead of referencing __progname. Modified: head/usr.bin/usbhidctl/usbhid.c Modified: head/usr.bin/usbhidctl/usbhid.c ============================================================================== --- head/usr.bin/usbhidctl/usbhid.c Tue Jun 23 23:01:05 2009 (r194788) +++ head/usr.bin/usbhidctl/usbhid.c Tue Jun 23 23:16:00 2009 (r194789) @@ -91,16 +91,15 @@ prbits(int bits, char **strs, int n) void usage(void) { - extern char *__progname; fprintf(stderr, "usage: %s -f device " "[-l] [-n] [-r] [-t tablefile] [-v] [-x] name ...\n", - __progname); + getprogname()); fprintf(stderr, " %s -f device " "[-l] [-n] [-r] [-t tablefile] [-v] [-x] -a\n", - __progname); + getprogname()); exit(1); } From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 23:16:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44F15106567E; Tue, 23 Jun 2009 23:16:38 +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 319928FC28; Tue, 23 Jun 2009 23:16:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NNGcS6094336; Tue, 23 Jun 2009 23:16:38 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NNGcFR094333; Tue, 23 Jun 2009 23:16:38 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200906232316.n5NNGcFR094333@svn.freebsd.org> From: Alexander Motin Date: Tue, 23 Jun 2009 23:16: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: r194790 - in head/sys: amd64/isa i386/isa X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 23:16:40 -0000 Author: mav Date: Tue Jun 23 23:16:37 2009 New Revision: 194790 URL: http://svn.freebsd.org/changeset/base/194790 Log: Make algorithm a bit more bulletproof. Modified: head/sys/amd64/isa/clock.c head/sys/i386/isa/clock.c Modified: head/sys/amd64/isa/clock.c ============================================================================== --- head/sys/amd64/isa/clock.c Tue Jun 23 23:16:00 2009 (r194789) +++ head/sys/amd64/isa/clock.c Tue Jun 23 23:16:37 2009 (r194790) @@ -169,7 +169,7 @@ clkintr(struct trapframe *frame) #endif hardclockintr(frame); } else { - if (--pscnt == 0) { + if (--pscnt <= 0) { pscnt = psratio; #ifdef SMP if (smp_started) @@ -262,7 +262,7 @@ rtcintr(struct trapframe *frame) while (rtcin(RTC_INTR) & RTCIR_PERIOD) { flag = 1; - if (--pscnt == 0) { + if (--pscnt <= 0) { pscnt = psdiv; #ifdef SMP if (smp_started) Modified: head/sys/i386/isa/clock.c ============================================================================== --- head/sys/i386/isa/clock.c Tue Jun 23 23:16:00 2009 (r194789) +++ head/sys/i386/isa/clock.c Tue Jun 23 23:16:37 2009 (r194790) @@ -195,7 +195,7 @@ clkintr(struct trapframe *frame) #endif hardclockintr(frame); } else { - if (--pscnt == 0) { + if (--pscnt <= 0) { pscnt = psratio; #ifdef SMP if (smp_started) @@ -293,7 +293,7 @@ rtcintr(struct trapframe *frame) while (rtcin(RTC_INTR) & RTCIR_PERIOD) { flag = 1; - if (--pscnt == 0) { + if (--pscnt <= 0) { pscnt = psdiv; #ifdef SMP if (smp_started) From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 23:17:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 532A2106567C; Tue, 23 Jun 2009 23:17:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4183A8FC0C; Tue, 23 Jun 2009 23:17:05 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NNH5R9094380; Tue, 23 Jun 2009 23:17:05 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NNH54M094378; Tue, 23 Jun 2009 23:17:05 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906232317.n5NNH54M094378@svn.freebsd.org> From: Xin LI Date: Tue, 23 Jun 2009 23:17: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: r194791 - head/usr.bin/keylogout X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 23:17:05 -0000 Author: delphij Date: Tue Jun 23 23:17:04 2009 New Revision: 194791 URL: http://svn.freebsd.org/changeset/base/194791 Log: K&R -> ANSI Modified: head/usr.bin/keylogout/keylogout.c Modified: head/usr.bin/keylogout/keylogout.c ============================================================================== --- head/usr.bin/keylogout/keylogout.c Tue Jun 23 23:16:37 2009 (r194790) +++ head/usr.bin/keylogout/keylogout.c Tue Jun 23 23:17:04 2009 (r194791) @@ -45,9 +45,7 @@ __FBSDID("$FreeBSD$"); #include int -main(argc,argv) - int argc; - char *argv[]; +main(int argc, char **argv) { static char secret[HEXKEYBYTES + 1]; From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 23:18:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FB0F1065670; Tue, 23 Jun 2009 23:18:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8E1668FC14; Tue, 23 Jun 2009 23:18:19 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NNIJh2094493; Tue, 23 Jun 2009 23:18:19 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NNIJDq094491; Tue, 23 Jun 2009 23:18:19 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906232318.n5NNIJDq094491@svn.freebsd.org> From: Xin LI Date: Tue, 23 Jun 2009 23:18: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: r194792 - head/usr.bin/nfsstat X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 23:18:20 -0000 Author: delphij Date: Tue Jun 23 23:18:19 2009 New Revision: 194792 URL: http://svn.freebsd.org/changeset/base/194792 Log: Use C99 initialization when necessary; apply static to internal rountines. This makes nfsstat WARNS=3 clean. Modified: head/usr.bin/nfsstat/nfsstat.c Modified: head/usr.bin/nfsstat/nfsstat.c ============================================================================== --- head/usr.bin/nfsstat/nfsstat.c Tue Jun 23 23:17:04 2009 (r194791) +++ head/usr.bin/nfsstat/nfsstat.c Tue Jun 23 23:18:19 2009 (r194792) @@ -35,7 +35,7 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1983, 1989, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ @@ -77,10 +77,10 @@ static const char rcsid[] = struct nlist nl[] = { #define N_NFSSTAT 0 - { "nfsstats" }, + { .n_name = "nfsstats" }, #define N_NFSRVSTAT 1 - { "nfsrvstats" }, - "", + { .n_name = "nfsrvstats" }, + { .n_name = NULL }, }; kvm_t *kd; @@ -198,7 +198,7 @@ main(int argc, char **argv) * Read the nfs stats using sysctl(3) for live kernels, or kvm_read * for dead ones. */ -void +static void readstats(struct nfsstats **stp, struct nfsrvstats **srvstp, int zero) { union { From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 23:20:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F316F1065679; Tue, 23 Jun 2009 23:20:09 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E13528FC2E; Tue, 23 Jun 2009 23:20:09 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NNK99d094573; Tue, 23 Jun 2009 23:20:09 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NNK94S094569; Tue, 23 Jun 2009 23:20:09 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906232320.n5NNK94S094569@svn.freebsd.org> From: Xin LI Date: Tue, 23 Jun 2009 23:20: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: r194793 - in head/lib/libcompat: 4.3 4.4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 23:20:10 -0000 Author: delphij Date: Tue Jun 23 23:20:09 2009 New Revision: 194793 URL: http://svn.freebsd.org/changeset/base/194793 Log: K&R -> ANSI Modified: head/lib/libcompat/4.3/cfree.c head/lib/libcompat/4.3/regex.c head/lib/libcompat/4.4/cuserid.c Modified: head/lib/libcompat/4.3/cfree.c ============================================================================== --- head/lib/libcompat/4.3/cfree.c Tue Jun 23 23:18:19 2009 (r194792) +++ head/lib/libcompat/4.3/cfree.c Tue Jun 23 23:20:09 2009 (r194793) @@ -37,8 +37,7 @@ static char sccsid[] = "@(#)cfree.c 8.1 #include void -cfree(p) - void *p; +cfree(void *p) { free(p); } Modified: head/lib/libcompat/4.3/regex.c ============================================================================== --- head/lib/libcompat/4.3/regex.c Tue Jun 23 23:18:19 2009 (r194792) +++ head/lib/libcompat/4.3/regex.c Tue Jun 23 23:20:09 2009 (r194793) @@ -56,8 +56,7 @@ static int re_goterr; static char *re_errstr; char * -re_comp(s) - char *s; +re_comp(char *s) { if (s == NULL || *s == '\0') { if (re_regexp == NULL) @@ -74,8 +73,7 @@ re_comp(s) } int -re_exec(s) - char *s; +re_exec(char *s) { int rc; @@ -85,8 +83,7 @@ re_exec(s) } void -regerror(s) - const char *s; +regerror(const char *s) { re_goterr = 1; if (re_errstr) Modified: head/lib/libcompat/4.4/cuserid.c ============================================================================== --- head/lib/libcompat/4.4/cuserid.c Tue Jun 23 23:18:19 2009 (r194792) +++ head/lib/libcompat/4.4/cuserid.c Tue Jun 23 23:20:09 2009 (r194793) @@ -39,8 +39,7 @@ __FBSDID("$FreeBSD$"); #include char * -cuserid(s) - char *s; +cuserid(char *s) { struct passwd *pwd; From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 23:27:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D51E1065674; Tue, 23 Jun 2009 23:27:36 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0B6A48FC16; Tue, 23 Jun 2009 23:27:36 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NNRZ6q094877; Tue, 23 Jun 2009 23:27:35 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NNRZwh094874; Tue, 23 Jun 2009 23:27:35 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906232327.n5NNRZwh094874@svn.freebsd.org> From: Xin LI Date: Tue, 23 Jun 2009 23:27: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: r194794 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 23:27:36 -0000 Author: delphij Date: Tue Jun 23 23:27:35 2009 New Revision: 194794 URL: http://svn.freebsd.org/changeset/base/194794 Log: Merge NetBSD revision 1.14: humanize_number.c is now 2-clause BSD licensed. (humanize_number.3 intentionally hold back until I make sure why we didn't merged dehumanize_number(3)). Obtained from: NetBSD Modified: head/lib/libutil/humanize_number.c Modified: head/lib/libutil/humanize_number.c ============================================================================== --- head/lib/libutil/humanize_number.c Tue Jun 23 23:20:09 2009 (r194793) +++ head/lib/libutil/humanize_number.c Tue Jun 23 23:27:35 2009 (r194794) @@ -1,4 +1,4 @@ -/* $NetBSD: humanize_number.c,v 1.13 2007/12/14 17:26:19 christos Exp $ */ +/* $NetBSD: humanize_number.c,v 1.14 2008/04/28 20:22:59 martin Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc. @@ -16,13 +16,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 23:30:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 183AA10656DB; Tue, 23 Jun 2009 23:30:57 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 04ED58FC08; Tue, 23 Jun 2009 23:30:57 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NNUuNp095002; Tue, 23 Jun 2009 23:30:56 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NNUuhZ094996; Tue, 23 Jun 2009 23:30:56 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906232330.n5NNUuhZ094996@svn.freebsd.org> From: Xin LI Date: Tue, 23 Jun 2009 23: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: r194795 - in head/bin: chflags chmod df hostname X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 23:30:57 -0000 Author: delphij Date: Tue Jun 23 23:30:56 2009 New Revision: 194795 URL: http://svn.freebsd.org/changeset/base/194795 Log: Staticify internal routines. Modified: head/bin/chflags/chflags.c head/bin/chmod/chmod.c head/bin/df/df.c head/bin/hostname/hostname.c Modified: head/bin/chflags/chflags.c ============================================================================== --- head/bin/chflags/chflags.c Tue Jun 23 23:27:35 2009 (r194794) +++ head/bin/chflags/chflags.c Tue Jun 23 23:30:56 2009 (r194795) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include -void usage(void); +static void usage(void); int main(int argc, char *argv[]) @@ -196,7 +196,7 @@ main(int argc, char *argv[]) exit(rval); } -void +static void usage(void) { (void)fprintf(stderr, Modified: head/bin/chmod/chmod.c ============================================================================== --- head/bin/chmod/chmod.c Tue Jun 23 23:27:35 2009 (r194794) +++ head/bin/chmod/chmod.c Tue Jun 23 23:30:56 2009 (r194795) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include -void usage(void); +static void usage(void); int main(int argc, char *argv[]) @@ -212,7 +212,7 @@ done: argv += optind; exit(rval); } -void +static void usage(void) { (void)fprintf(stderr, Modified: head/bin/df/df.c ============================================================================== --- head/bin/df/df.c Tue Jun 23 23:27:35 2009 (r194794) +++ head/bin/df/df.c Tue Jun 23 23:30:56 2009 (r194795) @@ -476,7 +476,7 @@ prtstat(struct statfs *sfsp, struct maxw (void)printf("\n"); } -void +static void addstat(struct statfs *totalfsp, struct statfs *statfsp) { uint64_t bsize; Modified: head/bin/hostname/hostname.c ============================================================================== --- head/bin/hostname/hostname.c Tue Jun 23 23:27:35 2009 (r194794) +++ head/bin/hostname/hostname.c Tue Jun 23 23:30:56 2009 (r194795) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include -void usage(void); +static void usage(void); int main(int argc, char *argv[]) @@ -96,7 +96,7 @@ main(int argc, char *argv[]) exit(0); } -void +static void usage(void) { From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 23:32:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 66389106566C; Tue, 23 Jun 2009 23:32:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 54B518FC12; Tue, 23 Jun 2009 23:32:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NNWO67095060; Tue, 23 Jun 2009 23:32:24 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NNWOrM095058; Tue, 23 Jun 2009 23:32:24 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906232332.n5NNWOrM095058@svn.freebsd.org> From: Xin LI Date: Tue, 23 Jun 2009 23:32: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: r194796 - head/usr.bin/hexdump X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 23:32:24 -0000 Author: delphij Date: Tue Jun 23 23:32:24 2009 New Revision: 194796 URL: http://svn.freebsd.org/changeset/base/194796 Log: Use strlcpy() instead of explicitly set \0 on the tail of the array. Modified: head/usr.bin/hexdump/parse.c Modified: head/usr.bin/hexdump/parse.c ============================================================================== --- head/usr.bin/hexdump/parse.c Tue Jun 23 23:30:56 2009 (r194795) +++ head/usr.bin/hexdump/parse.c Tue Jun 23 23:32:24 2009 (r194796) @@ -142,8 +142,7 @@ add(const char *fmt) badfmt(fmt); if (!(tfu->fmt = malloc(p - savep + 1))) err(1, NULL); - (void) strncpy(tfu->fmt, savep, p - savep); - tfu->fmt[p - savep] = '\0'; + (void) strlcpy(tfu->fmt, savep, p - savep + 1); escape(tfu->fmt); p++; } From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 23:34:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CB12106568D; Tue, 23 Jun 2009 23:34:46 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6A9DB8FC0C; Tue, 23 Jun 2009 23:34:46 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NNYkpZ095157; Tue, 23 Jun 2009 23:34:46 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NNYkkx095155; Tue, 23 Jun 2009 23:34:46 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906232334.n5NNYkkx095155@svn.freebsd.org> From: Xin LI Date: Tue, 23 Jun 2009 23:34: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: r194797 - head/usr.bin/make X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 23:34:47 -0000 Author: delphij Date: Tue Jun 23 23:34:46 2009 New Revision: 194797 URL: http://svn.freebsd.org/changeset/base/194797 Log: Use strlcpy() instead of manually setting the last byte of the array to \0. Modified: head/usr.bin/make/arch.c Modified: head/usr.bin/make/arch.c ============================================================================== --- head/usr.bin/make/arch.c Tue Jun 23 23:32:24 2009 (r194796) +++ head/usr.bin/make/arch.c Tue Jun 23 23:34:46 2009 (r194797) @@ -583,8 +583,7 @@ ArchArchiveNext(struct arfile *ar) * looks like a member - get name by stripping trailing spaces * and NUL terminating. */ - strncpy(ar->sname, ar->hdr.ar_name, AR_NAMSIZ); - ar->sname[AR_NAMSIZ] = '\0'; + strlcpy(ar->sname, ar->hdr.ar_name, AR_NAMSIZ + 1); for (ptr = ar->sname + AR_NAMSIZ; ptr > ar->sname; ptr--) if (ptr[-1] != ' ') break; @@ -595,8 +594,7 @@ ArchArchiveNext(struct arfile *ar) * Parse the size. All entries need to have a size. Be careful * to not allow buffer overruns. */ - strncpy(buf, ar->hdr.ar_size, sizeof(ar->hdr.ar_size)); - buf[sizeof(ar->hdr.ar_size)] = '\0'; + strlcpy(buf, ar->hdr.ar_size, sizeof(ar->hdr.ar_size) + 1); errno = 0; ar->size = strtoumax(buf, &end, 10); @@ -650,8 +648,7 @@ ArchArchiveNext(struct arfile *ar) * Now parse the modification date. Be careful to not overrun * buffers. */ - strncpy(buf, ar->hdr.ar_date, sizeof(ar->hdr.ar_date)); - buf[sizeof(ar->hdr.ar_date)] = '\0'; + strlcpy(buf, ar->hdr.ar_date, sizeof(ar->hdr.ar_date) + 1); errno = 0; ar->time = (int64_t)strtoll(buf, &end, 10); @@ -965,8 +962,7 @@ ArchStatMember(const char *archive, cons if (member != NULL && strlen(member) > AR_NAMSIZ) { /* Try truncated name */ - strncpy(copy, member, AR_NAMSIZ); - copy[AR_NAMSIZ] = '\0'; + strlcpy(copy, member, AR_NAMSIZ + 1); if ((he = Hash_FindEntry(&ar->members, copy)) != NULL) return (*(int64_t *)Hash_GetValue(he)); From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 23:37:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CEA71065670; Tue, 23 Jun 2009 23:37:26 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B5768FC08; Tue, 23 Jun 2009 23:37:26 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NNbQab095240; Tue, 23 Jun 2009 23:37:26 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NNbQbQ095238; Tue, 23 Jun 2009 23:37:26 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906232337.n5NNbQbQ095238@svn.freebsd.org> From: Xin LI Date: Tue, 23 Jun 2009 23:37:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194798 - head/usr.bin/makewhatis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 23:37:26 -0000 Author: delphij Date: Tue Jun 23 23:37:25 2009 New Revision: 194798 URL: http://svn.freebsd.org/changeset/base/194798 Log: %.s expects an int as the length specifier, so cast properly. Modified: head/usr.bin/makewhatis/makewhatis.c Modified: head/usr.bin/makewhatis/makewhatis.c ============================================================================== --- head/usr.bin/makewhatis/makewhatis.c Tue Jun 23 23:34:46 2009 (r194797) +++ head/usr.bin/makewhatis/makewhatis.c Tue Jun 23 23:37:25 2009 (r194798) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1002,7 +1003,7 @@ main(int argc, char **argv) char *sep = strchr(locale, '_'); if (sep != NULL && isupper(sep[1]) && isupper(sep[2])) { - asprintf(&lang_locale, "%.*s%s", sep - locale, locale, &sep[3]); + asprintf(&lang_locale, "%.*s%s", (int)(ptrdiff_t)(sep - locale), locale, &sep[3]); } } break; From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 23:39:23 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54A9C1065673; Tue, 23 Jun 2009 23:39:23 +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 E77478FC15; Tue, 23 Jun 2009 23:39:22 +0000 (UTC) (envelope-from das@FreeBSD.ORG) Received: from zim.MIT.EDU (localhost [127.0.0.1]) by zim.MIT.EDU (8.14.3/8.14.2) with ESMTP id n5NNjnWa006264; Tue, 23 Jun 2009 19:45:49 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by zim.MIT.EDU (8.14.3/8.14.2/Submit) id n5NNjnPT006263; Tue, 23 Jun 2009 19:45:49 -0400 (EDT) (envelope-from das@FreeBSD.ORG) Date: Tue, 23 Jun 2009 19:45:49 -0400 From: David Schultz To: Kostik Belousov Message-ID: <20090623234549.GA6076@zim.MIT.EDU> Mail-Followup-To: Kostik Belousov , Ed Schouten , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <200906201639.n5KGdPhO081114@svn.freebsd.org> <20090620174158.GG2884@deviant.kiev.zoral.com.ua> <20090623221248.GA5445@zim.MIT.EDU> <20090623221053.GT2884@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090623221053.GT2884@deviant.kiev.zoral.com.ua> Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Ed Schouten Subject: Re: svn commit: r194538 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 23:39:23 -0000 On Wed, Jun 24, 2009, Kostik Belousov wrote: > On Tue, Jun 23, 2009 at 06:12:48PM -0400, David Schultz wrote: > > On Sat, Jun 20, 2009, Kostik Belousov wrote: > > > On Sat, Jun 20, 2009 at 04:39:25PM +0000, Ed Schouten wrote: > > > > Author: ed > > > > Date: Sat Jun 20 16:39:25 2009 > > > > New Revision: 194538 > > > > URL: http://svn.freebsd.org/changeset/base/194538 > > > > > > > > Log: > > > > Add placeholder to prevent reuse of privilege 254. > > > > > > > > Requested by: rwatson > > > > > > > > Modified: > > > > head/sys/sys/priv.h > > > > > > > > Modified: head/sys/sys/priv.h > > > > ============================================================================== > > > > --- head/sys/sys/priv.h Sat Jun 20 16:37:24 2009 (r194537) > > > > +++ head/sys/sys/priv.h Sat Jun 20 16:39:25 2009 (r194538) > > > > @@ -211,6 +211,7 @@ > > > > #define PRIV_TTY_DRAINWAIT 251 /* Set tty drain wait time. */ > > > > #define PRIV_TTY_DTRWAIT 252 /* Set DTR wait on tty. */ > > > > #define PRIV_TTY_EXCLUSIVE 253 /* Override tty exclusive flag. */ > > > > +#define _PRIV_TTY_PRISON 254 /* Removed. */ > > > > #define PRIV_TTY_STI 255 /* Simulate input on another tty. */ > > > > #define PRIV_TTY_SETA 256 /* Set tty termios structure. */ > > > > > > > Names starting with two underscores or underscore and upper-case letter > > > are reserved to the C language implementation. We should not use it > > > in the code. > > > > Applications are not supposed to use such symbols, but we use them > > pervasively in system headers specifically to avoid conflicting > > with symbols an application might define. (Effectively, we > > consider system headers to be part of the language implementation.) > > My interpretation is that we use freestanding environment for the kernel, > and appropriate requirements shall be fullfilled by kernel code. If that's the case, then how do you propose we cope with the boilerplate preface to virtually every header file, i.e., like the following? #ifndef _SYS_PRIV_H_ #define _SYS_PRIV_H_ The intent of the restrictions on names with underscores is to provide a namespace for implementors of libraries and header files that will not conflict with conforming applications. (In this context, I guess it makes more sense to talk about third-party modules instead of applications.) Of course the compiler may also define symbols in this namespace, but that's a much more manageable problem, notwithstanding the fact that compiler authors are generally careful to use more specific prefixes such as `__STDC' and `__GNUC'. From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 23:49:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75F3C106566C; Tue, 23 Jun 2009 23:49:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62F378FC0C; Tue, 23 Jun 2009 23:49:52 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NNnqUh095523; Tue, 23 Jun 2009 23:49:52 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NNnq2q095511; Tue, 23 Jun 2009 23:49:52 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906232349.n5NNnq2q095511@svn.freebsd.org> From: Xin LI Date: Tue, 23 Jun 2009 23:49: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: r194799 - head/sbin/ifconfig X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 23:49:52 -0000 Author: delphij Date: Tue Jun 23 23:49:52 2009 New Revision: 194799 URL: http://svn.freebsd.org/changeset/base/194799 Log: - Use size_t instead of int when appropriate; - Use C99 sparse initialization. With these changes ifconfig(8) is WARNS=2 clean. Modified: head/sbin/ifconfig/af_atalk.c head/sbin/ifconfig/af_inet.c head/sbin/ifconfig/af_inet6.c head/sbin/ifconfig/ifclone.c head/sbin/ifconfig/ifconfig.c head/sbin/ifconfig/ifconfig.h head/sbin/ifconfig/ifgif.c head/sbin/ifconfig/ifgre.c head/sbin/ifconfig/ifmac.c head/sbin/ifconfig/ifmedia.c head/sbin/ifconfig/ifvlan.c Modified: head/sbin/ifconfig/af_atalk.c ============================================================================== --- head/sbin/ifconfig/af_atalk.c Tue Jun 23 23:37:25 2009 (r194798) +++ head/sbin/ifconfig/af_atalk.c Tue Jun 23 23:49:52 2009 (r194799) @@ -173,7 +173,7 @@ static __constructor void atalk_ctor(void) { #define N(a) (sizeof(a) / sizeof(a[0])) - int i; + size_t i; for (i = 0; i < N(atalk_cmds); i++) cmd_register(&atalk_cmds[i]); Modified: head/sbin/ifconfig/af_inet.c ============================================================================== --- head/sbin/ifconfig/af_inet.c Tue Jun 23 23:37:25 2009 (r194798) +++ head/sbin/ifconfig/af_inet.c Tue Jun 23 23:49:52 2009 (r194799) @@ -130,7 +130,7 @@ in_getaddr(const char *s, int which) return; if ((hp = gethostbyname(s)) != 0) bcopy(hp->h_addr, (char *)&sin->sin_addr, - MIN(hp->h_length, sizeof(sin->sin_addr))); + MIN((size_t)hp->h_length, sizeof(sin->sin_addr))); else if ((np = getnetbyname(s)) != 0) sin->sin_addr = inet_makeaddr(np->n_net, INADDR_ANY); else Modified: head/sbin/ifconfig/af_inet6.c ============================================================================== --- head/sbin/ifconfig/af_inet6.c Tue Jun 23 23:37:25 2009 (r194798) +++ head/sbin/ifconfig/af_inet6.c Tue Jun 23 23:49:52 2009 (r194799) @@ -58,12 +58,8 @@ static const char rcsid[] = static struct in6_ifreq in6_ridreq; static struct in6_aliasreq in6_addreq = - { { 0 }, - { 0 }, - { 0 }, - { 0 }, - 0, - { 0, 0, ND6_INFINITE_LIFETIME, ND6_INFINITE_LIFETIME } }; + { .ifra_flags = 0, + .ifra_lifetime = { 0, 0, ND6_INFINITE_LIFETIME, ND6_INFINITE_LIFETIME } }; static int ip6lifetime; static void in6_fillscopeid(struct sockaddr_in6 *sin6); @@ -522,13 +518,13 @@ in6_Lopt_cb(const char *optarg __unused) { ip6lifetime++; /* print IPv6 address lifetime */ } -static struct option in6_Lopt = { "L", "[-L]", in6_Lopt_cb }; +static struct option in6_Lopt = { .opt = "L", .opt_usage = "[-L]", .cb = in6_Lopt_cb }; static __constructor void inet6_ctor(void) { #define N(a) (sizeof(a) / sizeof(a[0])) - int i; + size_t i; for (i = 0; i < N(inet6_cmds); i++) cmd_register(&inet6_cmds[i]); Modified: head/sbin/ifconfig/ifclone.c ============================================================================== --- head/sbin/ifconfig/ifclone.c Tue Jun 23 23:37:25 2009 (r194798) +++ head/sbin/ifconfig/ifclone.c Tue Jun 23 23:49:52 2009 (r194799) @@ -179,13 +179,13 @@ clone_Copt_cb(const char *optarg __unuse list_cloners(); exit(0); } -static struct option clone_Copt = { "C", "[-C]", clone_Copt_cb }; +static struct option clone_Copt = { .opt = "C", .opt_usage = "[-C]", .cb = clone_Copt_cb }; static __constructor void clone_ctor(void) { #define N(a) (sizeof(a) / sizeof(a[0])) - int i; + size_t i; for (i = 0; i < N(clone_cmds); i++) cmd_register(&clone_cmds[i]); Modified: head/sbin/ifconfig/ifconfig.c ============================================================================== --- head/sbin/ifconfig/ifconfig.c Tue Jun 23 23:37:25 2009 (r194798) +++ head/sbin/ifconfig/ifconfig.c Tue Jun 23 23:49:52 2009 (r194799) @@ -1053,7 +1053,7 @@ static __constructor void ifconfig_ctor(void) { #define N(a) (sizeof(a) / sizeof(a[0])) - int i; + size_t i; for (i = 0; i < N(basic_cmds); i++) cmd_register(&basic_cmds[i]); Modified: head/sbin/ifconfig/ifconfig.h ============================================================================== --- head/sbin/ifconfig/ifconfig.h Tue Jun 23 23:37:25 2009 (r194798) +++ head/sbin/ifconfig/ifconfig.h Tue Jun 23 23:49:52 2009 (r194799) @@ -68,12 +68,12 @@ void callback_register(callback_func *, #define DECL_CMD_FUNC2(name, arg1, arg2) \ void name(const char *arg1, const char *arg2, int s, const struct afswtch *afp) -#define DEF_CMD(name, param, func) { name, param, { .c_func = func } } -#define DEF_CMD_ARG(name, func) { name, NEXTARG, { .c_func = func } } -#define DEF_CMD_OPTARG(name, func) { name, OPTARG, { .c_func = func } } -#define DEF_CMD_ARG2(name, func) { name, NEXTARG2, { .c_func2 = func } } -#define DEF_CLONE_CMD(name, param, func) { name, param, { .c_func = func }, 1 } -#define DEF_CLONE_CMD_ARG(name, func) { name, NEXTARG, { .c_func = func }, 1 } +#define DEF_CMD(name, param, func) { name, param, { .c_func = func }, 0, NULL } +#define DEF_CMD_ARG(name, func) { name, NEXTARG, { .c_func = func }, 0, NULL } +#define DEF_CMD_OPTARG(name, func) { name, OPTARG, { .c_func = func }, 0, NULL } +#define DEF_CMD_ARG2(name, func) { name, NEXTARG2, { .c_func2 = func }, 0, NULL } +#define DEF_CLONE_CMD(name, param, func) { name, param, { .c_func = func }, 1, NULL } +#define DEF_CLONE_CMD_ARG(name, func) { name, NEXTARG, { .c_func = func }, 1, NULL } struct ifaddrs; struct addrinfo; Modified: head/sbin/ifconfig/ifgif.c ============================================================================== --- head/sbin/ifconfig/ifgif.c Tue Jun 23 23:37:25 2009 (r194798) +++ head/sbin/ifconfig/ifgif.c Tue Jun 23 23:49:52 2009 (r194799) @@ -66,7 +66,7 @@ gif_status(int s) { int opts; int nopts = 0; - int i; + size_t i; ifr.ifr_data = (caddr_t)&opts; if (ioctl(s, GIFGOPTS, &ifr) == -1) @@ -123,7 +123,7 @@ static __constructor void gif_ctor(void) { #define N(a) (sizeof(a) / sizeof(a[0])) - int i; + size_t i; for (i = 0; i < N(gif_cmds); i++) cmd_register(&gif_cmds[i]); Modified: head/sbin/ifconfig/ifgre.c ============================================================================== --- head/sbin/ifconfig/ifgre.c Tue Jun 23 23:37:25 2009 (r194798) +++ head/sbin/ifconfig/ifgre.c Tue Jun 23 23:49:52 2009 (r194799) @@ -89,7 +89,7 @@ static __constructor void gre_ctor(void) { #define N(a) (sizeof(a) / sizeof(a[0])) - int i; + size_t i; for (i = 0; i < N(gre_cmds); i++) cmd_register(&gre_cmds[i]); Modified: head/sbin/ifconfig/ifmac.c ============================================================================== --- head/sbin/ifconfig/ifmac.c Tue Jun 23 23:37:25 2009 (r194798) +++ head/sbin/ifconfig/ifmac.c Tue Jun 23 23:49:52 2009 (r194799) @@ -112,7 +112,7 @@ static __constructor void mac_ctor(void) { #define N(a) (sizeof(a) / sizeof(a[0])) - int i; + size_t i; for (i = 0; i < N(mac_cmds); i++) cmd_register(&mac_cmds[i]); Modified: head/sbin/ifconfig/ifmedia.c ============================================================================== --- head/sbin/ifconfig/ifmedia.c Tue Jun 23 23:37:25 2009 (r194798) +++ head/sbin/ifconfig/ifmedia.c Tue Jun 23 23:49:52 2009 (r194799) @@ -330,7 +330,7 @@ setmediainst(const char *val, int d, int ifmr = ifmedia_getstate(s); inst = atoi(val); - if (inst < 0 || inst > IFM_INST_MAX) + if (inst < 0 || inst > (int)IFM_INST_MAX) errx(1, "invalid media instance: %s", val); strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); @@ -822,7 +822,7 @@ static __constructor void ifmedia_ctor(void) { #define N(a) (sizeof(a) / sizeof(a[0])) - int i; + size_t i; for (i = 0; i < N(media_cmds); i++) cmd_register(&media_cmds[i]); Modified: head/sbin/ifconfig/ifvlan.c ============================================================================== --- head/sbin/ifconfig/ifvlan.c Tue Jun 23 23:37:25 2009 (r194798) +++ head/sbin/ifconfig/ifvlan.c Tue Jun 23 23:49:52 2009 (r194799) @@ -192,7 +192,7 @@ static __constructor void vlan_ctor(void) { #define N(a) (sizeof(a) / sizeof(a[0])) - int i; + size_t i; for (i = 0; i < N(vlan_cmds); i++) cmd_register(&vlan_cmds[i]); From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 23:52:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2080E1065679; Tue, 23 Jun 2009 23:52:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E7738FC14; Tue, 23 Jun 2009 23:52:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NNqCXK095603; Tue, 23 Jun 2009 23:52:12 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NNqCqq095601; Tue, 23 Jun 2009 23:52:12 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906232352.n5NNqCqq095601@svn.freebsd.org> From: Xin LI Date: Tue, 23 Jun 2009 23:52:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194800 - head/lib/libc/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 23:52:13 -0000 Author: delphij Date: Tue Jun 23 23:52:12 2009 New Revision: 194800 URL: http://svn.freebsd.org/changeset/base/194800 Log: Use const instead of __const, and merge the license change from NetBSD. Obtained from: NetBSD Modified: head/lib/libc/gen/fmtcheck.c Modified: head/lib/libc/gen/fmtcheck.c ============================================================================== --- head/lib/libc/gen/fmtcheck.c Tue Jun 23 23:49:52 2009 (r194799) +++ head/lib/libc/gen/fmtcheck.c Tue Jun 23 23:52:12 2009 (r194800) @@ -1,3 +1,5 @@ +/* $NetBSD: fmtcheck.c,v 1.8 2008/04/28 20:22:59 martin Exp $ */ + /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. * All rights reserved. @@ -12,13 +14,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED @@ -33,7 +28,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* $NetBSD: fmtcheck.c,v 1.2 2000/11/01 01:17:20 briggs Exp $ */ #include __FBSDID("$FreeBSD$"); @@ -308,7 +302,7 @@ get_next_format(const char **pf, EFT eft /*NOTREACHED*/ } -__const char * +const char * __fmtcheck(const char *f1, const char *f2) { const char *f1p, *f2p; From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 23:53:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 364A81065675; Tue, 23 Jun 2009 23:53:36 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 24A5E8FC08; Tue, 23 Jun 2009 23:53:36 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NNrar0095712; Tue, 23 Jun 2009 23:53:36 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NNra7b095710; Tue, 23 Jun 2009 23:53:36 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906232353.n5NNra7b095710@svn.freebsd.org> From: Xin LI Date: Tue, 23 Jun 2009 23:53: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: r194801 - head/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 23:53:36 -0000 Author: delphij Date: Tue Jun 23 23:53:35 2009 New Revision: 194801 URL: http://svn.freebsd.org/changeset/base/194801 Log: Merge fmtcheck() prototype change. Obtained from: NetBSD Modified: head/include/stdio.h Modified: head/include/stdio.h ============================================================================== --- head/include/stdio.h Tue Jun 23 23:52:12 2009 (r194800) +++ head/include/stdio.h Tue Jun 23 23:53:35 2009 (r194801) @@ -394,7 +394,7 @@ int asprintf(char **, const char *, ... char *ctermid_r(char *); void fcloseall(void); char *fgetln(FILE *, size_t *); -__const char *fmtcheck(const char *, const char *) __format_arg(2); +const char *fmtcheck(const char *, const char *) __format_arg(2); int fpurge(FILE *); void setbuffer(FILE *, char *, int); int setlinebuf(FILE *); From owner-svn-src-head@FreeBSD.ORG Tue Jun 23 23:56:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7EA71065675; Tue, 23 Jun 2009 23:56:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B5AFA8FC12; Tue, 23 Jun 2009 23:56:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5NNuusw095821; Tue, 23 Jun 2009 23:56:56 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5NNuuWh095819; Tue, 23 Jun 2009 23:56:56 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906232356.n5NNuuWh095819@svn.freebsd.org> From: Xin LI Date: Tue, 23 Jun 2009 23:56: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: r194802 - head/sbin/kldload X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jun 2009 23:56:57 -0000 Author: delphij Date: Tue Jun 23 23:56:56 2009 New Revision: 194802 URL: http://svn.freebsd.org/changeset/base/194802 Log: Add a note about the implication of secure level setting against kldload, and cross reference security(7). Modified: head/sbin/kldload/kldload.8 Modified: head/sbin/kldload/kldload.8 ============================================================================== --- head/sbin/kldload/kldload.8 Tue Jun 23 23:53:35 2009 (r194801) +++ head/sbin/kldload/kldload.8 Tue Jun 23 23:56:56 2009 (r194802) @@ -67,6 +67,11 @@ Be more verbose. .It Fl q Silence any extraneous warnings. .El +.Sh NOTES +.Pp +The kernel security level settings may prevent a module from being +loaded or unloaded by giving +.Em "Operation not permitted" . .Sh FILES .Bl -tag -width /boot/kernel -compact .It Pa /boot/kernel @@ -107,6 +112,7 @@ Modules may also be auto-loaded through .Xr kldload 2 , .Xr loader.conf 5 , .Xr rc.conf 5 , +.Xr security 7 , .Xr kldconfig 8 , .Xr kldstat 8 , .Xr kldunload 8 From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 01:14:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE01E10656A3; Wed, 24 Jun 2009 01:14:17 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id ABC248FC18; Wed, 24 Jun 2009 01:14:17 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5O1EHMq097306; Wed, 24 Jun 2009 01:14:17 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5O1EHsJ097304; Wed, 24 Jun 2009 01:14:17 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906240114.n5O1EHsJ097304@svn.freebsd.org> From: Xin LI Date: Wed, 24 Jun 2009 01:14: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: r194803 - head/lib/libc/db/btree X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 01:14:18 -0000 Author: delphij Date: Wed Jun 24 01:14:17 2009 New Revision: 194803 URL: http://svn.freebsd.org/changeset/base/194803 Log: style: operators should appear at the line end if we have to wrap. Modified: head/lib/libc/db/btree/bt_split.c Modified: head/lib/libc/db/btree/bt_split.c ============================================================================== --- head/lib/libc/db/btree/bt_split.c Tue Jun 23 23:56:56 2009 (r194802) +++ head/lib/libc/db/btree/bt_split.c Wed Jun 24 01:14:17 2009 (r194803) @@ -644,8 +644,8 @@ bt_psplit(BTREE *t, PAGE *h, PAGE *l, PA * where we decide to try and copy too much onto the left page. * Make sure that doesn't happen. */ - if ((skip <= off && used + nbytes + sizeof(indx_t) >= full) - || nxt == top - 1) { + if ((skip <= off && used + nbytes + sizeof(indx_t) >= full) || + nxt == top - 1) { --off; break; } From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 01:15:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 677E3106567A; Wed, 24 Jun 2009 01:15:10 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5545C8FC1E; Wed, 24 Jun 2009 01:15:10 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5O1FAUP097364; Wed, 24 Jun 2009 01:15:10 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5O1FAJO097361; Wed, 24 Jun 2009 01:15:10 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906240115.n5O1FAJO097361@svn.freebsd.org> From: Xin LI Date: Wed, 24 Jun 2009 01:15: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: r194804 - in head/lib/libc/db: btree mpool X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 01:15:11 -0000 Author: delphij Date: Wed Jun 24 01:15:10 2009 New Revision: 194804 URL: http://svn.freebsd.org/changeset/base/194804 Log: Update SCCS IDs for Berkeley DB 1.86 merge. Modified: head/lib/libc/db/btree/bt_split.c head/lib/libc/db/mpool/mpool.c Modified: head/lib/libc/db/btree/bt_split.c ============================================================================== --- head/lib/libc/db/btree/bt_split.c Wed Jun 24 01:14:17 2009 (r194803) +++ head/lib/libc/db/btree/bt_split.c Wed Jun 24 01:15:10 2009 (r194804) @@ -31,7 +31,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)bt_split.c 8.9 (Berkeley) 7/26/94"; +static char sccsid[] = "@(#)bt_split.c 8.10 (Berkeley) 1/9/95"; #endif /* LIBC_SCCS and not lint */ #include __FBSDID("$FreeBSD$"); Modified: head/lib/libc/db/mpool/mpool.c ============================================================================== --- head/lib/libc/db/mpool/mpool.c Wed Jun 24 01:14:17 2009 (r194803) +++ head/lib/libc/db/mpool/mpool.c Wed Jun 24 01:15:10 2009 (r194804) @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)mpool.c 8.5 (Berkeley) 7/26/94"; +static char sccsid[] = "@(#)mpool.c 8.7 (Berkeley) 11/2/95"; #endif /* LIBC_SCCS and not lint */ #include __FBSDID("$FreeBSD$"); From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 02:01:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C76A5106564A; Wed, 24 Jun 2009 02:01:16 +0000 (UTC) (envelope-from ariff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B549E8FC1A; Wed, 24 Jun 2009 02:01:16 +0000 (UTC) (envelope-from ariff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5O21GdN098252; Wed, 24 Jun 2009 02:01:16 GMT (envelope-from ariff@svn.freebsd.org) Received: (from ariff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5O21Ggu098250; Wed, 24 Jun 2009 02:01:16 GMT (envelope-from ariff@svn.freebsd.org) Message-Id: <200906240201.n5O21Ggu098250@svn.freebsd.org> From: Ariff Abdullah Date: Wed, 24 Jun 2009 02:01:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194805 - head/sys/dev/sound/pcm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 02:01:17 -0000 Author: ariff Date: Wed Jun 24 02:01:16 2009 New Revision: 194805 URL: http://svn.freebsd.org/changeset/base/194805 Log: Slight comment fix. Modified: head/sys/dev/sound/pcm/feeder_rate.c Modified: head/sys/dev/sound/pcm/feeder_rate.c ============================================================================== --- head/sys/dev/sound/pcm/feeder_rate.c Wed Jun 24 01:15:10 2009 (r194804) +++ head/sys/dev/sound/pcm/feeder_rate.c Wed Jun 24 02:01:16 2009 (r194805) @@ -1664,11 +1664,10 @@ z_resampler_feed_internal(struct pcm_fee * * Notice that there are 2 methods of doing the drift * operations: The former is much cleaner (in a sense - * sense of mathematical readings of my eyes), but - * slower due to integer division in z_gy2gx(). - * Nevertheless, both should give the same exact - * accurate drifting results, so the later is - * favourable. + * of mathematical readings of my eyes), but slower + * due to integer division in z_gy2gx(). Nevertheless, + * both should give the same exact accurate drifting + * results, so the later is favourable. */ do { info->z_resample(info, dst); From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 04:45:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A68E1106566C; Wed, 24 Jun 2009 04:45:03 +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 8A2D18FC14; Wed, 24 Jun 2009 04:45:03 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5O4j3Io001717; Wed, 24 Jun 2009 04:45:03 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5O4j3p4001714; Wed, 24 Jun 2009 04:45:03 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200906240445.n5O4j3p4001714@svn.freebsd.org> From: Alan Cox Date: Wed, 24 Jun 2009 04:45: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: r194806 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 04:45:04 -0000 Author: alc Date: Wed Jun 24 04:45:03 2009 New Revision: 194806 URL: http://svn.freebsd.org/changeset/base/194806 Log: The bits set in a page's dirty mask are a subset of the bits set in its valid mask. Consequently, there is no need to perform a bit-wise and of the page's dirty and valid masks in order to determine which parts of a page are dirty and valid. Eliminate an unnecessary #include. Modified: head/sys/vm/vm_object.c head/sys/vm/vm_pageout.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Wed Jun 24 02:01:16 2009 (r194805) +++ head/sys/vm/vm_object.c Wed Jun 24 04:45:03 2009 (r194806) @@ -787,7 +787,7 @@ vm_object_page_clean(vm_object_t object, continue; } vm_page_test_dirty(p); - if ((p->dirty & p->valid) == 0) { + if (p->dirty == 0) { if (--scanlimit == 0) break; ++tscan; @@ -874,7 +874,7 @@ again: } vm_page_test_dirty(p); - if ((p->dirty & p->valid) == 0) { + if (p->dirty == 0) { p->oflags &= ~VPO_CLEANCHK; continue; } @@ -947,7 +947,7 @@ vm_object_page_collect_flush(vm_object_t (tp->busy != 0)) break; vm_page_test_dirty(tp); - if ((tp->dirty & tp->valid) == 0) { + if (tp->dirty == 0) { tp->oflags &= ~VPO_CLEANCHK; break; } @@ -971,7 +971,7 @@ vm_object_page_collect_flush(vm_object_t (tp->busy != 0)) break; vm_page_test_dirty(tp); - if ((tp->dirty & tp->valid) == 0) { + if (tp->dirty == 0) { tp->oflags &= ~VPO_CLEANCHK; break; } @@ -999,7 +999,7 @@ vm_object_page_collect_flush(vm_object_t vm_pageout_flush(ma, runlen, pagerflags); for (i = 0; i < runlen; i++) { - if (ma[i]->valid & ma[i]->dirty) { + if (ma[i]->dirty) { pmap_remove_write(ma[i]); ma[i]->oflags |= VPO_CLEANCHK; @@ -1946,7 +1946,7 @@ again: ("vm_object_page_remove: page %p is fictitious", p)); if (clean_only && p->valid) { pmap_remove_write(p); - if (p->valid & p->dirty) + if (p->dirty) continue; } pmap_remove_all(p); Modified: head/sys/vm/vm_pageout.c ============================================================================== --- head/sys/vm/vm_pageout.c Wed Jun 24 02:01:16 2009 (r194805) +++ head/sys/vm/vm_pageout.c Wed Jun 24 04:45:03 2009 (r194806) @@ -105,8 +105,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include - /* * System initialization */ @@ -350,7 +348,7 @@ more: break; } vm_page_test_dirty(p); - if ((p->dirty & p->valid) == 0 || + if (p->dirty == 0 || p->queue != PQ_INACTIVE || p->wire_count != 0 || /* may be held by buf cache */ p->hold_count != 0) { /* may be undergoing I/O */ @@ -378,7 +376,7 @@ more: break; } vm_page_test_dirty(p); - if ((p->dirty & p->valid) == 0 || + if (p->dirty == 0 || p->queue != PQ_INACTIVE || p->wire_count != 0 || /* may be held by buf cache */ p->hold_count != 0) { /* may be undergoing I/O */ From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 04:56:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4B7E106564A; Wed, 24 Jun 2009 04:56:13 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C2C028FC08; Wed, 24 Jun 2009 04:56:13 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5O4uDdW001949; Wed, 24 Jun 2009 04:56:13 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5O4uDND001946; Wed, 24 Jun 2009 04:56:13 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <200906240456.n5O4uDND001946@svn.freebsd.org> From: Colin Percival Date: Wed, 24 Jun 2009 04:56: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: r194807 - head/usr.sbin/sysinstall X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 04:56:14 -0000 Author: cperciva Date: Wed Jun 24 04:56:13 2009 New Revision: 194807 URL: http://svn.freebsd.org/changeset/base/194807 Log: Add detection of UFS filesystems. PR: bin/135565 Submitted by: Daniel O'Connor Reviewed by: randi MFC after: 1 month Modified: head/usr.sbin/sysinstall/devices.c head/usr.sbin/sysinstall/ufs.c Modified: head/usr.sbin/sysinstall/devices.c ============================================================================== --- head/usr.sbin/sysinstall/devices.c Wed Jun 24 04:45:03 2009 (r194806) +++ head/usr.sbin/sysinstall/devices.c Wed Jun 24 04:56:13 2009 (r194807) @@ -421,7 +421,7 @@ skipif: } } - /* Finally, go get the disks and look for DOS partitions to register */ + /* Finally, go get the disks and look for partitions to register */ if ((names = Disk_Names()) != NULL) { int i; @@ -458,7 +458,11 @@ skipif: if (isDebug()) msgDebug("Found a disk device named %s\n", names[i]); - /* Look for existing DOS partitions to register as "DOS media devices" */ + /* Look for existing DOS partitions to register as "DOS media devices" + * XXX: libdisks handling of extended partitions is too + * simplistic - it does not handle them containing (for + * example) UFS partitions + */ for (c1 = d->chunks->part; c1; c1 = c1->next) { if (c1->type == fat || c1->type == efi || c1->type == extended) { Device *dev; @@ -470,8 +474,25 @@ skipif: mediaInitDOS, mediaGetDOS, mediaShutdownDOS, NULL); dev->private = c1; if (isDebug()) - msgDebug("Found a DOS partition %s on drive %s\n", c1->name, d->name); + msgDebug("Found a DOS partition %s\n", c1->name); + } else if (c1->type == freebsd) { + Device *dev; + char devname[80]; + Chunk *c2; + + for (c2 = c1->part; c2; c2 = c2->next) { + if (c2->type != part || c2->subtype != 7) + continue; + /* Got one! */ + snprintf(devname, sizeof devname, "/dev/%s", c1->name); + dev = deviceRegister(c2->name, c2->name, strdup(devname), DEVICE_TYPE_UFS, TRUE, + mediaInitUFS, mediaGetUFS, mediaShutdownUFS, NULL); + dev->private = c2; + if (isDebug()) + msgDebug("Found a UFS sub-partition %s\n", c2->name); + } } + } } free(names); Modified: head/usr.sbin/sysinstall/ufs.c ============================================================================== --- head/usr.sbin/sysinstall/ufs.c Wed Jun 24 04:45:03 2009 (r194806) +++ head/usr.sbin/sysinstall/ufs.c Wed Jun 24 04:56:13 2009 (r194807) @@ -39,11 +39,47 @@ #include "sysinstall.h" #include #include +#include +#include -/* No init or shutdown routines necessary - all done in mediaSetUFS() */ +static Boolean UFSMounted; +static char mountpoint[] = "/dist"; + +Boolean +mediaInitUFS(Device *dev) +{ + struct ufs_args args; + + if (UFSMounted) + return TRUE; + + Mkdir(mountpoint); + memset(&args, 0, sizeof(args)); + args.fspec = dev->devname; + + if (mount("ufs", mountpoint, MNT_RDONLY, (caddr_t)&args) == -1) { + msgConfirm("Error mounting %s on %s: %s (%u)", args.fspec, mountpoint, strerror(errno), errno); + return FALSE; + } + UFSMounted = TRUE; + return TRUE; +} FILE * mediaGetUFS(Device *dev, char *file, Boolean probe) { return mediaGenericGet((char *)dev->private, file); } + +void +mediaShutdownUFS(Device *dev) +{ + if (!UFSMounted) + return; + if (unmount(mountpoint, MNT_FORCE) != 0) + msgConfirm("Could not unmount the UFS partition from %s: %s", + mountpoint, strerror(errno)); + else + UFSMounted = FALSE; + return; +} From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 06:42:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13F73106566C; Wed, 24 Jun 2009 06:42:14 +0000 (UTC) (envelope-from jhay@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 030188FC16; Wed, 24 Jun 2009 06:42:14 +0000 (UTC) (envelope-from jhay@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5O6gDV4004319; Wed, 24 Jun 2009 06:42:13 GMT (envelope-from jhay@svn.freebsd.org) Received: (from jhay@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5O6gDiB004317; Wed, 24 Jun 2009 06:42:13 GMT (envelope-from jhay@svn.freebsd.org) Message-Id: <200906240642.n5O6gDiB004317@svn.freebsd.org> From: John Hay Date: Wed, 24 Jun 2009 06:42:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194811 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 06:42:14 -0000 Author: jhay Date: Wed Jun 24 06:42:13 2009 New Revision: 194811 URL: http://svn.freebsd.org/changeset/base/194811 Log: Do not stop the loop when an empty or deleted directory entry is found. Rather just skip over it. Modified: head/sys/geom/geom_redboot.c Modified: head/sys/geom/geom_redboot.c ============================================================================== --- head/sys/geom/geom_redboot.c Wed Jun 24 06:15:18 2009 (r194810) +++ head/sys/geom/geom_redboot.c Wed Jun 24 06:42:13 2009 (r194811) @@ -195,7 +195,9 @@ parse_fis_directory(u_char *buf, size_t */ fisdir = redbcfg = NULL; *(tail = &head) = NULL; - for (i = 0; fd < efd && fd->name[0] != 0xff; i++, fd++) { + for (i = 0; fd < efd; i++, fd++) { + if (fd->name[0] == 0xff) + continue; if (match(fd->name, FISDIR_NAME)) fisdir = fd; else if (match(fd->name, REDBCFG_NAME)) From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 08:52:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76BF11065676; Wed, 24 Jun 2009 08:52:09 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A8F48FC0A; Wed, 24 Jun 2009 08:52:09 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5O8q9wa006779; Wed, 24 Jun 2009 08:52:09 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5O8q9XD006777; Wed, 24 Jun 2009 08:52:09 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906240852.n5O8q9XD006777@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 08:52: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: r194812 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 08:52:10 -0000 Author: rwatson Date: Wed Jun 24 08:52:09 2009 New Revision: 194812 URL: http://svn.freebsd.org/changeset/base/194812 Log: Make stf_getsrcifa6() return a reference to an in6_ifaddr rather than a pointer, and dispose of the references when no longer needed. MFC after: 6 weeks Modified: head/sys/net/if_stf.c Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Wed Jun 24 06:42:13 2009 (r194811) +++ head/sys/net/if_stf.c Wed Jun 24 08:52:09 2009 (r194812) @@ -349,8 +349,10 @@ stf_encapcheck(m, off, proto, arg) * success on: dst = 10.1.1.1, ia6->ia_addr = 2002:0a01:0101:... */ if (bcmp(GET_V4(&ia6->ia_addr.sin6_addr), &ip.ip_dst, - sizeof(ip.ip_dst)) != 0) + sizeof(ip.ip_dst)) != 0) { + ifa_free(&ia6->ia_ifa); return 0; + } /* * check if IPv4 src matches the IPv4 address derived from the @@ -361,6 +363,7 @@ stf_encapcheck(m, off, proto, arg) bzero(&a, sizeof(a)); bcopy(GET_V4(&ia6->ia_addr.sin6_addr), &a, sizeof(a)); bcopy(GET_V4(&ia6->ia_prefixmask.sin6_addr), &mask, sizeof(mask)); + ifa_free(&ia6->ia_ifa); a.s_addr &= mask.s_addr; b = ip.ip_src; b.s_addr &= mask.s_addr; @@ -396,6 +399,7 @@ stf_getsrcifa6(ifp) if (ia4 == NULL) continue; + ifa_ref(ia); IF_ADDR_UNLOCK(ifp); return (struct in6_ifaddr *)ia; } @@ -457,6 +461,7 @@ stf_output(ifp, m, dst, ro) if (m->m_len < sizeof(*ip6)) { m = m_pullup(m, sizeof(*ip6)); if (!m) { + ifa_free(&ia6->ia_ifa); ifp->if_oerrors++; return ENOBUFS; } @@ -483,6 +488,7 @@ stf_output(ifp, m, dst, ro) else if (IN6_IS_ADDR_6TO4(&dst6->sin6_addr)) ptr = GET_V4(&dst6->sin6_addr); else { + ifa_free(&ia6->ia_ifa); m_freem(m); ifp->if_oerrors++; return ENETUNREACH; @@ -505,6 +511,7 @@ stf_output(ifp, m, dst, ro) if (m && m->m_len < sizeof(struct ip)) m = m_pullup(m, sizeof(struct ip)); if (m == NULL) { + ifa_free(&ia6->ia_ifa); ifp->if_oerrors++; return ENOBUFS; } @@ -514,6 +521,7 @@ stf_output(ifp, m, dst, ro) bcopy(GET_V4(&((struct sockaddr_in6 *)&ia6->ia_addr)->sin6_addr), &ip->ip_src, sizeof(ip->ip_src)); + ifa_free(&ia6->ia_ifa); bcopy(&in4, &ip->ip_dst, sizeof(ip->ip_dst)); ip->ip_p = IPPROTO_IPV6; ip->ip_ttl = ip_stf_ttl; From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 08:53:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D8711065673; Wed, 24 Jun 2009 08:53:23 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8BD2D8FC20; Wed, 24 Jun 2009 08:53:23 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5O8rN7R006839; Wed, 24 Jun 2009 08:53:23 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5O8rNlN006837; Wed, 24 Jun 2009 08:53:23 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906240853.n5O8rNlN006837@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 08:53:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194813 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 08:53:24 -0000 Author: rwatson Date: Wed Jun 24 08:53:23 2009 New Revision: 194813 URL: http://svn.freebsd.org/changeset/base/194813 Log: Lock if_addrhead when iterating, and where necessary acquire and release ifadr references in if_sppp. MFC after: 6 weeks Modified: head/sys/net/if_spppsubr.c Modified: head/sys/net/if_spppsubr.c ============================================================================== --- head/sys/net/if_spppsubr.c Wed Jun 24 08:52:09 2009 (r194812) +++ head/sys/net/if_spppsubr.c Wed Jun 24 08:53:23 2009 (r194813) @@ -4905,6 +4905,7 @@ sppp_get_ip_addrs(struct sppp *sp, u_lon * aliases don't make any sense on a p2p link anyway. */ si = 0; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (ifa->ifa_addr->sa_family == AF_INET) { si = (struct sockaddr_in *)ifa->ifa_addr; @@ -4923,6 +4924,7 @@ sppp_get_ip_addrs(struct sppp *sp, u_lon if (si && si->sin_addr.s_addr) ddst = si->sin_addr.s_addr; } + IF_ADDR_UNLOCK(ifp); if (dst) *dst = ntohl(ddst); if (src) *src = ntohl(ssrc); @@ -4946,23 +4948,24 @@ sppp_set_ip_addr(struct sppp *sp, u_long * aliases don't make any sense on a p2p link anyway. */ si = 0; - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) - { - if (ifa->ifa_addr->sa_family == AF_INET) - { + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + if (ifa->ifa_addr->sa_family == AF_INET) { si = (struct sockaddr_in *)ifa->ifa_addr; - if (si) + if (si != NULL) { + ifa_ref(ifa); break; + } } } + IF_ADDR_UNLOCK(ifp); - if (ifa && si) - { + if (ifa != NULL) { int error; + /* delete old route */ error = rtinit(ifa, (int)RTM_DELETE, RTF_HOST); - if(debug && error) - { + if (debug && error) { log(LOG_DEBUG, SPP_FMT "sppp_set_ip_addr: rtinit DEL failed, error=%d\n", SPP_ARGS(ifp), error); } @@ -4975,11 +4978,11 @@ sppp_set_ip_addr(struct sppp *sp, u_long /* add new route */ error = rtinit(ifa, (int)RTM_ADD, RTF_HOST); - if (debug && error) - { + if (debug && error) { log(LOG_DEBUG, SPP_FMT "sppp_set_ip_addr: rtinit ADD failed, error=%d", SPP_ARGS(ifp), error); } + ifa_free(ifa); } } #endif @@ -5004,7 +5007,8 @@ sppp_get_ip6_addrs(struct sppp *sp, stru * Pick the first link-local AF_INET6 address from the list, * aliases don't make any sense on a p2p link anyway. */ - si = 0; + si = NULL; + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (ifa->ifa_addr->sa_family == AF_INET6) { si = (struct sockaddr_in6 *)ifa->ifa_addr; @@ -5030,6 +5034,7 @@ sppp_get_ip6_addrs(struct sppp *sp, stru bcopy(&ddst, dst, sizeof(*dst)); if (src) bcopy(&ssrc, src, sizeof(*src)); + IF_ADDR_UNLOCK(ifp); } #ifdef IPV6CP_MYIFID_DYN @@ -5058,28 +5063,29 @@ sppp_set_ip6_addr(struct sppp *sp, const */ sin6 = NULL; - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) - { - if (ifa->ifa_addr->sa_family == AF_INET6) - { + IF_ADDR_LOCK(ifp); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + if (ifa->ifa_addr->sa_family == AF_INET6) { sin6 = (struct sockaddr_in6 *)ifa->ifa_addr; - if (sin6 && IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) + if (sin6 && IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { + ifa_ref(ifa); break; + } } } + IF_ADDR_UNLOCK(ifp); - if (ifa && sin6) - { + if (ifa != NULL) { int error; struct sockaddr_in6 new_sin6 = *sin6; bcopy(src, &new_sin6.sin6_addr, sizeof(new_sin6.sin6_addr)); error = in6_ifinit(ifp, ifatoia6(ifa), &new_sin6, 1); - if (debug && error) - { + if (debug && error) { log(LOG_DEBUG, SPP_FMT "sppp_set_ip6_addr: in6_ifinit " " failed, error=%d\n", SPP_ARGS(ifp), error); } + ifa_free(ifa); } } #endif From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 09:26:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CD28106564A; Wed, 24 Jun 2009 09:26:34 +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 1B4D18FC15; Wed, 24 Jun 2009 09:26:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5O9QYmX007599; Wed, 24 Jun 2009 09:26:34 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5O9QXLe007597; Wed, 24 Jun 2009 09:26:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200906240926.n5O9QXLe007597@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 24 Jun 2009 09:26: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: r194814 - head/sys/vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 09:26:34 -0000 Author: kib Date: Wed Jun 24 09:26:33 2009 New Revision: 194814 URL: http://svn.freebsd.org/changeset/base/194814 Log: Initialize the uip to silence gcc warning that seems to sneak in in some build environments. Reported by: alc, bf1783 at googlemail com Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Wed Jun 24 08:53:23 2009 (r194813) +++ head/sys/vm/swap_pager.c Wed Jun 24 09:26:33 2009 (r194814) @@ -569,6 +569,7 @@ swap_pager_alloc(void *handle, vm_ooffse vm_pindex_t pindex; struct uidinfo *uip; + uip = NULL; pindex = OFF_TO_IDX(offset + PAGE_MASK + size); if (handle) { mtx_lock(&Giant); From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 10:28:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57BA4106566C; Wed, 24 Jun 2009 10:28:31 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2AE988FC18; Wed, 24 Jun 2009 10:28:31 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OASVvC009031; Wed, 24 Jun 2009 10:28:31 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OASVRS009029; Wed, 24 Jun 2009 10:28:31 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906241028.n5OASVRS009029@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 10:28:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194818 - head/sys/netatalk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 10:28:31 -0000 Author: rwatson Date: Wed Jun 24 10:28:30 2009 New Revision: 194818 URL: http://svn.freebsd.org/changeset/base/194818 Log: Reduce debugging output for netatalk routing events. MFC after: 3 days Modified: head/sys/netatalk/at_rmx.c Modified: head/sys/netatalk/at_rmx.c ============================================================================== --- head/sys/netatalk/at_rmx.c Wed Jun 24 09:54:05 2009 (r194817) +++ head/sys/netatalk/at_rmx.c Wed Jun 24 10:28:30 2009 (r194818) @@ -40,6 +40,7 @@ int at_inithead(void **head, int off); +#if 0 #define HEXBUF_LEN 256 static const char * @@ -65,74 +66,35 @@ prsockaddr(void *v, char *hexbuf) *bp = '\0'; return (hexbuf); } +#endif static struct radix_node * at_addroute(void *v_arg, void *n_arg, struct radix_node_head *head, struct radix_node *treenodes) { - struct radix_node *rn; - char hexbuf[HEXBUF_LEN]; - printf("at_addroute: v=%s\n", prsockaddr(v_arg, hexbuf)); - printf("at_addroute: n=%s\n", prsockaddr(n_arg, hexbuf)); - printf("at_addroute: head=%p treenodes=%p\n", (void *)head, - (void *)treenodes); - - rn = rn_addroute(v_arg, n_arg, head, treenodes); - - printf("at_addroute: returns rn=%p\n", (void *)rn); - - return (rn); + return (rn_addroute(v_arg, n_arg, head, treenodes)); } static struct radix_node * at_matroute(void *v_arg, struct radix_node_head *head) { - struct radix_node *rn; - char hexbuf[HEXBUF_LEN]; - - printf("at_matroute: v=%s\n", prsockaddr(v_arg, hexbuf)); - printf("at_matroute: head=%p\n", (void *)head); - - rn = rn_match(v_arg, head); - - printf("at_matroute: returnr rn=%p\n", (void *)rn); - return (rn); + return (rn_match(v_arg, head)); } static struct radix_node * at_lookup(void *v_arg, void *m_arg, struct radix_node_head *head) { - struct radix_node *rn; - char hexbuf[HEXBUF_LEN]; - printf("at_lookup: v=%s\n", prsockaddr(v_arg, hexbuf)); - printf("at_lookup: n=%s\n", prsockaddr(m_arg, hexbuf)); - printf("at_lookup: head=%p\n", (void *)head); - - rn = rn_lookup(v_arg, m_arg, head); - - printf("at_lookup: returns rn=%p\n", (void *)rn); - - return (rn); + return (rn_lookup(v_arg, m_arg, head)); } static struct radix_node * at_delroute(void *v_arg, void *netmask_arg, struct radix_node_head *head) { - struct radix_node *rn; - char hexbuf[HEXBUF_LEN]; - - printf("at_delroute: v=%s\n", prsockaddr(v_arg, hexbuf)); - printf("at_delroute: n=%s\n", prsockaddr(netmask_arg, hexbuf)); - printf("at_delroute: head=%p\n", (void *)head); - - rn = rn_delete(v_arg, netmask_arg, head); - - printf("at_delroute: returns rn=%p\n", (void *)rn); - return (rn); + return (rn_delete(v_arg, netmask_arg, head)); } /* From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 10:32:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 906421065692; Wed, 24 Jun 2009 10:32:44 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7D08C8FC0C; Wed, 24 Jun 2009 10:32:44 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OAWibf009148; Wed, 24 Jun 2009 10:32:44 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OAWimu009142; Wed, 24 Jun 2009 10:32:44 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906241032.n5OAWimu009142@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 10:32: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: r194819 - in head/sys: net netatalk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 10:32:45 -0000 Author: rwatson Date: Wed Jun 24 10:32:44 2009 New Revision: 194819 URL: http://svn.freebsd.org/changeset/base/194819 Log: Break at_ifawithnet() into two variants: - at_ifawithnet(), which acquires an locks it needs and returns an at_ifaddr reference. - at_ifawithnet_locked(), which relies on the caller locking at_ifaddr_list, and returns a pointer rather than a reference. Update various consumers to prefer one or the other, including ether and fddi output, to properly release at_ifaddr references. Rework at_control() to manage locking and references in a manner identical to in_control(). MFC after: 6 weeks Modified: head/sys/net/if_ethersubr.c head/sys/net/if_fddisubr.c head/sys/netatalk/aarp.c head/sys/netatalk/at_control.c head/sys/netatalk/at_extern.h Modified: head/sys/net/if_ethersubr.c ============================================================================== --- head/sys/net/if_ethersubr.c Wed Jun 24 10:28:30 2009 (r194818) +++ head/sys/net/if_ethersubr.c Wed Jun 24 10:32:44 2009 (r194819) @@ -261,14 +261,17 @@ ether_output(struct ifnet *ifp, struct m if ((aa = at_ifawithnet((struct sockaddr_at *)dst)) == NULL) senderr(EHOSTUNREACH); /* XXX */ - if (!aarpresolve(ifp, m, (struct sockaddr_at *)dst, edst)) + if (!aarpresolve(ifp, m, (struct sockaddr_at *)dst, edst)) { + ifa_free(&aa->aa_ifa); return (0); + } /* * In the phase 2 case, need to prepend an mbuf for the llc header. */ if ( aa->aa_flags & AFA_PHASE2 ) { struct llc llc; + ifa_free(&aa->aa_ifa); M_PREPEND(m, LLC_SNAPFRAMELEN, M_DONTWAIT); if (m == NULL) senderr(ENOBUFS); @@ -280,6 +283,7 @@ ether_output(struct ifnet *ifp, struct m type = htons(m->m_pkthdr.len); hlen = LLC_SNAPFRAMELEN + ETHER_HDR_LEN; } else { + ifa_free(&aa->aa_ifa); type = htons(ETHERTYPE_AT); } break; Modified: head/sys/net/if_fddisubr.c ============================================================================== --- head/sys/net/if_fddisubr.c Wed Jun 24 10:28:30 2009 (r194818) +++ head/sys/net/if_fddisubr.c Wed Jun 24 10:32:44 2009 (r194819) @@ -222,6 +222,7 @@ fddi_output(ifp, m, dst, ro) } else { type = htons(ETHERTYPE_AT); } + ifa_free(&aa->aa_ifa); break; } #endif /* NETATALK */ Modified: head/sys/netatalk/aarp.c ============================================================================== --- head/sys/netatalk/aarp.c Wed Jun 24 10:28:30 2009 (r194818) +++ head/sys/netatalk/aarp.c Wed Jun 24 10:32:44 2009 (r194819) @@ -142,9 +142,12 @@ aarptimer(void *ignored) /* * Search through the network addresses to find one that includes the given * network. Remember to take netranges into consideration. + * + * The _locked variant relies on the caller holding the at_ifaddr lock; the + * unlocked variant returns a reference that the caller must dispose of. */ struct at_ifaddr * -at_ifawithnet(struct sockaddr_at *sat) +at_ifawithnet_locked(struct sockaddr_at *sat) { struct at_ifaddr *aa; struct sockaddr_at *sat2; @@ -163,6 +166,19 @@ at_ifawithnet(struct sockaddr_at *sat) return (aa); } +struct at_ifaddr * +at_ifawithnet(struct sockaddr_at *sat) +{ + struct at_ifaddr *aa; + + AT_IFADDR_RLOCK(); + aa = at_ifawithnet_locked(sat); + if (aa != NULL) + ifa_ref(&aa->aa_ifa); + AT_IFADDR_RUNLOCK(); + return (aa); +} + static void aarpwhohas(struct ifnet *ifp, struct sockaddr_at *sat) { @@ -201,9 +217,8 @@ aarpwhohas(struct ifnet *ifp, struct soc * same address as we're looking for. If the net is phase 2, * generate an 802.2 and SNAP header. */ - AT_IFADDR_RLOCK(); - if ((aa = at_ifawithnet(sat)) == NULL) { - AT_IFADDR_RUNLOCK(); + aa = at_ifawithnet(sat); + if (aa == NULL) { m_freem(m); return; } @@ -217,7 +232,7 @@ aarpwhohas(struct ifnet *ifp, struct soc sizeof(struct ether_aarp)); M_PREPEND(m, sizeof(struct llc), M_DONTWAIT); if (m == NULL) { - AT_IFADDR_RUNLOCK(); + ifa_free(&aa->aa_ifa); return; } llc = mtod(m, struct llc *); @@ -244,7 +259,7 @@ aarpwhohas(struct ifnet *ifp, struct soc printf("aarp: sending request for %u.%u\n", ntohs(AA_SAT(aa)->sat_addr.s_net), AA_SAT(aa)->sat_addr.s_node); #endif /* NETATALKDEBUG */ - AT_IFADDR_RUNLOCK(); + ifa_free(&aa->aa_ifa); sa.sa_len = sizeof(struct sockaddr); sa.sa_family = AF_UNSPEC; @@ -261,7 +276,7 @@ aarpresolve(struct ifnet *ifp, struct mb AT_IFADDR_RLOCK(); if (at_broadcast(destsat)) { m->m_flags |= M_BCAST; - if ((aa = at_ifawithnet(destsat)) == NULL) { + if ((aa = at_ifawithnet_locked(destsat)) == NULL) { AT_IFADDR_RUNLOCK(); m_freem(m); return (0); @@ -379,14 +394,11 @@ at_aarpinput(struct ifnet *ifp, struct m sat.sat_len = sizeof(struct sockaddr_at); sat.sat_family = AF_APPLETALK; sat.sat_addr.s_net = net; - AT_IFADDR_RLOCK(); - if ((aa = at_ifawithnet(&sat)) == NULL) { - AT_IFADDR_RUNLOCK(); + aa = at_ifawithnet(&sat); + if (aa == NULL) { m_freem(m); return; } - ifa_ref(&aa->aa_ifa); - AT_IFADDR_RUNLOCK(); bcopy(ea->aarp_spnet, &spa.s_net, sizeof(spa.s_net)); bcopy(ea->aarp_tpnet, &tpa.s_net, sizeof(tpa.s_net)); } else { Modified: head/sys/netatalk/at_control.c ============================================================================== --- head/sys/netatalk/at_control.c Wed Jun 24 10:28:30 2009 (r194818) +++ head/sys/netatalk/at_control.c Wed Jun 24 10:32:44 2009 (r194819) @@ -79,28 +79,32 @@ at_control(struct socket *so, u_long cmd struct sockaddr_at *sat; struct netrange *nr; struct at_aliasreq *ifra = (struct at_aliasreq *)data; - struct at_ifaddr *aa0; - struct at_ifaddr *aa = NULL; + struct at_ifaddr *aa_temp; + struct at_ifaddr *aa; struct ifaddr *ifa, *ifa0; int error; /* * If we have an ifp, then find the matching at_ifaddr if it exists */ - AT_IFADDR_WLOCK(); + aa = NULL; + AT_IFADDR_RLOCK(); if (ifp != NULL) { for (aa = at_ifaddr_list; aa != NULL; aa = aa->aa_next) { if (aa->aa_ifp == ifp) break; } } + if (aa != NULL) + ifa_ref(&aa->aa_ifa); + AT_IFADDR_RUNLOCK(); /* * In this first switch table we are basically getting ready for * the second one, by getting the atalk-specific things set up * so that they start to look more similar to other protocols etc. */ - + error = 0; switch (cmd) { case SIOCAIFADDR: case SIOCDIFADDR: @@ -111,19 +115,27 @@ at_control(struct socket *so, u_long cmd * the first address on the NEXT interface! */ if (ifra->ifra_addr.sat_family == AF_APPLETALK) { - for (; aa; aa = aa->aa_next) { + struct at_ifaddr *oaa; + + AT_IFADDR_RLOCK(); + for (oaa = aa; aa; aa = aa->aa_next) { if (aa->aa_ifp == ifp && sateqaddr(&aa->aa_addr, &ifra->ifra_addr)) break; } + if (oaa != NULL && oaa != aa) + ifa_free(&oaa->aa_ifa); + if (aa != NULL && oaa != aa) + ifa_ref(&aa->aa_ifa); + AT_IFADDR_RUNLOCK(); } /* * If we a retrying to delete an addres but didn't find such, * then rewurn with an error */ if (cmd == SIOCDIFADDR && aa == NULL) { - AT_IFADDR_WUNLOCK(); - return (EADDRNOTAVAIL); + error = EADDRNOTAVAIL; + goto out; } /*FALLTHROUGH*/ @@ -134,34 +146,50 @@ at_control(struct socket *so, u_long cmd * XXXRW: Layering? */ if (priv_check(td, PRIV_NET_ADDIFADDR)) { - AT_IFADDR_WUNLOCK(); - return (EPERM); + error = EPERM; + goto out; } sat = satosat(&ifr->ifr_addr); nr = (struct netrange *)sat->sat_zero; if (nr->nr_phase == 1) { + struct at_ifaddr *oaa; + /* * Look for a phase 1 address on this interface. * This may leave aa pointing to the first address on * the NEXT interface! */ - for (; aa; aa = aa->aa_next) { + AT_IFADDR_RLOCK(); + for (oaa = aa; aa; aa = aa->aa_next) { if (aa->aa_ifp == ifp && (aa->aa_flags & AFA_PHASE2) == 0) break; } + if (oaa != NULL && oaa != aa) + ifa_free(&oaa->aa_ifa); + if (aa != NULL && oaa != aa) + ifa_ref(&aa->aa_ifa); + AT_IFADDR_RUNLOCK(); } else { /* default to phase 2 */ + struct at_ifaddr *oaa; + /* * Look for a phase 2 address on this interface. * This may leave aa pointing to the first address on * the NEXT interface! */ - for (; aa; aa = aa->aa_next) { + AT_IFADDR_RLOCK(); + for (oaa = aa; aa; aa = aa->aa_next) { if (aa->aa_ifp == ifp && (aa->aa_flags & AFA_PHASE2)) break; } + if (oaa != NULL && oaa != aa) + ifa_free(&oaa->aa_ifa); + if (aa != NULL && oaa != aa) + ifa_ref(&aa->aa_ifa); + AT_IFADDR_RUNLOCK(); } if (ifp == NULL) @@ -172,45 +200,20 @@ at_control(struct socket *so, u_long cmd * allocate a fresh one. */ if (aa == NULL) { - aa0 = malloc(sizeof(struct at_ifaddr), M_IFADDR, + aa = malloc(sizeof(struct at_ifaddr), M_IFADDR, M_NOWAIT | M_ZERO); - if (aa0 == NULL) { - AT_IFADDR_WUNLOCK(); - return (ENOBUFS); + if (aa == NULL) { + error = ENOBUFS; + goto out; } - callout_init(&aa0->aa_callout, CALLOUT_MPSAFE); - if ((aa = at_ifaddr_list) != NULL) { - /* - * Don't let the loopback be first, since the - * first address is the machine's default - * address for binding. If it is, stick - * ourself in front, otherwise go to the back - * of the list. - */ - if (at_ifaddr_list->aa_ifp->if_flags & - IFF_LOOPBACK) { - aa = aa0; - aa->aa_next = at_ifaddr_list; - at_ifaddr_list = aa; - } else { - for (; aa->aa_next; aa = aa->aa_next) - ; - aa->aa_next = aa0; - } - } else - at_ifaddr_list = aa0; - aa = aa0; + callout_init(&aa->aa_callout, CALLOUT_MPSAFE); - /* - * Find the end of the interface's addresses - * and link our new one on the end - */ ifa = (struct ifaddr *)aa; ifa_init(ifa); /* * As the at_ifaddr contains the actual sockaddrs, - * and the ifaddr itself, link them al together + * and the ifaddr itself, link them all together * correctly. */ ifa->ifa_addr = (struct sockaddr *)&aa->aa_addr; @@ -225,10 +228,35 @@ at_control(struct socket *so, u_long cmd else aa->aa_flags |= AFA_PHASE2; + ifa_ref(&aa->aa_ifa); /* at_ifaddr_list */ + AT_IFADDR_WLOCK(); + if ((aa_temp = at_ifaddr_list) != NULL) { + /* + * Don't let the loopback be first, since the + * first address is the machine's default + * address for binding. If it is, stick + * ourself in front, otherwise go to the back + * of the list. + */ + if (at_ifaddr_list->aa_ifp->if_flags & + IFF_LOOPBACK) { + aa->aa_next = at_ifaddr_list; + at_ifaddr_list = aa; + } else { + for (; aa_temp->aa_next; aa_temp = + aa_temp->aa_next) + ; + aa_temp->aa_next = aa; + } + } else + at_ifaddr_list = aa; + AT_IFADDR_WUNLOCK(); + /* * and link it all together */ aa->aa_ifp = ifp; + ifa_ref(&aa->aa_ifa); /* if_addrhead */ IF_ADDR_LOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); IF_ADDR_UNLOCK(ifp); @@ -236,15 +264,8 @@ at_control(struct socket *so, u_long cmd /* * If we DID find one then we clobber any routes * dependent on it.. - * - * XXXRW: While we ref the ifaddr, there are - * potential races here still. */ - ifa_ref(&aa->aa_ifa); - AT_IFADDR_WUNLOCK(); at_scrub(ifp, aa); - AT_IFADDR_WLOCK(); - ifa_free(&aa->aa_ifa); } break; @@ -252,29 +273,45 @@ at_control(struct socket *so, u_long cmd sat = satosat(&ifr->ifr_addr); nr = (struct netrange *)sat->sat_zero; if (nr->nr_phase == 1) { + struct at_ifaddr *oaa; + /* * If the request is specifying phase 1, then * only look at a phase one address */ - for (; aa; aa = aa->aa_next) { + AT_IFADDR_RUNLOCK(); + for (oaa = aa; aa; aa = aa->aa_next) { if (aa->aa_ifp == ifp && (aa->aa_flags & AFA_PHASE2) == 0) break; } + if (oaa != NULL && oaa != aa) + ifa_free(&oaa->aa_ifa); + if (aa != NULL && oaa != aa) + ifa_ref(&aa->aa_ifa); + AT_IFADDR_RLOCK(); } else { + struct at_ifaddr *oaa; + /* * default to phase 2 */ - for (; aa; aa = aa->aa_next) { + AT_IFADDR_RLOCK(); + for (oaa = aa; aa; aa = aa->aa_next) { if (aa->aa_ifp == ifp && (aa->aa_flags & AFA_PHASE2)) break; } + if (oaa != NULL && oaa != aa) + ifa_free(&oaa->aa_ifa); + if (aa != NULL && oaa != aa) + ifa_ref(&aa->aa_ifa); + AT_IFADDR_RUNLOCK(); } if (aa == NULL) { - AT_IFADDR_WUNLOCK(); - return (EADDRNOTAVAIL); + error = EADDRNOTAVAIL; + goto out; } break; } @@ -301,30 +338,24 @@ at_control(struct socket *so, u_long cmd aa->aa_firstnet; ((struct netrange *)&sat->sat_zero)->nr_lastnet = aa->aa_lastnet; - AT_IFADDR_WUNLOCK(); break; case SIOCSIFADDR: - ifa_ref(&aa->aa_ifa); - AT_IFADDR_WUNLOCK(); error = at_ifinit(ifp, aa, (struct sockaddr_at *)&ifr->ifr_addr); - ifa_free(&aa->aa_ifa); - return (error); + goto out; case SIOCAIFADDR: if (sateqaddr(&ifra->ifra_addr, &aa->aa_addr)) { - AT_IFADDR_WUNLOCK(); - return (0); + error = 0; + goto out; } - ifa_ref(&aa->aa_ifa); - AT_IFADDR_WUNLOCK(); error = at_ifinit(ifp, aa, (struct sockaddr_at *)&ifr->ifr_addr); - ifa_free(&aa->aa_ifa); - return (error); + goto out; case SIOCDIFADDR: + /* * remove the ifaddr from the interface */ @@ -332,41 +363,46 @@ at_control(struct socket *so, u_long cmd IF_ADDR_LOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, ifa0, ifa_link); IF_ADDR_UNLOCK(ifp); + ifa_free(ifa0); /* if_addrhead */ /* * Now remove the at_ifaddr from the parallel structure * as well, or we'd be in deep trouble */ - aa0 = aa; - if (aa0 == (aa = at_ifaddr_list)) { + + AT_IFADDR_WLOCK(); + if (aa == (aa_temp = at_ifaddr_list)) { at_ifaddr_list = aa->aa_next; } else { - while (aa->aa_next && (aa->aa_next != aa0)) - aa = aa->aa_next; + while (aa_temp->aa_next && (aa_temp->aa_next != aa)) + aa_temp = aa_temp->aa_next; /* - * if we found it, remove it, otherwise we screwed up. + * if we found it, remove it, otherwise we + * screwed up. */ - if (aa->aa_next) - aa->aa_next = aa0->aa_next; + if (aa_temp->aa_next) + aa_temp->aa_next = aa->aa_next; else panic("at_control"); } AT_IFADDR_WUNLOCK(); - - /* - * Now reclaim the reference. - */ - ifa_free(ifa0); + ifa_free(ifa0); /* at_ifaddr_list */ + aa = aa_temp; break; default: - AT_IFADDR_WUNLOCK(); - if (ifp == NULL || ifp->if_ioctl == NULL) - return (EOPNOTSUPP); - return ((*ifp->if_ioctl)(ifp, cmd, data)); + if (ifp == NULL || ifp->if_ioctl == NULL) { + error = EOPNOTSUPP; + goto out; + } + error = ((*ifp->if_ioctl)(ifp, cmd, data)); } - return (0); + +out: + if (aa != NULL) + ifa_free(&aa->aa_ifa); + return (error); } /* Modified: head/sys/netatalk/at_extern.h ============================================================================== --- head/sys/netatalk/at_extern.h Wed Jun 24 10:28:30 2009 (r194818) +++ head/sys/netatalk/at_extern.h Wed Jun 24 10:32:44 2009 (r194819) @@ -55,6 +55,8 @@ u_short at_cksum(struct mbuf *m, int s int at_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td); struct at_ifaddr *at_ifawithnet(struct sockaddr_at *); +struct at_ifaddr *at_ifawithnet_locked(struct sockaddr_at *sat); + int at_inithead(void**, int); void ddp_init(void); int ddp_output(struct mbuf *m, struct socket *so); From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 10:33:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 60E7010656B2; Wed, 24 Jun 2009 10:33:36 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 336A38FC18; Wed, 24 Jun 2009 10:33:36 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OAXarF009212; Wed, 24 Jun 2009 10:33:36 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OAXawc009210; Wed, 24 Jun 2009 10:33:36 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906241033.n5OAXawc009210@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 10:33: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: r194820 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 10:33:37 -0000 Author: rwatson Date: Wed Jun 24 10:33:35 2009 New Revision: 194820 URL: http://svn.freebsd.org/changeset/base/194820 Log: In ARP input, more consistently acquire and release ifaddr references. MFC after: 6 weeks Modified: head/sys/netinet/if_ether.c Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Wed Jun 24 10:32:44 2009 (r194819) +++ head/sys/netinet/if_ether.c Wed Jun 24 10:33:35 2009 (r194820) @@ -512,13 +512,16 @@ in_arpinput(struct mbuf *m) LIST_FOREACH(ia, INADDR_HASH(itaddr.s_addr), ia_hash) { if (((bridged && ia->ia_ifp->if_bridge != NULL) || ia->ia_ifp == ifp) && - itaddr.s_addr == ia->ia_addr.sin_addr.s_addr) + itaddr.s_addr == ia->ia_addr.sin_addr.s_addr) { + ifa_ref(&ia->ia_ifa); goto match; + } #ifdef DEV_CARP if (ifp->if_carp != NULL && carp_iamatch(ifp->if_carp, ia, &isaddr, &enaddr) && itaddr.s_addr == ia->ia_addr.sin_addr.s_addr) { carp_match = 1; + ifa_ref(&ia->ia_ifa); goto match; } #endif @@ -526,8 +529,10 @@ in_arpinput(struct mbuf *m) LIST_FOREACH(ia, INADDR_HASH(isaddr.s_addr), ia_hash) if (((bridged && ia->ia_ifp->if_bridge != NULL) || ia->ia_ifp == ifp) && - isaddr.s_addr == ia->ia_addr.sin_addr.s_addr) + isaddr.s_addr == ia->ia_addr.sin_addr.s_addr) { + ifa_ref(&ia->ia_ifa); goto match; + } #define BDG_MEMBER_MATCHES_ARP(addr, ifp, ia) \ (ia->ia_ifp->if_bridge == ifp->if_softc && \ @@ -542,6 +547,7 @@ in_arpinput(struct mbuf *m) if (is_bridge) { LIST_FOREACH(ia, INADDR_HASH(itaddr.s_addr), ia_hash) { if (BDG_MEMBER_MATCHES_ARP(itaddr.s_addr, ifp, ia)) { + ifa_ref(&ia->ia_ifa); ifp = ia->ia_ifp; goto match; } @@ -553,20 +559,26 @@ in_arpinput(struct mbuf *m) * No match, use the first inet address on the receive interface * as a dummy address for the rest of the function. */ + IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (ifa->ifa_addr->sa_family == AF_INET) { ia = ifatoia(ifa); + ifa_ref(ifa); goto match; } + IF_ADDR_UNLOCK(ifp); + /* * If bridging, fall back to using any inet address. */ if (!bridged || (ia = TAILQ_FIRST(&V_in_ifaddrhead)) == NULL) goto drop; + ifa_ref(&ia->ia_ifa); match: if (!enaddr) enaddr = (u_int8_t *)IF_LLADDR(ifp); myaddr = ia->ia_addr.sin_addr; + ifa_free(&ia->ia_ifa); if (!bcmp(ar_sha(ah), enaddr, ifp->if_addrlen)) goto drop; /* it's from me, ignore it. */ if (!bcmp(ar_sha(ah), ifp->if_broadcastaddr, ifp->if_addrlen)) { From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 10:36:49 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 183F61065673; Wed, 24 Jun 2009 10:36:49 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 066788FC15; Wed, 24 Jun 2009 10:36:49 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OAamQ6009309; Wed, 24 Jun 2009 10:36:48 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OAamNW009307; Wed, 24 Jun 2009 10:36:48 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906241036.n5OAamNW009307@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 10:36: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: r194821 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 10:36:49 -0000 Author: rwatson Date: Wed Jun 24 10:36:48 2009 New Revision: 194821 URL: http://svn.freebsd.org/changeset/base/194821 Log: In if_setlladdr(), use IF_ADDR_LOCK() and ifaddr references to improve the safety of link layer address manipulation. MFC after: 6 weeks Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Wed Jun 24 10:33:35 2009 (r194820) +++ head/sys/net/if.c Wed Jun 24 10:36:48 2009 (r194821) @@ -3145,14 +3145,23 @@ if_setlladdr(struct ifnet *ifp, const u_ struct ifaddr *ifa; struct ifreq ifr; + IF_ADDR_LOCK(ifp); ifa = ifp->if_addr; - if (ifa == NULL) + if (ifa == NULL) { + IF_ADDR_UNLOCK(ifp); return (EINVAL); + } + ifa_ref(ifa); + IF_ADDR_UNLOCK(ifp); sdl = (struct sockaddr_dl *)ifa->ifa_addr; - if (sdl == NULL) + if (sdl == NULL) { + ifa_free(ifa); return (EINVAL); - if (len != sdl->sdl_alen) /* don't allow length to change */ + } + if (len != sdl->sdl_alen) { /* don't allow length to change */ + ifa_free(ifa); return (EINVAL); + } switch (ifp->if_type) { case IFT_ETHER: case IFT_FDDI: @@ -3164,10 +3173,13 @@ if_setlladdr(struct ifnet *ifp, const u_ case IFT_IEEE8023ADLAG: case IFT_IEEE80211: bcopy(lladdr, LLADDR(sdl), len); + ifa_free(ifa); break; default: + ifa_free(ifa); return (ENODEV); } + /* * If the interface is already up, we need * to re-init it in order to reprogram its From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 10:46:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F44B1065674; Wed, 24 Jun 2009 10:46:04 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0CD6D8FC0A; Wed, 24 Jun 2009 10:46:04 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OAk3lK009571; Wed, 24 Jun 2009 10:46:03 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OAk3iB009569; Wed, 24 Jun 2009 10:46:03 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906241046.n5OAk3iB009569@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 10:46: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: r194822 - head/sys/netatalk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 10:46:04 -0000 Author: rwatson Date: Wed Jun 24 10:46:03 2009 New Revision: 194822 URL: http://svn.freebsd.org/changeset/base/194822 Log: Printf fewer warnings when adding a route to an atalk address fails; userspace will print the error. MFC after: 3 days Modified: head/sys/netatalk/at_control.c Modified: head/sys/netatalk/at_control.c ============================================================================== --- head/sys/netatalk/at_control.c Wed Jun 24 10:36:48 2009 (r194821) +++ head/sys/netatalk/at_control.c Wed Jun 24 10:46:03 2009 (r194822) @@ -830,7 +830,6 @@ static int aa_addsingleroute(struct ifaddr *ifa, struct at_addr *addr, struct at_addr *mask) { - int error; #if 0 printf("aa_addsingleroute: %x.%x mask %x.%x ...\n", @@ -838,22 +837,15 @@ aa_addsingleroute(struct ifaddr *ifa, st mask->s_node); #endif - error = aa_dosingleroute(ifa, addr, mask, RTM_ADD, RTF_UP); - if (error) - printf("aa_addsingleroute: error %d\n", error); - return (error); + return (aa_dosingleroute(ifa, addr, mask, RTM_ADD, RTF_UP)); } static int aa_delsingleroute(struct ifaddr *ifa, struct at_addr *addr, struct at_addr *mask) { - int error; - error = aa_dosingleroute(ifa, addr, mask, RTM_DELETE, 0); - if (error) - printf("aa_delsingleroute: error %d\n", error); - return (error); + return (aa_dosingleroute(ifa, addr, mask, RTM_DELETE, 0)); } static int From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 12:01:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6F4C1065749; Wed, 24 Jun 2009 12:01:10 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 925BB8FC14; Wed, 24 Jun 2009 12:01:10 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OC1AbZ013421; Wed, 24 Jun 2009 12:01:10 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OC1A1H013418; Wed, 24 Jun 2009 12:01:10 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200906241201.n5OC1A1H013418@svn.freebsd.org> From: Roman Divacky Date: Wed, 24 Jun 2009 12:01: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: r194825 - in head/sys: contrib/ngatm/netnatm/sig netgraph/atm/uni X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 12:01:11 -0000 Author: rdivacky Date: Wed Jun 24 12:01:10 2009 New Revision: 194825 URL: http://svn.freebsd.org/changeset/base/194825 Log: Use proper form of gnu designated initalizers. This lets clang compile this files. Approved by: ed (mentor) Silence from: harti (maintainer?) Modified: head/sys/contrib/ngatm/netnatm/sig/sig_uni.c head/sys/netgraph/atm/uni/ng_uni.c Modified: head/sys/contrib/ngatm/netnatm/sig/sig_uni.c ============================================================================== --- head/sys/contrib/ngatm/netnatm/sig/sig_uni.c Wed Jun 24 12:01:00 2009 (r194824) +++ head/sys/contrib/ngatm/netnatm/sig/sig_uni.c Wed Jun 24 12:01:10 2009 (r194825) @@ -109,7 +109,7 @@ static const char *sig_names[] = { }; static const char *verb_names[] = { -# define UNI_DEBUG_DEFINE(D) [UNI_FAC_##D] #D, +# define UNI_DEBUG_DEFINE(D) [UNI_FAC_##D] = #D, UNI_DEBUG_FACILITIES # undef UNI_DEBUG_DEFINE }; Modified: head/sys/netgraph/atm/uni/ng_uni.c ============================================================================== --- head/sys/netgraph/atm/uni/ng_uni.c Wed Jun 24 12:01:00 2009 (r194824) +++ head/sys/netgraph/atm/uni/ng_uni.c Wed Jun 24 12:01:10 2009 (r194825) @@ -743,7 +743,7 @@ uni_verbose(struct uni *uni, void *varg, va_list ap; static char *facnames[] = { -#define UNI_DEBUG_DEFINE(D) [UNI_FAC_##D] #D, +#define UNI_DEBUG_DEFINE(D) [UNI_FAC_##D] = #D, UNI_DEBUG_FACILITIES #undef UNI_DEBUG_DEFINE }; From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 12:06:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 287D2106568F; Wed, 24 Jun 2009 12:06:16 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 020698FC17; Wed, 24 Jun 2009 12:06:16 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OC6FAt013650; Wed, 24 Jun 2009 12:06:15 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OC6FpT013646; Wed, 24 Jun 2009 12:06:15 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906241206.n5OC6FpT013646@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 12:06: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: r194828 - in head: share/man/man9 sys/kern sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 12:06:24 -0000 Author: rwatson Date: Wed Jun 24 12:06:15 2009 New Revision: 194828 URL: http://svn.freebsd.org/changeset/base/194828 Log: Add stack_print_short() and stack_print_short_ddb() interfaces to stack(9), which generate a more compact rendition of a stack trace via the kernel's printf. MFC after: 1 week Modified: head/share/man/man9/stack.9 head/sys/kern/subr_stack.c head/sys/sys/stack.h Modified: head/share/man/man9/stack.9 ============================================================================== --- head/share/man/man9/stack.9 Wed Jun 24 12:04:26 2009 (r194827) +++ head/share/man/man9/stack.9 Wed Jun 24 12:06:15 2009 (r194828) @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2007 Robert N. M. Watson +.\" Copyright (c) 2007-2009 Robert N. M. Watson .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 27, 2007 +.Dd June 24, 2009 .Dt STACK 9 .Os .Sh NAME @@ -54,6 +54,10 @@ In the kernel configuration file: .Ft void .Fn stack_print_ddb "struct stack *st" .Ft void +.Fn stack_print_short "struct stack *st" +.Ft void +.Fn stack_print_short_ddb "struct stack *st" +.Ft void .Fn stack_sbuf_print "struct sbuf sb*" "struct stack *st" .Ft void .Fn stack_sbuf_print_ddb "struct sbuf sb*" "struct stack *st" @@ -84,6 +88,8 @@ A trace of the current kernel thread's c .Fn stack_save . .Pp .Fn stack_print +and +.Fn stack_print_short may be used to print a stack trace using the kernel .Xr printf 9 , and may sleep as a result of acquiring @@ -91,7 +97,9 @@ and may sleep as a result of acquiring locks in the kernel linker while looking up symbol names. In locking-sensitive environments, the unsynchronized .Fn stack_print_ddb -variant may be invoked. +and +.Fn stack_print_short_ddb +variants may be invoked. This function bypasses kernel linker locking, making it usable in .Xr ddb 4 , but not in a live system where linker data structures may change. Modified: head/sys/kern/subr_stack.c ============================================================================== --- head/sys/kern/subr_stack.c Wed Jun 24 12:04:26 2009 (r194827) +++ head/sys/kern/subr_stack.c Wed Jun 24 12:06:15 2009 (r194828) @@ -42,10 +42,10 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_STACK, "stack", "Stack Traces"); -static void stack_symbol(vm_offset_t pc, char *namebuf, u_int buflen, +static int stack_symbol(vm_offset_t pc, char *namebuf, u_int buflen, long *offset); #ifdef DDB -static void stack_symbol_ddb(vm_offset_t pc, const char **name, long *offset); +static int stack_symbol_ddb(vm_offset_t pc, const char **name, long *offset); #endif struct stack * @@ -98,12 +98,33 @@ stack_print(struct stack *st) KASSERT(st->depth <= STACK_MAX, ("bogus stack")); for (i = 0; i < st->depth; i++) { - stack_symbol(st->pcs[i], namebuf, sizeof(namebuf), &offset); + (void)stack_symbol(st->pcs[i], namebuf, sizeof(namebuf), + &offset); printf("#%d %p at %s+%#lx\n", i, (void *)st->pcs[i], namebuf, offset); } } +void +stack_print_short(struct stack *st) +{ + char namebuf[64]; + long offset; + int i; + + KASSERT(st->depth <= STACK_MAX, ("bogus stack")); + for (i = 0; i < st->depth; i++) { + if (i > 0) + printf(" "); + if (stack_symbol(st->pcs[i], namebuf, sizeof(namebuf), + &offset) == 0) + printf("%s+%#lx", namebuf, offset); + else + printf("%p", (void *)st->pcs[i]); + } + printf("\n"); +} + #ifdef DDB void stack_print_ddb(struct stack *st) @@ -119,6 +140,25 @@ stack_print_ddb(struct stack *st) name, offset); } } + +void +stack_print_short_ddb(struct stack *st) +{ + const char *name; + long offset; + int i; + + KASSERT(st->depth <= STACK_MAX, ("bogus stack")); + for (i = 0; i < st->depth; i++) { + if (i > 0) + printf(" "); + if (stack_symbol_ddb(st->pcs[i], &name, &offset) == 0) + printf("%s+%#lx", name, offset); + else + printf("%p", (void *)st->pcs[i]); + } + printf("\n"); +} #endif /* @@ -134,7 +174,8 @@ stack_sbuf_print(struct sbuf *sb, struct KASSERT(st->depth <= STACK_MAX, ("bogus stack")); for (i = 0; i < st->depth; i++) { - stack_symbol(st->pcs[i], namebuf, sizeof(namebuf), &offset); + (void)stack_symbol(st->pcs[i], namebuf, sizeof(namebuf), + &offset); sbuf_printf(sb, "#%d %p at %s+%#lx\n", i, (void *)st->pcs[i], namebuf, offset); } @@ -150,7 +191,7 @@ stack_sbuf_print_ddb(struct sbuf *sb, st KASSERT(st->depth <= STACK_MAX, ("bogus stack")); for (i = 0; i < st->depth; i++) { - stack_symbol_ddb(st->pcs[i], &name, &offset); + (void)stack_symbol_ddb(st->pcs[i], &name, &offset); sbuf_printf(sb, "#%d %p at %s+%#lx\n", i, (void *)st->pcs[i], name, offset); } @@ -188,7 +229,7 @@ stack_ktr(u_int mask, const char *file, if (depth == 0 || st->depth < depth) depth = st->depth; for (i = 0; i < depth; i++) { - stack_symbol_ddb(st->pcs[i], &name, &offset); + (void)stack_symbol_ddb(st->pcs[i], &name, &offset); ktr_tracepoint(mask, file, line, "#%d %p at %s+%#lx", i, st->pcs[i], (u_long)name, offset, 0, 0); } @@ -201,7 +242,7 @@ stack_ktr(u_int mask, const char *file, * Two variants of stack symbol lookup -- one that uses the DDB interfaces * and bypasses linker locking, and the other that doesn't. */ -static void +static int stack_symbol(vm_offset_t pc, char *namebuf, u_int buflen, long *offset) { @@ -209,11 +250,13 @@ stack_symbol(vm_offset_t pc, char *nameb offset) != 0) { *offset = 0; strlcpy(namebuf, "??", buflen); - } + return (ENOENT); + } else + return (0); } #ifdef DDB -static void +static int stack_symbol_ddb(vm_offset_t pc, const char **name, long *offset) { linker_symval_t symval; @@ -225,10 +268,11 @@ stack_symbol_ddb(vm_offset_t pc, const c goto out; if (symval.name != NULL) { *name = symval.name; - return; + return (0); } out: *offset = 0; *name = "??"; + return (ENOENT); } #endif Modified: head/sys/sys/stack.h ============================================================================== --- head/sys/sys/stack.h Wed Jun 24 12:04:26 2009 (r194827) +++ head/sys/sys/stack.h Wed Jun 24 12:06:15 2009 (r194828) @@ -41,6 +41,8 @@ void stack_copy(struct stack *, struct void stack_zero(struct stack *); void stack_print(struct stack *); void stack_print_ddb(struct stack *); +void stack_print_short(struct stack *); +void stack_print_short_ddb(struct stack *); void stack_sbuf_print(struct sbuf *, struct stack *); void stack_sbuf_print_ddb(struct sbuf *, struct stack *); #ifdef KTR From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 12:17:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85F751065670; Wed, 24 Jun 2009 12:17:58 +0000 (UTC) (envelope-from flo@kasimir.com) Received: from mail.solomo.de (mail.solomo.de [85.214.49.72]) by mx1.freebsd.org (Postfix) with ESMTP id DBE848FC1F; Wed, 24 Jun 2009 12:17:56 +0000 (UTC) (envelope-from flo@kasimir.com) Received: from localhost (localhost [127.0.0.1]) by mail.solomo.de (Postfix) with ESMTP id B14763F54F; Wed, 24 Jun 2009 14:07:47 +0200 (CEST) X-Virus-Scanned: amavisd-new at vistream.de Received: from mail.solomo.de ([127.0.0.1]) by localhost (mail.solomo.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id exlv6XOu-ib6; Wed, 24 Jun 2009 14:07:45 +0200 (CEST) Received: from nibbler.vistream.local (relay3.vistream.de [87.139.10.28]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.solomo.de (Postfix) with ESMTPSA id 867A73F54B; Wed, 24 Jun 2009 14:07:45 +0200 (CEST) Message-ID: <4A421711.40907@kasimir.com> Date: Wed, 24 Jun 2009 14:07:45 +0200 From: Florian Smeets User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1pre) Gecko/20090623 Shredder/3.0b3pre MIME-Version: 1.0 To: Konstantin Belousov References: <200906232045.n5NKjMMC089652@svn.freebsd.org> In-Reply-To: <200906232045.n5NKjMMC089652@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194766 - in head/sys: dev/md fs/procfs fs/tmpfs kern security/mac_biba security/mac_lomac sys vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 12:17:58 -0000 On 23.06.09 22:45, Konstantin Belousov wrote: > Author: kib > Date: Tue Jun 23 20:45:22 2009 > New Revision: 194766 > URL: http://svn.freebsd.org/changeset/base/194766 > Hi kib, this commit breaks my sparc64. boot -v does only show: FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 8.0-CURRENT #3 r194766M: Wed Jun 24 13:58:36 CEST 2009 root@280r.solomo.de:/usr/obj/usr/src/sys/280R panic: trap: fast data access mmu miss cpuid = 0 KDB: enter: panic [thread pid 0 tid 0 ] Stopped at 0xc01fe840: ta %xcc, 1 db> where Tracing pid 0 tid 0 td 0xc053c520 (null)() at 0xc01c878c (null)() at 0xc03bc530 (null)() at 0xc0060fd8 (null)() at 0xc03487b0 (null)() at 0xc0359c48 (null)() at 0xc035af68 (null)() at 0xc03b4200 (null)() at 0xc0356f94 (null)() at 0xc017792c (null)() at 0xc0060030 db> usually the next few lines are: real memory = 6442450944 (6144 MB) avail memory = 6286557184 (5995 MB) cpu0: Sun Microsystems UltraSparc-III+ Processor (900.00 MHz CPU) cpu1: Sun Microsystems UltraSparc-III+ Processor (900.00 MHz CPU) FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs r194765 boots fine. This one panics. Anything i can do, anything you want me to try? Cheers, Florian From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 12:53:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 402E2106564A; Wed, 24 Jun 2009 12:53:00 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2DC5E8FC14; Wed, 24 Jun 2009 12:53:00 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OCr0Jd014650; Wed, 24 Jun 2009 12:53:00 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OCr00p014648; Wed, 24 Jun 2009 12:53:00 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906241253.n5OCr00p014648@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 12:53:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194831 - head/lib/libutil X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 12:53:00 -0000 Author: rwatson Date: Wed Jun 24 12:52:59 2009 New Revision: 194831 URL: http://svn.freebsd.org/changeset/base/194831 Log: Fix copy-and-paste-o's from kinfo_getfile.3 in kinfo_getvmmap.3. MFC after: 3 days Modified: head/lib/libutil/kinfo_getvmmap.3 Modified: head/lib/libutil/kinfo_getvmmap.3 ============================================================================== --- head/lib/libutil/kinfo_getvmmap.3 Wed Jun 24 12:08:23 2009 (r194830) +++ head/lib/libutil/kinfo_getvmmap.3 Wed Jun 24 12:52:59 2009 (r194831) @@ -37,9 +37,9 @@ .In sys/types.h .In libutil.h .Ft struct kinfo_vmentry * -.Fn kinfo_getfile "pid_t pid" "int *cntp" +.Fn kinfo_getvmmap "pid_t pid" "int *cntp" .Sh DESCRIPTION -This function is used for obtaining the file descriptor information +This function is used for obtaining virtual memory mapping information of a particular process. .Pp The From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 13:08:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 504551065670; Wed, 24 Jun 2009 13:08:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by mx1.freebsd.org (Postfix) with ESMTP id D520B8FC1D; Wed, 24 Jun 2009 13:08:20 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n5OD8GBD080577 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Jun 2009 16:08:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n5OD8G1e018569; Wed, 24 Jun 2009 16:08:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n5OD8Gfo018568; Wed, 24 Jun 2009 16:08:16 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 24 Jun 2009 16:08:16 +0300 From: Kostik Belousov To: Florian Smeets Message-ID: <20090624130816.GC2884@deviant.kiev.zoral.com.ua> References: <200906232045.n5NKjMMC089652@svn.freebsd.org> <4A421711.40907@kasimir.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="aHyShe78FfJzbeER" Content-Disposition: inline In-Reply-To: <4A421711.40907@kasimir.com> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.1 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 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: r194766 - in head/sys: dev/md fs/procfs fs/tmpfs kern security/mac_biba security/mac_lomac sys vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 13:08:21 -0000 --aHyShe78FfJzbeER Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 24, 2009 at 02:07:45PM +0200, Florian Smeets wrote: > On 23.06.09 22:45, Konstantin Belousov wrote: > >Author: kib > >Date: Tue Jun 23 20:45:22 2009 > >New Revision: 194766 > >URL: http://svn.freebsd.org/changeset/base/194766 > > >=20 > Hi kib, >=20 > this commit breaks my sparc64. >=20 > boot -v does only show: >=20 I assume the lines Copyright (c) 1992-2009 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. must be before these two ? > FreeBSD is a registered trademark of The FreeBSD Foundation. > FreeBSD 8.0-CURRENT #3 r194766M: Wed Jun 24 13:58:36 CEST 2009 What are the local changes you have in your sources ? > root@280r.solomo.de:/usr/obj/usr/src/sys/280R > panic: trap: fast data access mmu miss > cpuid =3D 0 > KDB: enter: panic > [thread pid 0 tid 0 ] > Stopped at 0xc01fe840: ta %xcc, 1 Can you look for the source line for this instruction ? > db> where > Tracing pid 0 tid 0 td 0xc053c520 > (null)() at 0xc01c878c > (null)() at 0xc03bc530 > (null)() at 0xc0060fd8 > (null)() at 0xc03487b0 > (null)() at 0xc0359c48 > (null)() at 0xc035af68 > (null)() at 0xc03b4200 > (null)() at 0xc0356f94 > (null)() at 0xc017792c > (null)() at 0xc0060030 > db> >=20 > usually the next few lines are: >=20 > real memory =3D 6442450944 (6144 MB) > avail memory =3D 6286557184 (5995 MB) These lines are printed by sparc64/sparc64/machdep.c:cpu_startup(). > cpu0: Sun Microsystems UltraSparc-III+ Processor (900.00 MHz CPU) > cpu1: Sun Microsystems UltraSparc-III+ Processor (900.00 MHz CPU) > FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs >=20 > r194765 boots fine. This one panics. >=20 > Anything i can do, anything you want me to try? I do not see anything obvious that might explain this. The changes I made add or substract allocation sizes from several variables, so to speak. Ideally, we need to find exact location in the boot sequence where the trap happen. The appearance of the copyright message means that sparc64_init() is done, and MI startup code is running. You may define VERBOSE_SYSINIT in init_main.c and watch what startup code is last called. --aHyShe78FfJzbeER Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkpCJT8ACgkQC3+MBN1Mb4gwdgCeKPC8jbL1+bxWm765nZ3zbR9m LGAAn2lmxulndvnvvUeAGXWCmIaxt6H2 =11sV -----END PGP SIGNATURE----- --aHyShe78FfJzbeER-- From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 13:30:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13F311065675; Wed, 24 Jun 2009 13:30:58 +0000 (UTC) (envelope-from flo@kasimir.com) Received: from mail.solomo.de (mail.solomo.de [85.214.49.72]) by mx1.freebsd.org (Postfix) with ESMTP id B4D0C8FC0A; Wed, 24 Jun 2009 13:30:57 +0000 (UTC) (envelope-from flo@kasimir.com) Received: from localhost (localhost [127.0.0.1]) by mail.solomo.de (Postfix) with ESMTP id 8DF443F4E5; Wed, 24 Jun 2009 15:30:56 +0200 (CEST) X-Virus-Scanned: amavisd-new at vistream.de Received: from mail.solomo.de ([127.0.0.1]) by localhost (mail.solomo.de [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Q34652zsdl6Q; Wed, 24 Jun 2009 15:30:54 +0200 (CEST) Received: from nibbler.vistream.local (relay3.vistream.de [87.139.10.28]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.solomo.de (Postfix) with ESMTPSA id 1FAE73F4D1; Wed, 24 Jun 2009 15:30:54 +0200 (CEST) Message-ID: <4A422A8C.8030006@kasimir.com> Date: Wed, 24 Jun 2009 15:30:52 +0200 From: Florian Smeets User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1pre) Gecko/20090624 Shredder/3.0b3pre MIME-Version: 1.0 To: Kostik Belousov References: <200906232045.n5NKjMMC089652@svn.freebsd.org> <4A421711.40907@kasimir.com> <20090624130816.GC2884@deviant.kiev.zoral.com.ua> In-Reply-To: <20090624130816.GC2884@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194766 - in head/sys: dev/md fs/procfs fs/tmpfs kern security/mac_biba security/mac_lomac sys vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 13:30:58 -0000 On 24.06.09 15:08, Kostik Belousov wrote: > On Wed, Jun 24, 2009 at 02:07:45PM +0200, Florian Smeets wrote: >> On 23.06.09 22:45, Konstantin Belousov wrote: >>> Author: kib >>> Date: Tue Jun 23 20:45:22 2009 >>> New Revision: 194766 >>> URL: http://svn.freebsd.org/changeset/base/194766 >>> >> >> Hi kib, >> >> this commit breaks my sparc64. >> >> boot -v does only show: >> > I assume the lines > Copyright (c) 1992-2009 The FreeBSD Project. > Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 > The Regents of the University of California. All rights reserved. > must be before these two ? Yes, of course. My sentence was poorly phrased, sorry. > >> FreeBSD is a registered trademark of The FreeBSD Foundation. >> FreeBSD 8.0-CURRENT #3 r194766M: Wed Jun 24 13:58:36 CEST 2009 > What are the local changes you have in your sources ? No i don't have local changes anymore. This was stock head@r194766. >> root@280r.solomo.de:/usr/obj/usr/src/sys/280R >> panic: trap: fast data access mmu miss >> cpuid = 0 >> KDB: enter: panic >> [thread pid 0 tid 0 ] >> Stopped at 0xc01fe840: ta %xcc, 1 > Can you look for the source line for this instruction ? The only thing i could find was this: root@280r:~ 5 > nm -n /boot/kernel/kernel | grep c01fe840 root@280r:~ 6 > nm -n /boot/kernel/kernel | grep c01fe8 00000000c01fe880 t kdb_sysctl_enter You wanted me to run nm on the kernel, right? > > Ideally, we need to find exact location in the boot sequence where > the trap happen. > > The appearance of the copyright message means that sparc64_init() is > done, and MI startup code is running. You may define VERBOSE_SYSINIT > in init_main.c and watch what startup code is last called. > I'll do that and let you know. Cheers, Florian From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 13:35:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CFB4106564A; Wed, 24 Jun 2009 13:35:39 +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 3B0748FC1E; Wed, 24 Jun 2009 13:35:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5ODZd7a015711; Wed, 24 Jun 2009 13:35:39 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5ODZdJA015707; Wed, 24 Jun 2009 13:35:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906241335.n5ODZdJA015707@svn.freebsd.org> From: John Baldwin Date: Wed, 24 Jun 2009 13:35: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: r194832 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 13:35:39 -0000 Author: jhb Date: Wed Jun 24 13:35:38 2009 New Revision: 194832 URL: http://svn.freebsd.org/changeset/base/194832 Log: - Move syscall function argument structure types to be just above the relevenat system call function. - Whitespace fixes. Modified: head/sys/kern/sysv_msg.c head/sys/kern/sysv_sem.c head/sys/kern/sysv_shm.c Modified: head/sys/kern/sysv_msg.c ============================================================================== --- head/sys/kern/sysv_msg.c Wed Jun 24 12:52:59 2009 (r194831) +++ head/sys/kern/sysv_msg.c Wed Jun 24 13:35:38 2009 (r194832) @@ -314,8 +314,7 @@ SYSCALL_MODULE_HELPER(msgget); SYSCALL_MODULE_HELPER(msgsnd); SYSCALL_MODULE_HELPER(msgrcv); -DECLARE_MODULE(sysvmsg, sysvmsg_mod, - SI_SUB_SYSV_MSG, SI_ORDER_FIRST); +DECLARE_MODULE(sysvmsg, sysvmsg_mod, SI_SUB_SYSV_MSG, SI_ORDER_FIRST); MODULE_VERSION(sysvmsg, 1); /* Modified: head/sys/kern/sysv_sem.c ============================================================================== --- head/sys/kern/sysv_sem.c Wed Jun 24 12:52:59 2009 (r194831) +++ head/sys/kern/sysv_sem.c Wed Jun 24 13:35:38 2009 (r194832) @@ -322,8 +322,7 @@ SYSCALL_MODULE_HELPER(__semctl); SYSCALL_MODULE_HELPER(semget); SYSCALL_MODULE_HELPER(semop); -DECLARE_MODULE(sysvsem, sysvsem_mod, - SI_SUB_SYSV_SEM, SI_ORDER_FIRST); +DECLARE_MODULE(sysvsem, sysvsem_mod, SI_SUB_SYSV_SEM, SI_ORDER_FIRST); MODULE_VERSION(sysvsem, 1); /* Modified: head/sys/kern/sysv_shm.c ============================================================================== --- head/sys/kern/sysv_shm.c Wed Jun 24 12:52:59 2009 (r194831) +++ head/sys/kern/sysv_shm.c Wed Jun 24 13:35:38 2009 (r194832) @@ -519,13 +519,6 @@ done2: } #endif -#ifndef _SYS_SYSPROTO_H_ -struct shmctl_args { - int shmid; - int cmd; - struct shmid_ds *buf; -}; -#endif int kern_shmctl(td, shmid, cmd, buf, bufsz) struct thread *td; @@ -636,6 +629,13 @@ done2: return (error); } +#ifndef _SYS_SYSPROTO_H_ +struct shmctl_args { + int shmid; + int cmd; + struct shmid_ds *buf; +}; +#endif int shmctl(td, uap) struct thread *td; @@ -680,13 +680,6 @@ done: } -#ifndef _SYS_SYSPROTO_H_ -struct shmget_args { - key_t key; - size_t size; - int shmflg; -}; -#endif static int shmget_existing(td, uap, mode, segnum) struct thread *td; @@ -807,6 +800,13 @@ shmget_allocate_segment(td, uap, mode) return (0); } +#ifndef _SYS_SYSPROTO_H_ +struct shmget_args { + key_t key; + size_t size; + int shmflg; +}; +#endif int shmget(td, uap) struct thread *td; @@ -1024,6 +1024,5 @@ SYSCALL_MODULE_HELPER(shmctl); SYSCALL_MODULE_HELPER(shmdt); SYSCALL_MODULE_HELPER(shmget); -DECLARE_MODULE(sysvshm, sysvshm_mod, - SI_SUB_SYSV_SHM, SI_ORDER_FIRST); +DECLARE_MODULE(sysvshm, sysvshm_mod, SI_SUB_SYSV_SHM, SI_ORDER_FIRST); MODULE_VERSION(sysvshm, 1); From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 13:36:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A292A1065674; Wed, 24 Jun 2009 13:36:37 +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 8FCDE8FC0A; Wed, 24 Jun 2009 13:36:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5ODabUG015765; Wed, 24 Jun 2009 13:36:37 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5ODabXj015761; Wed, 24 Jun 2009 13:36:37 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906241336.n5ODabXj015761@svn.freebsd.org> From: John Baldwin Date: Wed, 24 Jun 2009 13:36: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: r194833 - in head/sys: compat/freebsd32 kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 13:36:38 -0000 Author: jhb Date: Wed Jun 24 13:36:37 2009 New Revision: 194833 URL: http://svn.freebsd.org/changeset/base/194833 Log: Add a new COMPAT7 flag for FreeBSD 7.x compatibility system calls. Modified: head/sys/compat/freebsd32/syscalls.master head/sys/kern/makesyscalls.sh head/sys/kern/syscalls.master Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Wed Jun 24 13:35:38 2009 (r194832) +++ head/sys/compat/freebsd32/syscalls.master Wed Jun 24 13:36:37 2009 (r194833) @@ -13,7 +13,7 @@ ; case where the event exists, but we don't want auditing, the ; event should be #defined to AUE_NULL in audit_kevents.h. ; type one of STD, OBSOL, UNIMPL, COMPAT, COMPAT4, COMPAT6, -; LIBCOMPAT, NODEF, NOARGS, NOPROTO, NOSTD +; COMPAT7, LIBCOMPAT, NODEF, NOARGS, NOPROTO, NOSTD ; The COMPAT* options may be combined with one or more NO* ; options separated by '|' with no spaces (e.g. COMPAT|NOARGS) ; name psuedo-prototype of syscall routine @@ -28,6 +28,7 @@ ; COMPAT included on COMPAT #ifdef ; COMPAT4 included on COMPAT4 #ifdef (FreeBSD 4 compat) ; COMPAT6 included on COMPAT6 #ifdef (FreeBSD 6 compat) +; COMPAT7 included on COMPAT7 #ifdef (FreeBSD 7 compat) ; LIBCOMPAT included on COMPAT #ifdef, and placed in syscall.h ; OBSOL obsolete, not included in system, only specifies name ; UNIMPL not implemented, placeholder only Modified: head/sys/kern/makesyscalls.sh ============================================================================== --- head/sys/kern/makesyscalls.sh Wed Jun 24 13:35:38 2009 (r194832) +++ head/sys/kern/makesyscalls.sh Wed Jun 24 13:36:37 2009 (r194833) @@ -8,6 +8,7 @@ set -e compat=COMPAT_43 compat4=COMPAT_FREEBSD4 compat6=COMPAT_FREEBSD6 +compat7=COMPAT_FREEBSD7 # output files: sysnames="syscalls.c" @@ -30,15 +31,17 @@ syscompat4="sysent.compat4.$$" syscompat4dcl="sysent.compat4dcl.$$" syscompat6="sysent.compat6.$$" syscompat6dcl="sysent.compat6dcl.$$" +syscompat7="sysent.compat7.$$" +syscompat7dcl="sysent.compat7dcl.$$" sysent="sysent.switch.$$" sysinc="sysinc.switch.$$" sysarg="sysarg.switch.$$" sysprotoend="sysprotoend.$$" systracetmp="systrace.$$" -trap "rm $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $syscompat6 $syscompat6dcl $sysent $sysinc $sysarg $sysprotoend $systracetmp" 0 +trap "rm $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $syscompat6 $syscompat6dcl $syscompat7 $syscompat7dcl $sysent $sysinc $sysarg $sysprotoend $systracetmp" 0 -touch $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $syscompat6 $syscompat6dcl $sysent $sysinc $sysarg $sysprotoend $systracetmp +touch $sysaue $sysdcl $syscompat $syscompatdcl $syscompat4 $syscompat4dcl $syscompat6 $syscompat6dcl $syscompat7 $syscompat7dcl $sysent $sysinc $sysarg $sysprotoend $systracetmp case $# in 0) echo "usage: $0 input-file " 1>&2 @@ -75,6 +78,8 @@ s/\$//g syscompat4dcl = \"$syscompat4dcl\" syscompat6 = \"$syscompat6\" syscompat6dcl = \"$syscompat6dcl\" + syscompat7 = \"$syscompat7\" + syscompat7dcl = \"$syscompat7dcl\" sysent = \"$sysent\" syssw = \"$syssw\" sysinc = \"$sysinc\" @@ -87,6 +92,7 @@ s/\$//g compat = \"$compat\" compat4 = \"$compat4\" compat6 = \"$compat6\" + compat7 = \"$compat7\" syscallprefix = \"$syscallprefix\" switchname = \"$switchname\" namesname = \"$namesname\" @@ -104,6 +110,7 @@ s/\$//g printf "\n#ifdef %s\n\n", compat > syscompat printf "\n#ifdef %s\n\n", compat4 > syscompat4 printf "\n#ifdef %s\n\n", compat6 > syscompat6 + printf "\n#ifdef %s\n\n", compat7 > syscompat7 printf "/*\n * System call names.\n *\n" > sysnames printf " * DO NOT EDIT-- this file is automatically generated.\n" > sysnames @@ -181,6 +188,7 @@ s/\$//g print > syscompat print > syscompat4 print > syscompat6 + print > syscompat7 print > sysnames savesyscall = syscall next @@ -192,6 +200,7 @@ s/\$//g print > syscompat print > syscompat4 print > syscompat6 + print > syscompat7 print > sysnames syscall = savesyscall next @@ -203,6 +212,7 @@ s/\$//g print > syscompat print > syscompat4 print > syscompat6 + print > syscompat7 print > sysnames next } @@ -286,6 +296,8 @@ s/\$//g argalias = "freebsd4_" argalias if (flag("COMPAT6")) argalias = "freebsd6_" argalias + if (flag("COMPAT7")) + argalias = "freebsd7_" argalias } f++ @@ -407,7 +419,8 @@ s/\$//g syscall++ next } - type("COMPAT") || type("COMPAT4") || type("COMPAT6") { + type("COMPAT") || type("COMPAT4") || type("COMPAT6") || \ + type("COMPAT7") { if (flag("COMPAT")) { ncompat++ out = syscompat @@ -429,6 +442,13 @@ s/\$//g wrap = "compat6" prefix = "freebsd6_" descr = "freebsd6" + } else if (flag("COMPAT7")) { + ncompat7++ + out = syscompat7 + outdcl = syscompat7dcl + wrap = "compat7" + prefix = "freebsd7_" + descr = "freebsd7" } parseline() if (argc != 0 && !flag("NOARGS") && !flag("NOPROTO") && \ @@ -520,7 +540,7 @@ s/\$//g END { printf "\n#define AS(name) (sizeof(struct name) / sizeof(register_t))\n" > sysinc - if (ncompat != 0 || ncompat4 != 0 || ncompat6 != 0) + if (ncompat != 0 || ncompat4 != 0 || ncompat6 != 0 || ncompat7 != 0) printf "#include \"opt_compat.h\"\n\n" > syssw if (ncompat != 0) { @@ -547,9 +567,18 @@ s/\$//g printf "#endif\n" > sysinc } + if (ncompat7 != 0) { + printf "\n#ifdef %s\n", compat7 > sysinc + printf "#define compat7(n, name) n, (sy_call_t *)__CONCAT(freebsd7_,name)\n" > sysinc + printf "#else\n" > sysinc + printf "#define compat7(n, name) 0, (sy_call_t *)nosys\n" > sysinc + printf "#endif\n" > sysinc + } + printf("\n#endif /* %s */\n\n", compat) > syscompatdcl printf("\n#endif /* %s */\n\n", compat4) > syscompat4dcl printf("\n#endif /* %s */\n\n", compat6) > syscompat6dcl + printf("\n#endif /* %s */\n\n", compat7) > syscompat7dcl printf("\n#undef PAD_\n") > sysprotoend printf("#undef PADL_\n") > sysprotoend @@ -570,6 +599,7 @@ cat $sysarg $sysdcl \ $syscompat $syscompatdcl \ $syscompat4 $syscompat4dcl \ $syscompat6 $syscompat6dcl \ + $syscompat7 $syscompat7dcl \ $sysaue $sysprotoend > $sysproto cat $systracetmp >> $systrace Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Wed Jun 24 13:35:38 2009 (r194832) +++ head/sys/kern/syscalls.master Wed Jun 24 13:36:37 2009 (r194833) @@ -12,7 +12,7 @@ ; case where the event exists, but we don't want auditing, the ; event should be #defined to AUE_NULL in audit_kevents.h. ; type one of STD, OBSOL, UNIMPL, COMPAT, COMPAT4, COMPAT6, -; LIBCOMPAT, NODEF, NOARGS, NOPROTO, NOSTD +; COMPAT7, LIBCOMPAT, NODEF, NOARGS, NOPROTO, NOSTD ; The COMPAT* options may be combined with one or more NO* ; options separated by '|' with no spaces (e.g. COMPAT|NOARGS) ; name psuedo-prototype of syscall routine @@ -27,6 +27,7 @@ ; COMPAT included on COMPAT #ifdef ; COMPAT4 included on COMPAT4 #ifdef (FreeBSD 4 compat) ; COMPAT6 included on COMPAT6 #ifdef (FreeBSD 6 compat) +; COMPAT7 included on COMPAT7 #ifdef (FreeBSD 7 compat) ; LIBCOMPAT included on COMPAT #ifdef, and placed in syscall.h ; OBSOL obsolete, not included in system, only specifies name ; UNIMPL not implemented, placeholder only From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 14:29:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61B641065670; Wed, 24 Jun 2009 14:29:40 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FD138FC2E; Wed, 24 Jun 2009 14:29:40 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OETerp016918; Wed, 24 Jun 2009 14:29:40 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OETesR016916; Wed, 24 Jun 2009 14:29:40 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906241429.n5OETesR016916@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 14:29: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: r194835 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 14:29:40 -0000 Author: rwatson Date: Wed Jun 24 14:29:40 2009 New Revision: 194835 URL: http://svn.freebsd.org/changeset/base/194835 Log: Clear 'ia' after iterating if_addrhead for unicast address matching: since 'ifa' was used as the TAILQ_FOREACH() iterator argument, and 'ia' was just derived form it, it could be left non-NULL which confused later conditional freeing code. This could cause kernel panics if multicast IP packets were received. [1] Call 'struct in_ifaddr *' in ip_rtaddr() 'ia', not 'ifa' in keeping with normal conventions. When 'ipstealth' is enabled returns from ip_input early, properly release the 'ia' reference. Reported by: lstewart, sam [1] MFC after: 6 weeks Modified: head/sys/netinet/ip_input.c Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Wed Jun 24 13:38:08 2009 (r194834) +++ head/sys/netinet/ip_input.c Wed Jun 24 14:29:40 2009 (r194835) @@ -661,6 +661,7 @@ passin: #endif } IF_ADDR_UNLOCK(ifp); + ia = NULL; } /* RFC 3927 2.7: Do not forward datagrams for 169.254.0.0/16. */ if (IN_LINKLOCAL(ntohl(ip->ip_dst.s_addr))) { @@ -738,9 +739,11 @@ ours: * IPSTEALTH: Process non-routing options only * if the packet is destined for us. */ - if (V_ipstealth && hlen > sizeof (struct ip) && - ip_dooptions(m, 1)) + if (V_ipstealth && hlen > sizeof (struct ip) && ip_dooptions(m, 1)) { + if (ia != NULL) + ifa_free(&ia->ia_ifa); return; + } #endif /* IPSTEALTH */ /* Count the packet in the ip address stats */ @@ -1349,7 +1352,7 @@ ip_rtaddr(struct in_addr dst, u_int fibn { struct route sro; struct sockaddr_in *sin; - struct in_ifaddr *ifa; + struct in_ifaddr *ia; bzero(&sro, sizeof(sro)); sin = (struct sockaddr_in *)&sro.ro_dst; @@ -1361,10 +1364,10 @@ ip_rtaddr(struct in_addr dst, u_int fibn if (sro.ro_rt == NULL) return (NULL); - ifa = ifatoia(sro.ro_rt->rt_ifa); - ifa_ref(&ifa->ia_ifa); + ia = ifatoia(sro.ro_rt->rt_ifa); + ifa_ref(&ia->ia_ifa); RTFREE(sro.ro_rt); - return (ifa); + return (ia); } u_char inetctlerrmap[PRC_NCMDS] = { From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 14:47:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B13E1065672; Wed, 24 Jun 2009 14:47:33 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 58B668FC16; Wed, 24 Jun 2009 14:47:33 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OElXYx017346; Wed, 24 Jun 2009 14:47:33 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OElXCs017344; Wed, 24 Jun 2009 14:47:33 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <200906241447.n5OElXCs017344@svn.freebsd.org> From: Andrew Gallatin Date: Wed, 24 Jun 2009 14:47: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: r194836 - head/sys/dev/mxge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 14:47:34 -0000 Author: gallatin Date: Wed Jun 24 14:47:32 2009 New Revision: 194836 URL: http://svn.freebsd.org/changeset/base/194836 Log: Allow admin to specify the initial mtu upon driver load for mxge. Modified: head/sys/dev/mxge/if_mxge.c Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Wed Jun 24 14:29:40 2009 (r194835) +++ head/sys/dev/mxge/if_mxge.c Wed Jun 24 14:47:32 2009 (r194836) @@ -105,6 +105,7 @@ static int mxge_ticks; static int mxge_max_slices = 1; static int mxge_rss_hash_type = MXGEFW_RSS_HASH_TYPE_SRC_PORT; static int mxge_always_promisc = 0; +static int mxge_initial_mtu = ETHERMTU_JUMBO; static char *mxge_fw_unaligned = "mxge_ethp_z8e"; static char *mxge_fw_aligned = "mxge_eth_z8e"; static char *mxge_fw_rss_aligned = "mxge_rss_eth_z8e"; @@ -4009,6 +4010,7 @@ mxge_fetch_tunables(mxge_softc_t *sc) TUNABLE_INT_FETCH("hw.mxge.lro_cnt", &sc->lro_cnt); TUNABLE_INT_FETCH("hw.mxge.always_promisc", &mxge_always_promisc); TUNABLE_INT_FETCH("hw.mxge.rss_hash_type", &mxge_rss_hash_type); + TUNABLE_INT_FETCH("hw.mxge.initial_mtu", &mxge_initial_mtu); if (sc->lro_cnt != 0) mxge_lro_cnt = sc->lro_cnt; @@ -4023,6 +4025,9 @@ mxge_fetch_tunables(mxge_softc_t *sc) || mxge_rss_hash_type > MXGEFW_RSS_HASH_TYPE_MAX) { mxge_rss_hash_type = MXGEFW_RSS_HASH_TYPE_SRC_PORT; } + if (mxge_initial_mtu > ETHERMTU_JUMBO || + mxge_initial_mtu < ETHER_MIN_LEN) + mxge_initial_mtu = ETHERMTU_JUMBO; } @@ -4586,9 +4591,9 @@ mxge_attach(device_t dev) mxge_set_media(sc, IFM_ETHER | IFM_AUTO); mxge_media_probe(sc); ether_ifattach(ifp, sc->mac_addr); - /* ether_ifattach sets mtu to 1500 */ - if (ifp->if_capabilities & IFCAP_JUMBO_MTU) - ifp->if_mtu = 9000; + /* ether_ifattach sets mtu to ETHERMTU */ + if (mxge_initial_mtu != ETHERMTU) + mxge_change_mtu(sc, mxge_initial_mtu); mxge_add_sysctls(sc); #ifdef IFNET_BUF_RING From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 14:49:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B84D7106564A; Wed, 24 Jun 2009 14:49:26 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A68E98FC1E; Wed, 24 Jun 2009 14:49:26 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OEnQ25017420; Wed, 24 Jun 2009 14:49:26 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OEnQmn017418; Wed, 24 Jun 2009 14:49:26 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906241449.n5OEnQmn017418@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 14:49: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: r194837 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 14:49:27 -0000 Author: rwatson Date: Wed Jun 24 14:49:26 2009 New Revision: 194837 URL: http://svn.freebsd.org/changeset/base/194837 Log: Add missing unlock of if_addr_mtx when an unmatched ARP packet is received. Reported by: lstewart MFC after: 6 weeks Modified: head/sys/netinet/if_ether.c Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Wed Jun 24 14:47:32 2009 (r194836) +++ head/sys/netinet/if_ether.c Wed Jun 24 14:49:26 2009 (r194837) @@ -564,6 +564,7 @@ in_arpinput(struct mbuf *m) if (ifa->ifa_addr->sa_family == AF_INET) { ia = ifatoia(ifa); ifa_ref(ifa); + IF_ADDR_UNLOCK(ifp); goto match; } IF_ADDR_UNLOCK(ifp); From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 15:29:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41CA21065673; Wed, 24 Jun 2009 15:29:37 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 159ED8FC08; Wed, 24 Jun 2009 15:29:37 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OFTaZH018546; Wed, 24 Jun 2009 15:29:36 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OFTaRT018544; Wed, 24 Jun 2009 15:29:36 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200906241529.n5OFTaRT018544@svn.freebsd.org> From: Jamie Gritton Date: Wed, 24 Jun 2009 15:29: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: r194841 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 15:29:37 -0000 Author: jamie Date: Wed Jun 24 15:29:36 2009 New Revision: 194841 URL: http://svn.freebsd.org/changeset/base/194841 Log: Fix a race in vi_if_move, where a vnet is used after the prison that referred to it has been released. Approved by: bz (mentor) Modified: head/sys/kern/kern_vimage.c Modified: head/sys/kern/kern_vimage.c ============================================================================== --- head/sys/kern/kern_vimage.c Wed Jun 24 15:24:51 2009 (r194840) +++ head/sys/kern/kern_vimage.c Wed Jun 24 15:29:36 2009 (r194841) @@ -117,9 +117,11 @@ vi_if_move(struct thread *td, struct ifn struct prison *pr; struct vimage *new_vip, *my_vip; struct vnet *new_vnet; + int error; if (vi_req != NULL) { /* SIOCSIFVIMAGE */ + pr = NULL; /* Check for API / ABI version mismatch. */ if (vi_req->vi_api_cookie != VI_API_COOKIE) return (EDOOFUS); @@ -148,6 +150,7 @@ vi_if_move(struct thread *td, struct ifn sx_sunlock(&allprison_lock); if (pr == NULL) return (ENXIO); + prison_hold_locked(pr); mtx_unlock(&pr->pr_mtx); if (ifp != NULL) { /* SIOCSIFVNET */ @@ -158,31 +161,35 @@ vi_if_move(struct thread *td, struct ifn CURVNET_SET(pr->pr_vnet); ifp = ifunit(ifname); CURVNET_RESTORE(); - if (ifp == NULL) + if (ifp == NULL) { + prison_free(pr); return (ENXIO); + } } - - /* No-op if the target jail has the same vnet. */ - if (new_vnet == ifp->if_vnet) - return (0); } - /* - * Check for naming clashes in target vnet. Not locked so races - * are possible. - */ - CURVNET_SET_QUIET(new_vnet); - t_ifp = ifunit(ifname); - CURVNET_RESTORE(); - if (t_ifp != NULL) - return (EEXIST); - - /* Detach from curvnet and attach to new_vnet. */ - if_vmove(ifp, new_vnet); + error = 0; + if (new_vnet != ifp->if_vnet) { + /* + * Check for naming clashes in target vnet. Not locked so races + * are possible. + */ + CURVNET_SET_QUIET(new_vnet); + t_ifp = ifunit(ifname); + CURVNET_RESTORE(); + if (t_ifp != NULL) + error = EEXIST; + else { + /* Detach from curvnet and attach to new_vnet. */ + if_vmove(ifp, new_vnet); - /* Report the new if_xname back to the userland */ - sprintf(ifname, "%s", ifp->if_xname); - return (0); + /* Report the new if_xname back to the userland */ + sprintf(ifname, "%s", ifp->if_xname); + } + } + if (pr != NULL) + prison_free(pr); + return (error); } /* From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 15:32:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F8121065688; Wed, 24 Jun 2009 15:32:58 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33A158FC08; Wed, 24 Jun 2009 15:32:58 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OFWwHW018652; Wed, 24 Jun 2009 15:32:58 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OFWw9K018650; Wed, 24 Jun 2009 15:32:58 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200906241532.n5OFWw9K018650@svn.freebsd.org> From: Jamie Gritton Date: Wed, 24 Jun 2009 15:32: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: r194842 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 15:32:59 -0000 Author: jamie Date: Wed Jun 24 15:32:57 2009 New Revision: 194842 URL: http://svn.freebsd.org/changeset/base/194842 Log: Clean up struct prison, with the recent fields in more logical places, and room for future expansion. Approved by: bz (mentor) Modified: head/sys/sys/jail.h Modified: head/sys/sys/jail.h ============================================================================== --- head/sys/sys/jail.h Wed Jun 24 15:29:36 2009 (r194841) +++ head/sys/sys/jail.h Wed Jun 24 15:32:57 2009 (r194842) @@ -149,30 +149,32 @@ struct prison { int pr_ref; /* (p) refcount */ int pr_uref; /* (p) user (alive) refcount */ unsigned pr_flags; /* (p) PR_* flags */ - char pr_path[MAXPATHLEN]; /* (c) chroot path */ - struct cpuset *pr_cpuset; /* (p) cpuset */ - struct vnode *pr_root; /* (c) vnode to rdir */ - char pr_hostname[MAXHOSTNAMELEN]; /* (p) jail hostname */ - char pr_name[MAXHOSTNAMELEN]; /* (p) admin jail name */ + LIST_HEAD(, prison) pr_children; /* (a) list of child jails */ + LIST_ENTRY(prison) pr_sibling; /* (a) next in parent's list */ struct prison *pr_parent; /* (c) containing jail */ - int pr_securelevel; /* (p) securelevel */ - struct task pr_task; /* (d) destroy task */ struct mtx pr_mtx; + struct task pr_task; /* (d) destroy task */ struct osd pr_osd; /* (p) additional data */ + struct cpuset *pr_cpuset; /* (p) cpuset */ + struct vnet *pr_vnet; /* (c) network stack */ + struct vnode *pr_root; /* (c) vnode to rdir */ int pr_ip4s; /* (p) number of v4 IPs */ - struct in_addr *pr_ip4; /* (p) v4 IPs of jail */ int pr_ip6s; /* (p) number of v6 IPs */ + struct in_addr *pr_ip4; /* (p) v4 IPs of jail */ struct in6_addr *pr_ip6; /* (p) v6 IPs of jail */ - LIST_HEAD(, prison) pr_children; /* (a) list of child jails */ - LIST_ENTRY(prison) pr_sibling; /* (a) next in parent's list */ + void *pr_sparep[4]; int pr_childcount; /* (a) number of child jails */ + int pr_childmax; /* (p) maximum child jails */ unsigned pr_allow; /* (p) PR_ALLOW_* flags */ + int pr_securelevel; /* (p) securelevel */ int pr_enforce_statfs; /* (p) statfs permission */ + int pr_spare[5]; + unsigned long pr_hostid; /* (p) jail hostid */ + char pr_name[MAXHOSTNAMELEN]; /* (p) admin jail name */ + char pr_path[MAXPATHLEN]; /* (c) chroot path */ + char pr_hostname[MAXHOSTNAMELEN]; /* (p) jail hostname */ char pr_domainname[MAXHOSTNAMELEN]; /* (p) jail domainname */ char pr_hostuuid[HOSTUUIDLEN]; /* (p) jail hostuuid */ - unsigned long pr_hostid; /* (p) jail hostid */ - struct vnet *pr_vnet; /* (c) network stack */ - int pr_childmax; /* (p) maximum child jails */ }; #endif /* _KERNEL || _WANT_PRISON */ From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 15:38:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E6A91065673; Wed, 24 Jun 2009 15:38:18 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0C2A68FC19; Wed, 24 Jun 2009 15:38:18 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OFcHNo018866; Wed, 24 Jun 2009 15:38:17 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OFcHwp018860; Wed, 24 Jun 2009 15:38:17 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200906241538.n5OFcHwp018860@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 24 Jun 2009 15:38: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: r194844 - in head/sys: conf dev/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 15:38:18 -0000 Author: raj Date: Wed Jun 24 15:38:17 2009 New Revision: 194844 URL: http://svn.freebsd.org/changeset/base/194844 Log: Move non-PCI prototypes from ata-pci.h -> ata-all.h. This removes unnecessary PCI #includes dependency for systems with ATA controllers living at non-PCI buses. Submitted by: Piotr Ziecik Obtained from: Semihalf Modified: head/sys/conf/files head/sys/dev/ata/ata-all.h head/sys/dev/ata/ata-dma.c head/sys/dev/ata/ata-pci.h head/sys/dev/ata/ata-sata.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Jun 24 15:33:33 2009 (r194843) +++ head/sys/conf/files Wed Jun 24 15:38:17 2009 (r194844) @@ -491,12 +491,12 @@ dev/ata/ata_if.m optional ata | atacore dev/ata/ata-all.c optional ata | atacore dev/ata/ata-lowlevel.c optional ata | atacore dev/ata/ata-queue.c optional ata | atacore +dev/ata/ata-dma.c optional ata | atadma +dev/ata/ata-sata.c optional ata | atasata dev/ata/ata-card.c optional ata pccard | atapccard dev/ata/ata-cbus.c optional ata pc98 | atapc98 dev/ata/ata-isa.c optional ata isa | ataisa dev/ata/ata-pci.c optional ata pci | atapci -dev/ata/ata-dma.c optional ata pci | atapci -dev/ata/ata-sata.c optional ata pci | atapci dev/ata/chipsets/ata-ahci.c optional ata pci | ataahci | ataacerlabs | \ ataati | ataintel | atajmicron | atavia dev/ata/chipsets/ata-acard.c optional ata pci | ataacard Modified: head/sys/dev/ata/ata-all.h ============================================================================== --- head/sys/dev/ata/ata-all.h Wed Jun 24 15:33:33 2009 (r194843) +++ head/sys/dev/ata/ata-all.h Wed Jun 24 15:38:17 2009 (r194844) @@ -609,6 +609,19 @@ int ata_end_transaction(struct ata_reque void ata_generic_reset(device_t dev); int ata_generic_command(struct ata_request *request); +/* ata-dma.c: */ +void ata_dmainit(device_t); +void ata_dmafini(device_t dev); + +/* ata-sata.c: */ +void ata_sata_phy_check_events(device_t dev); +int ata_sata_scr_read(struct ata_channel *ch, int port, int reg, uint32_t *val); +int ata_sata_scr_write(struct ata_channel *ch, int port, int reg, uint32_t val); +int ata_sata_phy_reset(device_t dev, int port, int quick); +void ata_sata_setmode(device_t dev, int mode); +int ata_request2fis_h2d(struct ata_request *request, u_int8_t *fis); +void ata_pm_identify(device_t dev); + /* macros for alloc/free of struct ata_request */ extern uma_zone_t ata_request_zone; #define ata_alloc_request() uma_zalloc(ata_request_zone, M_NOWAIT | M_ZERO) Modified: head/sys/dev/ata/ata-dma.c ============================================================================== --- head/sys/dev/ata/ata-dma.c Wed Jun 24 15:33:33 2009 (r194843) +++ head/sys/dev/ata/ata-dma.c Wed Jun 24 15:38:17 2009 (r194844) @@ -40,9 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include -#include /* prototypes */ static void ata_dmasetupc_cb(void *xsc, bus_dma_segment_t *segs, int nsegs, int error); Modified: head/sys/dev/ata/ata-pci.h ============================================================================== --- head/sys/dev/ata/ata-pci.h Wed Jun 24 15:33:33 2009 (r194843) +++ head/sys/dev/ata/ata-pci.h Wed Jun 24 15:38:17 2009 (r194844) @@ -451,15 +451,6 @@ void ata_print_cable(device_t dev, u_int int ata_check_80pin(device_t dev, int mode); int ata_mode2idx(int mode); -/* global prototypes ata-sata.c */ -void ata_sata_phy_check_events(device_t dev); -int ata_sata_scr_read(struct ata_channel *ch, int port, int reg, uint32_t *val); -int ata_sata_scr_write(struct ata_channel *ch, int port, int reg, uint32_t val); -int ata_sata_phy_reset(device_t dev, int port, int quick); -void ata_sata_setmode(device_t dev, int mode); -int ata_request2fis_h2d(struct ata_request *request, u_int8_t *fis); -void ata_pm_identify(device_t dev); - /* global prototypes from chipsets/ata-*.c */ int ata_ahci_chipinit(device_t); int ata_ahci_ch_attach(device_t dev); @@ -471,10 +462,6 @@ void ata_ahci_reset(device_t dev); int ata_marvell_edma_chipinit(device_t); int ata_sii_chipinit(device_t); -/* global prototypes ata-dma.c */ -void ata_dmainit(device_t); -void ata_dmafini(device_t dev); - /* externs */ extern devclass_t ata_pci_devclass; Modified: head/sys/dev/ata/ata-sata.c ============================================================================== --- head/sys/dev/ata/ata-sata.c Wed Jun 24 15:33:33 2009 (r194843) +++ head/sys/dev/ata/ata-sata.c Wed Jun 24 15:38:17 2009 (r194844) @@ -44,10 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include -#include #include void From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 15:41:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3C671065675; Wed, 24 Jun 2009 15:41:18 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B88FF8FC14; Wed, 24 Jun 2009 15:41:18 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OFfItT018976; Wed, 24 Jun 2009 15:41:18 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OFfICp018966; Wed, 24 Jun 2009 15:41:18 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200906241541.n5OFfICp018966@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 24 Jun 2009 15:41: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: r194845 - in head/sys/arm: conf mv mv/discovery mv/kirkwood mv/orion X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 15:41:19 -0000 Author: raj Date: Wed Jun 24 15:41:18 2009 New Revision: 194845 URL: http://svn.freebsd.org/changeset/base/194845 Log: Introduce ata(4) support for Marvell integrated SATA controllers (found on 88F5xxx, 88F6xxx and MV78xxx system on chip devices). Reviewed by: stas Obtained from: Semihalf Added: head/sys/arm/mv/mv_sata.c (contents, props changed) Modified: head/sys/arm/conf/DB-78XXX head/sys/arm/conf/DB-88F5XXX head/sys/arm/conf/DB-88F6XXX head/sys/arm/mv/discovery/discovery.c head/sys/arm/mv/files.mv head/sys/arm/mv/kirkwood/kirkwood.c head/sys/arm/mv/mvreg.h head/sys/arm/mv/orion/orion.c Modified: head/sys/arm/conf/DB-78XXX ============================================================================== --- head/sys/arm/conf/DB-78XXX Wed Jun 24 15:38:17 2009 (r194844) +++ head/sys/arm/conf/DB-78XXX Wed Jun 24 15:41:18 2009 (r194845) @@ -77,3 +77,7 @@ device da device iic device iicbus device ds133x + +# SATA +device ata +device atadisk Modified: head/sys/arm/conf/DB-88F5XXX ============================================================================== --- head/sys/arm/conf/DB-88F5XXX Wed Jun 24 15:38:17 2009 (r194844) +++ head/sys/arm/conf/DB-88F5XXX Wed Jun 24 15:41:18 2009 (r194845) @@ -79,3 +79,7 @@ device umass device scbus device pass device da + +# SATA +device ata +device atadisk Modified: head/sys/arm/conf/DB-88F6XXX ============================================================================== --- head/sys/arm/conf/DB-88F6XXX Wed Jun 24 15:38:17 2009 (r194844) +++ head/sys/arm/conf/DB-88F6XXX Wed Jun 24 15:41:18 2009 (r194845) @@ -76,3 +76,7 @@ device da # I2C (TWSI) device iic device iicbus + +# SATA +device ata +device atadisk Modified: head/sys/arm/mv/discovery/discovery.c ============================================================================== --- head/sys/arm/mv/discovery/discovery.c Wed Jun 24 15:38:17 2009 (r194844) +++ head/sys/arm/mv/discovery/discovery.c Wed Jun 24 15:41:18 2009 (r194845) @@ -130,6 +130,11 @@ struct obio_device obio_devices[] = { { -1 }, { -1 }, CPU_PM_CTRL_NONE }, + { "sata", MV_SATAHC_BASE, MV_SATAHC_SIZE, + { MV_INT_SATA, -1 }, + { -1 }, + CPU_PM_CTRL_SATA0 | CPU_PM_CTRL_SATA1 + }, { NULL, 0, 0, { 0 }, { 0 }, 0 } }; Modified: head/sys/arm/mv/files.mv ============================================================================== --- head/sys/arm/mv/files.mv Wed Jun 24 15:38:17 2009 (r194844) +++ head/sys/arm/mv/files.mv Wed Jun 24 15:41:18 2009 (r194845) @@ -24,6 +24,7 @@ arm/mv/gpio.c standard arm/mv/ic.c standard arm/mv/mv_machdep.c standard arm/mv/mv_pci.c optional pci +arm/mv/mv_sata.c optional ata | atamvsata arm/mv/obio.c standard arm/mv/timer.c standard arm/mv/twsi.c optional iicbus Modified: head/sys/arm/mv/kirkwood/kirkwood.c ============================================================================== --- head/sys/arm/mv/kirkwood/kirkwood.c Wed Jun 24 15:38:17 2009 (r194844) +++ head/sys/arm/mv/kirkwood/kirkwood.c Wed Jun 24 15:41:18 2009 (r194845) @@ -99,6 +99,11 @@ struct obio_device obio_devices[] = { { -1 }, { -1 }, CPU_PM_CTRL_NONE }, + { "sata", MV_SATAHC_BASE, MV_SATAHC_SIZE, + { MV_INT_SATA, -1 }, + { -1 }, + CPU_PM_CTRL_SATA0 | CPU_PM_CTRL_SATA1 + }, { NULL, 0, 0, { 0 }, { 0 }, 0 } }; Added: head/sys/arm/mv/mv_sata.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/mv_sata.c Wed Jun 24 15:41:18 2009 (r194845) @@ -0,0 +1,862 @@ +/*- + * Copyright (C) 2008-2009 Semihalf + * All rights reserved. + * + * Initial version developed by Ilya Bakulin. Full functionality and bringup + * by Piotr Ziecik. + * + * 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "ata_if.h" + +#include "mvreg.h" +#include "mvvar.h" + +/* Useful macros */ +#define EDMA_TIMEOUT 100000 /* 100 ms */ +#define SATA_INL(sc, reg) ATA_INL((sc)->sc_mem_res, reg) +#define SATA_OUTL(sc, reg, val) ATA_OUTL((sc)->sc_mem_res, reg, val) + +/* HW-related data structures */ +struct sata_prdentry { + uint32_t prd_addrlo; + uint32_t prd_count; + uint32_t prd_addrhi; + uint32_t prd_reserved; +}; + +struct sata_crqb { + uint32_t crqb_prdlo; + uint32_t crqb_prdhi; + uint32_t crqb_flags; + uint16_t crqb_count; + uint16_t crqb_reserved1[2]; + uint8_t crqb_ata_command; + uint8_t crqb_ata_feature; + uint8_t crqb_ata_lba_low; + uint8_t crqb_ata_lba_mid; + uint8_t crqb_ata_lba_high; + uint8_t crqb_ata_device; + uint8_t crqb_ata_lba_low_p; + uint8_t crqb_ata_lba_mid_p; + uint8_t crqb_ata_lba_high_p; + uint8_t crqb_ata_feature_p; + uint8_t crqb_ata_count; + uint8_t crqb_ata_count_p; + uint16_t crqb_reserved2; +}; + +struct sata_crpb { + uint8_t crpb_tag; + uint8_t crpb_reserved; + uint8_t crpb_edma_status; + uint8_t crpb_dev_status; + uint32_t crpb_timestamp; +}; + +/* Identification section. */ +struct sata_softc { + device_t sc_dev; + unsigned int sc_version; + unsigned int sc_edma_qlen; + uint32_t sc_edma_reqis_mask; + uint32_t sc_edma_resos_mask; + struct resource *sc_mem_res; + bus_space_tag_t sc_mem_res_bustag; + bus_space_handle_t sc_mem_res_bushdl; + struct resource *sc_irq_res; + void *sc_irq_cookiep; + struct { + void (*function)(void *); + void *argument; + } sc_interrupt[SATA_CHAN_NUM]; +}; + +/* Controller functions */ +static int sata_probe(device_t dev); +static int sata_attach(device_t dev); +static int sata_detach(device_t dev); +static void sata_intr(void*); +static struct resource * sata_alloc_resource(device_t dev, device_t child, + int type, int *rid, u_long start, u_long end, u_long count, u_int flags); +static int sata_release_resource(device_t dev, device_t child, int type, + int rid, struct resource *r); +static int sata_setup_intr(device_t dev, device_t child, + struct resource *irq, int flags, driver_filter_t *filt, + driver_intr_t *function, void *argument, void **cookiep); +static int sata_teardown_intr(device_t dev, device_t child, + struct resource *irq, void *cookie); + +/* Channel functions */ +static int sata_channel_probe(device_t dev); +static int sata_channel_attach(device_t dev); +static int sata_channel_detach(device_t dev); +static int sata_channel_begin_transaction(struct ata_request *request); +static int sata_channel_end_transaction(struct ata_request *request); +static int sata_channel_status(device_t dev); +static void sata_channel_setmode(device_t parent, device_t dev); +static void sata_channel_reset(device_t dev); +static void sata_channel_dmasetprd(void *xsc, bus_dma_segment_t *segs, + int nsegs, int error); + +/* EDMA functions */ +static int sata_edma_ctrl(device_t dev, int on); +static int sata_edma_is_running(device_t); + +static device_method_t sata_methods[] = { + /* Device method */ + DEVMETHOD(device_probe, sata_probe), + DEVMETHOD(device_attach, sata_attach), + DEVMETHOD(device_detach, sata_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, bus_generic_suspend), + DEVMETHOD(device_resume, bus_generic_resume), + + /* ATA bus methods. */ + DEVMETHOD(bus_alloc_resource, sata_alloc_resource), + DEVMETHOD(bus_release_resource, sata_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, sata_setup_intr), + DEVMETHOD(bus_teardown_intr, sata_teardown_intr), + { 0, 0 }, +}; + +static driver_t sata_driver = { + "sata", + sata_methods, + sizeof(struct sata_softc), +}; + +devclass_t sata_devclass; + +DRIVER_MODULE(sata, mbus, sata_driver, sata_devclass, 0, 0); +MODULE_VERSION(sata, 1); +MODULE_DEPEND(sata, ata, 1, 1, 1); + +static int +sata_probe(device_t dev) +{ + struct sata_softc *sc; + uint32_t d, r; + + soc_id(&d, &r); + sc = device_get_softc(dev); + + /* No SATA controller on the 88F5281 SoC */ + if (d == MV_DEV_88F5281) + return (ENXIO); + + switch(d) { + case MV_DEV_88F5182: + sc->sc_version = 1; + sc->sc_edma_qlen = 128; + break; + case MV_DEV_88F6281: + case MV_DEV_MV78100: + case MV_DEV_MV78100_Z0: + sc->sc_version = 2; + sc->sc_edma_qlen = 32; + break; + default: + device_printf(dev, "unsupported SoC (ID: 0x%08X)!\n", d); + return (ENXIO); + } + + sc->sc_edma_reqis_mask = (sc->sc_edma_qlen - 1) << SATA_EDMA_REQIS_OFS; + sc->sc_edma_resos_mask = (sc->sc_edma_qlen - 1) << SATA_EDMA_RESOS_OFS; + + device_set_desc(dev, "Marvell Integrated SATA Controller"); + return (0); +} + +static int +sata_attach(device_t dev) +{ + struct sata_softc *sc; + int mem_id, irq_id, error, i; + device_t ata_chan; + uint32_t reg; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + mem_id = 0; + irq_id = 0; + + /* Allocate resources */ + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &mem_id, RF_ACTIVE); + if (sc->sc_mem_res == NULL) { + device_printf(dev, "could not allocate memory.\n"); + return (ENOMEM); + } + + sc->sc_mem_res_bustag = rman_get_bustag(sc->sc_mem_res); + sc->sc_mem_res_bushdl = rman_get_bushandle(sc->sc_mem_res); + KASSERT(sc->sc_mem_res_bustag && sc->sc_mem_res_bushdl, + ("cannot get bus handle or tag.")); + + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &irq_id, + RF_ACTIVE); + if (sc->sc_irq_res == NULL) { + device_printf(dev, "could not allocate IRQ.\n"); + error = ENOMEM; + goto err; + } + + error = bus_setup_intr(dev, sc->sc_irq_res, + INTR_TYPE_BIO | INTR_MPSAFE | INTR_ENTROPY, + NULL, sata_intr, sc, &sc->sc_irq_cookiep); + if (error != 0) { + device_printf(dev, "could not setup interrupt.\n"); + goto err; + } + + /* Attach channels */ + for (i = 0; i < SATA_CHAN_NUM; i++) { + ata_chan = device_add_child(dev, "ata", + devclass_find_free_unit(ata_devclass, 0)); + + if (!ata_chan) { + device_printf(dev, "cannot add channel %d.\n", i); + error = ENOMEM; + goto err; + } + } + + /* Disable interrupt coalescing */ + reg = SATA_INL(sc, SATA_CR); + for (i = 0; i < SATA_CHAN_NUM; i++) + reg |= SATA_CR_COALDIS(i); + + /* Disable DMA byte swapping */ + if (sc->sc_version == 2) + reg |= SATA_CR_NODMABS | SATA_CR_NOEDMABS | + SATA_CR_NOPRDPBS; + + SATA_OUTL(sc, SATA_CR, reg); + + /* Clear and mask all interrupts */ + SATA_OUTL(sc, SATA_ICR, 0); + SATA_OUTL(sc, SATA_MIMR, 0); + + return(bus_generic_attach(dev)); + +err: + sata_detach(dev); + return (error); +} + +static int +sata_detach(device_t dev) +{ + struct sata_softc *sc; + + sc = device_get_softc(dev); + + if (device_is_attached(dev)) + bus_generic_detach(dev); + + if (sc->sc_mem_res != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->sc_mem_res), sc->sc_mem_res); + sc->sc_mem_res = NULL; + } + + if (sc->sc_irq_res != NULL) { + bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_irq_cookiep); + bus_release_resource(dev, SYS_RES_IRQ, + rman_get_rid(sc->sc_irq_res), sc->sc_irq_res); + sc->sc_irq_res = NULL; + } + + return (0); +} + +static struct resource * +sata_alloc_resource(device_t dev, device_t child, int type, int *rid, + u_long start, u_long end, u_long count, u_int flags) +{ + struct sata_softc *sc; + + sc = device_get_softc(dev); + + KASSERT(type == SYS_RES_IRQ && *rid == ATA_IRQ_RID, + ("illegal resource request (type %u, rid %u).", + type, *rid)); + + return (sc->sc_irq_res); +} + +static int +sata_release_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + + KASSERT(type == SYS_RES_IRQ && rid == ATA_IRQ_RID, + ("strange type %u and/or rid %u while releasing resource.", type, + rid)); + + return (0); +} + +static int +sata_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, + driver_filter_t *filt, driver_intr_t *function, void *argument, + void **cookiep) +{ + struct sata_softc *sc; + struct ata_channel *ch; + + sc = device_get_softc(dev); + ch = device_get_softc(child); + + if (filt != NULL) { + device_printf(dev, "filter interrupts are not supported.\n"); + return (EINVAL); + } + + sc->sc_interrupt[ch->unit].function = function; + sc->sc_interrupt[ch->unit].argument = argument; + *cookiep = sc; + + return (0); +} + +static int +sata_teardown_intr(device_t dev, device_t child, struct resource *irq, + void *cookie) +{ + struct sata_softc *sc; + struct ata_channel *ch; + + sc = device_get_softc(dev); + ch = device_get_softc(child); + + sc->sc_interrupt[ch->unit].function = NULL; + sc->sc_interrupt[ch->unit].argument = NULL; + + return (0); +} + +static void +sata_intr(void *xsc) +{ + struct sata_softc *sc; + int unit; + + sc = xsc; + + /* + * Behave like ata_generic_intr() for PCI controllers. + * Simply invoke ISRs on all channels. + */ + for (unit = 0; unit < SATA_CHAN_NUM; unit++) + if (sc->sc_interrupt[unit].function != NULL) + sc->sc_interrupt[unit].function( + sc->sc_interrupt[unit].argument); +} + +static int +sata_channel_probe(device_t dev) +{ + + device_set_desc(dev, "Marvell Integrated SATA Channel"); + return (ata_probe(dev)); +} + +static int +sata_channel_attach(device_t dev) +{ + struct sata_softc *sc; + struct ata_channel *ch; + uint64_t work; + int error, i; + + sc = device_get_softc(device_get_parent(dev)); + ch = device_get_softc(dev); + + if (ch->attached) + return (0); + + ch->dev = dev; + ch->unit = device_get_unit(dev); + ch->flags |= ATA_USE_16BIT | ATA_NO_SLAVE; + + /* Set legacy ATA resources. */ + for (i = ATA_DATA; i <= ATA_COMMAND; i++) { + ch->r_io[i].res = sc->sc_mem_res; + ch->r_io[i].offset = SATA_SHADOWR_BASE(ch->unit) + (i << 2); + } + + ch->r_io[ATA_CONTROL].res = sc->sc_mem_res; + ch->r_io[ATA_CONTROL].offset = SATA_SHADOWR_CONTROL(ch->unit); + + ch->r_io[ATA_IDX_ADDR].res = sc->sc_mem_res; + ata_default_registers(dev); + + /* Set SATA resources. */ + ch->r_io[ATA_SSTATUS].res = sc->sc_mem_res; + ch->r_io[ATA_SSTATUS].offset = SATA_SATA_SSTATUS(ch->unit); + ch->r_io[ATA_SERROR].res = sc->sc_mem_res; + ch->r_io[ATA_SERROR].offset = SATA_SATA_SERROR(ch->unit); + ch->r_io[ATA_SCONTROL].res = sc->sc_mem_res; + ch->r_io[ATA_SCONTROL].offset = SATA_SATA_SCONTROL(ch->unit); + ata_generic_hw(dev); + + ch->hw.begin_transaction = sata_channel_begin_transaction; + ch->hw.end_transaction = sata_channel_end_transaction; + ch->hw.status = sata_channel_status; + + /* Set DMA resources */ + ata_dmainit(dev); + ch->dma.setprd = sata_channel_dmasetprd; + + /* Clear work area */ + KASSERT(sc->sc_edma_qlen * (sizeof(struct sata_crqb) + + sizeof(struct sata_crpb)) <= ch->dma.max_iosize, + ("insufficient DMA memory for request/response queues.\n")); + bzero(ch->dma.work, sc->sc_edma_qlen * (sizeof(struct sata_crqb) + + sizeof(struct sata_crpb))); + bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + + /* Turn off EDMA engine */ + error = sata_edma_ctrl(dev, 0); + if (error) { + ata_dmafini(dev); + return (error); + } + + /* + * Initialize EDMA engine: + * - Native Command Queuing off, + * - Non-Queued operation, + * - Host Queue Cache enabled. + */ + SATA_OUTL(sc, SATA_EDMA_CFG(ch->unit), SATA_EDMA_CFG_HQCACHE | + (sc->sc_version == 1) ? SATA_EDMA_CFG_QL128 : 0); + + /* Set request queue pointers */ + work = ch->dma.work_bus; + SATA_OUTL(sc, SATA_EDMA_REQBAHR(ch->unit), work >> 32); + SATA_OUTL(sc, SATA_EDMA_REQIPR(ch->unit), work & 0xFFFFFFFF); + SATA_OUTL(sc, SATA_EDMA_REQOPR(ch->unit), work & 0xFFFFFFFF); + + /* Set response queue pointers */ + work += sc->sc_edma_qlen * sizeof(struct sata_crqb); + SATA_OUTL(sc, SATA_EDMA_RESBAHR(ch->unit), work >> 32); + SATA_OUTL(sc, SATA_EDMA_RESIPR(ch->unit), work & 0xFFFFFFFF); + SATA_OUTL(sc, SATA_EDMA_RESOPR(ch->unit), work & 0xFFFFFFFF); + + /* Clear any outstanding interrupts */ + ATA_IDX_OUTL(ch, ATA_SERROR, ATA_IDX_INL(ch, ATA_SERROR)); + SATA_OUTL(sc, SATA_SATA_FISICR(ch->unit), 0); + SATA_OUTL(sc, SATA_EDMA_IECR(ch->unit), 0); + SATA_OUTL(sc, SATA_ICR, + ~(SATA_ICR_DEV(ch->unit) | SATA_ICR_DMADONE(ch->unit))); + + /* Umask channel interrupts */ + SATA_OUTL(sc, SATA_EDMA_IEMR(ch->unit), 0xFFFFFFFF); + SATA_OUTL(sc, SATA_MIMR, SATA_INL(sc, SATA_MIMR) | + SATA_MICR_DONE(ch->unit) | SATA_MICR_DMADONE(ch->unit) | + SATA_MICR_ERR(ch->unit)); + + ch->attached = 1; + + return (ata_attach(dev)); +} + +static int +sata_channel_detach(device_t dev) +{ + struct sata_softc *sc; + struct ata_channel *ch; + int error; + + sc = device_get_softc(device_get_parent(dev)); + ch = device_get_softc(dev); + + if (!ch->attached) + return (0); + + /* Turn off EDMA engine */ + sata_edma_ctrl(dev, 0); + + /* Mask chanel interrupts */ + SATA_OUTL(sc, SATA_EDMA_IEMR(ch->unit), 0); + SATA_OUTL(sc, SATA_MIMR, SATA_INL(sc, SATA_MIMR) & ~( + SATA_MICR_DONE(ch->unit) | SATA_MICR_DMADONE(ch->unit) | + SATA_MICR_ERR(ch->unit))); + + error = ata_detach(dev); + ata_dmafini(dev); + + ch->attached = 0; + + return (error); +} + +static int +sata_channel_begin_transaction(struct ata_request *request) +{ + struct sata_softc *sc; + struct ata_channel *ch; + struct sata_crqb *crqb; + uint32_t req_in; + int error, slot; + + sc = device_get_softc(GRANDPARENT(request->dev)); + ch = device_get_softc(request->parent); + + mtx_assert(&ch->state_mtx, MA_OWNED); + + /* Only DMA R/W goes through the EDMA machine. */ + if (request->u.ata.command != ATA_READ_DMA && + request->u.ata.command != ATA_WRITE_DMA) { + + /* Disable EDMA before accessing legacy registers */ + if (sata_edma_is_running(request->parent)) { + error = sata_edma_ctrl(request->parent, 0); + if (error) { + request->result = error; + return (ATA_OP_FINISHED); + } + } + + return (ata_begin_transaction(request)); + } + + /* Check for 48 bit access and convert if needed */ + ata_modify_if_48bit(request); + + /* Prepare data for DMA */ + if ((error = ch->dma.load(request, NULL, NULL))) { + device_printf(request->dev, "setting up DMA failed!\n"); + request->result = error; + return ATA_OP_FINISHED; + } + + /* Get next free queue slot */ + req_in = SATA_INL(sc, SATA_EDMA_REQIPR(ch->unit)); + slot = (req_in & sc->sc_edma_reqis_mask) >> SATA_EDMA_REQIS_OFS; + crqb = (struct sata_crqb *)(ch->dma.work + + (slot << SATA_EDMA_REQIS_OFS)); + + /* Fill in request */ + bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + + crqb->crqb_prdlo = htole32((uint64_t)request->dma->sg_bus & 0xFFFFFFFF); + crqb->crqb_prdhi = htole32((uint64_t)request->dma->sg_bus >> 32); + crqb->crqb_flags = htole32((request->flags & ATA_R_READ ? 0x01 : 0x00) | + (request->tag << 1)); + + crqb->crqb_ata_command = request->u.ata.command; + crqb->crqb_ata_feature = request->u.ata.feature; + crqb->crqb_ata_lba_low = request->u.ata.lba; + crqb->crqb_ata_lba_mid = request->u.ata.lba >> 8; + crqb->crqb_ata_lba_high = request->u.ata.lba >> 16; + crqb->crqb_ata_device = ((request->u.ata.lba >> 24) & 0x0F) | (1 << 6); + crqb->crqb_ata_count = request->u.ata.count; + + bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + + /* Enable EDMA if disabled */ + if (!sata_edma_is_running(request->parent)) { + error = sata_edma_ctrl(request->parent, 1); + if (error) { + ch->dma.unload(request); + request->result = error; + return (ATA_OP_FINISHED); + } + } + + /* Tell EDMA about new request */ + req_in = (req_in & ~sc->sc_edma_reqis_mask) | (((slot + 1) << + SATA_EDMA_REQIS_OFS) & sc->sc_edma_reqis_mask); + + SATA_OUTL(sc, SATA_EDMA_REQIPR(ch->unit), req_in); + + return (ATA_OP_CONTINUES); +} + +static int +sata_channel_end_transaction(struct ata_request *request) +{ + struct sata_softc *sc; + struct ata_channel *ch; + struct sata_crpb *crpb; + uint32_t res_in, res_out, icr; + int slot; + + sc = device_get_softc(GRANDPARENT(request->dev)); + ch = device_get_softc(request->parent); + + mtx_assert(&ch->state_mtx, MA_OWNED); + + icr = SATA_INL(sc, SATA_ICR); + if (icr & SATA_ICR_DMADONE(ch->unit)) { + /* Get current response slot */ + res_out = SATA_INL(sc, SATA_EDMA_RESOPR(ch->unit)); + slot = (res_out & sc->sc_edma_resos_mask) >> + SATA_EDMA_RESOS_OFS; + crpb = (struct sata_crpb *)(ch->dma.work + + (sc->sc_edma_qlen * sizeof(struct sata_crqb)) + + (slot << SATA_EDMA_RESOS_OFS)); + + /* Record this request status */ + bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + + request->status = crpb->crpb_dev_status; + request->error = 0; + + bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + + /* Update response queue pointer */ + res_out = (res_out & ~sc->sc_edma_resos_mask) | (((slot + 1) << + SATA_EDMA_RESOS_OFS) & sc->sc_edma_resos_mask); + + SATA_OUTL(sc, SATA_EDMA_RESOPR(ch->unit), res_out); + + /* Ack DMA interrupt if there is nothing more to do */ + res_in = SATA_INL(sc, SATA_EDMA_RESIPR(ch->unit)); + res_in &= sc->sc_edma_resos_mask; + res_out &= sc->sc_edma_resos_mask; + + if (res_in == res_out) + SATA_OUTL(sc, SATA_ICR, + ~SATA_ICR_DMADONE(ch->unit)); + + /* Update progress */ + if (!(request->status & ATA_S_ERROR) && + !(request->flags & ATA_R_TIMEOUT)) + request->donecount = request->bytecount; + + /* Unload DMA data */ + ch->dma.unload(request); + + return(ATA_OP_FINISHED); + } + + /* Legacy ATA interrupt */ + return (ata_end_transaction(request)); +} + +static int +sata_channel_status(device_t dev) +{ + struct sata_softc *sc; + struct ata_channel *ch; + uint32_t icr, iecr; + + sc = device_get_softc(device_get_parent(dev)); + ch = device_get_softc(dev); + + icr = SATA_INL(sc, SATA_ICR); + iecr = SATA_INL(sc, SATA_EDMA_IECR(ch->unit)); + + if ((icr & SATA_ICR_DEV(ch->unit)) || iecr) { + /* Disable EDMA before accessing SATA registers */ + sata_edma_ctrl(dev, 0); + ata_sata_phy_check_events(dev); + + /* Ack device and error interrupt */ + SATA_OUTL(sc, SATA_ICR, ~SATA_ICR_DEV(ch->unit)); + SATA_OUTL(sc, SATA_EDMA_IECR(ch->unit), 0); + } + + icr &= SATA_ICR_DEV(ch->unit) | SATA_ICR_DMADONE(ch->unit); + return (icr); +} + +static void +sata_channel_reset(device_t dev) +{ + struct sata_softc *sc; + struct ata_channel *ch; + + sc = device_get_softc(device_get_parent(dev)); + ch = device_get_softc(dev); + + /* Disable EDMA before using legacy registers */ + sata_edma_ctrl(dev, 0); + + /* Mask all EDMA interrups */ + SATA_OUTL(sc, SATA_EDMA_IEMR(ch->unit), 0); + + /* Reset EDMA */ + SATA_OUTL(sc, SATA_EDMA_CMD(ch->unit), SATA_EDMA_CMD_RESET); + DELAY(25); + SATA_OUTL(sc, SATA_EDMA_CMD(ch->unit), 0); + + /* Reset PHY and device */ + if (ata_sata_phy_reset(dev, -1, 1)) + ata_generic_reset(dev); + else + ch->devices = 0; + + /* Clear EDMA errors */ + SATA_OUTL(sc, SATA_SATA_FISICR(ch->unit), 0); + SATA_OUTL(sc, SATA_EDMA_IECR(ch->unit), 0); + + /* Unmask all EDMA interrups */ + SATA_OUTL(sc, SATA_EDMA_IEMR(ch->unit), 0xFFFFFFFF); +} + +static void +sata_channel_setmode(device_t parent, device_t dev) +{ + struct ata_device *atadev; + + atadev = device_get_softc(dev); + + /* Disable EDMA before using legacy registers */ + sata_edma_ctrl(parent, 0); + + ata_sata_setmode(dev, ATA_PIO_MAX); + if (atadev->mode >= ATA_DMA) + ata_sata_setmode(dev, atadev->mode); +} + +static void +sata_channel_dmasetprd(void *xsc, bus_dma_segment_t *segs, int nsegs, + int error) +{ + struct ata_dmasetprd_args *args; + struct sata_prdentry *prd; + int i; + + args = xsc; + prd = args->dmatab; + + if ((args->error = error)) + return; + + for (i = 0; i < nsegs; i++) { + prd[i].prd_addrlo = htole32(segs[i].ds_addr); + prd[i].prd_addrhi = htole32((uint64_t)segs[i].ds_addr >> 32); + prd[i].prd_count = htole32(segs[i].ds_len); + } + + prd[i - 1].prd_count |= htole32(ATA_DMA_EOT); + KASSERT(nsegs <= ATA_DMA_ENTRIES, ("too many DMA segment entries.\n")); + args->nsegs = nsegs; +} + +static int +sata_edma_ctrl(device_t dev, int on) +{ + struct sata_softc *sc; + struct ata_channel *ch; + int bit, timeout; + uint32_t reg; + + sc = device_get_softc(device_get_parent(dev)); + ch = device_get_softc(dev); + bit = on ? SATA_EDMA_CMD_ENABLE : SATA_EDMA_CMD_DISABLE; + timeout = EDMA_TIMEOUT; + + SATA_OUTL(sc, SATA_EDMA_CMD(ch->unit), bit); + + while (1) { + DELAY(1); + + reg = SATA_INL(sc, SATA_EDMA_CMD(ch->unit)); + + /* Enable bit will be 1 after disable command completion */ + if (on && (reg & SATA_EDMA_CMD_ENABLE)) + break; + + /* Disable bit will be 0 after disable command completion */ + if (!on && !(reg & SATA_EDMA_CMD_DISABLE)) + break; + + if (timeout-- <= 0) { + device_printf(dev, "EDMA command timeout!\n"); + return (ETIMEDOUT); + } + } + + return (0); +} + +static int +sata_edma_is_running(device_t dev) +{ + struct sata_softc *sc; + struct ata_channel *ch; + + sc = device_get_softc(device_get_parent(dev)); + ch = device_get_softc(dev); + + return (SATA_INL(sc, SATA_EDMA_CMD(ch->unit)) & SATA_EDMA_CMD_ENABLE); +} + +static device_method_t sata_channel_methods[] = { + /* Device interface. */ + DEVMETHOD(device_probe, sata_channel_probe), + DEVMETHOD(device_attach, sata_channel_attach), + DEVMETHOD(device_detach, sata_channel_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_suspend, ata_suspend), + DEVMETHOD(device_resume, ata_resume), + + /* ATA channel interface */ + DEVMETHOD(ata_reset, sata_channel_reset), + DEVMETHOD(ata_setmode, sata_channel_setmode), + { 0, 0 } +}; + +driver_t sata_channel_driver = { + "ata", + sata_channel_methods, + sizeof(struct ata_channel), +}; + +DRIVER_MODULE(ata, sata, sata_channel_driver, ata_devclass, 0, 0); Modified: head/sys/arm/mv/mvreg.h ============================================================================== --- head/sys/arm/mv/mvreg.h Wed Jun 24 15:38:17 2009 (r194844) +++ head/sys/arm/mv/mvreg.h Wed Jun 24 15:41:18 2009 (r194845) @@ -274,6 +274,75 @@ #define CPU_TIMER0 0x14 /* + * SATA + */ +#define SATA_CHAN_NUM 2 + +#define EDMA_REGISTERS_OFFSET 0x2000 +#define EDMA_REGISTERS_SIZE 0x2000 +#define SATA_EDMA_BASE(ch) (EDMA_REGISTERS_OFFSET + \ + ((ch) * EDMA_REGISTERS_SIZE)) + +/* SATAHC registers */ +#define SATA_CR 0x000 /* Configuration Reg. */ +#define SATA_CR_NODMABS (1 << 8) +#define SATA_CR_NOEDMABS (1 << 9) +#define SATA_CR_NOPRDPBS (1 << 10) +#define SATA_CR_COALDIS(ch) (1 << (24 + ch)) + +#define SATA_ICR 0x014 /* Interrupt Cause Reg. */ +#define SATA_ICR_DMADONE(ch) (1 << (ch)) +#define SATA_ICR_COAL (1 << 4) +#define SATA_ICR_DEV(ch) (1 << (8 + ch)) + +#define SATA_MICR 0x020 /* Main Interrupt Cause Reg. */ +#define SATA_MICR_ERR(ch) (1 << (2 * ch)) +#define SATA_MICR_DONE(ch) (1 << ((2 * ch) + 1)) +#define SATA_MICR_DMADONE(ch) (1 << (4 + ch)) +#define SATA_MICR_COAL (1 << 8) + +#define SATA_MIMR 0x024 /* Main Interrupt Mask Reg. */ + +/* Shadow registers */ +#define SATA_SHADOWR_BASE(ch) (SATA_EDMA_BASE(ch) + 0x100) +#define SATA_SHADOWR_CONTROL(ch) (SATA_EDMA_BASE(ch) + 0x120) + +/* SATA registers */ +#define SATA_SATA_SSTATUS(ch) (SATA_EDMA_BASE(ch) + 0x300) +#define SATA_SATA_SERROR(ch) (SATA_EDMA_BASE(ch) + 0x304) +#define SATA_SATA_SCONTROL(ch) (SATA_EDMA_BASE(ch) + 0x308) +#define SATA_SATA_FISICR(ch) (SATA_EDMA_BASE(ch) + 0x364) + +/* EDMA registers */ +#define SATA_EDMA_CFG(ch) (SATA_EDMA_BASE(ch) + 0x000) +#define SATA_EDMA_CFG_QL128 (1 << 19) +#define SATA_EDMA_CFG_HQCACHE (1 << 22) + +#define SATA_EDMA_IECR(ch) (SATA_EDMA_BASE(ch) + 0x008) + +#define SATA_EDMA_IEMR(ch) (SATA_EDMA_BASE(ch) + 0x00C) +#define SATA_EDMA_REQBAHR(ch) (SATA_EDMA_BASE(ch) + 0x010) +#define SATA_EDMA_REQIPR(ch) (SATA_EDMA_BASE(ch) + 0x014) +#define SATA_EDMA_REQOPR(ch) (SATA_EDMA_BASE(ch) + 0x018) +#define SATA_EDMA_RESBAHR(ch) (SATA_EDMA_BASE(ch) + 0x01C) +#define SATA_EDMA_RESIPR(ch) (SATA_EDMA_BASE(ch) + 0x020) +#define SATA_EDMA_RESOPR(ch) (SATA_EDMA_BASE(ch) + 0x024) + +#define SATA_EDMA_CMD(ch) (SATA_EDMA_BASE(ch) + 0x028) +#define SATA_EDMA_CMD_ENABLE (1 << 0) +#define SATA_EDMA_CMD_DISABLE (1 << 1) +#define SATA_EDMA_CMD_RESET (1 << 2) + +#define SATA_EDMA_STATUS(ch) (SATA_EDMA_BASE(ch) + 0x030) +#define SATA_EDMA_STATUS_IDLE (1 << 7) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 15:48:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97FC2106564A; Wed, 24 Jun 2009 15:48:20 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 864388FC13; Wed, 24 Jun 2009 15:48:20 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OFmKrk019296; Wed, 24 Jun 2009 15:48:20 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OFmKKk019294; Wed, 24 Jun 2009 15:48:20 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200906241548.n5OFmKKk019294@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 24 Jun 2009 15:48: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: r194849 - head/sys/powerpc/mpc85xx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 15:48:21 -0000 Author: raj Date: Wed Jun 24 15:48:20 2009 New Revision: 194849 URL: http://svn.freebsd.org/changeset/base/194849 Log: More precise description of the DS1553 driver. Pointed out by: stas Modified: head/sys/powerpc/mpc85xx/ds1553_bus_lbc.c Modified: head/sys/powerpc/mpc85xx/ds1553_bus_lbc.c ============================================================================== --- head/sys/powerpc/mpc85xx/ds1553_bus_lbc.c Wed Jun 24 15:44:51 2009 (r194848) +++ head/sys/powerpc/mpc85xx/ds1553_bus_lbc.c Wed Jun 24 15:48:20 2009 (r194849) @@ -87,7 +87,7 @@ rtc_probe(device_t dev) if (devtype != LBC_DEVTYPE_RTC) return (EINVAL); - device_set_desc(dev, "Real Time Clock"); + device_set_desc(dev, "Dallas Semiconductor DS1553 RTC"); return (0); } From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 16:03:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23F171065670; Wed, 24 Jun 2009 16:03:58 +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 086908FC1D; Wed, 24 Jun 2009 16:03:58 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OG3vhB019641; Wed, 24 Jun 2009 16:03:57 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OG3vpo019638; Wed, 24 Jun 2009 16:03:57 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200906241603.n5OG3vpo019638@svn.freebsd.org> From: Andriy Gapon Date: Wed, 24 Jun 2009 16:03: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: r194850 - head/sys/cddl/dev/dtrace/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 16:03:58 -0000 Author: avg Date: Wed Jun 24 16:03:57 2009 New Revision: 194850 URL: http://svn.freebsd.org/changeset/base/194850 Log: dtrace/amd64: fix virtual address checks On amd64 KERNBASE/kernbase does not mean start of kernel memory. This should fix a KASSERT panic in dtrace_copycheck when copyin*() is used in D program. Also make checks for user memory a bit stricter. Reported by: Thomas Backman Submitted by: wxs (kaddr part) Tested by: Thomas Backman (prototype), wxs Reviewed by: alc (concept), jhb, current@ Aprroved by: jb (concept) MFC after: 2 weeks PR: kern/134408 Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Wed Jun 24 15:48:20 2009 (r194849) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Wed Jun 24 16:03:57 2009 (r194850) @@ -42,8 +42,6 @@ #include #include -extern uintptr_t kernbase; -uintptr_t kernelbase = (uintptr_t) &kernbase; uint8_t dtrace_fuword8_nocheck(void *); uint16_t dtrace_fuword16_nocheck(void *); @@ -524,9 +522,9 @@ dtrace_getreg(struct regs *rp, uint_t re static int dtrace_copycheck(uintptr_t uaddr, uintptr_t kaddr, size_t size) { - ASSERT(kaddr >= kernelbase && kaddr + size >= kaddr); + ASSERT(INKERNEL(kaddr) && kaddr + size >= kaddr); - if (uaddr + size >= kernelbase || uaddr + size < uaddr) { + if (uaddr + size > VM_MAXUSER_ADDRESS || uaddr + size < uaddr) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); cpu_core[curcpu].cpuc_dtrace_illval = uaddr; return (0); @@ -570,7 +568,7 @@ dtrace_copyoutstr(uintptr_t kaddr, uintp uint8_t dtrace_fuword8(void *uaddr) { - if ((uintptr_t)uaddr >= kernelbase) { + if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); @@ -581,7 +579,7 @@ dtrace_fuword8(void *uaddr) uint16_t dtrace_fuword16(void *uaddr) { - if ((uintptr_t)uaddr >= kernelbase) { + if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); @@ -592,7 +590,7 @@ dtrace_fuword16(void *uaddr) uint32_t dtrace_fuword32(void *uaddr) { - if ((uintptr_t)uaddr >= kernelbase) { + if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); @@ -603,7 +601,7 @@ dtrace_fuword32(void *uaddr) uint64_t dtrace_fuword64(void *uaddr) { - if ((uintptr_t)uaddr >= kernelbase) { + if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) { DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr; return (0); Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Wed Jun 24 15:48:20 2009 (r194849) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Wed Jun 24 16:03:57 2009 (r194850) @@ -40,7 +40,6 @@ #include #include -extern uintptr_t kernelbase; extern uintptr_t dtrace_in_probe_addr; extern int dtrace_in_probe; From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 16:11:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A05E106564A; Wed, 24 Jun 2009 16:11:29 +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 886658FC0A; Wed, 24 Jun 2009 16:11:29 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OGBT4e019850; Wed, 24 Jun 2009 16:11:29 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OGBTaI019848; Wed, 24 Jun 2009 16:11:29 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200906241611.n5OGBTaI019848@svn.freebsd.org> From: Scott Long Date: Wed, 24 Jun 2009 16:11:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194851 - head/sys/dev/mfi X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 16:11:30 -0000 Author: scottl Date: Wed Jun 24 16:11:29 2009 New Revision: 194851 URL: http://svn.freebsd.org/changeset/base/194851 Log: fw_state ad cur_state are holding unsigned bitfields, so declare then as unsigned as well. Submitted by: rdivacky Modified: head/sys/dev/mfi/mfi.c Modified: head/sys/dev/mfi/mfi.c ============================================================================== --- head/sys/dev/mfi/mfi.c Wed Jun 24 16:03:57 2009 (r194850) +++ head/sys/dev/mfi/mfi.c Wed Jun 24 16:11:29 2009 (r194851) @@ -230,7 +230,7 @@ mfi_issue_cmd_ppc(struct mfi_softc *sc,u static int mfi_transition_firmware(struct mfi_softc *sc) { - int32_t fw_state, cur_state; + uint32_t fw_state, cur_state; int max_wait, i; fw_state = sc->mfi_read_fw_status(sc)& MFI_FWSTATE_MASK; From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 16:52:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2DBC1065675; Wed, 24 Jun 2009 16:52:23 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5AD08FC12; Wed, 24 Jun 2009 16:52:23 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OGqNOe021028; Wed, 24 Jun 2009 16:52:23 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OGqNcm021026; Wed, 24 Jun 2009 16:52:23 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906241652.n5OGqNcm021026@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 16:52:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194857 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 16:52:24 -0000 Author: rwatson Date: Wed Jun 24 16:52:23 2009 New Revision: 194857 URL: http://svn.freebsd.org/changeset/base/194857 Log: Rework locking and reference counting in ipx_control to be consistent with the model used in in_control(). MFC after: 6 weeks Modified: head/sys/netipx/ipx.c Modified: head/sys/netipx/ipx.c ============================================================================== --- head/sys/netipx/ipx.c Wed Jun 24 16:37:44 2009 (r194856) +++ head/sys/netipx/ipx.c Wed Jun 24 16:52:23 2009 (r194857) @@ -100,11 +100,10 @@ ipx_control(struct socket *so, u_long cm { struct ifreq *ifr = (struct ifreq *)data; struct ipx_aliasreq *ifra = (struct ipx_aliasreq *)data; - struct ipx_ifaddr *ia; + struct ipx_ifaddr *ia, *ia_temp, *oia; struct ifaddr *ifa; - struct ipx_ifaddr *oia; int dstIsNew, hostIsNew; - int error = 0, priv; + int error, priv; /* * Find address for this interface, if it exists. @@ -112,11 +111,15 @@ ipx_control(struct socket *so, u_long cm if (ifp == NULL) return (EADDRNOTAVAIL); - IPX_IFADDR_WLOCK(); + IPX_IFADDR_RLOCK(); for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) if (ia->ia_ifp == ifp) break; + if (ia != NULL) + ifa_ref(&ia->ia_ifa); + IPX_IFADDR_RUNLOCK(); + error = 0; switch (cmd) { case SIOCGIFADDR: if (ia == NULL) { @@ -158,13 +161,21 @@ ipx_control(struct socket *so, u_long cm PRIV_NET_DELIFADDR; if (td && (error = priv_check(td, priv)) != 0) goto out; - if (ifra->ifra_addr.sipx_family == AF_IPX) - for (oia = ia; ia != NULL; ia = ia->ia_next) { - if (ia->ia_ifp == ifp && - ipx_neteq(ia->ia_addr.sipx_addr, - ifra->ifra_addr.sipx_addr)) - break; - } + + IPX_IFADDR_RLOCK(); + if (ifra->ifra_addr.sipx_family == AF_IPX) { + for (oia = ia; ia != NULL; ia = ia->ia_next) { + if (ia->ia_ifp == ifp && + ipx_neteq(ia->ia_addr.sipx_addr, + ifra->ifra_addr.sipx_addr)) + break; + } + if (oia != NULL && oia != ia) + ifa_free(&oia->ia_ifa); + if (ia != NULL && oia != ia) + ifa_ref(&ia->ia_ifa); + } + IPX_IFADDR_RUNLOCK(); if (cmd == SIOCDIFADDR && ia == NULL) { error = EADDRNOTAVAIL; goto out; @@ -176,20 +187,11 @@ ipx_control(struct socket *so, u_long cm if (td && (error = priv_check(td, PRIV_NET_SETLLADDR)) != 0) goto out; if (ia == NULL) { - oia = (struct ipx_ifaddr *) - malloc(sizeof(*ia), M_IFADDR, - M_NOWAIT | M_ZERO); - if (oia == NULL) { + ia = malloc(sizeof(*ia), M_IFADDR, M_NOWAIT | M_ZERO); + if (ia == NULL) { error = ENOBUFS; goto out; } - if ((ia = ipx_ifaddr) != NULL) { - for ( ; ia->ia_next != NULL; ia = ia->ia_next) - ; - ia->ia_next = oia; - } else - ipx_ifaddr = oia; - ia = oia; ifa = (struct ifaddr *)ia; ifa_init(ifa); ia->ia_ifp = ifp; @@ -203,6 +205,18 @@ ipx_control(struct socket *so, u_long cm ia->ia_broadaddr.sipx_addr.x_host = ipx_broadhost; } + ifa_ref(&ia->ia_ifa); /* ipx_ifaddr */ + IPX_IFADDR_WLOCK(); + if ((ia_temp = ipx_ifaddr) != NULL) { + for (; ia_temp->ia_next != NULL; + ia_temp = ia_temp->ia_next) + ; + ia_temp->ia_next = ia; + } else + ipx_ifaddr = ia; + IPX_IFADDR_WUNLOCK(); + + ifa_ref(&ia->ia_ifa); /* if_addrhead */ IF_ADDR_LOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); IF_ADDR_UNLOCK(ifp); @@ -224,54 +238,43 @@ ipx_control(struct socket *so, u_long cm rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST); ia->ia_flags &= ~IFA_ROUTE; } - ifa_ref(&ia->ia_ifa); - IPX_IFADDR_WUNLOCK(); if (ifp->if_ioctl) { error = (*ifp->if_ioctl)(ifp, SIOCSIFDSTADDR, (void *)ia); - if (error) { - ifa_free(&ia->ia_ifa); - return (error); - } + if (error) + goto out; } *(struct sockaddr *)&ia->ia_dstaddr = ifr->ifr_dstaddr; - ifa_free(&ia->ia_ifa); - return (0); + goto out; case SIOCSIFADDR: - ifa_ref(&ia->ia_ifa); - IPX_IFADDR_WUNLOCK(); error = ipx_ifinit(ifp, ia, (struct sockaddr_ipx *)&ifr->ifr_addr, 1); - ifa_free(&ia->ia_ifa); - return (error); + goto out; case SIOCDIFADDR: - /* XXXRW: Potential race here while ipx_ifaddr_rw is dropped. */ - ifa_ref(&ia->ia_ifa); - IPX_IFADDR_WUNLOCK(); ipx_ifscrub(ifp, ia); - IPX_IFADDR_WLOCK(); - ifa_free(&ia->ia_ifa); ifa = (struct ifaddr *)ia; + IF_ADDR_LOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); IF_ADDR_UNLOCK(ifp); - oia = ia; - if (oia == (ia = ipx_ifaddr)) { + ifa_free(ifa); /* if_addrhead */ + + IPX_IFADDR_WLOCK(); + if (ia == (ia_temp = ipx_ifaddr)) { ipx_ifaddr = ia->ia_next; } else { - while (ia->ia_next && (ia->ia_next != oia)) { - ia = ia->ia_next; - } - if (ia->ia_next) - ia->ia_next = oia->ia_next; + while (ia_temp->ia_next && (ia_temp->ia_next != ia)) + ia_temp = ia_temp->ia_next; + if (ia_temp->ia_next) + ia_temp->ia_next = ia->ia_next; else - printf("Didn't unlink ipxifadr from list\n"); + panic("Didn't unlink ipxifadr from list\n"); } - ifa_free(&oia->ia_ifa); IPX_IFADDR_WUNLOCK(); - return (0); + ifa_free(&ia->ia_ifa); /* ipx_ifaddr */ + goto out; case SIOCAIFADDR: dstIsNew = 0; @@ -284,8 +287,6 @@ ipx_control(struct socket *so, u_long cm ia->ia_addr.sipx_addr)) hostIsNew = 0; } - ifa_ref(&ia->ia_ifa); - IPX_IFADDR_WUNLOCK(); if ((ifp->if_flags & IFF_POINTOPOINT) && (ifra->ifra_dstaddr.sipx_family == AF_IPX)) { if (hostIsNew == 0) @@ -296,18 +297,19 @@ ipx_control(struct socket *so, u_long cm if (ifra->ifra_addr.sipx_family == AF_IPX && (hostIsNew || dstIsNew)) error = ipx_ifinit(ifp, ia, &ifra->ifra_addr, 0); - ifa_free(&ia->ia_ifa); - return (error); + goto out; default: - IPX_IFADDR_WUNLOCK(); - if (ifp->if_ioctl == NULL) - return (EOPNOTSUPP); - return ((*ifp->if_ioctl)(ifp, cmd, data)); + if (ifp->if_ioctl == NULL) { + error = EOPNOTSUPP; + goto out; + } + error = ((*ifp->if_ioctl)(ifp, cmd, data)); } out: - IPX_IFADDR_WUNLOCK(); + if (ia != NULL) + ifa_free(&ia->ia_ifa); return (error); } From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 16:52:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ABD28106571A; Wed, 24 Jun 2009 16:52:31 +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 5A7278FC08; Wed, 24 Jun 2009 16:52:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OGqUm5021069; Wed, 24 Jun 2009 16:52:30 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OGqUFm021067; Wed, 24 Jun 2009 16:52:30 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200906241652.n5OGqUFm021067@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 24 Jun 2009 16:52:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194858 - head/sys/sparc64/sparc64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 16:52:32 -0000 Author: kib Date: Wed Jun 24 16:52:30 2009 New Revision: 194858 URL: http://svn.freebsd.org/changeset/base/194858 Log: Unbreak sparc64 after the swap accounting changes: mark kernel_map entries allocated for translations in pmap_init() as MAP_NOFAULT. This prevents vm_map_insert from trying to account the entries for swap usage, that is both wrong and too early to work. While there, change FALSE to VMFS_NO_SPACE. Reported and tested by: Florian Smeets Reviewed by: marius Modified: head/sys/sparc64/sparc64/pmap.c Modified: head/sys/sparc64/sparc64/pmap.c ============================================================================== --- head/sys/sparc64/sparc64/pmap.c Wed Jun 24 16:52:23 2009 (r194857) +++ head/sys/sparc64/sparc64/pmap.c Wed Jun 24 16:52:30 2009 (r194858) @@ -629,8 +629,8 @@ pmap_init(void) continue; if (addr < VM_MIN_PROM_ADDRESS || addr > VM_MAX_PROM_ADDRESS) continue; - result = vm_map_find(kernel_map, NULL, 0, &addr, size, FALSE, - VM_PROT_ALL, VM_PROT_ALL, 0); + result = vm_map_find(kernel_map, NULL, 0, &addr, size, + VMFS_NO_SPACE, VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT); if (result != KERN_SUCCESS || addr != translations[i].om_start) panic("pmap_init: vm_map_find"); } From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 16:57:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4CE301065670; Wed, 24 Jun 2009 16:57:34 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A73C8FC23; Wed, 24 Jun 2009 16:57:34 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OGvXHe021215; Wed, 24 Jun 2009 16:57:33 GMT (envelope-from gad@svn.freebsd.org) Received: (from gad@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OGvXIo021213; Wed, 24 Jun 2009 16:57:33 GMT (envelope-from gad@svn.freebsd.org) Message-Id: <200906241657.n5OGvXIo021213@svn.freebsd.org> From: Garance A Drosehn Date: Wed, 24 Jun 2009 16:57: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: r194859 - head/usr.sbin/lpr/common_source X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 16:57:34 -0000 Author: gad Date: Wed Jun 24 16:57:33 2009 New Revision: 194859 URL: http://svn.freebsd.org/changeset/base/194859 Log: Fix end-of-line issues that can come up when `lpq' reads information about a queue from a remote host. That remote host may use \r, \r\n, or \n\r as the line-ending character. In some cases the remote host will write a single line of information without *any* EOL sequence. Translate all the non-unix EOL's to the standard newline, and make sure the final line includes a terminating newline. Logic is also added to translate all unprintable characters to '?', but that is #if-ed out for now. PR: bin/104731 MFC after: 3 weeks Modified: head/usr.sbin/lpr/common_source/displayq.c Modified: head/usr.sbin/lpr/common_source/displayq.c ============================================================================== --- head/usr.sbin/lpr/common_source/displayq.c Wed Jun 24 16:52:30 2009 (r194858) +++ head/usr.sbin/lpr/common_source/displayq.c Wed Jun 24 16:57:33 2009 (r194859) @@ -69,6 +69,13 @@ __FBSDID("$FreeBSD$"); #define SIZCOL 62 /* start of Size column in normal */ /* + * isprint() takes a parameter of 'int', but expect values in the range + * of unsigned char. Define a wrapper which takes a value of type 'char', + * whether signed or unsigned, and ensure it ends up in the right range. + */ +#define isprintch(Anychar) isprint((u_char)(Anychar)) + +/* * Stuff for handling job specifications */ extern uid_t uid, euid; @@ -86,6 +93,7 @@ static const char *head0 = "Rank Owne static const char *head1 = "Total Size\n"; static void alarmhandler(int _signo); +static void filtered_write(char *_obuffer, int _wlen, FILE *_wstream); static void warn(const struct printer *_pp); /* @@ -254,12 +262,105 @@ displayq(struct printer *pp, int format) if (write(fd, line, i) != i) fatal(pp, "Lost connection"); while ((i = read(fd, line, sizeof(line))) > 0) - (void) fwrite(line, 1, i, stdout); + filtered_write(line, i, stdout); + filtered_write(NULL, -1, stdout); (void) close(fd); } } /* + * The lpq-info read from remote hosts may contain unprintable characters, + * or carriage-returns instead of line-feeds. Clean those up before echoing + * the lpq-info line(s) to stdout. The info may also be missing any kind of + * end-of-line character. This also turns CRLF and LFCR into a plain LF. + * + * This routine may be called multiple times to process a single set of + * information, and after a set is finished this routine must be called + * one extra time with NULL specified as the buffer address. + */ +static void +filtered_write(char *wbuffer, int wlen, FILE *wstream) +{ + static char lastchar, savedchar; + char *chkptr, *dest_end, *dest_ch, *nxtptr, *w_end; + int destlen; + char destbuf[BUFSIZ]; + + if (wbuffer == NULL) { + if (savedchar != '\0') { + if (savedchar == '\r') + savedchar = '\n'; + fputc(savedchar, wstream); + lastchar = savedchar; + savedchar = '\0'; + } + if (lastchar != '\0' && lastchar != '\n') + fputc('\n', wstream); + lastchar = '\0'; + return; + } + + dest_ch = &destbuf[0]; + dest_end = dest_ch + sizeof(destbuf); + chkptr = wbuffer; + w_end = wbuffer + wlen; + lastchar = '\0'; + if (savedchar != '\0') { + chkptr = &savedchar; + nxtptr = wbuffer; + } else + nxtptr = chkptr + 1; + + while (chkptr < w_end) { + if (nxtptr < w_end) { + if ((*chkptr == '\r' && *nxtptr == '\n') || + (*chkptr == '\n' && *nxtptr == '\r')) { + *dest_ch++ = '\n'; + /* want to skip past that second character */ + nxtptr++; + goto check_next; + } + } else { + /* This is the last byte in the buffer given on this + * call, so check if it could be the first-byte of a + * significant two-byte sequence. If it is, then + * don't write it out now, but save for checking in + * the next call. + */ + savedchar = '\0'; + if (*chkptr == '\r' || *chkptr == '\n') { + savedchar = *chkptr; + break; + } + } + if (*chkptr == '\r') + *dest_ch++ = '\n'; +#if 0 /* XXX - don't translate unprintable characters (yet) */ + else if (*chkptr != '\t' && *chkptr != '\n' && + !isprintch(*chkptr)) + *dest_ch++ = '?'; +#endif + else + *dest_ch++ = *chkptr; + +check_next: + chkptr = nxtptr; + nxtptr = chkptr + 1; + if (dest_ch >= dest_end) { + destlen = dest_ch - &destbuf[0]; + fwrite(destbuf, 1, destlen, wstream); + lastchar = destbuf[destlen - 1]; + dest_ch = &destbuf[0]; + } + } + destlen = dest_ch - &destbuf[0]; + if (destlen > 0) { + fwrite(destbuf, 1, destlen, wstream); + lastchar = destbuf[destlen - 1]; + } +} + +/* * Print a warning message if there is no daemon present. */ static void From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 17:01:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56A771065679; Wed, 24 Jun 2009 17:01:18 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 42B0F8FC17; Wed, 24 Jun 2009 17:01:18 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OH1I1q021342; Wed, 24 Jun 2009 17:01:18 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OH1IXl021337; Wed, 24 Jun 2009 17:01:18 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200906241701.n5OH1IXl021337@svn.freebsd.org> From: Andrew Thompson Date: Wed, 24 Jun 2009 17:01: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: r194860 - in head: . share/man/man4 share/man/man9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 17:01:18 -0000 Author: thompsa Date: Wed Jun 24 17:01:17 2009 New Revision: 194860 URL: http://svn.freebsd.org/changeset/base/194860 Log: Move programming info from usb(4) to usbdi(9) and update for the usb stack changeover. Needs much more content still. Modified: head/ObsoleteFiles.inc head/share/man/man4/usb.4 head/share/man/man9/Makefile head/share/man/man9/usbdi.9 Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Jun 24 16:57:33 2009 (r194859) +++ head/ObsoleteFiles.inc Wed Jun 24 17:01:17 2009 (r194860) @@ -14,6 +14,53 @@ # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last. # +# 20090624: update usbdi(9) +OLD_FILES+=usr/share/man/man9/usbd_abort_default_pipe.9 +OLD_FILES+=usr/share/man/man9/usbd_abort_pipe.9 +OLD_FILES+=usr/share/man/man9/usbd_alloc_buffer.9 +OLD_FILES+=usr/share/man/man9/usbd_alloc_xfer.9 +OLD_FILES+=usr/share/man/man9/usbd_clear_endpoint_stall.9 +OLD_FILES+=usr/share/man/man9/usbd_clear_endpoint_stall_async.9 +OLD_FILES+=usr/share/man/man9/usbd_clear_endpoint_toggle.9 +OLD_FILES+=usr/share/man/man9/usbd_close_pipe.9 +OLD_FILES+=usr/share/man/man9/usbd_device2interface_handle.9 +OLD_FILES+=usr/share/man/man9/usbd_do_request_async.9 +OLD_FILES+=usr/share/man/man9/usbd_do_request_flags_pipe.9 +OLD_FILES+=usr/share/man/man9/usbd_endpoint_count.9 +OLD_FILES+=usr/share/man/man9/usbd_find_edesc.9 +OLD_FILES+=usr/share/man/man9/usbd_find_idesc.9 +OLD_FILES+=usr/share/man/man9/usbd_free_buffer.9 +OLD_FILES+=usr/share/man/man9/usbd_free_xfer.9 +OLD_FILES+=usr/share/man/man9/usbd_get_buffer.9 +OLD_FILES+=usr/share/man/man9/usbd_get_config.9 +OLD_FILES+=usr/share/man/man9/usbd_get_config_desc.9 +OLD_FILES+=usr/share/man/man9/usbd_get_config_desc_full.9 +OLD_FILES+=usr/share/man/man9/usbd_get_config_descriptor.9 +OLD_FILES+=usr/share/man/man9/usbd_get_device_descriptor.9 +OLD_FILES+=usr/share/man/man9/usbd_get_endpoint_descriptor.9 +OLD_FILES+=usr/share/man/man9/usbd_get_interface_altindex.9 +OLD_FILES+=usr/share/man/man9/usbd_get_interface_descriptor.9 +OLD_FILES+=usr/share/man/man9/usbd_get_no_alts.9 +OLD_FILES+=usr/share/man/man9/usbd_get_quirks.9 +OLD_FILES+=usr/share/man/man9/usbd_get_speed.9 +OLD_FILES+=usr/share/man/man9/usbd_get_string.9 +OLD_FILES+=usr/share/man/man9/usbd_get_string_desc.9 +OLD_FILES+=usr/share/man/man9/usbd_get_xfer_status.9 +OLD_FILES+=usr/share/man/man9/usbd_interface2device_handle.9 +OLD_FILES+=usr/share/man/man9/usbd_interface2endpoint_descriptor.9 +OLD_FILES+=usr/share/man/man9/usbd_interface_count.9 +OLD_FILES+=usr/share/man/man9/usbd_open_pipe.9 +OLD_FILES+=usr/share/man/man9/usbd_open_pipe_intr.9 +OLD_FILES+=usr/share/man/man9/usbd_pipe2device_handle.9 +OLD_FILES+=usr/share/man/man9/usbd_set_config_index.9 +OLD_FILES+=usr/share/man/man9/usbd_set_config_no.9 +OLD_FILES+=usr/share/man/man9/usbd_set_interface.9 +OLD_FILES+=usr/share/man/man9/usbd_setup_default_xfer.9 +OLD_FILES+=usr/share/man/man9/usbd_setup_isoc_xfer.9 +OLD_FILES+=usr/share/man/man9/usbd_setup_xfer.9 +OLD_FILES+=usr/share/man/man9/usbd_sync_transfer.9 +OLD_FILES+=usr/share/man/man9/usbd_transfer.9 +OLD_FILES+=usr/share/man/man9/usb_find_desc.9 # 20090605: removal of clists OLD_FILES+=usr/include/sys/clist.h # 20090602: removal of window(1) Modified: head/share/man/man4/usb.4 ============================================================================== --- head/share/man/man4/usb.4 Wed Jun 24 16:57:33 2009 (r194859) +++ head/share/man/man4/usb.4 Wed Jun 24 17:01:17 2009 (r194860) @@ -162,548 +162,6 @@ Any interface specific driver can attach .It If none is found, generic interface class drivers can attach. .El -.Sh USB KERNEL PROGRAMMING -Here is a list of commonly used functions: -.Pp -. -.Ft "usb2_error_t" -.Fo "usb2_transfer_setup" -.Fa "udev" -.Fa "ifaces" -.Fa "pxfer" -.Fa "setup_start" -.Fa "n_setup" -.Fa "priv_sc" -.Fa "priv_mtx" -.Fc -. -.Pp -. -.Ft "void" -.Fo "usb2_transfer_unsetup" -.Fa "pxfer" -.Fa "n_setup" -.Fc -. -.Pp -. -.Ft "void" -.Fo "usb2_transfer_start" -.Fa "xfer" -.Fc -. -.Pp -. -.Ft "void" -.Fo "usb2_transfer_stop" -.Fa "xfer" -.Fc -. -.Pp -. -.Ft "void" -.Fo "usb2_transfer_drain" -.Fa "xfer" -.Fc -. -. -.Sh DESCRIPTION -The -.Nm -module implements the core functionality of the USB standard and many -helper functions to make USB device driver programming easier and more -safe. -. -The -.Nm -module supports both USB Host and USB Device side mode! -. -.Sh USB TRANSFER MANAGEMENT FUNCTIONS -The USB standard defines four types of USB transfers. -. -Control transfers, Bulk transfers, Interrupt transfers and Isochronous -transfers. -. -All the transfer types are managed using the following five functions: -. -.Pp -. -.Fn usb2_transfer_setup -This function will allocate memory for and initialise an array of USB -transfers and all required DMA memory. -. -This function can sleep or block waiting for resources to become -available. -.Fa udev -is a pointer to "struct usb2_device". -.Fa ifaces -is an array of interface index numbers to use. See "if_index". -.Fa pxfer -is a pointer to an array of USB transfer pointers that are initialized -to NULL, and then pointed to allocated USB transfers. -.Fa setup_start -is a pointer to an array of USB config structures. -.Fa n_setup -is a number telling the USB system how many USB transfers should be -setup. -.Fa priv_sc -is the private softc pointer, which will be used to initialize -"xfer->priv_sc". -.Fa priv_mtx -is the private mutex protecting the transfer structure and the -softc. This pointer is used to initialize "xfer->priv_mtx". -This function returns -zero upon success. A non-zero return value indicates failure. -. -.Pp -. -.Fn usb2_transfer_unsetup -This function will release the given USB transfers and all allocated -resources associated with these USB transfers. -.Fa pxfer -is a pointer to an array of USB transfer pointers, that may be NULL, -that should be freed by the USB system. -.Fa n_setup -is a number telling the USB system how many USB transfers should be -unsetup. -. -This function can sleep waiting for USB transfers to complete. -. -This function is NULL safe with regard to the USB transfer structure -pointer. -. -It is not allowed to call this function from the USB transfer -callback. -. -.Pp -. -.Fn usb2_transfer_start -This function will start the USB transfer pointed to by -.Fa xfer, -if not already started. -. -This function is always non-blocking and must be called with the -so-called private USB mutex locked. -. -This function is NULL safe with regard to the USB transfer structure -pointer. -. -.Pp -. -.Fn usb2_transfer_stop -This function will stop the USB transfer pointed to by -.Fa xfer, -if not already stopped. -. -This function is always non-blocking and must be called with the -so-called private USB mutex locked. -. -This function can return before the USB callback has been called. -. -This function is NULL safe with regard to the USB transfer structure -pointer. -. -If the transfer was in progress, the callback will called with -"USB_ST_ERROR" and "xfer->error = USB_ERR_CANCELLED". -. -.Pp -. -.Fn usb2_transfer_drain -This function will stop an USB transfer, if not already stopped and -wait for any additional USB hardware operations to complete. -. -Buffers that are loaded into DMA using "usb2_set_frame_data()" can -safely be freed after that this function has returned. -. -This function can block the caller and will not return before the USB -callback has been called. -. -This function is NULL safe with regard to the USB transfer structure -pointer. -. -.Sh USB TRANSFER CALLBACK -. -The USB callback has three states. -. -USB_ST_SETUP, USB_ST_TRANSFERRED and USB_ST_ERROR. USB_ST_SETUP is the -initial state. -. -After the callback has been called with this state it will always be -called back at a later stage in one of the other two states. -. -In the USB_ST_ERROR state the "error" field of the USB transfer -structure is set to the error cause. -. -The USB callback should not restart the USB transfer in case the error -cause is USB_ERR_CANCELLED. -. -The USB callback is protected from recursion. -. -That means one can start and stop whatever transfer from the callback -of another transfer one desires. -. -Also the transfer that is currently called back. -. -Recursion is handled like this that when the callback that wants to -recurse returns it is called one more time. -. -. -.Pp -. -.Fn usb2_start_hardware -This function should only be called from within the USB callback and -is used to start the USB hardware. -. -Typical parameters that should be set in the USB transfer structure -before this function is called are "frlengths[]", "nframes" and -"frbuffers[]". -. -An USB transfer can have multiple frames consisting of one or more USB -packets making up an I/O vector for all USB transfer types. -. -After the USB transfer is complete "frlengths[]" is updated to the -actual USB transfer length for the given frame. -.Bd -literal -offset indent -void -usb2_default_callback(struct usb2_xfer *xfer) -{ - switch (USB_GET_STATE(xfer)) { - case USB_ST_SETUP: - /* - * Setup xfer->frlengths[], xfer->nframes - * and write data to xfer->frbuffers[], if any - */ - usb2_start_hardware(xfer); - break; - - case USB_ST_TRANSFERRED: - /* - * Read data from xfer->frbuffers[], if any. - * "xfer->frlengths[]" should now have been - * updated to the actual length. - */ - break; - - default: /* Error */ - /* - * Print error message and clear stall - * for example. - */ - break; - } - /* - * Here it is safe to do something without the private - * USB mutex locked. - */ - return; -} -.Ed -. -.Sh USB CONTROL TRANSFERS -An USB control transfer has three parts. -. -First the SETUP packet, then DATA packet(s) and then a STATUS -packet. -. -The SETUP packet is always pointed to by "xfer->frbuffers[0]" and the -length is stored in "xfer->frlengths[0]" also if there should not be -sent any SETUP packet! If an USB control transfer has no DATA stage, -then "xfer->nframes" should be set to 1. -. -Else the default value is "xfer->nframes" equal to 2. -. -.Bd -literal -offset indent - -Example1: SETUP + STATUS - xfer->nframes = 1; - xfer->frlenghts[0] = 8; - usb2_start_hardware(xfer); - -Example2: SETUP + DATA + STATUS - xfer->nframes = 2; - xfer->frlenghts[0] = 8; - xfer->frlenghts[1] = 1; - usb2_start_hardware(xfer); - -Example3: SETUP + DATA + STATUS - split -1st callback: - xfer->nframes = 1; - xfer->frlenghts[0] = 8; - usb2_start_hardware(xfer); - -2nd callback: - /* IMPORTANT: frbuffers[0] must still point at the setup packet! */ - xfer->nframes = 2; - xfer->frlenghts[0] = 0; - xfer->frlenghts[1] = 1; - usb2_start_hardware(xfer); - -Example4: SETUP + STATUS - split -1st callback: - xfer->nframes = 1; - xfer->frlenghts[0] = 8; - xfer->flags.manual_status = 1; - usb2_start_hardware(xfer); - -2nd callback: - xfer->nframes = 1; - xfer->frlenghts[0] = 0; - xfer->flags.manual_status = 0; - usb2_start_hardware(xfer); - -.Ed -.Sh USB TRANSFER CONFIG -To simply the search for endpoints the -.Nm -module defines a USB config structure where it is possible to specify -the characteristics of the wanted endpoint. -.Bd -literal -offset indent - -struct usb2_config { - bufsize, - callback - direction, - endpoint, - frames, - index flags, - interval, - timeout, - type, -}; - -.Ed -. -.Pp -.Fa type -field selects the USB pipe type. -. -Valid values are: UE_INTERRUPT, UE_CONTROL, UE_BULK, -UE_ISOCHRONOUS. -. -The special value UE_BULK_INTR will select BULK and INTERRUPT pipes. -. -This field is mandatory. -. -.Pp -.Fa endpoint -field selects the USB endpoint number. -. -A value of 0xFF, "-1" or "UE_ADDR_ANY" will select the first matching -endpoint. -. -This field is mandatory. -. -.Pp -.Fa direction -field selects the USB endpoint direction. -. -A value of "UE_DIR_ANY" will select the first matching endpoint. -. -Else valid values are: "UE_DIR_IN" and "UE_DIR_OUT". -. -"UE_DIR_IN" and "UE_DIR_OUT" can be binary OR'ed by "UE_DIR_SID" which -means that the direction will be swapped in case of -USB_MODE_DEVICE. -. -Note that "UE_DIR_IN" refers to the data transfer direction of the -"IN" tokens and "UE_DIR_OUT" refers to the data transfer direction of -the "OUT" tokens. -. -This field is mandatory. -. -.Pp -.Fa interval -field selects the interrupt interval. -. -The value of this field is given in milliseconds and is independent of -device speed. -. -Depending on the endpoint type, this field has different meaning: -.Bl -tag -.It UE_INTERRUPT -"0" use the default interrupt interval based on endpoint descriptor. -"Else" use the given value for polling rate. -.It UE_ISOCHRONOUS -"0" use default. "Else" the value is ignored. -.It UE_BULK -.It UE_CONTROL -"0" no transfer pre-delay. "Else" a delay as given by this field in -milliseconds is inserted before the hardware is started when -"usb2_start_hardware()" is called. -.Pp -NOTE: The transfer timeout, if any, is started after that the -pre-delay has elapsed! -.El -. -.Pp -.Fa timeout -field, if non-zero, will set the transfer timeout in milliseconds. If -the "timeout" field is zero and the transfer type is ISOCHRONOUS a -timeout of 250ms will be used. -. -.Pp -.Fa frames -field sets the maximum number of frames. If zero is specified it will -yield the following results: -.Bl -tag -.It UE_BULK -xfer->nframes = 1; -.It UE_INTERRUPT -xfer->nframes = 1; -.It UE_CONTROL -xfer->nframes = 2; -.It UE_ISOCHRONOUS -Not allowed. Will cause an error. -.El -. -.Pp -.Fa ep_index -field allows you to give a number, in case more endpoints match the -description, that selects which matching "ep_index" should be used. -. -.Pp -.Fa if_index -field allows you to select which of the interface numbers in the -"ifaces" array parameter passed to "usb2_transfer_setup" that should -be used when setting up the given USB transfer. -. -.Pp -.Fa flags -field has type "struct usb2_xfer_flags" and allows one to set initial -flags an USB transfer. Valid flags are: -.Bl -tag -.It force_short_xfer -This flag forces the last transmitted USB packet to be short. A short -packet has a length of less than "xfer->max_packet_size", which -derives from "wMaxPacketSize". This flag can be changed during -operation. -.It short_xfer_ok -This flag allows the received transfer length, "xfer->actlen" to be -less than "xfer->sumlen" upon completion of a transfer. This flag can -be changed during operation. -.It short_frames_ok -This flag allows the reception of multiple short USB frames. This flag -only has effect for BULK and INTERRUPT endpoints and if the number of -frames received is greater than 1. This flag can be changed during -operation. -.It pipe_bof -This flag causes a failing USB transfer to remain first in the PIPE -queue except in the case of "xfer->error" equal to -"USB_ERR_CANCELLED". No other USB transfers in the affected PIPE queue -will be started until either: -.Bl -tag -.It 1 -The failing USB transfer is stopped using "usb2_transfer_stop()". -.It 2 -The failing USB transfer performs a successful transfer. -.El -The purpose of this flag is to avoid races when multiple transfers are -queued for execution on an USB endpoint, and the first executing -transfer fails leading to the need for clearing of stall for -example. -. -In this case this flag is used to prevent the following USB transfers -from being executed at the same time the clear-stall command is -executed on the USB control endpoint. -. -This flag can be changed during operation. -.Pp -"BOF" is short for "Block On Failure" -.Pp -NOTE: This flag should be set on all BULK and INTERRUPT USB transfers -which use an endpoint that can be shared between userland and kernel. -. -. -.It proxy_buffer -Setting this flag will cause that the total buffer size will be -rounded up to the nearest atomic hardware transfer size. -. -The maximum data length of any USB transfer is always stored in the -"xfer->max_data_length". -. -For control transfers the USB kernel will allocate additional space -for the 8-bytes of SETUP header. -. -These 8-bytes are not counted by the "xfer->max_data_length" -variable. -. -This flag can not be changed during operation. -. -. -.It ext_buffer -Setting this flag will cause that no data buffer will be -allocated. -. -Instead the USB client must supply a data buffer. -. -This flag can not be changed during operation. -. -. -.It manual_status -Setting this flag prevents an USB STATUS stage to be appended to the -end of the USB control transfer. -. -If no control data is transferred this flag must be cleared. -. -Else an error will be returned to the USB callback. -. -This flag is mostly useful for the USB device side. -. -This flag can be changed during operation. -. -. -.It no_pipe_ok -Setting this flag causes the USB_ERR_NO_PIPE error to be ignored. This -flag can not be changed during operation. -. -. -.It stall_pipe -.Bl -tag -.It Device Side Mode -Setting this flag will cause STALL pids to be sent to the endpoint -belonging to this transfer before the transfer is started. -. -The transfer is started at the moment the host issues a clear-stall -command on the STALL'ed endpoint. -. -This flag can be changed during operation. -.It Host Side Mode -Setting this flag will cause a clear-stall control request to be -executed on the endpoint before the USB transfer is started. -.El -.Pp -If this flag is changed outside the USB callback function you have to -use the "usb2_transfer_set_stall()" and "usb2_transfer_clear_stall()" -functions! This flag is automatically cleared after that the stall or -clear stall has been executed. -. -.El -.Pp -.Fa bufsize -field sets the total buffer size in bytes. -. -If this field is zero, "wMaxPacketSize" will be used, multiplied by -the "frames" field if the transfer type is ISOCHRONOUS. -. -This is useful for setting up interrupt pipes. -. -This field is mandatory. -.Pp -NOTE: For control transfers "bufsize" includes the length of the -request structure. -. -.Pp -.Fa callback -pointer sets the USB callback. This field is mandatory. -. -. -.Sh USB LINUX COMPAT LAYER -The -.Nm -module supports the Linux USB API. -. -. -. .Sh SEE ALSO The .Tn USB @@ -712,6 +170,7 @@ specifications can be found at: .D1 Pa http://www.usb.org/developers/docs/ .Pp .Xr libusb 3 , +.Xr usbdi 4 , .Xr aue 4 , .Xr axe 4 , .Xr cue 4 , Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Wed Jun 24 16:57:33 2009 (r194859) +++ head/share/man/man9/Makefile Wed Jun 24 17:01:17 2009 (r194860) @@ -1210,55 +1210,58 @@ MLINKS+=uidinfo.9 uifind.9 \ uidinfo.9 uihashinit.9 \ uidinfo.9 uihold.9 MLINKS+=uio.9 uiomove.9 -MLINKS+=usbdi.9 usbd_abort_default_pipe.9 \ - usbdi.9 usbd_abort_pipe.9 \ - usbdi.9 usbd_alloc_buffer.9 \ - usbdi.9 usbd_alloc_xfer.9 \ - usbdi.9 usbd_clear_endpoint_stall.9 \ - usbdi.9 usbd_clear_endpoint_stall_async.9 \ - usbdi.9 usbd_clear_endpoint_toggle.9 \ - usbdi.9 usbd_close_pipe.9 \ - usbdi.9 usbd_device2interface_handle.9 \ +MLINKS+=usbdi.9 usb_fifo_alloc_buffer.9 \ + usbdi.9 usb_fifo_attach.9 \ + usbdi.9 usb_fifo_detach.9 \ + usbdi.9 usb_fifo_free_buffer.9 \ + usbdi.9 usb_fifo_get_data.9 \ + usbdi.9 usb_fifo_get_data_buffer.9 \ + usbdi.9 usb_fifo_get_data_error.9 \ + usbdi.9 usb_fifo_get_data_linear.9 \ + usbdi.9 usb_fifo_put_bytes_max.9 \ + usbdi.9 usb_fifo_put_data.9 \ + usbdi.9 usb_fifo_put_data_buffer.9 \ + usbdi.9 usb_fifo_put_data_error.9 \ + usbdi.9 usb_fifo_put_data_linear.9 \ + usbdi.9 usb_fifo_reset.9 \ + usbdi.9 usb_fifo_softc.9 \ + usbdi.9 usb_fifo_wakeup.9 \ usbdi.9 usbd_do_request.9 \ - usbdi.9 usbd_do_request_async.9 \ usbdi.9 usbd_do_request_flags.9 \ - usbdi.9 usbd_do_request_flags_pipe.9 \ - usbdi.9 usbd_endpoint_count.9 \ usbdi.9 usbd_errstr.9 \ - usbdi.9 usbd_find_edesc.9 \ - usbdi.9 usbd_find_idesc.9 \ - usbdi.9 usbd_free_buffer.9 \ - usbdi.9 usbd_free_xfer.9 \ - usbdi.9 usbd_get_buffer.9 \ - usbdi.9 usbd_get_config.9 \ - usbdi.9 usbd_get_config_desc.9 \ - usbdi.9 usbd_get_config_desc_full.9 \ - usbdi.9 usbd_get_config_descriptor.9 \ - usbdi.9 usbd_get_device_descriptor.9 \ - usbdi.9 usbd_get_endpoint_descriptor.9 \ - usbdi.9 usbd_get_interface_altindex.9 \ - usbdi.9 usbd_get_interface_descriptor.9 \ - usbdi.9 usbd_get_no_alts.9 \ - usbdi.9 usbd_get_quirks.9 \ - usbdi.9 usbd_get_speed.9 \ - usbdi.9 usbd_get_string.9 \ - usbdi.9 usbd_get_string_desc.9 \ - usbdi.9 usbd_get_xfer_status.9 \ - usbdi.9 usbd_interface2device_handle.9 \ - usbdi.9 usbd_interface2endpoint_descriptor.9 \ - usbdi.9 usbd_interface_count.9 \ - usbdi.9 usbd_open_pipe.9 \ - usbdi.9 usbd_open_pipe_intr.9 \ - usbdi.9 usbd_pipe2device_handle.9 \ - usbdi.9 usbd_set_config_index.9 \ - usbdi.9 usbd_set_config_no.9 \ - usbdi.9 usbd_set_interface.9 \ - usbdi.9 usbd_setup_default_xfer.9 \ - usbdi.9 usbd_setup_isoc_xfer.9 \ - usbdi.9 usbd_setup_xfer.9 \ - usbdi.9 usbd_sync_transfer.9 \ - usbdi.9 usbd_transfer.9 \ - usbdi.9 usb_find_desc.9 + usbdi.9 usbd_lookup_id_by_info.9 \ + usbdi.9 usbd_lookup_id_by_uaa.9 \ + usbdi.9 usbd_transfer_clear_stall.9 \ + usbdi.9 usbd_transfer_drain.9 \ + usbdi.9 usbd_transfer_pending.9 \ + usbdi.9 usbd_transfer_poll.9 \ + usbdi.9 usbd_transfer_setup.9 \ + usbdi.9 usbd_transfer_start.9 \ + usbdi.9 usbd_transfer_stop.9 \ + usbdi.9 usbd_transfer_submit.9 \ + usbdi.9 usbd_transfer_unsetup.9 \ + usbdi.9 usbd_xfer_clr_flag.9 \ + usbdi.9 usbd_xfer_frame_data.9 \ + usbdi.9 usbd_xfer_frame_len.9 \ + usbdi.9 usbd_xfer_get_frame.9 \ + usbdi.9 usbd_xfer_get_priv.9 \ + usbdi.9 usbd_xfer_is_stalled.9 \ + usbdi.9 usbd_xfer_max_framelen.9 \ + usbdi.9 usbd_xfer_max_frames.9 \ + usbdi.9 usbd_xfer_max_len.9 \ + usbdi.9 usbd_xfer_set_flag.9 \ + usbdi.9 usbd_xfer_set_frame_data.9 \ + usbdi.9 usbd_xfer_set_frame_len.9 \ + usbdi.9 usbd_xfer_set_frame_offset.9 \ + usbdi.9 usbd_xfer_set_frames.9 \ + usbdi.9 usbd_xfer_set_interval.9 \ + usbdi.9 usbd_xfer_set_priv.9 \ + usbdi.9 usbd_xfer_set_stall.9 \ + usbdi.9 usbd_xfer_set_timeout.9 \ + usbdi.9 usbd_xfer_softc.9 \ + usbdi.9 usbd_xfer_state.9 \ + usbdi.9 usbd_xfer_state.9 \ + usbdi.9 usbd_xfer_status.9 MLINKS+=vcount.9 count_dev.9 MLINKS+=vfsconf.9 vfs_modevent.9 \ vfsconf.9 vfs_register.9 \ Modified: head/share/man/man9/usbdi.9 ============================================================================== --- head/share/man/man9/usbdi.9 Wed Jun 24 16:57:33 2009 (r194859) +++ head/share/man/man9/usbdi.9 Wed Jun 24 17:01:17 2009 (r194860) @@ -24,1230 +24,615 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd December 30, 2005 +.Dd June 24, 2009 .Os .Dt USBDI 9 .Sh NAME -.Nm usb_detach_wait , -.Nm usb_detach_wakeup , -.Nm usb_find_desc , -.Nm usbd_abort_default_pipe , -.Nm usbd_abort_pipe , -.Nm usbd_alloc_buffer , -.Nm usbd_alloc_xfer , -.Nm usbd_bulk_transfer , -.Nm usbd_clear_endpoint_stall , -.Nm usbd_clear_endpoint_stall_async , -.Nm usbd_clear_endpoint_toggle , -.Nm usbd_close_pipe , -.Nm usbd_device2interface_handle , -.Nm usbd_devinfo , +.Nm usb_fifo_alloc_buffer , +.Nm usb_fifo_attach , +.Nm usb_fifo_detach , +.Nm usb_fifo_free_buffer , +.Nm usb_fifo_get_data , +.Nm usb_fifo_get_data_buffer , +.Nm usb_fifo_get_data_error , +.Nm usb_fifo_get_data_linear , +.Nm usb_fifo_put_bytes_max , +.Nm usb_fifo_put_data , +.Nm usb_fifo_put_data_buffer , +.Nm usb_fifo_put_data_error , +.Nm usb_fifo_put_data_linear , +.Nm usb_fifo_reset , +.Nm usb_fifo_softc , +.Nm usb_fifo_wakeup , .Nm usbd_do_request , -.Nm usbd_do_request_async , .Nm usbd_do_request_flags , -.Nm usbd_do_request_flags_pipe , -.Nm usbd_dopoll , -.Nm usbd_endpoint_count , .Nm usbd_errstr , -.Nm usbd_fill_deviceinfo , -.Nm usbd_find_edesc , -.Nm usbd_find_idesc , -.Nm usbd_free_buffer , -.Nm usbd_free_xfer , -.Nm usbd_get_buffer , -.Nm usbd_get_config , -.Nm usbd_get_config_desc , -.Nm usbd_get_config_desc_full , -.Nm usbd_get_config_descriptor , -.Nm usbd_get_device_descriptor , -.Nm usbd_get_endpoint_descriptor , -.Nm usbd_get_interface_altindex , -.Nm usbd_get_interface_descriptor , -.Nm usbd_get_no_alts , -.Nm usbd_get_quirks , -.Nm usbd_get_speed , -.Nm usbd_get_string , -.Nm usbd_get_string_desc , -.Nm usbd_get_xfer_status , -.Nm usbd_interface2device_handle , -.Nm usbd_interface2endpoint_descriptor , -.Nm usbd_interface_count , -.Nm usbd_intr_transfer , -.Nm usbd_open_pipe , -.Nm usbd_open_pipe_intr , -.Nm usbd_pipe2device_handle , -.Nm usbd_ratecheck , -.Nm usbd_set_config_index , -.Nm usbd_set_config_no , -.Nm usbd_set_interface , -.Nm usbd_set_polling , -.Nm usbd_setup_default_xfer , -.Nm usbd_setup_isoc_xfer , -.Nm usbd_setup_xfer , -.Nm usbd_sync_transfer , -.Nm usbd_transfer +.Nm usbd_lookup_id_by_info , +.Nm usbd_lookup_id_by_uaa , +.Nm usbd_transfer_clear_stall , +.Nm usbd_transfer_drain , +.Nm usbd_transfer_pending , +.Nm usbd_transfer_poll , +.Nm usbd_transfer_setup , +.Nm usbd_transfer_start , +.Nm usbd_transfer_stop , +.Nm usbd_transfer_submit , +.Nm usbd_transfer_unsetup , +.Nm usbd_xfer_clr_flag , +.Nm usbd_xfer_frame_data , +.Nm usbd_xfer_frame_len , +.Nm usbd_xfer_get_frame , +.Nm usbd_xfer_get_priv , +.Nm usbd_xfer_is_stalled , +.Nm usbd_xfer_max_framelen , +.Nm usbd_xfer_max_frames , +.Nm usbd_xfer_max_len , +.Nm usbd_xfer_set_flag , +.Nm usbd_xfer_set_frame_data , +.Nm usbd_xfer_set_frame_len , +.Nm usbd_xfer_set_frame_offset , +.Nm usbd_xfer_set_frames , +.Nm usbd_xfer_set_interval , +.Nm usbd_xfer_set_priv , +.Nm usbd_xfer_set_stall , +.Nm usbd_xfer_set_timeout , +.Nm usbd_xfer_softc , +.Nm usbd_xfer_state , +.Nm usbd_xfer_state , +.Nm usbd_xfer_status .Nd Universal Serial Bus driver programming interface .Sh SYNOPSIS .In dev/usb/usb.h .In dev/usb/usbdi.h .In dev/usb/usbdi_util.h -.Pp -.Ft void -.Fn usb_detach_wait "device_ptr_t dv" -.Ft void -.Fn usb_detach_wakeup "device_ptr_t dv" -.Ft "const usb_descriptor_t *" -.Fn usb_find_desc "usbd_device_handle dev" "int type" "int subtype" -.Ft usbd_status -.Fn usbd_abort_default_pipe "usbd_device_handle dev" -.Ft usbd_status -.Fn usbd_abort_pipe "usbd_pipe_handle pipe" -.Ft "void *" -.Fn usbd_alloc_buffer "usbd_xfer_handle xfer" "u_int32_t size" -.Ft usbd_xfer_handle -.Fn usbd_alloc_xfer "usbd_device_handle dev" -.Ft usbd_status -.Fo usbd_bulk_transfer -.Fa "usbd_xfer_handle xfer" -.Fa "usbd_pipe_handle pipe" -.Fa "u_int16_t flags" -.Fa "u_int32_t timeout" -.Fa "void *buf" -.Fa "u_int32_t *size" -.Fa "char *lbl" -.Fc -.Ft usbd_status -.Fn usbd_clear_endpoint_stall "usbd_pipe_handle pipe" -.Ft usbd_status -.Fn usbd_clear_endpoint_stall_async "usbd_pipe_handle" -.Ft void -.Fn usbd_clear_endpoint_toggle "usbd_pipe_handle pipe" -.Ft usbd_status -.Fn usbd_close_pipe "usbd_pipe_handle pipe" -.Ft usbd_status -.Fo usbd_device2interface_handle -.Fa "usbd_device_handle dev" -.Fa "u_int8_t ifaceno" -.Fa "usbd_interface_handle *iface" -.Fc -.Ft void -.Fn usbd_devinfo "usbd_device_handle dev" "int showclass" "char *cp" -.Ft usbd_status -.Fo usbd_do_request -.Fa "usbd_device_handle dev" -.Fa "usb_device_request_t *req" -.Fa "void *data" -.Fc -.Ft usbd_status -.Fo usbd_do_request_async -.Fa "usbd_device_handle dev" -.Fa "usb_device_request_t *req" -.Fa "void *data" -.Fc -.Ft usbd_status -.Fo usbd_do_request_flags -.Fa "usbd_device_handle dev" -.Fa "usb_device_request_t *req" -.Fa "void *data" -.Fa "u_int16_t flags" -.Fa "int *actlen" -.Fa "u_int32_t timo" -.Fc -.Ft usbd_status -.Fo usbd_do_request_flags_pipe -.Fa "usbd_device_handle dev" -.Fa "usbd_pipe_handle pipe" -.Fa "usb_device_request_t *req" -.Fa "void *data" -.Fa "u_int16_t flags" -.Fa "int *actlen" -.Fa "u_int32_t timeout" -.Fc -.Ft void -.Fn usbd_dopoll "usbd_interface_handle iface" -.Ft usbd_status -.Fn usbd_endpoint_count "usbd_interface_handle iface" "u_int8_t *count" -.Ft "const char *" -.Fn usbd_errstr "usbd_status err" -.Ft void -.Fo usbd_fill_deviceinfo -.Fa "usbd_device_handle dev" -.Fa "struct usb_device_info *di" -.Fa "int usedev" -.Fc -.Ft "usb_endpoint_descriptor_t *" -.Fo usbd_find_edesc -.Fa "usb_config_descriptor_t *cd" -.Fa "int ifaceidx" -.Fa "int altidx" -.Fa "int endptidx" -.Fc -.Ft "usb_interface_descriptor_t *" -.Fn usbd_find_idesc "usb_config_descriptor_t *cd" "int ifaceidx" "int altidx" -.Ft void -.Fn usbd_free_buffer "usbd_xfer_handle xfer" -.Ft usbd_status -.Fn usbd_free_xfer "usbd_xfer_handle xfer" -.Ft "void *" -.Fn usbd_get_buffer "usbd_xfer_handle xfer" -.Ft usbd_status -.Fn usbd_get_config "usbd_device_handle dev" "u_int8_t *conf" -.Ft usbd_status -.Fo usbd_get_config_desc -.Fa "usbd_device_handle dev" -.Fa "int confidx" -.Fa "usb_config_descriptor_t *d" -.Fc -.Ft usbd_status -.Fo usbd_get_config_desc_full -.Fa "usbd_device_handle dev" -.Fa "int conf" -.Fa "void *d" -.Fa "int size" -.Fc -.Ft "usb_config_descriptor_t *" -.Fn usbd_get_config_descriptor "usbd_device_handle dev" -.Ft "usb_device_descriptor_t *" -.Fn usbd_get_device_descriptor "usbd_device_handle dev" -.Ft "usb_endpoint_descriptor_t *" -.Fo usbd_get_endpoint_descriptor -.Fa "usbd_interface_handle iface" -.Fa "u_int8_t address" -.Fc -.Ft int -.Fn usbd_get_interface_altindex "usbd_interface_handle iface" -.Ft "usb_interface_descriptor_t *" -.Fn usbd_get_interface_descriptor "usbd_interface_handle iface" -.Ft int -.Fn usbd_get_no_alts "usb_config_descriptor_t *cdesc" "int ifaceno" -.Ft "const struct usbd_quirks *" -.Fn usbd_get_quirks "usbd_device_handle dev" -.Ft int -.Fn usbd_get_speed "usbd_device_handle dev" -.Ft usbd_status -.Fn usbd_get_string "usbd_device_handle dev" "int si" "char *buf" -.Ft usbd_status -.Fo usbd_get_string_desc -.Fa "usbd_device_handle dev" -.Fa "int sindex" -.Fa "int langid" -.Fa "usb_string_descriptor_t *sdesc" -.Fa "int *sizep" -.Fc -.Ft void -.Fo usbd_get_xfer_status -.Fa "usbd_xfer_handle xfer" -.Fa "usbd_private_handle *priv" -.Fa "void **buffer" -.Fa "u_int32_t *count" -.Fa "usbd_status *status" -.Fc -.Ft void -.Fo usbd_interface2device_handle -.Fa "usbd_interface_handle iface" -.Fa "usbd_device_handle *dev" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 17:03:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 153C9106566C; Wed, 24 Jun 2009 17:03:07 +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 033948FC17; Wed, 24 Jun 2009 17:03:07 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OH36cw021406; Wed, 24 Jun 2009 17:03:06 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OH36t0021404; Wed, 24 Jun 2009 17:03:06 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200906241703.n5OH36t0021404@svn.freebsd.org> From: Alexander Motin Date: Wed, 24 Jun 2009 17:03: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: r194861 - head/sys/dev/sound/pci/hda X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 17:03:07 -0000 Author: mav Date: Wed Jun 24 17:03:06 2009 New Revision: 194861 URL: http://svn.freebsd.org/changeset/base/194861 Log: Some DMA related changes: - honor parent DMA tag limitations, as man page requires, - allow data buffer to be allocated within full 64bit address range, when support is announced by hardware, - add quirk, disabling 64bit addresses for broken chips, use it for MCP78. Modified: head/sys/dev/sound/pci/hda/hdac.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Wed Jun 24 17:01:17 2009 (r194860) +++ head/sys/dev/sound/pci/hda/hdac.c Wed Jun 24 17:03:06 2009 (r194861) @@ -87,7 +87,7 @@ #include "mixer_if.h" -#define HDA_DRV_TEST_REV "20090614_0135" +#define HDA_DRV_TEST_REV "20090624_0136" SND_DECLARE_FILE("$FreeBSD$"); @@ -474,6 +474,7 @@ static uint32_t hdac_fmt[] = { static struct pcmchan_caps hdac_caps = {48000, 48000, hdac_fmt, 0}; #define HDAC_NO_MSI 1 +#define HDAC_NO_64BIT 2 static const struct { uint32_t model; @@ -498,10 +499,10 @@ static const struct { { HDA_NVIDIA_MCP67_2, "NVidia MCP67", 0 }, { HDA_NVIDIA_MCP73_1, "NVidia MCP73", 0 }, { HDA_NVIDIA_MCP73_2, "NVidia MCP73", 0 }, - { HDA_NVIDIA_MCP78_1, "NVidia MCP78", 0 }, - { HDA_NVIDIA_MCP78_2, "NVidia MCP78", 0 }, - { HDA_NVIDIA_MCP78_3, "NVidia MCP78", 0 }, - { HDA_NVIDIA_MCP78_4, "NVidia MCP78", 0 }, + { HDA_NVIDIA_MCP78_1, "NVidia MCP78", HDAC_NO_64BIT }, + { HDA_NVIDIA_MCP78_2, "NVidia MCP78", HDAC_NO_64BIT }, + { HDA_NVIDIA_MCP78_3, "NVidia MCP78", HDAC_NO_64BIT }, + { HDA_NVIDIA_MCP78_4, "NVidia MCP78", HDAC_NO_64BIT }, { HDA_NVIDIA_MCP79_1, "NVidia MCP79", 0 }, { HDA_NVIDIA_MCP79_2, "NVidia MCP79", 0 }, { HDA_NVIDIA_MCP79_3, "NVidia MCP79", 0 }, @@ -1593,22 +1594,21 @@ hdac_dma_cb(void *callback_arg, bus_dma_ static int hdac_dma_alloc(struct hdac_softc *sc, struct hdac_dma *dma, bus_size_t size) { - bus_addr_t lowaddr; bus_size_t roundsz; int result; roundsz = roundup2(size, HDAC_DMA_ALIGNMENT); - lowaddr = (sc->support_64bit) ? BUS_SPACE_MAXADDR : - BUS_SPACE_MAXADDR_32BIT; bzero(dma, sizeof(*dma)); /* * Create a DMA tag */ - result = bus_dma_tag_create(NULL, /* parent */ + result = bus_dma_tag_create( + bus_get_dma_tag(sc->dev), /* parent */ HDAC_DMA_ALIGNMENT, /* alignment */ 0, /* boundary */ - lowaddr, /* lowaddr */ + (sc->support_64bit) ? BUS_SPACE_MAXADDR : + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, /* filtfunc */ NULL, /* fistfuncarg */ @@ -4044,29 +4044,6 @@ hdac_attach(device_t dev) else sc->polling = 0; - result = bus_dma_tag_create(NULL, /* parent */ - HDAC_DMA_ALIGNMENT, /* alignment */ - 0, /* boundary */ - BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, /* filtfunc */ - NULL, /* fistfuncarg */ - HDA_BUFSZ_MAX, /* maxsize */ - 1, /* nsegments */ - HDA_BUFSZ_MAX, /* maxsegsz */ - 0, /* flags */ - NULL, /* lockfunc */ - NULL, /* lockfuncarg */ - &sc->chan_dmat); /* dmat */ - if (result != 0) { - device_printf(dev, "%s: bus_dma_tag_create failed (%x)\n", - __func__, result); - snd_mtxfree(sc->lock); - free(sc, M_DEVBUF); - return (ENXIO); - } - - sc->hdabus = NULL; for (i = 0; i < HDAC_CODEC_MAX; i++) sc->codecs[i] = NULL; @@ -4163,6 +4140,9 @@ hdac_attach(device_t dev) if (result != 0) goto hdac_attach_fail; + if (devid >= 0 && (hdac_devices[devid].flags & HDAC_NO_64BIT)) + sc->support_64bit = 0; + /* Allocate CORB and RIRB dma memory */ result = hdac_dma_alloc(sc, &sc->corb_dma, sc->corb_size * sizeof(uint32_t)); @@ -4173,6 +4153,28 @@ hdac_attach(device_t dev) if (result != 0) goto hdac_attach_fail; + result = bus_dma_tag_create( + bus_get_dma_tag(sc->dev), /* parent */ + HDAC_DMA_ALIGNMENT, /* alignment */ + 0, /* boundary */ + (sc->support_64bit) ? BUS_SPACE_MAXADDR : + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, /* filtfunc */ + NULL, /* fistfuncarg */ + HDA_BUFSZ_MAX, /* maxsize */ + 1, /* nsegments */ + HDA_BUFSZ_MAX, /* maxsegsz */ + 0, /* flags */ + NULL, /* lockfunc */ + NULL, /* lockfuncarg */ + &sc->chan_dmat); /* dmat */ + if (result != 0) { + device_printf(dev, "%s: bus_dma_tag_create failed (%x)\n", + __func__, result); + goto hdac_attach_fail; + } + /* Quiesce everything */ HDA_BOOTHVERBOSE( device_printf(dev, "Reset controller...\n"); From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 17:23:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7911B1065677; Wed, 24 Jun 2009 17:23:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 674348FC15; Wed, 24 Jun 2009 17:23:10 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OHNA9S021913; Wed, 24 Jun 2009 17:23:10 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OHNAsQ021911; Wed, 24 Jun 2009 17:23:10 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200906241723.n5OHNAsQ021911@svn.freebsd.org> From: Warner Losh Date: Wed, 24 Jun 2009 17:23: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: r194863 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 17:23:11 -0000 Author: imp Date: Wed Jun 24 17:23:10 2009 New Revision: 194863 URL: http://svn.freebsd.org/changeset/base/194863 Log: Remove usb. The need to have core@ approve major changes to usb has passed now that the new usb stack is in the tree. The coordination issues that necessitated this entry are now OBE. Approved by: core (rwatson) Modified: head/MAINTAINERS Modified: head/MAINTAINERS ============================================================================== --- head/MAINTAINERS Wed Jun 24 17:16:13 2009 (r194862) +++ head/MAINTAINERS Wed Jun 24 17:23:10 2009 (r194863) @@ -124,7 +124,6 @@ usr.bin/bluetooth emax Pre-commit review usr.sbin/bluetooth emax Pre-commit review preferred. gnu/usr.bin/send-pr bugmaster Pre-commit review requested. BSD.{local,x11*}.dist portmgr Pre-commit review requested, since these files interface with ports. -usb core Please contact core@ before any major changes ncurses rafan Heads-up appreciated, try not to break it. Following are the entries from the Makefiles, and a few other sources. From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 17:24:08 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B71BA106564A; Wed, 24 Jun 2009 17:24:08 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from mail.farley.org (mail.farley.org [IPv6:2001:470:1f0f:20:2::11]) by mx1.freebsd.org (Postfix) with ESMTP id 7012F8FC1D; Wed, 24 Jun 2009 17:24:08 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from thor.farley.org (HPooka@thor.farley.org [IPv6:2001:470:1f0f:20:1::5]) by mail.farley.org (8.14.3/8.14.3) with ESMTP id n5OHO7oi087853; Wed, 24 Jun 2009 12:24:07 -0500 (CDT) (envelope-from scf@FreeBSD.org) Date: Wed, 24 Jun 2009 12:24:07 -0500 (CDT) From: "Sean C. Farley" To: Garance A Drosehn In-Reply-To: <200906241657.n5OGvXIo021213@svn.freebsd.org> Message-ID: References: <200906241657.n5OGvXIo021213@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-2.6 required=4.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail.farley.org Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r194859 - head/usr.sbin/lpr/common_source X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 17:24:09 -0000 On Wed, 24 Jun 2009, Garance A Drosehn wrote: > Author: gad > Date: Wed Jun 24 16:57:33 2009 > New Revision: 194859 > URL: http://svn.freebsd.org/changeset/base/194859 > > Log: > Fix end-of-line issues that can come up when `lpq' reads information > about a queue from a remote host. That remote host may use \r, \r\n, > or \n\r as the line-ending character. In some cases the remote host > will write a single line of information without *any* EOL sequence. > > Translate all the non-unix EOL's to the standard newline, and make > sure the final line includes a terminating newline. Logic is also > added to translate all unprintable characters to '?', but that is > #if-ed out for now. > > PR: bin/104731 > MFC after: 3 weeks Thank you! Sean -- scf@FreeBSD.org From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 17:41:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24F1E1065673; Wed, 24 Jun 2009 17:41:30 +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 116DD8FC0C; Wed, 24 Jun 2009 17:41:30 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OHfUE0022424; Wed, 24 Jun 2009 17:41:30 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OHfTaw022417; Wed, 24 Jun 2009 17:41:29 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200906241741.n5OHfTaw022417@svn.freebsd.org> From: Jack F Vogel Date: Wed, 24 Jun 2009 17:41:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194865 - in head/sys: dev/e1000 modules/igb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 17:41:30 -0000 Author: jfv Date: Wed Jun 24 17:41:29 2009 New Revision: 194865 URL: http://svn.freebsd.org/changeset/base/194865 Log: Updates for both the em and igb drivers, add support for multiqueue tx, shared code updates, new device support, and some bug fixes. Modified: head/sys/dev/e1000/e1000_82540.c head/sys/dev/e1000/e1000_82541.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_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_osdep.c 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/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/modules/igb/Makefile Modified: head/sys/dev/e1000/e1000_82540.c ============================================================================== --- head/sys/dev/e1000/e1000_82540.c Wed Jun 24 17:31:37 2009 (r194864) +++ head/sys/dev/e1000/e1000_82540.c Wed Jun 24 17:41:29 2009 (r194865) @@ -57,6 +57,7 @@ static s32 e1000_set_vco_speed_82540(st static s32 e1000_setup_copper_link_82540(struct e1000_hw *hw); static s32 e1000_setup_fiber_serdes_link_82540(struct e1000_hw *hw); static void e1000_power_down_phy_copper_82540(struct e1000_hw *hw); +static s32 e1000_read_mac_addr_82540(struct e1000_hw *hw); /** * e1000_init_phy_params_82540 - Init PHY func ptrs. @@ -229,6 +230,8 @@ static s32 e1000_init_mac_params_82540(s mac->ops.clear_vfta = e1000_clear_vfta_generic; /* setting MTA */ mac->ops.mta_set = e1000_mta_set_generic; + /* read mac address */ + mac->ops.read_mac_addr = e1000_read_mac_addr_82540; /* ID LED init */ mac->ops.id_led_init = e1000_id_led_init_generic; /* setup LED */ @@ -676,3 +679,45 @@ static void e1000_clear_hw_cntrs_82540(s E1000_READ_REG(hw, E1000_MGTPTC); } +/** + * e1000_read_mac_addr_82540 - Read device MAC address + * @hw: pointer to the HW structure + * + * Reads the device MAC address from the EEPROM and stores the value. + * Since devices with two ports use the same EEPROM, we increment the + * last bit in the MAC address for the second port. + * + * This version is being used over generic because of customer issues + * with VmWare and Virtual Box when using generic. It seems in + * the emulated 82545, RAR[0] does NOT have a valid address after a + * reset, this older method works and using this breaks nothing for + * these legacy adapters. + **/ +s32 e1000_read_mac_addr_82540(struct e1000_hw *hw) +{ + s32 ret_val = E1000_SUCCESS; + u16 offset, nvm_data, i; + + DEBUGFUNC("e1000_read_mac_addr"); + + for (i = 0; i < ETH_ADDR_LEN; i += 2) { + offset = i >> 1; + ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data); + if (ret_val) { + DEBUGOUT("NVM Read Error\n"); + goto out; + } + hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF); + hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8); + } + + /* Flip last bit of mac address if we're on second port */ + if (hw->bus.func == E1000_FUNC_1) + hw->mac.perm_addr[5] ^= 1; + + for (i = 0; i < ETH_ADDR_LEN; i++) + hw->mac.addr[i] = hw->mac.perm_addr[i]; + +out: + return ret_val; +} Modified: head/sys/dev/e1000/e1000_82541.c ============================================================================== --- head/sys/dev/e1000/e1000_82541.c Wed Jun 24 17:31:37 2009 (r194864) +++ head/sys/dev/e1000/e1000_82541.c Wed Jun 24 17:41:29 2009 (r194865) @@ -377,6 +377,7 @@ static s32 e1000_reset_hw_82541(struct e static s32 e1000_init_hw_82541(struct e1000_hw *hw) { struct e1000_mac_info *mac = &hw->mac; + struct e1000_dev_spec_82541 *dev_spec = &hw->dev_spec._82541; u32 i, txdctl; s32 ret_val; @@ -388,6 +389,13 @@ 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, + &dev_spec->spd_default); + if (ret_val) + goto out; /* Disabling VLAN filtering */ DEBUGOUT("Initializing the IEEE VLAN\n"); @@ -425,6 +433,7 @@ static s32 e1000_init_hw_82541(struct e1 */ e1000_clear_hw_cntrs_82541(hw); +out: return ret_val; } Modified: head/sys/dev/e1000/e1000_82571.c ============================================================================== --- head/sys/dev/e1000/e1000_82571.c Wed Jun 24 17:31:37 2009 (r194864) +++ head/sys/dev/e1000/e1000_82571.c Wed Jun 24 17:41:29 2009 (r194865) @@ -47,6 +47,7 @@ * 82573L Gigabit Ethernet Controller * 82574L Gigabit Network Connection * 82574L Gigabit Network Connection + * 82583V Gigabit Network Connection */ #include "e1000_api.h" @@ -154,6 +155,7 @@ static s32 e1000_init_phy_params_82571(s goto out; } break; + case e1000_82583: case e1000_82574: phy->type = e1000_phy_bm; phy->ops.get_cfg_done = e1000_get_cfg_done_generic; @@ -215,6 +217,7 @@ static s32 e1000_init_nvm_params_82571(s switch (hw->mac.type) { case e1000_82573: case e1000_82574: + case e1000_82583: if (((eecd >> 15) & 0x3) == 0x3) { nvm->type = e1000_nvm_flash_hw; nvm->word_size = 2048; @@ -264,6 +267,9 @@ static s32 e1000_init_mac_params_82571(s { struct e1000_mac_info *mac = &hw->mac; s32 ret_val = E1000_SUCCESS; + u32 swsm = 0; + u32 swsm2 = 0; + bool force_clear_smbi = FALSE; DEBUGFUNC("e1000_init_mac_params_82571"); @@ -304,6 +310,7 @@ static s32 e1000_init_mac_params_82571(s switch (hw->mac.type) { case e1000_82573: case e1000_82574: + case e1000_82583: mac->ops.set_lan_id = e1000_set_lan_id_single_port; break; default: @@ -339,6 +346,7 @@ static s32 e1000_init_mac_params_82571(s /* check management mode */ switch (hw->mac.type) { case e1000_82574: + case e1000_82583: mac->ops.check_mng_mode = e1000_check_mng_mode_82574; break; default: @@ -366,6 +374,7 @@ static s32 e1000_init_mac_params_82571(s /* turn on/off LED */ switch (hw->mac.type) { case e1000_82574: + case e1000_82583: mac->ops.led_on = e1000_led_on_82574; break; default: @@ -381,6 +390,50 @@ static s32 e1000_init_mac_params_82571(s ? e1000_get_speed_and_duplex_copper_generic : e1000_get_speed_and_duplex_fiber_serdes_generic; + /* + * Ensure that the inter-port SWSM.SMBI lock bit is clear before + * first NVM or PHY acess. This should be done for single-port + * devices, and for one port only on dual-port devices so that + * for those devices we can still use the SMBI lock to synchronize + * inter-port accesses to the PHY & NVM. + */ + switch (hw->mac.type) { + case e1000_82571: + case e1000_82572: + swsm2 = E1000_READ_REG(hw, E1000_SWSM2); + + if (!(swsm2 & E1000_SWSM2_LOCK)) { + /* Only do this for the first interface on this card */ + E1000_WRITE_REG(hw, E1000_SWSM2, + swsm2 | E1000_SWSM2_LOCK); + force_clear_smbi = TRUE; + } else + force_clear_smbi = FALSE; + break; + default: + force_clear_smbi = TRUE; + break; + } + + if (force_clear_smbi) { + /* Make sure SWSM.SMBI is clear */ + swsm = E1000_READ_REG(hw, E1000_SWSM); + if (swsm & E1000_SWSM_SMBI) { + /* This bit should not be set on a first interface, and + * indicates that the bootagent or EFI code has + * improperly left this bit enabled + */ + DEBUGOUT("Please update your 82571 Bootagent\n"); + } + E1000_WRITE_REG(hw, E1000_SWSM, swsm & ~E1000_SWSM_SMBI); + } + + /* + * Initialze device specific counter of SMBI acquisition + * timeouts. + */ + hw->dev_spec._82571.smb_counter = 0; + out: return ret_val; } @@ -430,6 +483,7 @@ static s32 e1000_get_phy_id_82571(struct ret_val = e1000_get_phy_id(hw); break; case e1000_82574: + case e1000_82583: ret_val = phy->ops.read_reg(hw, PHY_ID1, &phy_id); if (ret_val) goto out; @@ -458,17 +512,43 @@ out: * * Acquire the HW semaphore to access the PHY or NVM **/ -static s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw) +s32 e1000_get_hw_semaphore_82571(struct e1000_hw *hw) { u32 swsm; s32 ret_val = E1000_SUCCESS; - s32 timeout = hw->nvm.word_size + 1; + s32 sw_timeout = hw->nvm.word_size + 1; + s32 fw_timeout = hw->nvm.word_size + 1; s32 i = 0; DEBUGFUNC("e1000_get_hw_semaphore_82571"); + /* + * If we have timedout 3 times on trying to acquire + * the inter-port SMBI semaphore, there is old code + * operating on the other port, and it is not + * releasing SMBI. Modify the number of times that + * we try for the semaphore to interwork with this + * older code. + */ + if (hw->dev_spec._82571.smb_counter > 2) + sw_timeout = 1; + + /* Get the SW semaphore */ + while (i < sw_timeout) { + swsm = E1000_READ_REG(hw, E1000_SWSM); + if (!(swsm & E1000_SWSM_SMBI)) + break; + + usec_delay(50); + i++; + } + + if (i == sw_timeout) { + DEBUGOUT("Driver can't access device - SMBI bit is set.\n"); + hw->dev_spec._82571.smb_counter++; + } /* Get the FW semaphore. */ - for (i = 0; i < timeout; i++) { + for (i = 0; i < fw_timeout; i++) { swsm = E1000_READ_REG(hw, E1000_SWSM); E1000_WRITE_REG(hw, E1000_SWSM, swsm | E1000_SWSM_SWESMBI); @@ -479,9 +559,9 @@ static s32 e1000_get_hw_semaphore_82571( usec_delay(50); } - if (i == timeout) { + if (i == fw_timeout) { /* Release semaphores */ - e1000_put_hw_semaphore_generic(hw); + e1000_put_hw_semaphore_82571(hw); DEBUGOUT("Driver can't access the NVM\n"); ret_val = -E1000_ERR_NVM; goto out; @@ -497,15 +577,15 @@ out: * * Release hardware semaphore used to access the PHY or NVM **/ -static void e1000_put_hw_semaphore_82571(struct e1000_hw *hw) +void e1000_put_hw_semaphore_82571(struct e1000_hw *hw) { u32 swsm; - DEBUGFUNC("e1000_put_hw_semaphore_82571"); + DEBUGFUNC("e1000_put_hw_semaphore_generic"); swsm = E1000_READ_REG(hw, E1000_SWSM); - swsm &= ~E1000_SWSM_SWESMBI; + swsm &= ~(E1000_SWSM_SMBI | E1000_SWSM_SWESMBI); E1000_WRITE_REG(hw, E1000_SWSM, swsm); } @@ -531,6 +611,7 @@ static s32 e1000_acquire_nvm_82571(struc switch (hw->mac.type) { case e1000_82574: + case e1000_82583: case e1000_82573: break; default: @@ -581,6 +662,7 @@ static s32 e1000_write_nvm_82571(struct switch (hw->mac.type) { case e1000_82573: case e1000_82574: + case e1000_82583: ret_val = e1000_write_nvm_eewr_82571(hw, offset, words, data); break; case e1000_82571: @@ -885,6 +967,7 @@ static s32 e1000_reset_hw_82571(struct e */ switch (hw->mac.type) { case e1000_82574: + case e1000_82583: case e1000_82573: extcnf_ctrl = E1000_READ_REG(hw, E1000_EXTCNF_CTRL); extcnf_ctrl |= E1000_EXTCNF_CTRL_MDIO_SW_OWNERSHIP; @@ -932,6 +1015,7 @@ static s32 e1000_reset_hw_82571(struct e switch (hw->mac.type) { case e1000_82574: + case e1000_82583: case e1000_82573: msec_delay(25); break; @@ -1014,6 +1098,7 @@ static s32 e1000_init_hw_82571(struct e1 /* ...for both queues. */ switch (mac->type) { case e1000_82574: + case e1000_82583: case e1000_82573: e1000_enable_tx_pkt_filtering_generic(hw); reg_data = E1000_READ_REG(hw, E1000_GCR); @@ -1096,6 +1181,7 @@ static void e1000_initialize_hw_bits_825 switch (hw->mac.type) { case e1000_82574: + case e1000_82583: case e1000_82573: reg = E1000_READ_REG(hw, E1000_CTRL); reg &= ~(1 << 29); @@ -1108,6 +1194,7 @@ static void e1000_initialize_hw_bits_825 /* Extended Device Control */ switch (hw->mac.type) { case e1000_82574: + case e1000_82583: case e1000_82573: reg = E1000_READ_REG(hw, E1000_CTRL_EXT); reg &= ~(1 << 23); @@ -1141,6 +1228,7 @@ static void e1000_initialize_hw_bits_825 switch (hw->mac.type) { case e1000_82574: + case e1000_82583: reg = E1000_READ_REG(hw, E1000_GCR); reg |= (1 << 22); E1000_WRITE_REG(hw, E1000_GCR, reg); @@ -1180,6 +1268,7 @@ static void e1000_clear_vfta_82571(struc switch (hw->mac.type) { case e1000_82574: + case e1000_82583: case e1000_82573: if (hw->mng_cookie.vlan_id != 0) { /* @@ -1281,6 +1370,7 @@ static s32 e1000_setup_link_82571(struct */ switch (hw->mac.type) { case e1000_82574: + case e1000_82583: case e1000_82573: if (hw->fc.requested_mode == e1000_fc_default) hw->fc.requested_mode = e1000_fc_full; @@ -1301,7 +1391,7 @@ static s32 e1000_setup_link_82571(struct **/ static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw) { - u32 ctrl, led_ctrl; + u32 ctrl; s32 ret_val; DEBUGFUNC("e1000_setup_copper_link_82571"); @@ -1318,11 +1408,6 @@ static s32 e1000_setup_copper_link_82571 break; case e1000_phy_igp_2: ret_val = e1000_copper_link_setup_igp(hw); - /* Setup activity LED */ - led_ctrl = E1000_READ_REG(hw, E1000_LEDCTL); - led_ctrl &= IGP_ACTIVITY_LED_MASK; - led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); - E1000_WRITE_REG(hw, E1000_LEDCTL, led_ctrl); break; default: ret_val = -E1000_ERR_PHY; @@ -1372,8 +1457,20 @@ static s32 e1000_setup_fiber_serdes_link * e1000_check_for_serdes_link_82571 - Check for link (Serdes) * @hw: pointer to the HW structure * - * Checks for link up on the hardware. If link is not up and we have - * a signal, then we need to force link up. + * Reports the link state as up or down. + * + * If autonegotiation is supported by the link partner, the link state is + * determined by the result of autongotiation. This is the most likely case. + * If autonegotiation is not supported by the link partner, and the link + * has a valid signal, force the link up. + * + * The link state is represented internally here by 4 states: + * + * 1) down + * 2) autoneg_progress + * 3) autoneg_complete (the link sucessfully autonegotiated) + * 4) forced_up (the link has been forced up, it did not autonegotiate) + * **/ s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw) { @@ -1401,6 +1498,7 @@ s32 e1000_check_for_serdes_link_82571(st */ mac->serdes_link_state = e1000_serdes_link_autoneg_progress; + mac->serdes_has_link = FALSE; DEBUGOUT("AN_UP -> AN_PROG\n"); } break; @@ -1419,28 +1517,35 @@ s32 e1000_check_for_serdes_link_82571(st (ctrl & ~E1000_CTRL_SLU)); mac->serdes_link_state = e1000_serdes_link_autoneg_progress; + mac->serdes_has_link = FALSE; DEBUGOUT("FORCED_UP -> AN_PROG\n"); } break; case e1000_serdes_link_autoneg_progress: - /* - * If the LU bit is set in the STATUS register, - * autoneg has completed sucessfully. If not, - * try foring the link because the far end may be - * available but not capable of autonegotiation. - */ - if (status & E1000_STATUS_LU) { - mac->serdes_link_state = - e1000_serdes_link_autoneg_complete; - DEBUGOUT("AN_PROG -> AN_UP\n"); + if (rxcw & E1000_RXCW_C) { + /* We received /C/ ordered sets, meaning the + * link partner has autonegotiated, and we can + * trust the Link Up (LU) status bit + */ + if (status & E1000_STATUS_LU) { + mac->serdes_link_state = + e1000_serdes_link_autoneg_complete; + DEBUGOUT("AN_PROG -> AN_UP\n"); + mac->serdes_has_link = TRUE; + } else { + /* Autoneg completed, but failed */ + mac->serdes_link_state = + e1000_serdes_link_down; + DEBUGOUT("AN_PROG -> DOWN\n"); + } } else { - /* - * Disable autoneg, force link up and - * full duplex, and change state to forced + /* The link partner did not autoneg. + * Force link up and full duplex, and change + * state to forced. */ E1000_WRITE_REG(hw, E1000_TXCW, - (mac->txcw & ~E1000_TXCW_ANE)); + (mac->txcw & ~E1000_TXCW_ANE)); ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD); E1000_WRITE_REG(hw, E1000_CTRL, ctrl); @@ -1452,10 +1557,10 @@ s32 e1000_check_for_serdes_link_82571(st break; } mac->serdes_link_state = - e1000_serdes_link_forced_up; + e1000_serdes_link_forced_up; + mac->serdes_has_link = TRUE; DEBUGOUT("AN_PROG -> FORCED_UP\n"); } - mac->serdes_has_link = TRUE; break; case e1000_serdes_link_down: @@ -1517,6 +1622,7 @@ static s32 e1000_valid_led_default_82571 switch (hw->mac.type) { case e1000_82574: + case e1000_82583: case e1000_82573: if(*data == ID_LED_RESERVED_F746) *data = ID_LED_DEFAULT_82573; Modified: head/sys/dev/e1000/e1000_82575.c ============================================================================== --- head/sys/dev/e1000/e1000_82575.c Wed Jun 24 17:31:37 2009 (r194864) +++ head/sys/dev/e1000/e1000_82575.c Wed Jun 24 17:41:29 2009 (r194865) @@ -38,6 +38,7 @@ * 82575GB Gigabit Network Connection * 82575GB Gigabit Network Connection * 82576 Gigabit Network Connection + * 82576 Quad Port Gigabit Mezzanine Adapter */ #include "e1000_api.h" @@ -77,6 +78,7 @@ static s32 e1000_reset_init_script_8257 static s32 e1000_read_mac_addr_82575(struct e1000_hw *hw); static void e1000_power_down_phy_copper_82575(struct e1000_hw *hw); void e1000_shutdown_fiber_serdes_link_82575(struct e1000_hw *hw); +static s32 e1000_set_pcie_completion_timeout(struct e1000_hw *hw); /** * e1000_init_phy_params_82575 - Init PHY func ptrs. @@ -326,11 +328,12 @@ void e1000_init_function_pointers_82575( **/ static s32 e1000_acquire_phy_82575(struct e1000_hw *hw) { - u16 mask; + u16 mask = E1000_SWFW_PHY0_SM; DEBUGFUNC("e1000_acquire_phy_82575"); - mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; + if (hw->bus.func == E1000_FUNC_1) + mask = E1000_SWFW_PHY1_SM; return e1000_acquire_swfw_sync_82575(hw, mask); } @@ -343,11 +346,13 @@ static s32 e1000_acquire_phy_82575(struc **/ static void e1000_release_phy_82575(struct e1000_hw *hw) { - u16 mask; + u16 mask = E1000_SWFW_PHY0_SM; DEBUGFUNC("e1000_release_phy_82575"); - mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; + if (hw->bus.func == E1000_FUNC_1) + mask = E1000_SWFW_PHY1_SM; + e1000_release_swfw_sync_82575(hw, mask); } @@ -785,9 +790,8 @@ static s32 e1000_get_cfg_done_82575(stru DEBUGFUNC("e1000_get_cfg_done_82575"); - if (hw->bus.func == 1) + if (hw->bus.func == E1000_FUNC_1) mask = E1000_NVM_CFG_DONE_PORT_1; - while (timeout) { if (E1000_READ_REG(hw, E1000_EEMNGCTL) & mask) break; @@ -937,13 +941,13 @@ void e1000_shutdown_fiber_serdes_link_82 u32 reg; u16 eeprom_data = 0; - if (hw->mac.type != e1000_82576 || - (hw->phy.media_type != e1000_media_type_fiber && - hw->phy.media_type != e1000_media_type_internal_serdes)) + if (hw->phy.media_type != e1000_media_type_internal_serdes) return; - if (hw->bus.func == 0) + if (hw->bus.func == E1000_FUNC_0) hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data); + else if (hw->bus.func == E1000_FUNC_1) + hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_B, 1, &eeprom_data); /* * If APM is not enabled in the EEPROM and management interface is @@ -970,250 +974,42 @@ void e1000_shutdown_fiber_serdes_link_82 } /** - * e1000_vmdq_loopback_enable_pf- Enables VM to VM queue loopback replication - * @hw: pointer to the HW structure - **/ -void e1000_vmdq_loopback_enable_pf(struct e1000_hw *hw) -{ - u32 reg; - - reg = E1000_READ_REG(hw, E1000_DTXSWC); - reg |= E1000_DTXSWC_VMDQ_LOOPBACK_EN; - E1000_WRITE_REG(hw, E1000_DTXSWC, reg); -} - -/** - * e1000_vmdq_loopback_disable_pf - Disable VM to VM queue loopbk replication + * e1000_vmdq_set_loopback_pf - enable or disable vmdq loopback * @hw: pointer to the HW structure + * @enable: state to enter, either enabled or disabled + * + * enables/disables L2 switch loopback functionality **/ -void e1000_vmdq_loopback_disable_pf(struct e1000_hw *hw) +void e1000_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable) { u32 reg; reg = E1000_READ_REG(hw, E1000_DTXSWC); - reg &= ~(E1000_DTXSWC_VMDQ_LOOPBACK_EN); + if (enable) + reg |= E1000_DTXSWC_VMDQ_LOOPBACK_EN; + else + reg &= ~(E1000_DTXSWC_VMDQ_LOOPBACK_EN); E1000_WRITE_REG(hw, E1000_DTXSWC, reg); } /** - * e1000_vmdq_replication_enable_pf - Enable replication of brdcst & multicst - * @hw: pointer to the HW structure - * - * Enables replication of broadcast and multicast packets from the network - * to VM's which have their respective broadcast and multicast accept - * bits set in the VM Offload Register. This gives the PF driver per - * VM granularity control over which VM's get replicated broadcast traffic. - **/ -void e1000_vmdq_replication_enable_pf(struct e1000_hw *hw, u32 enables) -{ - u32 reg; - u32 i; - - for (i = 0; i < MAX_NUM_VFS; i++) { - if (enables & (1 << i)) { - reg = E1000_READ_REG(hw, E1000_VMOLR(i)); - reg |= (E1000_VMOLR_AUPE | - E1000_VMOLR_BAM | - E1000_VMOLR_MPME); - E1000_WRITE_REG(hw, E1000_VMOLR(i), reg); - } - } - - reg = E1000_READ_REG(hw, E1000_VT_CTL); - reg |= E1000_VT_CTL_VM_REPL_EN; - E1000_WRITE_REG(hw, E1000_VT_CTL, reg); -} - -/** - * e1000_vmdq_replication_disable_pf - Disable replication of brdcst & multicst + * e1000_vmdq_set_replication_pf - enable or disable vmdq replication * @hw: pointer to the HW structure + * @enable: state to enter, either enabled or disabled * - * Disables replication of broadcast and multicast packets to the VM's. + * enables/disables replication of packets across multiple pools **/ -void e1000_vmdq_replication_disable_pf(struct e1000_hw *hw) +void e1000_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable) { u32 reg; reg = E1000_READ_REG(hw, E1000_VT_CTL); - reg &= ~(E1000_VT_CTL_VM_REPL_EN); - E1000_WRITE_REG(hw, E1000_VT_CTL, reg); -} - -/** - * e1000_vmdq_enable_replication_mode_pf - Enables replication mode in the device - * @hw: pointer to the HW structure - **/ -void e1000_vmdq_enable_replication_mode_pf(struct e1000_hw *hw) -{ - u32 reg; - - reg = E1000_READ_REG(hw, E1000_VT_CTL); - reg |= E1000_VT_CTL_VM_REPL_EN; - E1000_WRITE_REG(hw, E1000_VT_CTL, reg); -} - -/** - * e1000_vmdq_broadcast_replication_enable_pf - Enable replication of brdcst - * @hw: pointer to the HW structure - * @enables: PoolSet Bit - if set to ALL_QUEUES, apply to all pools. - * - * Enables replication of broadcast packets from the network - * to VM's which have their respective broadcast accept - * bits set in the VM Offload Register. This gives the PF driver per - * VM granularity control over which VM's get replicated broadcast traffic. - **/ -void e1000_vmdq_broadcast_replication_enable_pf(struct e1000_hw *hw, - u32 enables) -{ - u32 reg; - u32 i; - - for (i = 0; i < MAX_NUM_VFS; i++) { - if ((enables == ALL_QUEUES) || (enables & (1 << i))) { - reg = E1000_READ_REG(hw, E1000_VMOLR(i)); - reg |= E1000_VMOLR_BAM; - E1000_WRITE_REG(hw, E1000_VMOLR(i), reg); - } - } -} - -/** - * e1000_vmdq_broadcast_replication_disable_pf - Disable replication - * of broadcast packets - * @hw: pointer to the HW structure - * @disables: PoolSet Bit - if set to ALL_QUEUES, apply to all pools. - * - * Disables replication of broadcast packets for specific pools. - * If bam/mpe is disabled on all pools then replication mode is - * turned off. - **/ -void e1000_vmdq_broadcast_replication_disable_pf(struct e1000_hw *hw, - u32 disables) -{ - u32 reg; - u32 i; - u32 oneenabled = 0; - - for (i = 0; i < MAX_NUM_VFS; i++) { - reg = E1000_READ_REG(hw, E1000_VMOLR(i)); - if ((disables == ALL_QUEUES) || (disables & (1 << i))) { - reg &= ~(E1000_VMOLR_BAM); - E1000_WRITE_REG(hw, E1000_VMOLR(i), reg); - } - if (!oneenabled && (reg & (E1000_VMOLR_AUPE | - E1000_VMOLR_BAM | - E1000_VMOLR_MPME))) - oneenabled = 1; - } - if (!oneenabled) { - reg = E1000_READ_REG(hw, E1000_VT_CTL); + if (enable) + reg |= E1000_VT_CTL_VM_REPL_EN; + else reg &= ~(E1000_VT_CTL_VM_REPL_EN); - E1000_WRITE_REG(hw, E1000_VT_CTL, reg); - } -} -/** - * e1000_vmdq_multicast_promiscuous_enable_pf - Enable promiscuous reception - * @hw: pointer to the HW structure - * @enables: PoolSet Bit - if set to ALL_QUEUES, apply to all pools. - * - * Enables promiscuous reception of multicast packets from the network - * to VM's which have their respective multicast promiscuous mode enable - * bits set in the VM Offload Register. This gives the PF driver per - * VM granularity control over which VM's get all multicast traffic. - **/ -void e1000_vmdq_multicast_promiscuous_enable_pf(struct e1000_hw *hw, - u32 enables) -{ - u32 reg; - u32 i; - - for (i = 0; i < MAX_NUM_VFS; i++) { - if ((enables == ALL_QUEUES) || (enables & (1 << i))) { - reg = E1000_READ_REG(hw, E1000_VMOLR(i)); - reg |= E1000_VMOLR_MPME; - E1000_WRITE_REG(hw, E1000_VMOLR(i), reg); - } - } -} - -/** - * e1000_vmdq_multicast_promiscuous_disable_pf - Disable promiscuous - * reception of multicast packets - * @hw: pointer to the HW structure - * @disables: PoolSet Bit - if set to ALL_QUEUES, apply to all pools. - * - * Disables promiscuous reception of multicast packets for specific pools. - * If bam/mpe is disabled on all pools then replication mode is - * turned off. - **/ -void e1000_vmdq_multicast_promiscuous_disable_pf(struct e1000_hw *hw, - u32 disables) -{ - u32 reg; - u32 i; - u32 oneenabled = 0; - - for (i = 0; i < MAX_NUM_VFS; i++) { - reg = E1000_READ_REG(hw, E1000_VMOLR(i)); - if ((disables == ALL_QUEUES) || (disables & (1 << i))) { - reg &= ~(E1000_VMOLR_MPME); - E1000_WRITE_REG(hw, E1000_VMOLR(i), reg); - } - if (!oneenabled && (reg & (E1000_VMOLR_AUPE | - E1000_VMOLR_BAM | - E1000_VMOLR_MPME))) - oneenabled = 1; - } - if (!oneenabled) { - reg = E1000_READ_REG(hw, E1000_VT_CTL); - reg &= ~(E1000_VT_CTL_VM_REPL_EN); - E1000_WRITE_REG(hw, E1000_VT_CTL, reg); - } -} - -/** - * e1000_vmdq_aupe_enable_pf - Enable acceptance of untagged packets - * @hw: pointer to the HW structure - * @enables: PoolSet Bit - if set to ALL_QUEUES, apply to all pools. - * - * Enables acceptance of packets from the network which do not have - * a VLAN tag but match the exact MAC filter of a given VM. - **/ -void e1000_vmdq_aupe_enable_pf(struct e1000_hw *hw, u32 enables) -{ - u32 reg; - u32 i; - - for (i = 0; i < MAX_NUM_VFS; i++) { - if ((enables == ALL_QUEUES) || (enables & (1 << i))) { - reg = E1000_READ_REG(hw, E1000_VMOLR(i)); - reg |= E1000_VMOLR_AUPE; - E1000_WRITE_REG(hw, E1000_VMOLR(i), reg); - } - } -} - -/** - * e1000_vmdq_aupe_disable_pf - Disable acceptance of untagged packets - * @hw: pointer to the HW structure - * @disables: PoolSet Bit - if set to ALL_QUEUES, apply to all pools. - * - * Disables acceptance of packets from the network which do not have - * a VLAN tag but match the exact MAC filter of a given VM. - **/ -void e1000_vmdq_aupe_disable_pf(struct e1000_hw *hw, u32 disables) -{ - u32 reg; - u32 i; - - for (i = 0; i < MAX_NUM_VFS; i++) { - if ((disables == ALL_QUEUES) || (disables & (1 << i))) { - reg = E1000_READ_REG(hw, E1000_VMOLR(i)); - reg &= ~E1000_VMOLR_AUPE; - E1000_WRITE_REG(hw, E1000_VMOLR(i), reg); - } - } + E1000_WRITE_REG(hw, E1000_VT_CTL, reg); } /** @@ -1238,6 +1034,12 @@ static s32 e1000_reset_hw_82575(struct e DEBUGOUT("PCI-E Master disable polling has failed.\n"); } + /* set the completion timeout for interface */ + ret_val = e1000_set_pcie_completion_timeout(hw); + if (ret_val) { + DEBUGOUT("PCI-E Set completion timeout has failed.\n"); + } + DEBUGOUT("Masking off all interrupts\n"); E1000_WRITE_REG(hw, E1000_IMC, 0xffffffff); @@ -1333,7 +1135,7 @@ static s32 e1000_init_hw_82575(struct e1 **/ static s32 e1000_setup_copper_link_82575(struct e1000_hw *hw) { - u32 ctrl, led_ctrl; + u32 ctrl; s32 ret_val; bool link; @@ -1350,11 +1152,6 @@ static s32 e1000_setup_copper_link_82575 break; case e1000_phy_igp_3: ret_val = e1000_copper_link_setup_igp(hw); - /* Setup activity LED */ - led_ctrl = E1000_READ_REG(hw, E1000_LEDCTL); - led_ctrl &= IGP_ACTIVITY_LED_MASK; - led_ctrl |= (IGP_ACTIVITY_LED_ENABLE | IGP_LED3_MODE); - E1000_WRITE_REG(hw, E1000_LEDCTL, led_ctrl); break; default: ret_val = -E1000_ERR_PHY; @@ -1433,15 +1230,14 @@ static s32 e1000_setup_fiber_serdes_link */ E1000_WRITE_REG(hw, E1000_SCTL, E1000_SCTL_DISABLE_SERDES_LOOPBACK); - /* Force link up, set 1gb, set both sw defined pins */ + /* Force link up, set 1gb */ reg = E1000_READ_REG(hw, E1000_CTRL); - reg |= E1000_CTRL_SLU | - E1000_CTRL_SPD_1000 | - E1000_CTRL_FRCSPD | - E1000_CTRL_SWDPIN0 | - E1000_CTRL_SWDPIN1; + reg |= E1000_CTRL_SLU | E1000_CTRL_SPD_1000 | E1000_CTRL_FRCSPD; + if (hw->mac.type == e1000_82575 || hw->mac.type == e1000_82576) { + /* set both sw defined pins */ + reg |= E1000_CTRL_SWDPIN0 | E1000_CTRL_SWDPIN1; + } E1000_WRITE_REG(hw, E1000_CTRL, reg); - /* Power on phy for 82576 fiber adapters */ if (hw->mac.type == e1000_82576) { reg = E1000_READ_REG(hw, E1000_CTRL_EXT); @@ -1514,7 +1310,6 @@ static s32 e1000_valid_led_default_82575 if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF) { switch(hw->phy.media_type) { - case e1000_media_type_fiber: case e1000_media_type_internal_serdes: *data = ID_LED_DEFAULT_82575_SERDES; break; @@ -1605,12 +1400,6 @@ out: static bool e1000_sgmii_active_82575(struct e1000_hw *hw) { struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575; - - DEBUGFUNC("e1000_sgmii_active_82575"); - - if (hw->mac.type != e1000_82575 && hw->mac.type != e1000_82576) - return FALSE; - return dev_spec->sgmii_active; } @@ -1762,6 +1551,7 @@ static void e1000_clear_hw_cntrs_82575(s if (hw->phy.media_type == e1000_media_type_internal_serdes) E1000_READ_REG(hw, E1000_SCVPC); } + /** * e1000_rx_fifo_flush_82575 - Clean rx fifo after RX enable * @hw: pointer to the HW structure @@ -1836,3 +1626,54 @@ void e1000_rx_fifo_flush_82575(struct e1 E1000_READ_REG(hw, E1000_MPC); } +/** + * e1000_set_pcie_completion_timeout - set pci-e completion timeout + * @hw: pointer to the HW structure + * + * The defaults for 82575 and 82576 should be in the range of 50us to 50ms, + * however the hardware default for these parts is 500us to 1ms which is less + * than the 10ms recommended by the pci-e spec. To address this we need to + * increase the value to either 10ms to 200ms for capability version 1 config, + * or 16ms to 55ms for version 2. + **/ +static s32 e1000_set_pcie_completion_timeout(struct e1000_hw *hw) +{ + u32 gcr = E1000_READ_REG(hw, E1000_GCR); + s32 ret_val = E1000_SUCCESS; + u16 pcie_devctl2; + + /* only take action if timeout value is defaulted to 0 */ + if (gcr & E1000_GCR_CMPL_TMOUT_MASK) + goto out; + + /* + * if capababilities version is type 1 we can write the + * timeout of 10ms to 200ms through the GCR register + */ + if (!(gcr & E1000_GCR_CAP_VER2)) { + gcr |= E1000_GCR_CMPL_TMOUT_10ms; + goto out; + } + + /* + * for version 2 capabilities we need to write the config space + * directly in order to set the completion timeout value for + * 16ms to 55ms + */ + ret_val = e1000_read_pcie_cap_reg(hw, PCIE_DEVICE_CONTROL2, + &pcie_devctl2); + if (ret_val) + goto out; + + pcie_devctl2 |= PCIE_DEVICE_CONTROL2_16ms; + + ret_val = e1000_write_pcie_cap_reg(hw, PCIE_DEVICE_CONTROL2, + &pcie_devctl2); +out: + /* disable completion timeout resend */ + gcr &= ~E1000_GCR_CMPL_TMOUT_RESEND; + + E1000_WRITE_REG(hw, E1000_GCR, gcr); + return ret_val; +} + Modified: head/sys/dev/e1000/e1000_82575.h ============================================================================== --- head/sys/dev/e1000/e1000_82575.h Wed Jun 24 17:31:37 2009 (r194864) +++ head/sys/dev/e1000/e1000_82575.h Wed Jun 24 17:41:29 2009 (r194865) @@ -214,7 +214,7 @@ union e1000_adv_rx_desc { } wb; /* writeback */ }; -#define E1000_RXDADV_RSSTYPE_MASK 0x0000F000 +#define E1000_RXDADV_RSSTYPE_MASK 0x0000000F #define E1000_RXDADV_RSSTYPE_SHIFT 12 #define E1000_RXDADV_HDRBUFLEN_MASK 0x7FE0 #define E1000_RXDADV_HDRBUFLEN_SHIFT 5 @@ -421,21 +421,11 @@ struct e1000_adv_tx_context_desc { #define E1000_IOVCTL 0x05BBC #define E1000_IOVCTL_REUSE_VFQ 0x00000001 +#define E1000_RPLOLR_STRVLAN 0x40000000 +#define E1000_RPLOLR_STRCRC 0x80000000 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 18:18:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E12811065704; Wed, 24 Jun 2009 18:18:35 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB5488FC17; Wed, 24 Jun 2009 18:18:35 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OIIZrO023472; Wed, 24 Jun 2009 18:18:35 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OIIZOE023462; Wed, 24 Jun 2009 18:18:35 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200906241818.n5OIIZOE023462@svn.freebsd.org> From: Jamie Gritton Date: Wed, 24 Jun 2009 18:18: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: r194869 - in head: gnu/usr.bin/groff/tmac lib lib/libjail share/mk usr.bin/killall usr.sbin/jail usr.sbin/jexec usr.sbin/jls X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 18:18:37 -0000 Author: jamie Date: Wed Jun 24 18:18:35 2009 New Revision: 194869 URL: http://svn.freebsd.org/changeset/base/194869 Log: Add libjail, a (somewhat) simpler interface to the jail_set and jail_get system calls and the security.jail.param sysctls. Approved by: bz (mentor) Added: head/lib/libjail/ head/lib/libjail/Makefile (contents, props changed) head/lib/libjail/jail.3 (contents, props changed) head/lib/libjail/jail.c (contents, props changed) head/lib/libjail/jail.h (contents, props changed) head/lib/libjail/jail_getid.c (contents, props changed) Modified: head/gnu/usr.bin/groff/tmac/mdoc.local head/lib/Makefile head/share/mk/bsd.libnames.mk head/usr.bin/killall/Makefile head/usr.bin/killall/killall.c head/usr.sbin/jail/Makefile head/usr.sbin/jail/jail.c head/usr.sbin/jexec/Makefile head/usr.sbin/jexec/jexec.c head/usr.sbin/jls/Makefile head/usr.sbin/jls/jls.c Modified: head/gnu/usr.bin/groff/tmac/mdoc.local ============================================================================== --- head/gnu/usr.bin/groff/tmac/mdoc.local Wed Jun 24 18:12:16 2009 (r194868) +++ head/gnu/usr.bin/groff/tmac/mdoc.local Wed Jun 24 18:18:35 2009 (r194869) @@ -47,6 +47,7 @@ .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-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) Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Wed Jun 24 18:12:16 2009 (r194868) +++ head/lib/Makefile Wed Jun 24 18:18:35 2009 (r194869) @@ -35,8 +35,8 @@ SUBDIR= ${_csu} libc libbsm libauditd li libcalendar libcam libcompat libdevinfo libdevstat libdisk \ libdwarf libedit libexpat libfetch libftpio libgeom ${_libgpib} \ ${_libgssapi} ${_librpcsec_gss} libipsec \ - ${_libipx} libkiconv libmagic libmemstat ${_libmilter} ${_libmp} \ - ${_libncp} ${_libngatm} libopie libpam libpcap \ + ${_libipx} libjail libkiconv libmagic libmemstat ${_libmilter} \ + ${_libmp} ${_libncp} ${_libngatm} libopie libpam libpcap \ ${_libpmc} libproc librt ${_libsdp} ${_libsm} ${_libsmb} \ ${_libsmdb} \ ${_libsmutil} libstand ${_libtelnet} ${_libthr} libthread_db libufs \ Added: head/lib/libjail/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libjail/Makefile Wed Jun 24 18:18:35 2009 (r194869) @@ -0,0 +1,29 @@ +# $FreeBSD$ + +LIB= jail +SHLIBDIR?= /lib +SHLIB_MAJOR= 1 +SRCS= jail.c jail_getid.c +INCS= jail.h + +MAN= jail.3 + +MLINKS+=jail.3 jail_getid.3 +MLINKS+=jail.3 jail_getname.3 +MLINKS+=jail.3 jail_getv.3 +MLINKS+=jail.3 jail_setv.3 +MLINKS+=jail.3 jailparam.3 +MLINKS+=jail.3 jailparam_all.3 +MLINKS+=jail.3 jailparam_init.3 +MLINKS+=jail.3 jailparam_import.3 +MLINKS+=jail.3 jailparam_import_raw.3 +MLINKS+=jail.3 jailparam_get.3 +MLINKS+=jail.3 jailparam_set.3 +MLINKS+=jail.3 jailparam_export.3 +MLINKS+=jail.3 jailparam_free.3 + +CFLAGS+=-I${.CURDIR} + +WARNS?= 6 + +.include Added: head/lib/libjail/jail.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libjail/jail.3 Wed Jun 24 18:18:35 2009 (r194869) @@ -0,0 +1,275 @@ +.\" Copyright (c) 2009 James Gritton. +.\" 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 June 24, 2009 +.Dt JAIL 3 +.Os +.Sh NAME +.Nm jail_getid , +.Nm jail_getname , +.Nm jail_setv , +.Nm jail_getv , +.Nm jailparam_all , +.Nm jailparam_init , +.Nm jailparam_import , +.Nm jailparam_import_raw , +.Nm jailparam_set , +.Nm jailparam_get , +.Nm jailparam_export , +.Nm jailparam_free , +.Nd create and manage system jails +.Sh LIBRARY +.Lb libjail +.Sh SYNOPSIS +.In sys/param.h +.In sys/jail.h +.In jail.h +.Vt extern char jail_errmsg[] ; +.Ft int +.Fn jail_getid "const char *name" +.Ft char * +.Fn jail_getname "int jid" +.Ft int +.Fn jail_setv "int flags" ... +.Ft int +.Fn jail_getv "int flags" ... +.Ft int +.Fn jailparam_all "struct jailparam **jpp" +.Ft int +.Fn jailparam_init "struct jailparam *jp" "const char *name" +.Ft int +.Fn jailparam_import "struct jailparam *jp" "const char *value" +.Ft int +.Fn jailparam_import_raw "struct jailparam *jp" "void *value" "size_t valuelen" +.Ft int +.Fn jailparam_set "struct jailparam *jp" "unsigned njp" "int flags" +.Ft int +.Fn jailparam_get "struct jailparam *jp" "unsigned njp" "int flags" +.Ft char * +.Fn jailparam_export "struct jailparam *jp" +.Ft void +.Fn jailparam_free "struct jailparam *jp" "unsigned njp" +.Sh DESCRIPTION +The +.Nm jail +library is an interface to the +.Xr jail_set 2 +and +.Xr jail_get 2 +system calls, and the +.Va security.jail.param +MIB entries. +It simplifies the conversion of prison parameters between internal and +string formats, allowing the setting and querying of prisons without +knowing the parameter formats. +.Pp +The +.Fn jail_getid +function returns the JID of the jail identified by +.Ar name , +or \-1 if the jail does not exist. +.Pp +The +.Fn jail_getname +function returns the name of the jail identified by +.Ar jid , +or NULL if the jail does not exist. +.Pp +The +.Fn jail_setv +function takes a null-terminated list of name and value strings, +and passes it to +.Xr jail_set 2 . +.Pp +The +.Fn jail_getv +function takes a null-terminated list of name and value strings, +and passes it to +.Xr jail_get 2 . +It is the caller's responsibility to ensure that the value strings point +to buffers large enough to hold the string representation of the +returned parameters. +.Pp +The +.Fn jailparam_all +function sets +.Ar jpp +to a list of all known jail parameters, and returns the number of +parameters. +The list should later be freed with +.Fn jailparam_free +and +.Xr free 3 . +.Pp +The +.Fn jailparam_init +function clears a parameter record and copies the +.Ar name +to it. After use, it should be freed with +.Fn jailparam_free . +.Pp +The +.Fn jailparam_import +function adds a +.Ar value +to a parameter record, converting it from a string to its native form. +The +.Fn jailparam_import_raw +function adds a value without performing any conversion. +.Pp +The +.Fn jailparam_set +function passes a list of parameters to +.Xr jail_set 2 . +The parameters are assumed to have been created with +.Fn jailparam_init +and +.Fn jailparam_import . +.Pp +The +.Fn jailparam_get +function function passes a list of parameters to +.Xr jail_get 2 . +The parameters are assumed to have been created with +.Fn jailparam_init +or +.Fn jailparam_list , +with one parameter (the key) having been given a value with +.Fn jailparam_import . +.Pp +The +.Fn jailparam_export +function returns the string equivalent of a parameter value. +The returned string should freed after use. +.Pp +The +.Fn jailparam_free +function frees the stored names and values in a parameter list. +If the list itself came from +.Fn jailparam_all , +it should be freed as well. +.Sh EXAMPLES +Set the hostname of jail +.Dq foo +to +.Dq foo.bar : +.Bd -literal -offset indent +jail_setv(JAIL_UPDATE, "name", "foo", "host.hostname", "foo.bar", + NULL); +.Ed +.Pp +OR: +.Bd -literal -offset indent +struct jailparam params[2]; +jailparam_init(¶ms[0], "name"); +jailparam_import(¶ms[0], "foo"); +jailparam_init(¶ms[1], "host.hostname"); +jailparam_import(¶ms[1], "foo.bar"); +jailparam_set(params, 2, JAIL_UPDATE); +jailparam_free(params, 2); +.Ed +.Pp +Retrieve the hostname of jail +.Dq foo : +.Bd -literal -offset indent +char hostname[MAXHOSTNAMELEN]; +jail_getv(0, "name", "foo", "host.hostname", hostname, NULL); +.Ed +.Pp +OR: +.Bd -literal -offset indent +struct jailparam params[2]; +jailparam_init(¶ms[0], "name"); +jailparam_import(¶ms[0], "foo"); +jailparam_init(¶ms[1], "host.hostname"); +jailparam_get(params, 2, 0); +hostname = jailparam_export(¶ms[1]); +jailparam_free(params, 2); +.Ed +.Sh RETURN VALUES +The +.Fn jail_getid , +.Fn jail_setv , +.Fn jail_getv , +.Fn jailparam_set +and +.Fn jailparam_get +functions return a JID on success, or \-1 on error. +.Pp +The +.Fn jail_getname +and +.Fn jailparam_export +functions return a dynamically allocated string on success, or NULL on error. +.Pp +The +.Fn jailparam_all +function returns the number of parameters on success, or \-1 on error. +.Pp +The +.Fn jailparam_init , +.Fn jailparam_import +and +.Fn jailparam_import_raw +functions return 0 on success, or \-1 on error. +.Pp +Whenever an error is returned, +.Va errno +is set, and the global string +.Va jail_errmsg +contains a descrption of the error, possibly from +.Xr jail_set 2 +or +.Xr jail_get 2 . +.Sh ERRORS +The +.Nm jail +functions may return errors from +.Xr jail_set 2 , +.Xr jail_get 2 , +.Xr malloc 3 +or +.Xr sysctl 3 . +In addition, the following errors are possible: +.Bl -tag -width Er +.It Bq Er EINVAL +A prameter value cannot be convert from the passed string to its +internal form. +.It Bq Er ENOENT +The named parameter does not exist. +.It Bq Er ENOENT +A parameter is of an unknown type. +.Sh SEE ALSO +.Xr jail 2 , +.Xr jail 8 , +.Xr sysctl 3 +.Sh HISTORY +The +.Nm jail +library first appeared in +.Fx 8.0 . +.Sh AUTHORS +.An James Gritton Added: head/lib/libjail/jail.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libjail/jail.c Wed Jun 24 18:18:35 2009 (r194869) @@ -0,0 +1,972 @@ +/*- + * Copyright (c) 2009 James Gritton. + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "jail.h" + +#define SJPARAM "security.jail.param" + +#define JPS_IN_ADDR 1 +#define JPS_IN6_ADDR 2 + +#define ARRAY_SANITY 5 +#define ARRAY_SLOP 5 + + +static int jailparam_vlist(struct jailparam **jpp, va_list ap); +static int jailparam_type(struct jailparam *jp); +static char *noname(const char *name); +static char *nononame(const char *name); + +char jail_errmsg[JAIL_ERRMSGLEN]; + + +/* + * Import a null-terminated parameter list and set a jail with the flags + * and parameters. + */ +int +jail_setv(int flags, ...) +{ + va_list ap; + struct jailparam *jp; + int njp; + + va_start(ap, flags); + njp = jailparam_vlist(&jp, ap); + va_end(ap); + if (njp < 0) + return (njp); + return (jailparam_set(jp, njp, flags)); +} + +/* + * Read a null-terminated parameter list, get the referenced jail, and export + * the parameters to the list. + */ +int +jail_getv(int flags, ...) +{ + va_list ap, tap; + struct jailparam *jp; + char *valarg; + const char *value; + int njp, i, jid, namekey, zero; + + va_start(ap, flags); + va_copy(tap, ap); + njp = jailparam_vlist(&jp, tap); + va_end(tap); + if (njp < 0) + return (njp); + /* + * See if the name is the search key. If so, we don't want to write + * it back in case it's a read-only string. + */ + namekey = 1; + zero = 0; + for (i = 0; i < njp; i++) { + if (!strcmp(jp->jp_name, "lastjid") || + (!strcmp(jp->jp_name, "jid") && + memcmp(jp->jp_value, &zero, sizeof(zero)))) + namekey = 0; + } + jid = jailparam_get(jp, njp, flags); + if (jid < 0) { + va_end(ap); + return (-1); + } + for (i = 0; i < njp; i++) { + (void)va_arg(ap, char *); + value = jailparam_export(jp + i); + if (value == NULL) { + va_end(ap); + return (-1); + } + valarg = va_arg(ap, char *); + if (!namekey || strcmp(jp[i].jp_name, "name")) + /* It's up to the caller to ensure there's room. */ + strcpy(valarg, value); + } + va_end(ap); + return (jid); +} + +/* + * Return a list of all known parameters. + */ +int +jailparam_all(struct jailparam **jpp) +{ + struct jailparam *jp; + char *nname; + size_t mlen1, mlen2, buflen; + int njp, nlist; + int mib1[CTL_MAXNAME], mib2[CTL_MAXNAME - 2]; + char buf[MAXPATHLEN]; + + njp = 0; + nlist = 32; + jp = malloc(nlist * sizeof(*jp)); + if (jp == NULL) { + strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); + return (-1); + } + mib1[0] = 0; + mib1[1] = 2; + mlen1 = CTL_MAXNAME - 2; + if (sysctlnametomib(SJPARAM, mib1 + 2, &mlen1) < 0) { + snprintf(jail_errmsg, JAIL_ERRMSGLEN, + "sysctlnametomib(" SJPARAM "): %s", strerror(errno)); + goto error; + } + for (;; njp++) { + /* Get the next parameter. */ + mlen2 = sizeof(mib2); + if (sysctl(mib1, mlen1 + 2, mib2, &mlen2, NULL, 0) < 0) { + snprintf(jail_errmsg, JAIL_ERRMSGLEN, + "sysctl(0.2): %s", strerror(errno)); + goto error; + } + if (mib2[0] != mib1[2] || mib2[1] != mib1[3] || + mib2[2] != mib1[4]) + break; + /* Convert it to an ascii name. */ + memcpy(mib1 + 2, mib2, mlen2); + mlen1 = mlen2 / sizeof(int); + mib1[1] = 1; + buflen = sizeof(buf); + if (sysctl(mib1, mlen1 + 2, buf, &buflen, NULL, 0) < 0) { + snprintf(jail_errmsg, JAIL_ERRMSGLEN, + "sysctl(0.1): %s", strerror(errno)); + goto error; + } + /* Add the parameter to the list */ + if (njp >= nlist) { + nlist *= 2; + jp = realloc(jp, nlist * sizeof(jp)); + if (jp == NULL) { + jailparam_free(jp, njp); + return (-1); + } + } + if (jailparam_init(jp + njp, buf + sizeof(SJPARAM)) < 0) + goto error; + if (jailparam_type(jp + njp) < 0) { + njp++; + goto error; + } + /* Convert nobool parameters to bool. */ + if (jp[njp].jp_flags & JP_NOBOOL) { + nname = nononame(jp[njp].jp_name); + if (nname == NULL) { + njp++; + goto error; + } + free(jp[njp].jp_name); + jp[njp].jp_name = nname; + jp[njp].jp_flags ^= JP_BOOL | JP_NOBOOL; + } + mib1[1] = 2; + } + jp = realloc(jp, njp * sizeof(*jp)); + *jpp = jp; + return (njp); + + error: + jailparam_free(jp, njp); + free(jp); + return (-1); +} + +/* + * Clear a jail parameter and copy in its name. + */ +int +jailparam_init(struct jailparam *jp, const char *name) +{ + + memset(jp, 0, sizeof(*jp)); + jp->jp_name = strdup(name); + if (jp->jp_name == NULL) { + strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); + return (-1); + } + return (0); +} + +/* + * Put a name and value into a jail parameter element, converting the value + * to internal form. + */ +int +jailparam_import(struct jailparam *jp, const char *value) +{ + char *p, *ep, *tvalue; + const char *avalue; + int i, nval, fw; + + if (!jp->jp_ctltype && jailparam_type(jp) < 0) + goto error; + if (value == NULL) + return (0); + if ((jp->jp_ctltype & CTLTYPE) == CTLTYPE_STRING) { + jp->jp_value = strdup(value); + if (!jp->jp_value) { + strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); + goto error; + } + return (0); + } + nval = 1; + if (jp->jp_elemlen) { + if (value[0] == '\0' || (value[0] == '-' && value[1] == '\0')) { + jp->jp_value = strdup(""); + if (value == NULL) { + strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); + goto error; + } + jp->jp_valuelen = 0; + return (0); + } + for (p = strchr(value, ','); p; p = strchr(p + 1, ',')) + nval++; + jp->jp_valuelen = jp->jp_elemlen * nval; + } + jp->jp_value = malloc(jp->jp_valuelen); + if (!jp->jp_value) { + strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); + goto error; + } + avalue = value; + for (i = 0; i < nval; i++) { + fw = nval == 1 ? strlen(avalue) : strcspn(avalue, ","); + switch (jp->jp_ctltype & CTLTYPE) { + case CTLTYPE_INT: + if (jp->jp_flags & (JP_BOOL | JP_NOBOOL)) { + if (!strncasecmp(avalue, "true", 4)) + ((int *)jp->jp_value)[i] = 1; + else if (!strncasecmp(avalue, "false", 5)) + ((int *)jp->jp_value)[i] = 0; + else { + snprintf(jail_errmsg, + JAIL_ERRMSGLEN, + "%s: unknown boolean value \"%.*s\"", + jp->jp_name, fw, avalue); + errno = EINVAL; + goto error; + } + break; + } + ((int *)jp->jp_value)[i] = strtol(avalue, &ep, 10); + integer_test: + if (ep != avalue + fw) { + snprintf(jail_errmsg, JAIL_ERRMSGLEN, + "%s: non-integer value \"%.*s\"", + jp->jp_name, fw, avalue); + errno = EINVAL; + goto error; + } + break; + case CTLTYPE_UINT: + ((unsigned *)jp->jp_value)[i] = + strtoul(avalue, &ep, 10); + goto integer_test; + case CTLTYPE_LONG: + ((long *)jp->jp_value)[i] = strtol(avalue, &ep, 10); + goto integer_test; + case CTLTYPE_ULONG: + ((unsigned long *)jp->jp_value)[i] = + strtoul(avalue, &ep, 10); + goto integer_test; + case CTLTYPE_QUAD: + ((int64_t *)jp->jp_value)[i] = + strtoimax(avalue, &ep, 10); + goto integer_test; + case CTLTYPE_STRUCT: + tvalue = alloca(fw + 1); + strlcpy(tvalue, avalue, fw + 1); + switch (jp->jp_structtype) { + case JPS_IN_ADDR: + if (inet_pton(AF_INET, tvalue, + &((struct in_addr *)jp->jp_value)[i]) != 1) + { + snprintf(jail_errmsg, + JAIL_ERRMSGLEN, + "%s: not an IPv4 address: %s", + jp->jp_name, tvalue); + errno = EINVAL; + goto error; + } + break; + case JPS_IN6_ADDR: + if (inet_pton(AF_INET6, tvalue, + &((struct in6_addr *)jp->jp_value)[i]) != 1) + { + snprintf(jail_errmsg, + JAIL_ERRMSGLEN, + "%s: not an IPv6 address: %s", + jp->jp_name, tvalue); + errno = EINVAL; + goto error; + } + break; + default: + goto unknown_type; + } + break; + default: + unknown_type: + snprintf(jail_errmsg, JAIL_ERRMSGLEN, + "unknown type for %s", jp->jp_name); + errno = ENOENT; + goto error; + } + avalue += fw + 1; + } + return (0); + + error: + free(jp->jp_value); + jp->jp_value = NULL; + return (-1); +} + +/* + * Put a name and value into a jail parameter element, copying the value + * but not altering it. + */ +int +jailparam_import_raw(struct jailparam *jp, void *value, size_t valuelen) +{ + + jp->jp_value = value; + jp->jp_valuelen = valuelen; + jp->jp_flags |= JP_RAWVALUE; + return (0); +} + +/* + * Run the jail_set and jail_get system calls on a parameter list. + */ +int +jailparam_set(struct jailparam *jp, unsigned njp, int flags) +{ + struct iovec *jiov; + char *nname; + int i, jid; + unsigned j; + + jiov = alloca(sizeof(struct iovec) * 2 * (njp + 1)); + for (i = j = 0; j < njp; j++) { + jiov[i].iov_base = jp[j].jp_name; + jiov[i].iov_len = strlen(jp[j].jp_name) + 1; + i++; + if (jp[j].jp_flags & (JP_BOOL | JP_NOBOOL)) { + /* + * Set booleans without values. If one have a value of + * zero, change it to (or from) its "no" counterpart. + */ + jiov[i].iov_base = NULL; + jiov[i].iov_len = 0; + if (jp[j].jp_value != NULL && + jp[j].jp_valuelen == sizeof(int) && + !*(int *)jp[j].jp_value) { + nname = jp[j].jp_flags & JP_BOOL + ? noname(jiov[i].iov_base) + : nononame(jiov[i].iov_base); + if (nname == NULL) + return (-1); + free(jp[j].jp_name); + jiov[i].iov_base = jp[j].jp_name = nname; + } + } else { + jiov[i].iov_base = jp[j].jp_value; + jiov[i].iov_len = + (jp[j].jp_ctltype & CTLTYPE) == CTLTYPE_STRING + ? strlen(jp[j].jp_value) + 1 + : jp[j].jp_valuelen; + } + i++; + } + *(const void **)&jiov[i].iov_base = "errmsg"; + jiov[i].iov_len = sizeof("errmsg"); + i++; + jiov[i].iov_base = jail_errmsg; + jiov[i].iov_len = JAIL_ERRMSGLEN; + i++; + jail_errmsg[0] = 0; + jid = jail_set(jiov, i, flags); + if (jid < 0 && !jail_errmsg[0]) + snprintf(jail_errmsg, sizeof(jail_errmsg), "jail_set: %s", + strerror(errno)); + return (jid); +} + +int +jailparam_get(struct jailparam *jp, unsigned njp, int flags) +{ + struct iovec *jiov; + struct jailparam *jp_lastjid, *jp_jid, *jp_name, *jp_key; + int i, ai, ki, jid, arrays, sanity; + unsigned j; + + /* Find the key and any array parameters. */ + jiov = alloca(sizeof(struct iovec) * 2 * (njp + 1)); + jp_lastjid = jp_jid = jp_name = NULL; + arrays = 0; + for (ai = j = 0; j < njp; j++) { + if (!strcmp(jp[j].jp_name, "lastjid")) + jp_lastjid = jp + j; + else if (!strcmp(jp[j].jp_name, "jid")) + jp_jid = jp + j; + else if (!strcmp(jp[j].jp_name, "name")) + jp_name = jp + j; + else if (jp[j].jp_elemlen && !(jp[j].jp_flags & JP_RAWVALUE)) { + arrays = 1; + jiov[ai].iov_base = jp[j].jp_name; + jiov[ai].iov_len = strlen(jp[j].jp_name) + 1; + ai++; + jiov[ai].iov_base = NULL; + jiov[ai].iov_len = 0; + ai++; + } + } + jp_key = jp_lastjid ? jp_lastjid : + jp_jid && jp_jid->jp_valuelen == sizeof(int) && + *(int *)jp_jid->jp_value ? jp_jid : jp_name; + if (jp_key == NULL || jp_key->jp_value == NULL) { + strlcpy(jail_errmsg, "no jail specified", JAIL_ERRMSGLEN); + errno = ENOENT; + return (-1); + } + ki = ai; + jiov[ki].iov_base = jp_key->jp_name; + jiov[ki].iov_len = strlen(jp_key->jp_name) + 1; + ki++; + jiov[ki].iov_base = jp_key->jp_value; + jiov[ki].iov_len = (jp_key->jp_ctltype & CTLTYPE) == CTLTYPE_STRING + ? strlen(jp_key->jp_value) + 1 : jp_key->jp_valuelen; + ki++; + *(const void **)&jiov[ki].iov_base = "errmsg"; + jiov[ki].iov_len = sizeof("errmsg"); + ki++; + jiov[ki].iov_base = jail_errmsg; + jiov[ki].iov_len = JAIL_ERRMSGLEN; + ki++; + jail_errmsg[0] = 0; + if (arrays && jail_get(jiov, ki, flags) < 0) { + if (!jail_errmsg[0]) + snprintf(jail_errmsg, sizeof(jail_errmsg), + "jail_get: %s", strerror(errno)); + return (-1); + } + /* Allocate storage for all parameters. */ + for (ai = j = 0, i = ki; j < njp; j++) { + if (jp[j].jp_elemlen && !(jp[j].jp_flags & JP_RAWVALUE)) { + ai++; + jiov[ai].iov_len += jp[j].jp_elemlen * ARRAY_SLOP; + jiov[ai].iov_base = jp[j].jp_value = + malloc(jiov[ai].iov_len); + if (jiov[ai].iov_base == NULL) { + strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); + return (-1); + } + memset(jiov[ai].iov_base, 0, jiov[ai].iov_len); + ai++; + } else if (jp + j != jp_key) { + jiov[i].iov_base = jp[j].jp_name; + jiov[i].iov_len = strlen(jp[j].jp_name) + 1; + i++; + jiov[i].iov_base = jp[j].jp_value = + malloc(jp[j].jp_valuelen); + if (jiov[i].iov_base == NULL) { + strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); + return (-1); + } + jiov[i].iov_len = jp[j].jp_valuelen; + memset(jiov[i].iov_base, 0, jiov[i].iov_len); + i++; + } + } + /* + * Get the prison. If there are array elements, retry a few times + * in case their sizes changed from under us. + */ + for (sanity = 0;; sanity++) { + jid = jail_get(jiov, i, flags); + if (jid >= 0 || !arrays || sanity == ARRAY_SANITY || + errno != EINVAL || jail_errmsg[0]) + break; + for (ai = j = 0; j < njp; j++) { + if (jp[j].jp_elemlen && + !(jp[j].jp_flags & JP_RAWVALUE)) { + ai++; + free(jiov[ai].iov_base); + jiov[ai].iov_base = jp[j].jp_value = NULL; + jiov[ai].iov_len = 0; + ai++; + } + } + if (jail_get(jiov, ki, flags) < 0) + break; + for (ai = j = 0; j < njp; j++) { + if (jp[j].jp_elemlen && + !(jp[j].jp_flags & JP_RAWVALUE)) { + ai++; + jiov[ai].iov_len += + jp[j].jp_elemlen * ARRAY_SLOP; + jiov[ai].iov_base = jp[j].jp_value = + malloc(jiov[ai].iov_len); + if (jiov[ai].iov_base == NULL) { + strerror_r(errno, jail_errmsg, + JAIL_ERRMSGLEN); + return (-1); + } + memset(jiov[ai].iov_base, 0, jiov[ai].iov_len); + ai++; + } + } + } + if (jid < 0 && !jail_errmsg[0]) + snprintf(jail_errmsg, sizeof(jail_errmsg), + "jail_get: %s", strerror(errno)); + for (ai = j = 0, i = ki; j < njp; j++) { + if (jp[j].jp_elemlen && !(jp[j].jp_flags & JP_RAWVALUE)) { + ai++; + jp[j].jp_valuelen = jiov[ai].iov_len; + ai++; + } else if (jp + j != jp_key) { + i++; + jp[j].jp_valuelen = jiov[i].iov_len; + i++; + } + } + return (jid); +} + +/* + * Convert a jail parameter's value to external form. + */ +char * +jailparam_export(struct jailparam *jp) +{ + char *value, *tvalue, **values; + size_t valuelen; + int i, nval; + char valbuf[INET6_ADDRSTRLEN]; + + if (!jp->jp_ctltype && jailparam_type(jp) < 0) + return (NULL); + if ((jp->jp_ctltype & CTLTYPE) == CTLTYPE_STRING) { + value = strdup(jp->jp_value); + if (value == NULL) + strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); + return (value); + } + nval = jp->jp_elemlen ? jp->jp_valuelen / jp->jp_elemlen : 1; + if (nval == 0) { + value = strdup(""); + if (value == NULL) + strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); + return (value); + } + values = alloca(nval * sizeof(char *)); + valuelen = 0; + for (i = 0; i < nval; i++) { + switch (jp->jp_ctltype & CTLTYPE) { + case CTLTYPE_INT: + if (jp->jp_flags & (JP_BOOL | JP_NOBOOL)) { + strlcpy(valbuf, + ((int *)jp->jp_value)[i] ? "true" : "false", + sizeof(valbuf)); + break; + } + snprintf(valbuf, sizeof(valbuf), "%d", + ((int *)jp->jp_value)[i]); + break; + case CTLTYPE_UINT: + snprintf(valbuf, sizeof(valbuf), "%u", + ((unsigned *)jp->jp_value)[i]); + break; + case CTLTYPE_LONG: + snprintf(valbuf, sizeof(valbuf), "%ld", + ((long *)jp->jp_value)[i]); + break; + case CTLTYPE_ULONG: + snprintf(valbuf, sizeof(valbuf), "%lu", + ((unsigned long *)jp->jp_value)[i]); + break; + case CTLTYPE_QUAD: + snprintf(valbuf, sizeof(valbuf), "%jd", + (intmax_t)((int64_t *)jp->jp_value)[i]); + break; + case CTLTYPE_STRUCT: + switch (jp->jp_structtype) { + case JPS_IN_ADDR: + if (inet_ntop(AF_INET, + &((struct in_addr *)jp->jp_value)[i], + valbuf, sizeof(valbuf)) == NULL) { + strerror_r(errno, jail_errmsg, + JAIL_ERRMSGLEN); + + return (NULL); + } + break; + case JPS_IN6_ADDR: + if (inet_ntop(AF_INET6, + &((struct in6_addr *)jp->jp_value)[i], + valbuf, sizeof(valbuf)) == NULL) { + strerror_r(errno, jail_errmsg, + JAIL_ERRMSGLEN); + + return (NULL); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 18:19:55 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AF9C1065674; Wed, 24 Jun 2009 18:19:55 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 893908FC21; Wed, 24 Jun 2009 18:19:55 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OIJt39023527; Wed, 24 Jun 2009 18:19:55 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OIJtUa023525; Wed, 24 Jun 2009 18:19:55 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200906241819.n5OIJtUa023525@svn.freebsd.org> From: Jamie Gritton Date: Wed, 24 Jun 2009 18:19: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: r194870 - head/tools/build/mk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 18:19:56 -0000 Author: jamie Date: Wed Jun 24 18:19:55 2009 New Revision: 194870 URL: http://svn.freebsd.org/changeset/base/194870 Log: Add libjail, a (somewhat) simpler interface to the jail_set and jail_get system calls and the security.jail.param sysctls. Approved by: bz (mentor) Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Wed Jun 24 18:18:35 2009 (r194869) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Wed Jun 24 18:19:55 2009 (r194870) @@ -1023,6 +1023,7 @@ OLD_FILES+=usr/lib/libhdb_p.a OLD_FILES+=usr/lib/libhistory_p.a OLD_FILES+=usr/lib/libipsec_p.a OLD_FILES+=usr/lib/libipx_p.a +OLD_FILES+=usr/lib/libjail_p.a OLD_FILES+=usr/lib/libkadm5clnt_p.a OLD_FILES+=usr/lib/libkadm5srv_p.a OLD_FILES+=usr/lib/libkafs5_p.a From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 18:21:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E8421065670; Wed, 24 Jun 2009 18:21:37 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C1E98FC1A; Wed, 24 Jun 2009 18:21:37 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OILbTF023620; Wed, 24 Jun 2009 18:21:37 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OILbtL023615; Wed, 24 Jun 2009 18:21:37 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200906241821.n5OILbtL023615@svn.freebsd.org> From: Jamie Gritton Date: Wed, 24 Jun 2009 18:21: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: r194871 - in head: rescue/rescue sbin/ifconfig X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 18:21:38 -0000 Author: jamie Date: Wed Jun 24 18:21:37 2009 New Revision: 194871 URL: http://svn.freebsd.org/changeset/base/194871 Log: Add the "vnet" and "-vnet" options, to allow moving interfaces between jails with VIMAGE. Approved by: bz (mentor) Modified: head/rescue/rescue/Makefile head/sbin/ifconfig/Makefile head/sbin/ifconfig/ifconfig.8 head/sbin/ifconfig/ifconfig.c Modified: head/rescue/rescue/Makefile ============================================================================== --- head/rescue/rescue/Makefile Wed Jun 24 18:19:55 2009 (r194870) +++ head/rescue/rescue/Makefile Wed Jun 24 18:21:37 2009 (r194871) @@ -143,7 +143,7 @@ CRUNCH_LIBS+= -lipx .if ${MK_ZFS} != "no" CRUNCH_LIBS+= -lzfs -lnvpair -luutil -lavl .endif -CRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv -lmd -lreadline -lsbuf -lufs -lz +CRUNCH_LIBS+= -lgeom -lbsdxml -ljail -lkiconv -lmd -lreadline -lsbuf -lufs -lz .if ${MACHINE_ARCH} == "i386" CRUNCH_PROGS_sbin+= bsdlabel sconfig fdisk Modified: head/sbin/ifconfig/Makefile ============================================================================== --- head/sbin/ifconfig/Makefile Wed Jun 24 18:19:55 2009 (r194870) +++ head/sbin/ifconfig/Makefile Wed Jun 24 18:21:37 2009 (r194871) @@ -27,8 +27,8 @@ SRCS+= ifgre.c # GRE keys etc SRCS+= ifgif.c # GIF reversed header workaround SRCS+= ifieee80211.c regdomain.c # SIOC[GS]IEEE80211 support -DPADD+= ${LIBBSDXML} ${LIBSBUF} -LDADD+= -lbsdxml -lsbuf +DPADD+= ${LIBBSDXML} ${LIBSBUF} ${LIBJAIL} +LDADD+= -lbsdxml -ljail -lsbuf SRCS+= ifcarp.c # SIOC[GS]VH support SRCS+= ifgroup.c # ... Modified: head/sbin/ifconfig/ifconfig.8 ============================================================================== --- head/sbin/ifconfig/ifconfig.8 Wed Jun 24 18:19:55 2009 (r194870) +++ head/sbin/ifconfig/ifconfig.8 Wed Jun 24 18:21:37 2009 (r194871) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd January 7, 2009 +.Dd June 24, 2009 .Dt IFCONFIG 8 .Os .Sh NAME @@ -417,6 +417,18 @@ If the driver offers user-configurable V reception of extended frames, tag processing in hardware, or frame filtering in hardware, respectively. +.It Cm vnet Ar jail +Move the interface to the +.Xr jail 8 , +specified by name or JID. +If the jail has a virtual network stack, the interface will disappear +from the current environment and become visible to the jail. +.It Fl vnet Ar jail +Reclaim the interface from the +.Xr jail 8 , +specified by name or JID. +If the jail has a virtual network stack, the interface will disappear +from the jail, and become visible to the current network environment. .It Cm polling Turn on .Xr polling 4 @@ -2367,6 +2379,7 @@ tried to alter an interface's configurat .\" .Xr eon 5 , .Xr rc 8 , .Xr routed 8 , +.Xr jail 8 , .Xr sysctl 8 .Sh HISTORY The Modified: head/sbin/ifconfig/ifconfig.c ============================================================================== --- head/sbin/ifconfig/ifconfig.c Wed Jun 24 18:19:55 2009 (r194870) +++ head/sbin/ifconfig/ifconfig.c Wed Jun 24 18:21:37 2009 (r194871) @@ -67,6 +67,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -629,6 +630,34 @@ deletetunnel(const char *vname, int para } static void +setifvnet(const char *jname, int dummy __unused, int s, + const struct afswtch *afp) +{ + struct ifreq my_ifr; + + memcpy(&my_ifr, &ifr, sizeof(my_ifr)); + ifr.ifr_jid = jail_getid(jname); + if (ifr.ifr_jid < 0) + errx(1, "%s", jail_errmsg); + if (ioctl(s, SIOCSIFVNET, &ifr) < 0) + err(1, "SIOCSIFVNET"); +} + +static void +setifrvnet(const char *jname, int dummy __unused, int s, + const struct afswtch *afp) +{ + struct ifreq my_ifr; + + memcpy(&my_ifr, &ifr, sizeof(my_ifr)); + ifr.ifr_jid = jail_getid(jname); + if (ifr.ifr_jid < 0) + errx(1, "%s", jail_errmsg); + if (ioctl(s, SIOCSIFRVNET, &ifr) < 0) + err(1, "SIOCSIFRVNET"); +} + +static void setifnetmask(const char *addr, int dummy __unused, int s, const struct afswtch *afp) { @@ -1012,6 +1041,8 @@ static struct cmd basic_cmds[] = { DEF_CMD_ARG2("tunnel", settunnel), DEF_CMD("-tunnel", 0, deletetunnel), DEF_CMD("deletetunnel", 0, deletetunnel), + DEF_CMD_ARG("vnet", setifvnet), + DEF_CMD_ARG("-vnet", setifrvnet), DEF_CMD("link0", IFF_LINK0, setifflags), DEF_CMD("-link0", -IFF_LINK0, setifflags), DEF_CMD("link1", IFF_LINK1, setifflags), From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 18:24:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7479E1065673; Wed, 24 Jun 2009 18:24:20 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62F548FC15; Wed, 24 Jun 2009 18:24:20 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OIOKEX023729; Wed, 24 Jun 2009 18:24:20 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OIOKU4023727; Wed, 24 Jun 2009 18:24:20 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906241824.n5OIOKU4023727@svn.freebsd.org> From: Sam Leffler Date: Wed, 24 Jun 2009 18:24:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194872 - head/tools/tools/ath/athpoke X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 18:24:20 -0000 Author: sam Date: Wed Jun 24 18:24:20 2009 New Revision: 194872 URL: http://svn.freebsd.org/changeset/base/194872 Log: read back the written value and display Modified: head/tools/tools/ath/athpoke/athpoke.c Modified: head/tools/tools/ath/athpoke/athpoke.c ============================================================================== --- head/tools/tools/ath/athpoke/athpoke.c Wed Jun 24 18:21:37 2009 (r194871) +++ head/tools/tools/ath/athpoke/athpoke.c Wed Jun 24 18:24:20 2009 (r194872) @@ -105,8 +105,7 @@ main(int argc, char *argv[]) reg = (dr != NULL) ? dr->addr : (uint32_t) strtoul(argv[0], NULL, 0); if (cp != NULL) regwrite(s, &atd, reg, (uint32_t) strtoul(cp, NULL, 0)); - else - printf("%s = %08x\n", argv[0], regread(s, &atd, reg)); + printf("%s = %08x\n", argv[0], regread(s, &atd, reg)); } return 0; } From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 18:24:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98C2E1065680; Wed, 24 Jun 2009 18:24:37 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6D11D8FC22; Wed, 24 Jun 2009 18:24:37 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OIObKf023771; Wed, 24 Jun 2009 18:24:37 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OIObYY023769; Wed, 24 Jun 2009 18:24:37 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906241824.n5OIObYY023769@svn.freebsd.org> From: Sam Leffler Date: Wed, 24 Jun 2009 18:24: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: r194873 - head/tools/tools/ath/athpoke X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 18:24:38 -0000 Author: sam Date: Wed Jun 24 18:24:37 2009 New Revision: 194873 URL: http://svn.freebsd.org/changeset/base/194873 Log: add a link named athpeek since my fingers keep typing it Modified: head/tools/tools/ath/athpoke/Makefile Modified: head/tools/tools/ath/athpoke/Makefile ============================================================================== --- head/tools/tools/ath/athpoke/Makefile Wed Jun 24 18:24:20 2009 (r194872) +++ head/tools/tools/ath/athpoke/Makefile Wed Jun 24 18:24:37 2009 (r194873) @@ -1,6 +1,7 @@ # $FreeBSD$ PROG= athpoke +LINKS= ${BINDIR}/${PROG} ${BINDIR}/athpeek .PATH.c: ${.CURDIR}/../common From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 18:27:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 030041065670; Wed, 24 Jun 2009 18:27:08 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E3DF28FC14; Wed, 24 Jun 2009 18:27:07 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OIR7cO023932; Wed, 24 Jun 2009 18:27:07 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OIR7iS023929; Wed, 24 Jun 2009 18:27:07 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200906241827.n5OIR7iS023929@svn.freebsd.org> From: Jack F Vogel Date: Wed, 24 Jun 2009 18:27: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: r194875 - in head/sys: dev/ixgbe modules/ixgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 18:27:08 -0000 Author: jfv Date: Wed Jun 24 18:27:07 2009 New Revision: 194875 URL: http://svn.freebsd.org/changeset/base/194875 Log: Update for the Intel 10G driver, this adds support for newest hardware, adds multiqueue tx interface, infrastructure cleanup to allow up to 32 MSIX vectors on newer Nehalem systems. Bug fixes, etc. Modified: head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixgbe.h head/sys/dev/ixgbe/ixgbe_82598.c head/sys/dev/ixgbe/ixgbe_82599.c head/sys/dev/ixgbe/ixgbe_api.c head/sys/dev/ixgbe/ixgbe_api.h head/sys/dev/ixgbe/ixgbe_common.c head/sys/dev/ixgbe/ixgbe_osdep.h head/sys/dev/ixgbe/ixgbe_phy.c head/sys/dev/ixgbe/ixgbe_phy.h head/sys/dev/ixgbe/ixgbe_type.h head/sys/modules/ixgbe/Makefile Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Wed Jun 24 18:25:41 2009 (r194874) +++ head/sys/dev/ixgbe/ixgbe.c Wed Jun 24 18:27:07 2009 (r194875) @@ -46,7 +46,7 @@ int ixgbe_display_debug_stat /********************************************************************* * Driver version *********************************************************************/ -char ixgbe_driver_version[] = "1.7.4"; +char ixgbe_driver_version[] = "1.8.7"; /********************************************************************* * PCI Device ID Table @@ -73,6 +73,7 @@ static ixgbe_vendor_info_t ixgbe_vendor_ {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82598EB_SFP_LOM, 0, 0, 0}, {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_KX4, 0, 0, 0}, {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_SFP, 0, 0, 0}, + {IXGBE_INTEL_VENDOR_ID, IXGBE_DEV_ID_82599_XAUI_LOM, 0, 0, 0}, /* required last entry */ {0, 0, 0, 0, 0} }; @@ -94,6 +95,12 @@ static int ixgbe_detach(device_t); static int ixgbe_shutdown(device_t); static void ixgbe_start(struct ifnet *); static void ixgbe_start_locked(struct tx_ring *, struct ifnet *); +#if __FreeBSD_version >= 800000 +static int ixgbe_mq_start(struct ifnet *, struct mbuf *); +static int ixgbe_mq_start_locked(struct ifnet *, + struct tx_ring *, struct mbuf *); +static void ixgbe_qflush(struct ifnet *); +#endif static int ixgbe_ioctl(struct ifnet *, u_long, caddr_t); static void ixgbe_watchdog(struct adapter *); static void ixgbe_init(void *); @@ -106,9 +113,7 @@ static int ixgbe_allocate_pci_resou static int ixgbe_allocate_msix(struct adapter *); static int ixgbe_allocate_legacy(struct adapter *); static int ixgbe_allocate_queues(struct adapter *); -#if __FreeBSD_version >= 602105 static int ixgbe_setup_msix(struct adapter *); -#endif static void ixgbe_free_pci_resources(struct adapter *); static void ixgbe_local_timer(void *); static int ixgbe_hardware_init(struct adapter *); @@ -151,22 +156,15 @@ static int ixgbe_dma_malloc(struct adapt static void ixgbe_dma_free(struct adapter *, struct ixgbe_dma_alloc *); static void ixgbe_add_rx_process_limit(struct adapter *, const char *, const char *, int *, int); -static int ixgbe_tx_ctx_setup(struct tx_ring *, struct mbuf *); -static boolean_t ixgbe_tso_setup(struct tx_ring *, struct mbuf *, u32 *); -static void ixgbe_set_ivar(struct adapter *, u16, u8, s8); +static bool ixgbe_tx_ctx_setup(struct tx_ring *, struct mbuf *); +static bool ixgbe_tso_setup(struct tx_ring *, struct mbuf *, u32 *); +static void ixgbe_set_ivar(struct adapter *, u8, u8, s8); static void ixgbe_configure_ivars(struct adapter *); static u8 * ixgbe_mc_array_itr(struct ixgbe_hw *, u8 **, u32 *); -#ifdef IXGBE_HW_VLAN_SUPPORT +static void ixgbe_setup_vlan_hw_support(struct adapter *); static void ixgbe_register_vlan(void *, struct ifnet *, u16); static void ixgbe_unregister_vlan(void *, struct ifnet *, u16); -#endif - -#ifdef IXGBE_TIMESYNC -/* Precision Time sync support */ -static int ixgbe_tsync_init(struct adapter *); -static void ixgbe_tsync_disable(struct adapter *); -#endif static void ixgbe_update_aim(struct rx_ring *); @@ -176,12 +174,10 @@ static bool ixgbe_sfp_probe(struct adapt /* Legacy (single vector interrupt handler */ static void ixgbe_legacy_irq(void *); -#if __FreeBSD_version >= 602105 /* The MSI/X Interrupt handlers */ static void ixgbe_msix_tx(void *); static void ixgbe_msix_rx(void *); static void ixgbe_msix_link(void *); -#endif /* Deferred interrupt tasklets */ static void ixgbe_handle_tx(void *, int); @@ -238,45 +234,25 @@ TUNABLE_INT("hw.ixgbe.bulk_latency", &ix static int ixgbe_rx_process_limit = 100; TUNABLE_INT("hw.ixgbe.rx_process_limit", &ixgbe_rx_process_limit); -/* Flow control setting, default to off */ +/* Flow control setting, default to full */ static int ixgbe_flow_control = ixgbe_fc_full; TUNABLE_INT("hw.ixgbe.flow_control", &ixgbe_flow_control); /* - * Should the driver do LRO on the RX end - * this can be toggled on the fly, but the - * interface must be reset (down/up) for it - * to take effect. - */ -static int ixgbe_enable_lro = 1; -TUNABLE_INT("hw.ixgbe.enable_lro", &ixgbe_enable_lro); - -/* * MSIX should be the default for best performance, * but this allows it to be forced off for testing. */ -#if __FreeBSD_version >= 602105 static int ixgbe_enable_msix = 1; -#else -static int ixgbe_enable_msix = 0; -#endif TUNABLE_INT("hw.ixgbe.enable_msix", &ixgbe_enable_msix); /* - * Enable RX Header Split - * WARNING: disable this if bridging or forwarding!! + * Number of Queues, should normally + * be left at 0, it then autoconfigures to + * the number of cpus. Each queue is a pair + * of RX and TX rings with a dedicated interrupt */ -static int ixgbe_rx_hdr_split = 1; -TUNABLE_INT("hw.ixgbe.rx_hdr_split", &ixgbe_rx_hdr_split); - -/* - * Number of TX/RX Queues, with 0 setting - * it autoconfigures to the number of cpus. - */ -static int ixgbe_tx_queues = 1; -TUNABLE_INT("hw.ixgbe.tx_queues", &ixgbe_tx_queues); -static int ixgbe_rx_queues = 1; -TUNABLE_INT("hw.ixgbe.rx_queues", &ixgbe_rx_queues); +static int ixgbe_num_queues = 0; +TUNABLE_INT("hw.ixgbe.num_queues", &ixgbe_num_queues); /* Number of TX descriptors per ring */ static int ixgbe_txd = DEFAULT_TXD; @@ -290,6 +266,13 @@ TUNABLE_INT("hw.ixgbe.rxd", &ixgbe_rxd); static int ixgbe_total_ports; /* +** Shadow VFTA table, this is needed because +** the real filter table gets cleared during +** a soft reset and we need to repopulate it. +*/ +static u32 ixgbe_shadow_vfta[IXGBE_VFTA_SIZE]; + +/* ** The number of scatter-gather segments ** differs for 82598 and 82599, default to ** the former. @@ -400,6 +383,9 @@ ixgbe_attach(device_t dev) case IXGBE_DEV_ID_82599_KX4 : adapter->optics = IFM_10G_CX4; ixgbe_num_segs = IXGBE_82599_SCATTER; + break; + case IXGBE_DEV_ID_82599_XAUI_LOM : + ixgbe_num_segs = IXGBE_82599_SCATTER; default: break; } @@ -422,11 +408,6 @@ ixgbe_attach(device_t dev) SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "enable_lro", CTLTYPE_INT|CTLFLAG_RW, - &ixgbe_enable_lro, 1, "Large Receive Offload"); - - SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "enable_aim", CTLTYPE_INT|CTLFLAG_RW, &ixgbe_enable_aim, 1, "Interrupt Moderation"); @@ -445,11 +426,6 @@ ixgbe_attach(device_t dev) OID_AUTO, "bulk_latency", CTLTYPE_INT|CTLFLAG_RW, &ixgbe_bulk_latency, 1, "Bulk Latency"); - SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), - SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), - OID_AUTO, "hdr_split", CTLTYPE_INT|CTLFLAG_RW, - &ixgbe_rx_hdr_split, 1, "RX Header Split"); - /* Set up the timer callout */ callout_init_mtx(&adapter->timer, &adapter->core_mtx, 0); @@ -476,10 +452,10 @@ ixgbe_attach(device_t dev) ** system mbuf allocation. Tuning nmbclusters ** can alleviate this. */ - if ((adapter->num_rx_queues > 1) && (nmbclusters > 0 )){ + if ((adapter->num_queues > 1) && (nmbclusters > 0 )){ int s; /* Calculate the total RX mbuf needs */ - s = (ixgbe_rxd * adapter->num_rx_queues) * ixgbe_total_ports; + s = (ixgbe_rxd * adapter->num_queues) * ixgbe_total_ports; if (s > nmbclusters) { device_printf(dev, "RX Descriptors exceed " "system mbuf max, using default instead!\n"); @@ -537,6 +513,22 @@ ixgbe_attach(device_t dev) /* Setup OS specific network interface */ ixgbe_setup_interface(dev, adapter); +#ifdef IXGBE_IEEE1588 + /* + ** Setup the timer: IEEE 1588 support + */ + adapter->cycles.read = ixgbe_read_clock; + adapter->cycles.mask = (u64)-1; + adapter->cycles.mult = 1; + adapter->cycles.shift = IXGBE_TSYNC_SHIFT; + IXGBE_WRITE_REG(&adapter->hw, IXGBE_TIMINCA, (1<<24) | + IXGBE_TSYNC_CYCLE_TIME * IXGBE_TSYNC_SHIFT); + IXGBE_WRITE_REG(&adapter->hw, IXGBE_SYSTIML, 0x00000000); + IXGBE_WRITE_REG(&adapter->hw, IXGBE_SYSTIMH, 0xFF800000); + + // JFV - this is not complete yet +#endif + /* Sysctl for limiting the amount of work done in the taskqueue */ ixgbe_add_rx_process_limit(adapter, "rx_processing_limit", "max number of rx packets to process", &adapter->rx_process_limit, @@ -545,13 +537,11 @@ ixgbe_attach(device_t dev) /* Initialize statistics */ ixgbe_update_stats_counters(adapter); -#ifdef IXGBE_HW_VLAN_SUPPORT /* Register for VLAN events */ adapter->vlan_attach = EVENTHANDLER_REGISTER(vlan_config, ixgbe_register_vlan, 0, EVENTHANDLER_PRI_FIRST); adapter->vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig, ixgbe_unregister_vlan, 0, EVENTHANDLER_PRI_FIRST); -#endif /* let hardware know driver is loaded */ ctrl_ext = IXGBE_READ_REG(hw, IXGBE_CTRL_EXT); @@ -590,11 +580,7 @@ ixgbe_detach(device_t dev) INIT_DEBUGOUT("ixgbe_detach: begin"); /* Make sure VLANS are not using driver */ -#if __FreeBSD_version >= 700000 if (adapter->ifp->if_vlantrunk != NULL) { -#else - if (adapter->ifp->if_nvlans != 0) { -#endif device_printf(dev,"Vlan in use, detach first\n"); return (EBUSY); } @@ -603,14 +589,14 @@ ixgbe_detach(device_t dev) ixgbe_stop(adapter); IXGBE_CORE_UNLOCK(adapter); - for (int i = 0; i < adapter->num_tx_queues; i++, txr++) { + for (int i = 0; i < adapter->num_queues; i++, txr++) { if (txr->tq) { taskqueue_drain(txr->tq, &txr->tx_task); taskqueue_free(txr->tq); } } - for (int i = 0; i < adapter->num_rx_queues; i++, rxr++) { + for (int i = 0; i < adapter->num_queues; i++, rxr++) { if (rxr->tq) { taskqueue_drain(rxr->tq, &rxr->rx_task); taskqueue_free(rxr->tq); @@ -630,13 +616,11 @@ ixgbe_detach(device_t dev) ctrl_ext &= ~IXGBE_CTRL_EXT_DRV_LOAD; IXGBE_WRITE_REG(&adapter->hw, IXGBE_CTRL_EXT, ctrl_ext); -#ifdef IXGBE_HW_VLAN_SUPPORT /* Unregister VLAN events */ if (adapter->vlan_attach != NULL) EVENTHANDLER_DEREGISTER(vlan_config, adapter->vlan_attach); if (adapter->vlan_detach != NULL) EVENTHANDLER_DEREGISTER(vlan_unconfig, adapter->vlan_detach); -#endif ether_ifdetach(adapter->ifp); callout_drain(&adapter->timer); @@ -697,19 +681,6 @@ ixgbe_start_locked(struct tx_ring *txr, IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; - /* - * Force a cleanup if number of TX descriptors - * available is below the threshold. If it fails - * to get above, then abort transmit. - */ - if (txr->tx_avail <= IXGBE_TX_CLEANUP_THRESHOLD) { - ixgbe_txeof(txr); - /* Make sure things have improved */ - if (txr->tx_avail <= IXGBE_TX_OP_THRESHOLD) { - txr->no_tx_desc_avail++; - break; - } - } if (ixgbe_xmit(txr, &m_head)) { if (m_head == NULL) @@ -728,35 +699,127 @@ ixgbe_start_locked(struct tx_ring *txr, return; } - +/* + * Legacy TX start - called by the stack, this + * always uses the first tx ring, and should + * not be used with multiqueue tx enabled. + */ static void ixgbe_start(struct ifnet *ifp) { struct adapter *adapter = ifp->if_softc; struct tx_ring *txr = adapter->tx_rings; - u32 queue = 0; - - /* - ** This is really just here for testing - ** TX multiqueue, ultimately what is - ** needed is the flow support in the stack - ** and appropriate logic here to deal with - ** it. -jfv - */ - if (adapter->num_tx_queues > 1) - queue = (curcpu % adapter->num_tx_queues); - - txr = &adapter->tx_rings[queue]; if (ifp->if_drv_flags & IFF_DRV_RUNNING) { - if (IXGBE_TX_TRYLOCK(txr) == 0) - return; + IXGBE_TX_LOCK(txr); ixgbe_start_locked(txr, ifp); IXGBE_TX_UNLOCK(txr); } return; } +#if __FreeBSD_version >= 800000 +/* +** Multiqueue Transmit driver +** +*/ +static int +ixgbe_mq_start(struct ifnet *ifp, struct mbuf *m) +{ + struct adapter *adapter = ifp->if_softc; + struct tx_ring *txr; + int i = 0, err = 0; + + /* Which queue to use */ + if ((m->m_flags & M_FLOWID) != 0) + i = m->m_pkthdr.flowid % adapter->num_queues; + txr = &adapter->tx_rings[i]; + + if (IXGBE_TX_TRYLOCK(txr)) { + err = ixgbe_mq_start_locked(ifp, txr, m); + IXGBE_TX_UNLOCK(txr); + } else + err = drbr_enqueue(ifp, txr->br, m); + + return (err); +} + +static int +ixgbe_mq_start_locked(struct ifnet *ifp, struct tx_ring *txr, struct mbuf *m) +{ + struct adapter *adapter = txr->adapter; + struct mbuf *next; + int err = 0; + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + err = drbr_enqueue(ifp, txr->br, m); + return (err); + } + + if (m == NULL) /* Called by tasklet */ + goto process; + + /* If nothing queued go right to xmit */ + if (drbr_empty(ifp, txr->br)) { + if (ixgbe_xmit(txr, &m)) { + if (m && (err = drbr_enqueue(ifp, txr->br, m)) != 0) + return (err); + } else { + /* Success, update stats */ + drbr_stats_update(ifp, m->m_pkthdr.len, m->m_flags); + /* Send a copy of the frame to the BPF listener */ + ETHER_BPF_MTAP(ifp, m); + /* Set the watchdog */ + txr->watchdog_timer = IXGBE_TX_TIMEOUT; + } + + } else if ((err = drbr_enqueue(ifp, txr->br, m)) != 0) + return (err); + +process: + if (drbr_empty(ifp, txr->br)) + return (err); + + /* Process the queue */ + while (TRUE) { + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + break; + next = drbr_dequeue(ifp, txr->br); + if (next == NULL) + break; + if (ixgbe_xmit(txr, &next)) + break; + ETHER_BPF_MTAP(ifp, next); + /* Set the watchdog */ + txr->watchdog_timer = IXGBE_TX_TIMEOUT; + } + + if (txr->tx_avail <= IXGBE_TX_OP_THRESHOLD) + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + + return (err); +} + +/* +** Flush all ring buffers +*/ +static void +ixgbe_qflush(struct ifnet *ifp) +{ + struct adapter *adapter = ifp->if_softc; + struct tx_ring *txr = adapter->tx_rings; + struct mbuf *m; + + for (int i = 0; i < adapter->num_queues; i++, txr++) { + IXGBE_TX_LOCK(txr); + while ((m = buf_ring_dequeue_sc(txr->br)) != NULL) + m_freem(m); + IXGBE_TX_UNLOCK(txr); + } + if_qflush(ifp); +} +#endif /* __FreeBSD_version >= 800000 */ + /********************************************************************* * Ioctl entry point * @@ -769,13 +832,16 @@ ixgbe_start(struct ifnet *ifp) static int ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data) { - int error = 0; + struct adapter *adapter = ifp->if_softc; struct ifreq *ifr = (struct ifreq *) data; +#ifdef INET struct ifaddr *ifa = (struct ifaddr *) data; - struct adapter *adapter = ifp->if_softc; +#endif + int error = 0; switch (command) { case SIOCSIFADDR: +#ifdef INET IOCTL_DEBUGOUT("ioctl: SIOCxIFADDR (Get/Set Interface Addr)"); if (ifa->ifa_addr->sa_family == AF_INET) { ifp->if_flags |= IFF_UP; @@ -786,6 +852,7 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c } arp_ifinit(ifp, ifa); } else +#endif ether_ioctl(ifp, command, data); break; case SIOCSIFMTU: @@ -843,75 +910,24 @@ ixgbe_ioctl(struct ifnet * ifp, u_long c ifp->if_capenable ^= IFCAP_HWCSUM; if (mask & IFCAP_TSO4) ifp->if_capenable ^= IFCAP_TSO4; + if (mask & IFCAP_LRO) + ifp->if_capenable ^= IFCAP_LRO; if (mask & IFCAP_VLAN_HWTAGGING) ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; if (ifp->if_drv_flags & IFF_DRV_RUNNING) ixgbe_init(adapter); -#if __FreeBSD_version >= 700000 VLAN_CAPABILITIES(ifp); -#endif break; } -#ifdef IXGBE_TIMESYNC + +#ifdef IXGBE_IEEE1588 /* ** IOCTL support for Precision Time (IEEE 1588) Support */ - case IXGBE_TIMESYNC_READTS: - { - u32 rx_ctl, tx_ctl; - struct ixgbe_tsync_read *tdata; - - tdata = (struct ixgbe_tsync_read *) ifr->ifr_data; - - if (tdata->read_current_time) { - getnanotime(&tdata->system_time); - tdata->network_time = IXGBE_READ_REG(&adapter->hw, - IXGBE_SYSTIML); - tdata->network_time |= - (u64)IXGBE_READ_REG(&adapter->hw, - IXGBE_SYSTIMH ) << 32; - } - - rx_ctl = IXGBE_READ_REG(&adapter->hw, IXGBE_TSYNCRXCTL); - tx_ctl = IXGBE_READ_REG(&adapter->hw, IXGBE_TSYNCTXCTL); - - if (rx_ctl & 0x1) { - u32 tmp; - unsigned char *tmp_cp; - - tdata->rx_valid = 1; - tdata->rx_stamp = IXGBE_READ_REG(&adapter->hw, - IXGBE_RXSTMPL); - tdata->rx_stamp |= (u64)IXGBE_READ_REG(&adapter->hw, - IXGBE_RXSTMPH) << 32; - - tmp = IXGBE_READ_REG(&adapter->hw, IXGBE_RXSATRL); - tmp_cp = (unsigned char *) &tmp; - tdata->srcid[0] = tmp_cp[0]; - tdata->srcid[1] = tmp_cp[1]; - tdata->srcid[2] = tmp_cp[2]; - tdata->srcid[3] = tmp_cp[3]; - tmp = IXGBE_READ_REG(&adapter->hw, IXGBE_RXSATRH); - tmp_cp = (unsigned char *) &tmp; - tdata->srcid[4] = tmp_cp[0]; - tdata->srcid[5] = tmp_cp[1]; - tdata->seqid = tmp >> 16; - tdata->seqid = htons(tdata->seqid); - } else - tdata->rx_valid = 0; - - if (tx_ctl & 0x1) { - tdata->tx_valid = 1; - tdata->tx_stamp = IXGBE_READ_REG(&adapter->hw, - IXGBE_TXSTMPL); - tdata->tx_stamp |= (u64) IXGBE_READ_REG(&adapter->hw, - IXGBE_TXSTMPH) << 32; - } else - tdata->tx_valid = 0; - - return (0); - } -#endif /* IXGBE_TIMESYNC */ + case SIOCSHWTSTAMP: + error = ixgbe_hwtstamp_ioctl(adapter, ifp); + break; +#endif default: IOCTL_DEBUGOUT1("ioctl: UNKNOWN (0x%X)\n", (int)command); @@ -947,7 +963,7 @@ ixgbe_watchdog(struct adapter *adapter) * Finally, anytime all descriptors are clean the timer is * set to 0. */ - for (int i = 0; i < adapter->num_tx_queues; i++, txr++) { + for (int i = 0; i < adapter->num_queues; i++, txr++) { u32 head, tail; IXGBE_TX_LOCK(txr); @@ -976,7 +992,7 @@ ixgbe_watchdog(struct adapter *adapter) */ if (IXGBE_READ_REG(hw, IXGBE_TFCS) & IXGBE_TFCS_TXOFF) { txr = adapter->tx_rings; /* reset pointer */ - for (int i = 0; i < adapter->num_tx_queues; i++, txr++) { + for (int i = 0; i < adapter->num_queues; i++, txr++) { IXGBE_TX_LOCK(txr); txr->watchdog_timer = IXGBE_TX_TIMEOUT; IXGBE_TX_UNLOCK(txr); @@ -986,7 +1002,7 @@ ixgbe_watchdog(struct adapter *adapter) device_printf(adapter->dev, "Watchdog timeout -- resetting\n"); - for (int i = 0; i < adapter->num_tx_queues; i++, txr++) { + for (int i = 0; i < adapter->num_queues; i++, txr++) { device_printf(dev,"Queue(%d) tdh = %d, hw tdt = %d\n", i, IXGBE_READ_REG(hw, IXGBE_TDH(i)), IXGBE_READ_REG(hw, IXGBE_TDT(i))); @@ -1041,16 +1057,6 @@ ixgbe_init_locked(struct adapter *adapte return; } -#ifndef IXGBE_HW_VLAN_SUPPORT - if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) { - u32 ctrl; - - ctrl = IXGBE_READ_REG(&adapter->hw, IXGBE_VLNCTRL); - ctrl |= IXGBE_VLNCTRL_VME; - ctrl &= ~IXGBE_VLNCTRL_CFIEN; - IXGBE_WRITE_REG(&adapter->hw, IXGBE_VLNCTRL, ctrl); - } -#endif /* Prepare transmit descriptors and buffers */ if (ixgbe_setup_transmit_structures(adapter)) { device_printf(dev,"Could not setup transmit structures\n"); @@ -1096,7 +1102,7 @@ ixgbe_init_locked(struct adapter *adapte if (hw->device_id == IXGBE_DEV_ID_82598AT) gpie |= IXGBE_SDP1_GPIEN; - if (adapter->msix > 2) { + if (adapter->msix > 1) { /* Enable Enhanced MSIX mode */ gpie |= IXGBE_GPIE_MSIX_MODE; gpie |= IXGBE_GPIE_EIAME | IXGBE_GPIE_PBA_SUPPORT | @@ -1108,7 +1114,7 @@ ixgbe_init_locked(struct adapter *adapte ifp->if_hwassist = 0; if (ifp->if_capenable & IFCAP_TSO4) ifp->if_hwassist |= CSUM_TSO; - else if (ifp->if_capenable & IFCAP_TXCSUM) + if (ifp->if_capenable & IFCAP_TXCSUM) ifp->if_hwassist = (CSUM_TCP | CSUM_UDP); /* Set MTU size */ @@ -1121,7 +1127,7 @@ ixgbe_init_locked(struct adapter *adapte /* Now enable all the queues */ - for (int i = 0; i < adapter->num_tx_queues; i++) { + for (int i = 0; i < adapter->num_queues; i++) { txdctl = IXGBE_READ_REG(&adapter->hw, IXGBE_TXDCTL(i)); txdctl |= IXGBE_TXDCTL_ENABLE; /* Set WTHRESH to 8, burst writeback */ @@ -1129,7 +1135,7 @@ ixgbe_init_locked(struct adapter *adapte IXGBE_WRITE_REG(&adapter->hw, IXGBE_TXDCTL(i), txdctl); } - for (int i = 0; i < adapter->num_rx_queues; i++) { + for (int i = 0; i < adapter->num_queues; i++) { rxdctl = IXGBE_READ_REG(&adapter->hw, IXGBE_RXDCTL(i)); /* PTHRESH set to 32 */ rxdctl |= 0x0020; @@ -1146,6 +1152,9 @@ ixgbe_init_locked(struct adapter *adapte IXGBE_WRITE_REG(hw, IXGBE_RDT(i), adapter->num_rx_desc - 1); } + /* Set up VLAN offloads and filter */ + ixgbe_setup_vlan_hw_support(adapter); + /* Enable Receive engine */ rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL); if (adapter->hw.mac.type == ixgbe_mac_82598EB) @@ -1185,13 +1194,6 @@ ixgbe_init_locked(struct adapter *adapte } else taskqueue_enqueue(adapter->tq, &adapter->link_task); - -#ifdef IXGBE_TIMESYNC - /* Initialize IEEE 1588 support */ - if (adapter->hw.mac.type == ixgbe_mac_82599EB) - ixgbe_tsync_init(adapter); -#endif - /* Now inform the stack we're ready */ ifp->if_drv_flags |= IFF_DRV_RUNNING; ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; @@ -1212,9 +1214,67 @@ ixgbe_init(void *arg) /* -** MSIX Interrupt Tasklets +** +** MSIX Interrupt Handlers and Tasklets +** */ +static inline void +ixgbe_enable_queue(struct adapter *adapter, u32 vector) +{ + struct ixgbe_hw *hw = &adapter->hw; + u64 queue = (u64)(1 << vector); + u32 mask; + + if (hw->mac.type == ixgbe_mac_82598EB) { + mask = (IXGBE_EIMS_RTX_QUEUE & queue); + IXGBE_WRITE_REG(hw, IXGBE_EIMS, mask); + } else { + mask = (queue & 0xFFFFFFFF); + if (mask) + IXGBE_WRITE_REG(hw, IXGBE_EIMS_EX(0), mask); + mask = (queue >> 32); + if (mask) + IXGBE_WRITE_REG(hw, IXGBE_EIMS_EX(1), mask); + } +} + +static inline void +ixgbe_disable_queue(struct adapter *adapter, u32 vector) +{ + struct ixgbe_hw *hw = &adapter->hw; + u64 queue = (u64)(1 << vector); + u32 mask; + + if (hw->mac.type == ixgbe_mac_82598EB) { + mask = (IXGBE_EIMS_RTX_QUEUE & queue); + IXGBE_WRITE_REG(hw, IXGBE_EIMC, mask); + } else { + mask = (queue & 0xFFFFFFFF); + if (mask) + IXGBE_WRITE_REG(hw, IXGBE_EIMC_EX(0), mask); + mask = (queue >> 32); + if (mask) + IXGBE_WRITE_REG(hw, IXGBE_EIMC_EX(1), mask); + } +} + +static inline void +ixgbe_rearm_rx_queues(struct adapter *adapter, u64 queues) +{ + u32 mask; + + if (adapter->hw.mac.type == ixgbe_mac_82598EB) { + mask = (IXGBE_EIMS_RTX_QUEUE & queues); + IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, mask); + } else { + mask = (queues & 0xFFFFFFFF); + IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS_EX(0), mask); + mask = (queues >> 32); + IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS_EX(1), mask); + } +} + static void ixgbe_handle_rx(void *context, int pending) { @@ -1227,7 +1287,7 @@ ixgbe_handle_rx(void *context, int pendi more = ixgbe_rxeof(rxr, -1); } while (loop-- && more); /* Reenable this interrupt */ - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, rxr->eims); + ixgbe_enable_queue(adapter, rxr->msix); } static void @@ -1244,13 +1304,19 @@ ixgbe_handle_tx(void *context, int pendi more = ixgbe_txeof(txr); } while (loop-- && more); - if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - ixgbe_start_locked(txr, ifp); + if (ifp->if_drv_flags & IFF_DRV_RUNNING) { +#if __FreeBSD_version >= 800000 + if (!drbr_empty(ifp, txr->br)) + ixgbe_mq_start_locked(ifp, txr, NULL); +#else + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + ixgbe_start_locked(txr, ifp); +#endif + } IXGBE_TX_UNLOCK(txr); - /* Reenable this interrupt */ - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, txr->eims); + ixgbe_enable_queue(adapter, txr->msix); } @@ -1315,7 +1381,6 @@ ixgbe_legacy_irq(void *arg) } -#if __FreeBSD_version >= 602105 /********************************************************************* * * MSI TX Interrupt Service routine @@ -1328,7 +1393,7 @@ ixgbe_msix_tx(void *arg) struct adapter *adapter = txr->adapter; bool more; - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, txr->eims); + ixgbe_disable_queue(adapter, txr->msix); IXGBE_TX_LOCK(txr); ++txr->tx_irq; @@ -1337,7 +1402,7 @@ ixgbe_msix_tx(void *arg) if (more) taskqueue_enqueue(txr->tq, &txr->tx_task); else /* Reenable this interrupt */ - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, txr->eims); + ixgbe_enable_queue(adapter, txr->msix); return; } @@ -1354,7 +1419,7 @@ ixgbe_msix_rx(void *arg) struct adapter *adapter = rxr->adapter; bool more; - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, rxr->eims); + ixgbe_disable_queue(adapter, rxr->msix); ++rxr->rx_irq; more = ixgbe_rxeof(rxr, adapter->rx_process_limit); @@ -1366,7 +1431,7 @@ ixgbe_msix_rx(void *arg) if (more) taskqueue_enqueue(rxr->tq, &rxr->rx_task); else - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, rxr->eims); + ixgbe_enable_queue(adapter, rxr->msix); return; } @@ -1381,9 +1446,8 @@ ixgbe_msix_link(void *arg) ++adapter->link_irq; /* First get the cause */ - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, IXGBE_EIMS_OTHER); reg_eicr = IXGBE_READ_REG(hw, IXGBE_EICS); - /* Clear with write */ + /* Clear interrupt with write */ IXGBE_WRITE_REG(hw, IXGBE_EICR, reg_eicr); /* Link status change */ @@ -1418,7 +1482,6 @@ ixgbe_msix_link(void *arg) IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMS, IXGBE_EIMS_OTHER); return; } -#endif /* FreeBSD_version >= 602105 */ /* ** Routine to do adjust the RX EITR value based on traffic, @@ -1482,14 +1545,14 @@ ixgbe_init_moderation(struct adapter *ad } /* TX irq moderation rate is fixed */ - for (int i = 0; i < adapter->num_tx_queues; i++, txr++) { + for (int i = 0; i < adapter->num_queues; i++, txr++) { IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(txr->msix), ixgbe_ave_latency); txr->watchdog_timer = FALSE; } /* RX moderation will be adapted over time, set default */ - for (int i = 0; i < adapter->num_rx_queues; i++, rxr++) { + for (int i = 0; i < adapter->num_queues; i++, rxr++) { IXGBE_WRITE_REG(&adapter->hw, IXGBE_EITR(rxr->msix), ixgbe_low_latency); } @@ -1590,7 +1653,7 @@ ixgbe_xmit(struct tx_ring *txr, struct m u32 olinfo_status = 0, cmd_type_len; u32 paylen = 0; int i, j, error, nsegs; - int first, last = 0, offload = 0; + int first, last = 0; struct mbuf *m_head; bus_dma_segment_t segs[ixgbe_num_segs]; bus_dmamap_t map; @@ -1606,6 +1669,14 @@ ixgbe_xmit(struct tx_ring *txr, struct m if (m_head->m_flags & M_VLANTAG) cmd_type_len |= IXGBE_ADVTXD_DCMD_VLE; + /* Do a clean if descriptors are low */ + if (txr->tx_avail <= IXGBE_TX_CLEANUP_THRESHOLD) { + ixgbe_txeof(txr); + /* Now do we at least have a minimal? */ + if (txr->tx_avail <= IXGBE_TX_OP_THRESHOLD) + return (ENOBUFS); + } + /* * Important to capture the first descriptor * used because it will contain the index of @@ -1679,14 +1750,15 @@ ixgbe_xmit(struct tx_ring *txr, struct m ++adapter->tso_tx; } else return (ENXIO); - } else /* Offloads other than TSO */ - offload = ixgbe_tx_ctx_setup(txr, m_head); - if (offload == TRUE) + } else if (ixgbe_tx_ctx_setup(txr, m_head)) olinfo_status |= IXGBE_TXD_POPTS_TXSM << 8; -#ifdef IXGBE_TIMESYNC - if (offload == IXGBE_TIMESTAMP) - cmd_type_len |= IXGBE_ADVTXD_TSTAMP; + +#ifdef IXGBE_IEEE1588 + /* This is changing soon to an mtag detection */ + if (we detect this mbuf has a TSTAMP mtag) + cmd_type_len |= IXGBE_ADVTXD_MAC_TSTAMP; #endif + /* Record payload length */ if (paylen == 0) olinfo_status |= m_head->m_pkthdr.len << @@ -1881,7 +1953,7 @@ ixgbe_local_timer(void *arg) out: /* Trigger an RX interrupt on all queues */ - IXGBE_WRITE_REG(&adapter->hw, IXGBE_EICS, adapter->rx_mask); + ixgbe_rearm_rx_queues(adapter, adapter->rx_mask); callout_reset(&adapter->timer, hz, ixgbe_local_timer, adapter); } @@ -1914,7 +1986,7 @@ ixgbe_update_link_status(struct adapter device_printf(dev,"Link is Down\n"); if_link_state_change(ifp, LINK_STATE_DOWN); adapter->link_active = FALSE; - for (int i = 0; i < adapter->num_tx_queues; + for (int i = 0; i < adapter->num_queues; i++, txr++) txr->watchdog_timer = FALSE; } @@ -1946,11 +2018,6 @@ ixgbe_stop(void *arg) /* Tell the stack that the interface is no longer active */ ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); -#ifdef IXGBE_TIMESYNC - /* Disable IEEE 1588 support */ - if (adapter->hw.mac.type == ixgbe_mac_82599EB) - ixgbe_tsync_disable(adapter); -#endif ixgbe_reset_hw(&adapter->hw); adapter->hw.adapter_stopped = FALSE; ixgbe_stop_adapter(&adapter->hw); @@ -1996,16 +2063,16 @@ ixgbe_allocate_legacy(struct adapter *ad device_t dev = adapter->dev; struct tx_ring *txr = adapter->tx_rings; struct rx_ring *rxr = adapter->rx_rings; - int error; + int error, rid = 0; - /* Legacy RID at 0 */ - if (adapter->msix == 0) - adapter->rid[0] = 0; + /* MSI RID at 1 */ + if (adapter->msix == 1) + rid = 1; /* We allocate a single interrupt resource */ - adapter->res[0] = bus_alloc_resource_any(dev, - SYS_RES_IRQ, &adapter->rid[0], RF_SHAREABLE | RF_ACTIVE); - if (adapter->res[0] == NULL) { + adapter->res = bus_alloc_resource_any(dev, + SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); + if (adapter->res == NULL) { device_printf(dev, "Unable to allocate bus resource: " "interrupt\n"); return (ENXIO); @@ -2026,13 +2093,18 @@ ixgbe_allocate_legacy(struct adapter *ad taskqueue_start_threads(&rxr->tq, 1, PI_NET, "%s rxq", device_get_nameunit(adapter->dev)); - if ((error = bus_setup_intr(dev, adapter->res[0], -#if __FreeBSD_version >= 700000 + /* Tasklets for Link, SFP and Multispeed Fiber */ + TASK_INIT(&adapter->link_task, 0, ixgbe_handle_link, adapter); + TASK_INIT(&adapter->mod_task, 0, ixgbe_handle_mod, adapter); + TASK_INIT(&adapter->msf_task, 0, ixgbe_handle_msf, adapter); + adapter->tq = taskqueue_create_fast("ixgbe_link", M_NOWAIT, + taskqueue_thread_enqueue, &adapter->tq); + taskqueue_start_threads(&adapter->tq, 1, PI_NET, "%s linkq", + device_get_nameunit(adapter->dev)); + + if ((error = bus_setup_intr(dev, adapter->res, INTR_TYPE_NET | INTR_MPSAFE, NULL, ixgbe_legacy_irq, -#else - INTR_TYPE_NET | INTR_MPSAFE, ixgbe_legacy_irq, -#endif - adapter, &adapter->tag[0])) != 0) { + adapter, &adapter->tag)) != 0) { device_printf(dev, "Failed to register fast interrupt " "handler: %d\n", error); taskqueue_free(txr->tq); @@ -2046,7 +2118,6 @@ ixgbe_allocate_legacy(struct adapter *ad } -#if __FreeBSD_version >= 602105 /********************************************************************* * * Setup MSIX Interrupt resources and handlers @@ -2058,33 +2129,36 @@ ixgbe_allocate_msix(struct adapter *adap device_t dev = adapter->dev; struct tx_ring *txr = adapter->tx_rings; struct rx_ring *rxr = adapter->rx_rings; - int error, vector = 0; + int error, rid, vector = 0; /* TX setup: the code is here for multi tx, there are other parts of the driver not ready for it */ - for (int i = 0; i < adapter->num_tx_queues; i++, vector++, txr++) { - adapter->res[vector] = bus_alloc_resource_any(dev, - SYS_RES_IRQ, &adapter->rid[vector], + for (int i = 0; i < adapter->num_queues; i++, vector++, txr++) { + rid = vector + 1; + txr->res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); - if (!adapter->res[vector]) { + if (!txr->res) { device_printf(dev,"Unable to allocate" " bus resource: tx interrupt [%d]\n", vector); return (ENXIO); } /* Set the handler function */ - error = bus_setup_intr(dev, adapter->res[vector], - INTR_TYPE_NET | INTR_MPSAFE, -#if __FreeBSD_version > 700000 - NULL, -#endif - ixgbe_msix_tx, txr, &adapter->tag[vector]); + error = bus_setup_intr(dev, txr->res, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 18:30:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6A81C10656D6; Wed, 24 Jun 2009 18:30:15 +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 3CB1C8FC1F; Wed, 24 Jun 2009 18:30:15 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OIUFSK024168; Wed, 24 Jun 2009 18:30:15 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OIUFLK024166; Wed, 24 Jun 2009 18:30:15 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200906241830.n5OIUFLK024166@svn.freebsd.org> From: Rick Macklem Date: Wed, 24 Jun 2009 18:30: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: r194878 - head/sys/rpc/rpcsec_gss X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 18:30:16 -0000 Author: rmacklem Date: Wed Jun 24 18:30:14 2009 New Revision: 194878 URL: http://svn.freebsd.org/changeset/base/194878 Log: If the initial attempt to refresh credentials in the RPCSEC_GSS client side fails, the entry in the cache is left with no valid context (gd_ctx == GSS_C_NO_CONTEXT). As such, subsequent hits on the cache will result in persistent authentication failure, even after the user has done a kinit or similar and acquired a new valid TGT. This patch adds a test for that case upon a cache hit and calls rpc_gss_init() to make another attempt at getting valid credentials. It also moves the setting of gc_proc to before the import of the principal name to ensure that, if that case fails, it will be detected as a failure after going to "out:". Reviewed by: dfr Approved by: kib (mentor) Modified: head/sys/rpc/rpcsec_gss/rpcsec_gss.c Modified: head/sys/rpc/rpcsec_gss/rpcsec_gss.c ============================================================================== --- head/sys/rpc/rpcsec_gss/rpcsec_gss.c Wed Jun 24 18:29:32 2009 (r194877) +++ head/sys/rpc/rpcsec_gss/rpcsec_gss.c Wed Jun 24 18:30:14 2009 (r194878) @@ -193,6 +193,7 @@ rpc_gss_secfind(CLIENT *clnt, struct ucr uint32_t h, th; AUTH *auth; struct rpc_gss_data *gd, *tgd; + rpc_gss_options_ret_t options; if (rpc_gss_count > RPC_GSS_MAX) { while (rpc_gss_count > RPC_GSS_MAX) { @@ -231,6 +232,17 @@ again: } else { sx_sunlock(&rpc_gss_lock); } + + /* + * If the state != ESTABLISHED, try and initialize + * the authenticator again. This will happen if the + * user's credentials have expired. It may succeed now, + * if they have done a kinit or similar. + */ + if (gd->gd_state != RPCSEC_GSS_ESTABLISHED) { + memset(&options, 0, sizeof (options)); + (void) rpc_gss_init(gd->gd_auth, &options); + } return (gd->gd_auth); } } @@ -730,6 +742,9 @@ rpc_gss_init(AUTH *auth, rpc_gss_options gd->gd_state = RPCSEC_GSS_CONTEXT; mtx_unlock(&gd->gd_lock); + gd->gd_cred.gc_proc = RPCSEC_GSS_INIT; + gd->gd_cred.gc_seq = 0; + principal_desc.value = (void *)gd->gd_principal; principal_desc.length = strlen(gd->gd_principal); maj_stat = gss_import_name(&min_stat, &principal_desc, @@ -741,9 +756,6 @@ rpc_gss_init(AUTH *auth, rpc_gss_options } /* GSS context establishment loop. */ - gd->gd_cred.gc_proc = RPCSEC_GSS_INIT; - gd->gd_cred.gc_seq = 0; - memset(&recv_token, 0, sizeof(recv_token)); memset(&gr, 0, sizeof(gr)); memset(options_ret, 0, sizeof(*options_ret)); From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 18:38:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C77A5106568B; Wed, 24 Jun 2009 18:38:51 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B619C8FC1F; Wed, 24 Jun 2009 18:38:51 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OIcpsi024448; Wed, 24 Jun 2009 18:38:51 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OIcp1U024446; Wed, 24 Jun 2009 18:38:51 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200906241838.n5OIcp1U024446@svn.freebsd.org> From: Ulf Lilleengen Date: Wed, 24 Jun 2009 18:38: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: r194879 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 18:38:52 -0000 Author: lulf Date: Wed Jun 24 18:38:51 2009 New Revision: 194879 URL: http://svn.freebsd.org/changeset/base/194879 Log: - Fix a bug where a FIFO vnode use count was increased twice, but only decreased once. MFC after: 1 week Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Wed Jun 24 18:30:14 2009 (r194878) +++ head/sys/kern/kern_descrip.c Wed Jun 24 18:38:51 2009 (r194879) @@ -2741,7 +2741,6 @@ sysctl_kern_proc_ofiledesc(SYSCTL_HANDLE case DTYPE_FIFO: kif->kf_type = KF_TYPE_FIFO; vp = fp->f_vnode; - vref(vp); break; case DTYPE_KQUEUE: From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 18:42:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 886B1106564A; Wed, 24 Jun 2009 18:42:21 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 72BEB8FC0A; Wed, 24 Jun 2009 18:42:21 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OIgLjZ024582; Wed, 24 Jun 2009 18:42:21 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OIgL43024569; Wed, 24 Jun 2009 18:42:21 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200906241842.n5OIgL43024569@svn.freebsd.org> From: Doug Rabson Date: Wed, 24 Jun 2009 18:42: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: r194880 - in head: sbin/mount_nfs sbin/umount usr.bin/fstat usr.bin/nfsstat usr.bin/showmount usr.sbin/amd/include usr.sbin/mountd usr.sbin/nfsd usr.sbin/rpc.lockd usr.sbin/rpc.umntall X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 18:42:21 -0000 Author: dfr Date: Wed Jun 24 18:42:21 2009 New Revision: 194880 URL: http://svn.freebsd.org/changeset/base/194880 Log: Don't use sys/nfs/rpcv2.h - it is part of the old kernel RPC implementation and will be removed. Modified: head/sbin/mount_nfs/mount_nfs.c head/sbin/umount/umount.c head/usr.bin/fstat/fstat.c head/usr.bin/nfsstat/nfsstat.c head/usr.bin/showmount/showmount.c head/usr.sbin/amd/include/config.h head/usr.sbin/mountd/mountd.c head/usr.sbin/nfsd/nfsd.c head/usr.sbin/rpc.lockd/kern.c head/usr.sbin/rpc.umntall/mounttab.c head/usr.sbin/rpc.umntall/mounttab.h head/usr.sbin/rpc.umntall/rpc.umntall.c Modified: head/sbin/mount_nfs/mount_nfs.c ============================================================================== --- head/sbin/mount_nfs/mount_nfs.c Wed Jun 24 18:38:51 2009 (r194879) +++ head/sbin/mount_nfs/mount_nfs.c Wed Jun 24 18:42:21 2009 (r194880) @@ -56,9 +56,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include -#include -#include #include #include @@ -96,7 +96,7 @@ struct nfhret { long vers; long auth; long fhsize; - u_char nfh[NFSX_V3FHMAX]; + u_char nfh[NFS3_FHSIZE]; }; #define BGRND 1 #define ISBGRND 2 @@ -914,7 +914,7 @@ tryagain: nfs_nb.buf = &nfs_ss; nfs_nb.len = nfs_nb.maxlen = sizeof nfs_ss; - if (!rpcb_getaddr(RPCPROG_NFS, nfsvers, nconf, &nfs_nb, + if (!rpcb_getaddr(NFS_PROGRAM, nfsvers, nconf, &nfs_nb, hostp)) { if (rpc_createerr.cf_stat == RPC_PROGVERSMISMATCH && trymntmode == ANY) { @@ -930,7 +930,7 @@ tryagain: } /* Check that the server (nfsd) responds on the port we have chosen. */ - clp = clnt_tli_create(RPC_ANYFD, nconf, &nfs_nb, RPCPROG_NFS, nfsvers, + clp = clnt_tli_create(RPC_ANYFD, nconf, &nfs_nb, NFS_PROGRAM, nfsvers, 0, 0); if (clp == NULL) { snprintf(errbuf, sizeof errbuf, "[%s] %s:%s: %s", netid, @@ -996,10 +996,10 @@ tryagain: return (TRYRET_SUCCESS); } - /* Send the RPCMNT_MOUNT RPC to get the root filehandle. */ + /* Send the MOUNTPROC_MNT RPC to get the root filehandle. */ try.tv_sec = 10; try.tv_usec = 0; - clp = clnt_tp_create(hostp, RPCPROG_MNT, mntvers, nconf_mnt); + clp = clnt_tp_create(hostp, MOUNTPROG, mntvers, nconf_mnt); if (clp == NULL) { snprintf(errbuf, sizeof errbuf, "[%s] %s:%s: %s", netid_mnt, hostp, spec, clnt_spcreateerror("RPCMNT: clnt_create")); @@ -1009,7 +1009,7 @@ tryagain: clp->cl_auth = authsys_create_default(); nfhret.auth = secflavor; nfhret.vers = mntvers; - stat = clnt_call(clp, RPCMNT_MOUNT, (xdrproc_t)xdr_dir, spec, + stat = clnt_call(clp, MOUNTPROC_MNT, (xdrproc_t)xdr_dir, spec, (xdrproc_t)xdr_fh, &nfhret, try); auth_destroy(clp->cl_auth); @@ -1147,7 +1147,7 @@ getnetconf_cached(const char *netid) int xdr_dir(XDR *xdrsp, char *dirp) { - return (xdr_string(xdrsp, &dirp, RPCMNT_PATHLEN)); + return (xdr_string(xdrsp, &dirp, MNTPATHLEN)); } int @@ -1162,12 +1162,12 @@ xdr_fh(XDR *xdrsp, struct nfhret *np) return (1); switch (np->vers) { case 1: - np->fhsize = NFSX_V2FH; - return (xdr_opaque(xdrsp, (caddr_t)np->nfh, NFSX_V2FH)); + np->fhsize = NFS_FHSIZE; + return (xdr_opaque(xdrsp, (caddr_t)np->nfh, NFS_FHSIZE)); case 3: if (!xdr_long(xdrsp, &np->fhsize)) return (0); - if (np->fhsize <= 0 || np->fhsize > NFSX_V3FHMAX) + if (np->fhsize <= 0 || np->fhsize > NFS3_FHSIZE) return (0); if (!xdr_opaque(xdrsp, (caddr_t)np->nfh, np->fhsize)) return (0); Modified: head/sbin/umount/umount.c ============================================================================== --- head/sbin/umount/umount.c Wed Jun 24 18:38:51 2009 (r194879) +++ head/sbin/umount/umount.c Wed Jun 24 18:42:21 2009 (r194880) @@ -48,7 +48,7 @@ static const char rcsid[] = #include #include -#include +#include #include #include @@ -379,16 +379,16 @@ umountfs(struct statfs *sfs) * has been unmounted. */ if (ai != NULL && !(fflag & MNT_FORCE) && do_rpc) { - clp = clnt_create(hostp, RPCPROG_MNT, RPCMNT_VER1, "udp"); + clp = clnt_create(hostp, MOUNTPROG, MOUNTVERS, "udp"); if (clp == NULL) { warnx("%s: %s", hostp, - clnt_spcreateerror("RPCPROG_MNT")); + clnt_spcreateerror("MOUNTPROG")); return (1); } clp->cl_auth = authsys_create_default(); try.tv_sec = 20; try.tv_usec = 0; - clnt_stat = clnt_call(clp, RPCMNT_UMOUNT, (xdrproc_t)xdr_dir, + clnt_stat = clnt_call(clp, MOUNTPROC_UMNT, (xdrproc_t)xdr_dir, nfsdirname, (xdrproc_t)xdr_void, (caddr_t)0, try); if (clnt_stat != RPC_SUCCESS) { warnx("%s: %s", hostp, @@ -583,7 +583,7 @@ int xdr_dir(XDR *xdrsp, char *dirp) { - return (xdr_string(xdrsp, &dirp, RPCMNT_PATHLEN)); + return (xdr_string(xdrsp, &dirp, MNTPATHLEN)); } void Modified: head/usr.bin/fstat/fstat.c ============================================================================== --- head/usr.bin/fstat/fstat.c Wed Jun 24 18:38:51 2009 (r194879) +++ head/usr.bin/fstat/fstat.c Wed Jun 24 18:42:21 2009 (r194880) @@ -73,7 +73,6 @@ __FBSDID("$FreeBSD$"); #include #undef _KERNEL #include -#include #include #include Modified: head/usr.bin/nfsstat/nfsstat.c ============================================================================== --- head/usr.bin/nfsstat/nfsstat.c Wed Jun 24 18:38:51 2009 (r194879) +++ head/usr.bin/nfsstat/nfsstat.c Wed Jun 24 18:42:21 2009 (r194880) @@ -53,7 +53,6 @@ static const char rcsid[] = #include #include #include -#include #include #include #include Modified: head/usr.bin/showmount/showmount.c ============================================================================== --- head/usr.bin/showmount/showmount.c Wed Jun 24 18:38:51 2009 (r194879) +++ head/usr.bin/showmount/showmount.c Wed Jun 24 18:42:21 2009 (r194880) @@ -59,7 +59,7 @@ static const char rcsid[] = #include #include #include -#include +#include #include #include @@ -76,29 +76,29 @@ static const char rcsid[] = struct mountlist { struct mountlist *ml_left; struct mountlist *ml_right; - char ml_host[RPCMNT_NAMELEN+1]; - char ml_dirp[RPCMNT_PATHLEN+1]; + char ml_host[MNTNAMLEN+1]; + char ml_dirp[MNTPATHLEN+1]; }; struct grouplist { struct grouplist *gr_next; - char gr_name[RPCMNT_NAMELEN+1]; + char gr_name[MNTNAMLEN+1]; }; struct exportslist { struct exportslist *ex_next; struct grouplist *ex_groups; - char ex_dirp[RPCMNT_PATHLEN+1]; + char ex_dirp[MNTPATHLEN+1]; }; static struct mountlist *mntdump; -static struct exportslist *exports; +static struct exportslist *exportslist; static int type = 0; void print_dump(struct mountlist *); static void usage(void); int xdr_mntdump(XDR *, struct mountlist **); -int xdr_exports(XDR *, struct exportslist **); +int xdr_exportslist(XDR *, struct exportslist **); int tcp_callrpc(const char *host, int prognum, int versnum, int procnum, xdrproc_t inproc, char *in, xdrproc_t outproc, char *out); @@ -158,16 +158,16 @@ main(argc, argv) rpcs = DODUMP; if (rpcs & DODUMP) - if ((estat = tcp_callrpc(host, RPCPROG_MNT, mntvers, - RPCMNT_DUMP, (xdrproc_t)xdr_void, (char *)0, + if ((estat = tcp_callrpc(host, MOUNTPROG, mntvers, + MOUNTPROC_DUMP, (xdrproc_t)xdr_void, (char *)0, (xdrproc_t)xdr_mntdump, (char *)&mntdump)) != 0) { clnt_perrno(estat); errx(1, "can't do mountdump rpc"); } if (rpcs & DOEXPORTS) - if ((estat = tcp_callrpc(host, RPCPROG_MNT, mntvers, - RPCMNT_EXPORT, (xdrproc_t)xdr_void, (char *)0, - (xdrproc_t)xdr_exports, (char *)&exports)) != 0) { + if ((estat = tcp_callrpc(host, MOUNTPROG, mntvers, + MOUNTPROC_EXPORT, (xdrproc_t)xdr_void, (char *)0, + (xdrproc_t)xdr_exportslist, (char *)&exportslist)) != 0) { clnt_perrno(estat); errx(1, "can't do exports rpc"); } @@ -189,7 +189,7 @@ main(argc, argv) } if (rpcs & DOEXPORTS) { printf("Exports list on %s:\n", host); - exp = exports; + exp = exportslist; while (exp) { printf("%-35s", exp->ex_dirp); grp = exp->ex_groups; @@ -265,10 +265,10 @@ xdr_mntdump(xdrsp, mlp) return (0); mp->ml_left = mp->ml_right = (struct mountlist *)0; strp = mp->ml_host; - if (!xdr_string(xdrsp, &strp, RPCMNT_NAMELEN)) + if (!xdr_string(xdrsp, &strp, MNTNAMLEN)) return (0); strp = mp->ml_dirp; - if (!xdr_string(xdrsp, &strp, RPCMNT_PATHLEN)) + if (!xdr_string(xdrsp, &strp, MNTPATHLEN)) return (0); /* @@ -327,7 +327,7 @@ next: * Xdr routine to retrieve exports list */ int -xdr_exports(xdrsp, exp) +xdr_exportslist(xdrsp, exp) XDR *xdrsp; struct exportslist **exp; { @@ -345,7 +345,7 @@ xdr_exports(xdrsp, exp) return (0); ep->ex_groups = (struct grouplist *)0; strp = ep->ex_dirp; - if (!xdr_string(xdrsp, &strp, RPCMNT_PATHLEN)) + if (!xdr_string(xdrsp, &strp, MNTPATHLEN)) return (0); if (!xdr_bool(xdrsp, &grpbool)) return (0); @@ -354,7 +354,7 @@ xdr_exports(xdrsp, exp) if (gp == NULL) return (0); strp = gp->gr_name; - if (!xdr_string(xdrsp, &strp, RPCMNT_NAMELEN)) + if (!xdr_string(xdrsp, &strp, MNTNAMLEN)) return (0); gp->gr_next = ep->ex_groups; ep->ex_groups = gp; Modified: head/usr.sbin/amd/include/config.h ============================================================================== --- head/usr.sbin/amd/include/config.h Wed Jun 24 18:38:51 2009 (r194879) +++ head/usr.sbin/amd/include/config.h Wed Jun 24 18:42:21 2009 (r194880) @@ -753,7 +753,7 @@ /* #undef HAVE_NFS_PROT_HEADERS */ /* Define to 1 if you have the header file. */ -#define HAVE_NFS_RPCV2_H 1 +/* #define HAVE_NFS_RPCV2_H 1 */ /* Define to 1 if you have the `nis_domain_of' function. */ /* #undef HAVE_NIS_DOMAIN_OF */ Modified: head/usr.sbin/mountd/mountd.c ============================================================================== --- head/usr.sbin/mountd/mountd.c Wed Jun 24 18:38:51 2009 (r194879) +++ head/usr.sbin/mountd/mountd.c Wed Jun 24 18:42:21 2009 (r194880) @@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -93,8 +92,8 @@ __FBSDID("$FreeBSD$"); */ struct mountlist { struct mountlist *ml_next; - char ml_host[RPCMNT_NAMELEN+1]; - char ml_dirp[RPCMNT_PATHLEN+1]; + char ml_host[MNTNAMLEN+1]; + char ml_dirp[MNTPATHLEN+1]; }; struct dirlist { @@ -398,8 +397,8 @@ main(argc, argv) pidfile_write(pfh); - rpcb_unset(RPCPROG_MNT, RPCMNT_VER1, NULL); - rpcb_unset(RPCPROG_MNT, RPCMNT_VER3, NULL); + rpcb_unset(MOUNTPROG, MOUNTVERS, NULL); + rpcb_unset(MOUNTPROG, MOUNTVERS3, NULL); rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec); if (!resvport_only) { @@ -673,16 +672,16 @@ create_service(struct netconfig *nconf) RPC_MAXDATASIZE); if (transp != (SVCXPRT *) NULL) { - if (!svc_reg(transp, RPCPROG_MNT, RPCMNT_VER1, mntsrv, + if (!svc_reg(transp, MOUNTPROG, MOUNTVERS, mntsrv, NULL)) syslog(LOG_ERR, - "can't register %s RPCMNT_VER1 service", + "can't register %s MOUNTVERS service", nconf->nc_netid); if (!force_v2) { - if (!svc_reg(transp, RPCPROG_MNT, RPCMNT_VER3, + if (!svc_reg(transp, MOUNTPROG, MOUNTVERS3, mntsrv, NULL)) syslog(LOG_ERR, - "can't register %s RPCMNT_VER3 service", + "can't register %s MOUNTVERS3 service", nconf->nc_netid); } } else @@ -720,8 +719,8 @@ create_service(struct netconfig *nconf) memcpy(servaddr.buf, res->ai_addr, res->ai_addrlen); servaddr.len = res->ai_addrlen; - rpcb_set(RPCPROG_MNT, RPCMNT_VER1, nconf, &servaddr); - rpcb_set(RPCPROG_MNT, RPCMNT_VER3, nconf, &servaddr); + rpcb_set(MOUNTPROG, MOUNTVERS, nconf, &servaddr); + rpcb_set(MOUNTPROG, MOUNTVERS3, nconf, &servaddr); xcreated++; freeaddrinfo(res); @@ -755,7 +754,7 @@ mntsrv(rqstp, transp) int lookup_failed = 1; struct sockaddr *saddr; u_short sport; - char rpcpath[RPCMNT_PATHLEN + 1], dirpath[MAXPATHLEN]; + char rpcpath[MNTPATHLEN + 1], dirpath[MAXPATHLEN]; int bad = 0, defset, hostset; sigset_t sighup_mask; @@ -782,7 +781,7 @@ mntsrv(rqstp, transp) if (!svc_sendreply(transp, (xdrproc_t)xdr_void, NULL)) syslog(LOG_ERR, "can't send reply"); return; - case RPCMNT_MOUNT: + case MOUNTPROC_MNT: if (sport >= IPPORT_RESERVED && resvport_only) { syslog(LOG_NOTICE, "mount request from %s from unprivileged port", @@ -875,7 +874,7 @@ mntsrv(rqstp, transp) syslog(LOG_ERR, "can't send reply"); sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL); return; - case RPCMNT_DUMP: + case MOUNTPROC_DUMP: if (!svc_sendreply(transp, (xdrproc_t)xdr_mlist, (caddr_t)NULL)) syslog(LOG_ERR, "can't send reply"); else if (dolog) @@ -883,7 +882,7 @@ mntsrv(rqstp, transp) "dump request succeeded from %s", numerichost); return; - case RPCMNT_UMOUNT: + case MOUNTPROC_UMNT: if (sport >= IPPORT_RESERVED && resvport_only) { syslog(LOG_NOTICE, "umount request from %s from unprivileged port", @@ -912,7 +911,7 @@ mntsrv(rqstp, transp) "umount request succeeded from %s for %s", numerichost, dirpath); return; - case RPCMNT_UMNTALL: + case MOUNTPROC_UMNTALL: if (sport >= IPPORT_RESERVED && resvport_only) { syslog(LOG_NOTICE, "umountall request from %s from unprivileged port", @@ -930,7 +929,7 @@ mntsrv(rqstp, transp) "umountall request succeeded from %s", numerichost); return; - case RPCMNT_EXPORT: + case MOUNTPROC_EXPORT: if (!svc_sendreply(transp, (xdrproc_t)xdr_explist, (caddr_t)NULL)) if (!svc_sendreply(transp, (xdrproc_t)xdr_explist_brief, (caddr_t)NULL)) @@ -954,7 +953,7 @@ xdr_dir(xdrsp, dirp) XDR *xdrsp; char *dirp; { - return (xdr_string(xdrsp, &dirp, RPCMNT_PATHLEN)); + return (xdr_string(xdrsp, &dirp, MNTPATHLEN)); } /* @@ -1013,10 +1012,10 @@ xdr_mlist(xdrsp, cp) if (!xdr_bool(xdrsp, &true)) return (0); strp = &mlp->ml_host[0]; - if (!xdr_string(xdrsp, &strp, RPCMNT_NAMELEN)) + if (!xdr_string(xdrsp, &strp, MNTNAMLEN)) return (0); strp = &mlp->ml_dirp[0]; - if (!xdr_string(xdrsp, &strp, RPCMNT_PATHLEN)) + if (!xdr_string(xdrsp, &strp, MNTPATHLEN)) return (0); mlp = mlp->ml_next; } @@ -1088,7 +1087,7 @@ put_exlist(dp, xdrsp, adp, putdefp, brie if (!xdr_bool(xdrsp, &true)) return (1); strp = dp->dp_dirp; - if (!xdr_string(xdrsp, &strp, RPCMNT_PATHLEN)) + if (!xdr_string(xdrsp, &strp, MNTPATHLEN)) return (1); if (adp && !strcmp(dp->dp_dirp, adp->dp_dirp)) { gotalldir = 1; @@ -1098,7 +1097,7 @@ put_exlist(dp, xdrsp, adp, putdefp, brie if (!xdr_bool(xdrsp, &true)) return (1); strp = "(...)"; - if (!xdr_string(xdrsp, &strp, RPCMNT_PATHLEN)) + if (!xdr_string(xdrsp, &strp, MNTPATHLEN)) return (1); } else if ((dp->dp_flag & DP_DEFSET) == 0 && (gotalldir == 0 || (adp->dp_flag & DP_DEFSET) == 0)) { @@ -1110,14 +1109,14 @@ put_exlist(dp, xdrsp, adp, putdefp, brie return (1); strp = grp->gr_ptr.gt_addrinfo->ai_canonname; if (!xdr_string(xdrsp, &strp, - RPCMNT_NAMELEN)) + MNTNAMLEN)) return (1); } else if (grp->gr_type == GT_NET) { if (!xdr_bool(xdrsp, &true)) return (1); strp = grp->gr_ptr.gt_net.nt_name; if (!xdr_string(xdrsp, &strp, - RPCMNT_NAMELEN)) + MNTNAMLEN)) return (1); } hp = hp->ht_next; @@ -1216,7 +1215,7 @@ get_exportlist_one() len = endcp-cp; tgrp = grp = get_grp(); while (len > 0) { - if (len > RPCMNT_NAMELEN) { + if (len > MNTNAMLEN) { getexp_err(ep, tgrp); goto nextline; } @@ -2718,7 +2717,7 @@ parsecred(namelist, cr) syslog(LOG_ERR, "too many groups"); } -#define STRSIZ (RPCMNT_NAMELEN+RPCMNT_PATHLEN+50) +#define STRSIZ (MNTNAMLEN+MNTPATHLEN+50) /* * Routines that maintain the remote mounttab */ @@ -2748,10 +2747,10 @@ get_mountlist() mlp = (struct mountlist *)malloc(sizeof (*mlp)); if (mlp == (struct mountlist *)NULL) out_of_mem(); - strncpy(mlp->ml_host, host, RPCMNT_NAMELEN); - mlp->ml_host[RPCMNT_NAMELEN] = '\0'; - strncpy(mlp->ml_dirp, dirp, RPCMNT_PATHLEN); - mlp->ml_dirp[RPCMNT_PATHLEN] = '\0'; + strncpy(mlp->ml_host, host, MNTNAMLEN); + mlp->ml_host[MNTNAMLEN] = '\0'; + strncpy(mlp->ml_dirp, dirp, MNTPATHLEN); + mlp->ml_dirp[MNTPATHLEN] = '\0'; mlp->ml_next = (struct mountlist *)NULL; *mlpp = mlp; mlpp = &mlp->ml_next; @@ -2813,10 +2812,10 @@ add_mlist(hostp, dirp) mlp = (struct mountlist *)malloc(sizeof (*mlp)); if (mlp == (struct mountlist *)NULL) out_of_mem(); - strncpy(mlp->ml_host, hostp, RPCMNT_NAMELEN); - mlp->ml_host[RPCMNT_NAMELEN] = '\0'; - strncpy(mlp->ml_dirp, dirp, RPCMNT_PATHLEN); - mlp->ml_dirp[RPCMNT_PATHLEN] = '\0'; + strncpy(mlp->ml_host, hostp, MNTNAMLEN); + mlp->ml_host[MNTNAMLEN] = '\0'; + strncpy(mlp->ml_dirp, dirp, MNTPATHLEN); + mlp->ml_dirp[MNTPATHLEN] = '\0'; mlp->ml_next = (struct mountlist *)NULL; *mlpp = mlp; if ((mlfile = fopen(_PATH_RMOUNTLIST, "a")) == NULL) { @@ -3049,8 +3048,8 @@ void terminate(sig) int sig; { pidfile_remove(pfh); - rpcb_unset(RPCPROG_MNT, RPCMNT_VER1, NULL); - rpcb_unset(RPCPROG_MNT, RPCMNT_VER3, NULL); + rpcb_unset(MOUNTPROG, MOUNTVERS, NULL); + rpcb_unset(MOUNTPROG, MOUNTVERS3, NULL); exit (0); } Modified: head/usr.sbin/nfsd/nfsd.c ============================================================================== --- head/usr.sbin/nfsd/nfsd.c Wed Jun 24 18:38:51 2009 (r194879) +++ head/usr.sbin/nfsd/nfsd.c Wed Jun 24 18:42:21 2009 (r194880) @@ -54,11 +54,10 @@ static const char rcsid[] = #include #include +#include #include #include -#include -#include #include #include @@ -268,8 +267,8 @@ main(int argc, char **argv) err(1, "getnetconfigent udp failed"); nb_udp.buf = ai_udp->ai_addr; nb_udp.len = nb_udp.maxlen = ai_udp->ai_addrlen; - if ((!rpcb_set(RPCPROG_NFS, 2, nconf_udp, &nb_udp)) || - (!rpcb_set(RPCPROG_NFS, 3, nconf_udp, &nb_udp))) + if ((!rpcb_set(NFS_PROGRAM, 2, nconf_udp, &nb_udp)) || + (!rpcb_set(NFS_PROGRAM, 3, nconf_udp, &nb_udp))) err(1, "rpcb_set udp failed"); freeaddrinfo(ai_udp); } @@ -287,8 +286,8 @@ main(int argc, char **argv) err(1, "getnetconfigent udp6 failed"); nb_udp6.buf = ai_udp6->ai_addr; nb_udp6.len = nb_udp6.maxlen = ai_udp6->ai_addrlen; - if ((!rpcb_set(RPCPROG_NFS, 2, nconf_udp6, &nb_udp6)) || - (!rpcb_set(RPCPROG_NFS, 3, nconf_udp6, &nb_udp6))) + if ((!rpcb_set(NFS_PROGRAM, 2, nconf_udp6, &nb_udp6)) || + (!rpcb_set(NFS_PROGRAM, 3, nconf_udp6, &nb_udp6))) err(1, "rpcb_set udp6 failed"); freeaddrinfo(ai_udp6); } @@ -306,8 +305,8 @@ main(int argc, char **argv) err(1, "getnetconfigent tcp failed"); nb_tcp.buf = ai_tcp->ai_addr; nb_tcp.len = nb_tcp.maxlen = ai_tcp->ai_addrlen; - if ((!rpcb_set(RPCPROG_NFS, 2, nconf_tcp, &nb_tcp)) || - (!rpcb_set(RPCPROG_NFS, 3, nconf_tcp, &nb_tcp))) + if ((!rpcb_set(NFS_PROGRAM, 2, nconf_tcp, &nb_tcp)) || + (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp, &nb_tcp))) err(1, "rpcb_set tcp failed"); freeaddrinfo(ai_tcp); } @@ -325,8 +324,8 @@ main(int argc, char **argv) err(1, "getnetconfigent tcp6 failed"); nb_tcp6.buf = ai_tcp6->ai_addr; nb_tcp6.len = nb_tcp6.maxlen = ai_tcp6->ai_addrlen; - if ((!rpcb_set(RPCPROG_NFS, 2, nconf_tcp6, &nb_tcp6)) || - (!rpcb_set(RPCPROG_NFS, 3, nconf_tcp6, &nb_tcp6))) + if ((!rpcb_set(NFS_PROGRAM, 2, nconf_tcp6, &nb_tcp6)) || + (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp6, &nb_tcp6))) err(1, "rpcb_set tcp6 failed"); freeaddrinfo(ai_tcp6); } @@ -492,8 +491,8 @@ main(int argc, char **argv) err(1, "getnetconfigent udp failed"); nb_udp.buf = ai_udp->ai_addr; nb_udp.len = nb_udp.maxlen = ai_udp->ai_addrlen; - if ((!rpcb_set(RPCPROG_NFS, 2, nconf_udp, &nb_udp)) || - (!rpcb_set(RPCPROG_NFS, 3, nconf_udp, &nb_udp))) + if ((!rpcb_set(NFS_PROGRAM, 2, nconf_udp, &nb_udp)) || + (!rpcb_set(NFS_PROGRAM, 3, nconf_udp, &nb_udp))) err(1, "rpcb_set udp failed"); freeaddrinfo(ai_udp); } @@ -561,8 +560,8 @@ main(int argc, char **argv) err(1, "getnetconfigent udp6 failed"); nb_udp6.buf = ai_udp6->ai_addr; nb_udp6.len = nb_udp6.maxlen = ai_udp6->ai_addrlen; - if ((!rpcb_set(RPCPROG_NFS, 2, nconf_udp6, &nb_udp6)) || - (!rpcb_set(RPCPROG_NFS, 3, nconf_udp6, &nb_udp6))) + if ((!rpcb_set(NFS_PROGRAM, 2, nconf_udp6, &nb_udp6)) || + (!rpcb_set(NFS_PROGRAM, 3, nconf_udp6, &nb_udp6))) err(1, "rpcb_set udp6 failed"); freeaddrinfo(ai_udp6); } @@ -627,8 +626,8 @@ main(int argc, char **argv) err(1, "getnetconfigent tcp failed"); nb_tcp.buf = ai_tcp->ai_addr; nb_tcp.len = nb_tcp.maxlen = ai_tcp->ai_addrlen; - if ((!rpcb_set(RPCPROG_NFS, 2, nconf_tcp, - &nb_tcp)) || (!rpcb_set(RPCPROG_NFS, 3, + if ((!rpcb_set(NFS_PROGRAM, 2, nconf_tcp, + &nb_tcp)) || (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp, &nb_tcp))) err(1, "rpcb_set tcp failed"); freeaddrinfo(ai_tcp); @@ -702,8 +701,8 @@ main(int argc, char **argv) err(1, "getnetconfigent tcp6 failed"); nb_tcp6.buf = ai_tcp6->ai_addr; nb_tcp6.len = nb_tcp6.maxlen = ai_tcp6->ai_addrlen; - if ((!rpcb_set(RPCPROG_NFS, 2, nconf_tcp6, &nb_tcp6)) || - (!rpcb_set(RPCPROG_NFS, 3, nconf_tcp6, &nb_tcp6))) + if ((!rpcb_set(NFS_PROGRAM, 2, nconf_tcp6, &nb_tcp6)) || + (!rpcb_set(NFS_PROGRAM, 3, nconf_tcp6, &nb_tcp6))) err(1, "rpcb_set tcp6 failed"); freeaddrinfo(ai_tcp6); } @@ -871,8 +870,8 @@ reapchild(__unused int signo) void unregistration() { - if ((!rpcb_unset(RPCPROG_NFS, 2, NULL)) || - (!rpcb_unset(RPCPROG_NFS, 3, NULL))) + if ((!rpcb_unset(NFS_PROGRAM, 2, NULL)) || + (!rpcb_unset(NFS_PROGRAM, 3, NULL))) syslog(LOG_ERR, "rpcb_unset failed"); } Modified: head/usr.sbin/rpc.lockd/kern.c ============================================================================== --- head/usr.sbin/rpc.lockd/kern.c Wed Jun 24 18:38:51 2009 (r194879) +++ head/usr.sbin/rpc.lockd/kern.c Wed Jun 24 18:42:21 2009 (r194880) @@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$"); #include #include "nlm_prot.h" -#include #include #include Modified: head/usr.sbin/rpc.umntall/mounttab.c ============================================================================== --- head/usr.sbin/rpc.umntall/mounttab.c Wed Jun 24 18:38:51 2009 (r194879) +++ head/usr.sbin/rpc.umntall/mounttab.c Wed Jun 24 18:42:21 2009 (r194880) @@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include #include @@ -120,10 +120,10 @@ read_mtab() { return (0); } mtabp->mtab_time = time; - memmove(mtabp->mtab_host, hostp, RPCMNT_NAMELEN); - mtabp->mtab_host[RPCMNT_NAMELEN - 1] = '\0'; - memmove(mtabp->mtab_dirp, dirp, RPCMNT_PATHLEN); - mtabp->mtab_dirp[RPCMNT_PATHLEN - 1] = '\0'; + memmove(mtabp->mtab_host, hostp, MNTNAMLEN); + mtabp->mtab_host[MNTNAMLEN - 1] = '\0'; + memmove(mtabp->mtab_dirp, dirp, MNTPATHLEN); + mtabp->mtab_dirp[MNTPATHLEN - 1] = '\0'; mtabp->mtab_next = (struct mtablist *)NULL; *mtabpp = mtabp; mtabpp = &mtabp->mtab_next; @@ -196,7 +196,7 @@ clean_mtab(char *hostp, char *dirp, int warnx("delete mounttab entry%s %s:%s", (dirp == NULL) ? " by host" : "", mtabp->mtab_host, mtabp->mtab_dirp); - bzero(mtabp->mtab_host, RPCMNT_NAMELEN); + bzero(mtabp->mtab_host, MNTNAMLEN); } free(host); } Modified: head/usr.sbin/rpc.umntall/mounttab.h ============================================================================== --- head/usr.sbin/rpc.umntall/mounttab.h Wed Jun 24 18:38:51 2009 (r194879) +++ head/usr.sbin/rpc.umntall/mounttab.h Wed Jun 24 18:42:21 2009 (r194880) @@ -26,14 +26,14 @@ * $FreeBSD$ */ -#define STRSIZ (RPCMNT_NAMELEN+RPCMNT_PATHLEN+100) +#define STRSIZ (MNTNAMLEN+MNTPATHLEN+100) #define PATH_MOUNTTAB "/var/db/mounttab" /* Structure for /var/db/mounttab */ struct mtablist { time_t mtab_time; - char mtab_host[RPCMNT_NAMELEN]; - char mtab_dirp[RPCMNT_PATHLEN]; + char mtab_host[MNTNAMLEN]; + char mtab_dirp[MNTPATHLEN]; struct mtablist *mtab_next; }; Modified: head/usr.sbin/rpc.umntall/rpc.umntall.c ============================================================================== --- head/usr.sbin/rpc.umntall/rpc.umntall.c Wed Jun 24 18:38:51 2009 (r194879) +++ head/usr.sbin/rpc.umntall/rpc.umntall.c Wed Jun 24 18:42:21 2009 (r194880) @@ -35,7 +35,7 @@ static const char rcsid[] = #include #include -#include +#include #include #include @@ -176,18 +176,18 @@ do_umntall(char *hostname) { try.tv_sec = 3; try.tv_usec = 0; - clp = clnt_create_timed(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp", + clp = clnt_create_timed(hostname, MOUNTPROG, MOUNTVERS, "udp", &try); if (clp == NULL) { - warnx("%s: %s", hostname, clnt_spcreateerror("RPCPROG_MNT")); + warnx("%s: %s", hostname, clnt_spcreateerror("MOUNTPROG")); return (0); } clp->cl_auth = authunix_create_default(); - clnt_stat = clnt_call(clp, RPCMNT_UMNTALL, + clnt_stat = clnt_call(clp, MOUNTPROC_UMNTALL, (xdrproc_t)xdr_void, (caddr_t)0, (xdrproc_t)xdr_void, (caddr_t)0, try); if (clnt_stat != RPC_SUCCESS) - warnx("%s: %s", hostname, clnt_sperror(clp, "RPCMNT_UMNTALL")); + warnx("%s: %s", hostname, clnt_sperror(clp, "MOUNTPROC_UMNTALL")); auth_destroy(clp->cl_auth); clnt_destroy(clp); return (clnt_stat == RPC_SUCCESS); @@ -204,17 +204,17 @@ do_umount(char *hostname, char *dirp) { try.tv_sec = 3; try.tv_usec = 0; - clp = clnt_create_timed(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp", + clp = clnt_create_timed(hostname, MOUNTPROG, MOUNTVERS, "udp", &try); if (clp == NULL) { - warnx("%s: %s", hostname, clnt_spcreateerror("RPCPROG_MNT")); + warnx("%s: %s", hostname, clnt_spcreateerror("MOUNTPROG")); return (0); } clp->cl_auth = authsys_create_default(); - clnt_stat = clnt_call(clp, RPCMNT_UMOUNT, (xdrproc_t)xdr_dir, dirp, + clnt_stat = clnt_call(clp, MOUNTPROC_UMNT, (xdrproc_t)xdr_dir, dirp, (xdrproc_t)xdr_void, (caddr_t)0, try); if (clnt_stat != RPC_SUCCESS) - warnx("%s: %s", hostname, clnt_sperror(clp, "RPCMNT_UMOUNT")); + warnx("%s: %s", hostname, clnt_sperror(clp, "MOUNTPROC_UMNT")); auth_destroy(clp->cl_auth); clnt_destroy(clp); return (clnt_stat == RPC_SUCCESS); @@ -255,7 +255,7 @@ is_mounted(char *hostname, char *dirp) { */ int xdr_dir(XDR *xdrsp, char *dirp) { - return (xdr_string(xdrsp, &dirp, RPCMNT_PATHLEN)); + return (xdr_string(xdrsp, &dirp, MNTPATHLEN)); } static void From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 18:44:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8C741065673; Wed, 24 Jun 2009 18:44:38 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D76A88FC12; Wed, 24 Jun 2009 18:44:38 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OIicBV024664; Wed, 24 Jun 2009 18:44:38 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OIicS7024662; Wed, 24 Jun 2009 18:44:38 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200906241844.n5OIicS7024662@svn.freebsd.org> From: Ulf Lilleengen Date: Wed, 24 Jun 2009 18:44: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: r194881 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 18:44:39 -0000 Author: lulf Date: Wed Jun 24 18:44:38 2009 New Revision: 194881 URL: http://svn.freebsd.org/changeset/base/194881 Log: - Similar to the previous commit, but for CURRENT: Fix a bug where a FIFO vnode use count was increased twice, but only decreased once. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Wed Jun 24 18:42:21 2009 (r194880) +++ head/sys/kern/kern_descrip.c Wed Jun 24 18:44:38 2009 (r194881) @@ -2994,7 +2994,6 @@ sysctl_kern_proc_filedesc(SYSCTL_HANDLER case DTYPE_FIFO: kif->kf_type = KF_TYPE_FIFO; vp = fp->f_vnode; - vref(vp); break; case DTYPE_KQUEUE: From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 19:04:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31EAB106566C; Wed, 24 Jun 2009 19:04:10 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0555C8FC08; Wed, 24 Jun 2009 19:04:10 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OJ48aS025355; Wed, 24 Jun 2009 19:04:08 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OJ48ZH025352; Wed, 24 Jun 2009 19:04:08 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200906241904.n5OJ48ZH025352@svn.freebsd.org> From: Marius Strobl Date: Wed, 24 Jun 2009 19:04: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: r194886 - head/sys/dev/gem X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 19:04:10 -0000 Author: marius Date: Wed Jun 24 19:04:08 2009 New Revision: 194886 URL: http://svn.freebsd.org/changeset/base/194886 Log: Revert the part of r194763 which added a dying flag and instead call ether_ifdetach(9) before stopping the controller and the callouts. The consensus is that the latter is now safe to do and should also solve the problem of active BPF listeners clearing promiscuous mode can result in the tick callout being restarted which in turn will trigger a panic once it's actually gone. Modified: head/sys/dev/gem/if_gem.c head/sys/dev/gem/if_gemvar.h Modified: head/sys/dev/gem/if_gem.c ============================================================================== --- head/sys/dev/gem/if_gem.c Wed Jun 24 18:54:54 2009 (r194885) +++ head/sys/dev/gem/if_gem.c Wed Jun 24 19:04:08 2009 (r194886) @@ -403,15 +403,14 @@ gem_detach(struct gem_softc *sc) struct ifnet *ifp = sc->sc_ifp; int i; + ether_ifdetach(ifp); GEM_LOCK(sc); - sc->sc_flags |= GEM_DYING; gem_stop(ifp, 1); GEM_UNLOCK(sc); callout_drain(&sc->sc_tick_ch); #ifdef GEM_RINT_TIMEOUT callout_drain(&sc->sc_rx_ch); #endif - ether_ifdetach(ifp); if_free(ifp); device_delete_child(sc->sc_dev, sc->sc_miibus); @@ -2107,11 +2106,6 @@ gem_ioctl(struct ifnet *ifp, u_long cmd, switch (cmd) { case SIOCSIFFLAGS: GEM_LOCK(sc); - if ((sc->sc_flags & GEM_DYING) != 0) { - error = EINVAL; - GEM_UNLOCK(sc); - break; - } if ((ifp->if_flags & IFF_UP) != 0) { if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 && ((ifp->if_flags ^ sc->sc_ifflags) & Modified: head/sys/dev/gem/if_gemvar.h ============================================================================== --- head/sys/dev/gem/if_gemvar.h Wed Jun 24 18:54:54 2009 (r194885) +++ head/sys/dev/gem/if_gemvar.h Wed Jun 24 19:04:08 2009 (r194886) @@ -141,11 +141,10 @@ struct gem_softc { u_int sc_flags; #define GEM_INITED (1 << 0) /* reset persistent regs init'ed */ -#define GEM_DYING (1 << 1) /* detach initiated */ -#define GEM_LINK (1 << 2) /* link is up */ -#define GEM_PCI (1 << 3) /* PCI busses are little-endian */ -#define GEM_PCI66 (1 << 4) /* PCI bus runs at 66MHz */ -#define GEM_SERDES (1 << 5) /* use the SERDES */ +#define GEM_LINK (1 << 1) /* link is up */ +#define GEM_PCI (1 << 2) /* PCI busses are little-endian */ +#define GEM_PCI66 (1 << 3) /* PCI bus runs at 66MHz */ +#define GEM_SERDES (1 << 4) /* use the SERDES */ /* * ring buffer DMA stuff From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 19:16:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0AC3106564A; Wed, 24 Jun 2009 19:16:48 +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 CEBAB8FC12; Wed, 24 Jun 2009 19:16:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OJGmOX025802; Wed, 24 Jun 2009 19:16:48 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OJGmjn025799; Wed, 24 Jun 2009 19:16:48 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906241916.n5OJGmjn025799@svn.freebsd.org> From: John Baldwin Date: Wed, 24 Jun 2009 19:16: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: r194889 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 19:16:49 -0000 Author: jhb Date: Wed Jun 24 19:16:48 2009 New Revision: 194889 URL: http://svn.freebsd.org/changeset/base/194889 Log: Whitespace fix. Modified: head/sys/amd64/amd64/local_apic.c head/sys/i386/i386/local_apic.c Modified: head/sys/amd64/amd64/local_apic.c ============================================================================== --- head/sys/amd64/amd64/local_apic.c Wed Jun 24 19:09:36 2009 (r194888) +++ head/sys/amd64/amd64/local_apic.c Wed Jun 24 19:16:48 2009 (r194889) @@ -897,6 +897,7 @@ void apic_free_vector(u_int apic_id, u_int vector, u_int irq) { struct thread *td; + KASSERT(vector >= APIC_IO_INTS && vector != IDT_SYSCALL && vector <= APIC_IO_INTS + APIC_NUM_IOINTS, ("Vector %u does not map to an IRQ line", vector)); Modified: head/sys/i386/i386/local_apic.c ============================================================================== --- head/sys/i386/i386/local_apic.c Wed Jun 24 19:09:36 2009 (r194888) +++ head/sys/i386/i386/local_apic.c Wed Jun 24 19:16:48 2009 (r194889) @@ -901,6 +901,7 @@ void apic_free_vector(u_int apic_id, u_int vector, u_int irq) { struct thread *td; + KASSERT(vector >= APIC_IO_INTS && vector != IDT_SYSCALL && vector <= APIC_IO_INTS + APIC_NUM_IOINTS, ("Vector %u does not map to an IRQ line", vector)); From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 19:25:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0F97C1065670; Wed, 24 Jun 2009 19:25:48 +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 F21768FC12; Wed, 24 Jun 2009 19:25:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OJPlox026017; Wed, 24 Jun 2009 19:25:47 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OJPlFq026015; Wed, 24 Jun 2009 19:25:47 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200906241925.n5OJPlFq026015@svn.freebsd.org> From: Alexander Motin Date: Wed, 24 Jun 2009 19:25: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: r194890 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 19:25:48 -0000 Author: mav Date: Wed Jun 24 19:25:47 2009 New Revision: 194890 URL: http://svn.freebsd.org/changeset/base/194890 Log: Document new hint.atapci.X.msi and hint.ata.X.pm_level tunables. Modified: head/share/man/man4/ata.4 Modified: head/share/man/man4/ata.4 ============================================================================== --- head/share/man/man4/ata.4 Wed Jun 24 19:16:48 2009 (r194889) +++ head/share/man/man4/ata.4 Wed Jun 24 19:25:47 2009 (r194890) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 4, 2008 +.Dd June 24, 2009 .Dt ATA 4 .Os .Sh NAME @@ -93,6 +93,24 @@ set to 1 for DMA access, 0 for PIO (defa set to 1 to enable Write Caching, 0 to disable (default is enabled). .Em WARNING : can cause data loss on power failures and crashes. +.It Va hint.atapci.X.msi +set to 1 to allow Message Signalled Interrupts (MSI) to be used by +specified PCI ATA controller, if supported. +.It Va hint.ata.X.pm_level +controls SATA interface Power Management for specified channel, +allowing to save some power by the cost of additional command latency. +Possible values: +.Bl -tag -compact +.It 0 +interface Power Management is disabled, default value. +.It 1 +device is allowed to initiate PM state change, host is passive. +.It 2 +host initiates PARTIAL PM state transition every time port becomes idle. +.It 3 +host initiates SLUMBER PM state transition every time port becomes idle. +.El +Modes 2 and 3 are implemented only for AHCI driver now. .El .Sh DESCRIPTION The From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 19:30:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E1E73106564A; Wed, 24 Jun 2009 19:30:31 +0000 (UTC) (envelope-from joerg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D0BA78FC17; Wed, 24 Jun 2009 19:30:31 +0000 (UTC) (envelope-from joerg@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OJUVO2026160; Wed, 24 Jun 2009 19:30:31 GMT (envelope-from joerg@svn.freebsd.org) Received: (from joerg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OJUViQ026158; Wed, 24 Jun 2009 19:30:31 GMT (envelope-from joerg@svn.freebsd.org) Message-Id: <200906241930.n5OJUViQ026158@svn.freebsd.org> From: Joerg Wunsch Date: Wed, 24 Jun 2009 19:30:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194891 - head/sys/dev/fdc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 19:30:32 -0000 Author: joerg Date: Wed Jun 24 19:30:31 2009 New Revision: 194891 URL: http://svn.freebsd.org/changeset/base/194891 Log: With the fdc control device disappearing some 5 years ago, it is no longer useful for the FD_STYPE and FD_SOPTS ioctls to insist on being issued on a writable file descriptor. Otherwise, there's no longer a chance to set the drive type or options when a read-only medium is present in the drive, as there is no way to obtain a writable fd then. Modified: head/sys/dev/fdc/fdc.c Modified: head/sys/dev/fdc/fdc.c ============================================================================== --- head/sys/dev/fdc/fdc.c Wed Jun 24 19:25:47 2009 (r194890) +++ head/sys/dev/fdc/fdc.c Wed Jun 24 19:30:31 2009 (r194891) @@ -1498,8 +1498,6 @@ fd_ioctl(struct g_provider *pp, u_long c return (0); case FD_STYPE: /* set drive type */ - if (!(fflag & FWRITE)) - return (EPERM); /* * Allow setting drive type temporarily iff * currently unset. Used for fdformat so any @@ -1521,8 +1519,6 @@ fd_ioctl(struct g_provider *pp, u_long c return (0); case FD_SOPTS: /* set drive options */ - if (!(fflag & FWRITE)) - return (EPERM); fd->options = *(int *)data; return (0); From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 19:47:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 677271065673; Wed, 24 Jun 2009 19:47:54 +0000 (UTC) (envelope-from joerg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 546B78FC16; Wed, 24 Jun 2009 19:47:54 +0000 (UTC) (envelope-from joerg@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OJls3V026515; Wed, 24 Jun 2009 19:47:54 GMT (envelope-from joerg@svn.freebsd.org) Received: (from joerg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OJlrJ4026510; Wed, 24 Jun 2009 19:47:53 GMT (envelope-from joerg@svn.freebsd.org) Message-Id: <200906241947.n5OJlrJ4026510@svn.freebsd.org> From: Joerg Wunsch Date: Wed, 24 Jun 2009 19:47:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194892 - in head/usr.sbin: fdcontrol fdformat fdread fdwrite X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 19:47:54 -0000 Author: joerg Date: Wed Jun 24 19:47:53 2009 New Revision: 194892 URL: http://svn.freebsd.org/changeset/base/194892 Log: Drop the defunct FDOPT_NOERRLOG option from all the floppy utilities. The kernel does not log floppy media errors anymore. In fdcontrol, do always open the file descriptor in read-only mode so it can operate on read-only media, as there is no longer a separate control device to operate on. Modified: head/usr.sbin/fdcontrol/fdcontrol.c head/usr.sbin/fdformat/fdformat.c head/usr.sbin/fdread/fdread.c head/usr.sbin/fdwrite/fdwrite.c Modified: head/usr.sbin/fdcontrol/fdcontrol.c ============================================================================== --- head/usr.sbin/fdcontrol/fdcontrol.c Wed Jun 24 19:30:31 2009 (r194891) +++ head/usr.sbin/fdcontrol/fdcontrol.c Wed Jun 24 19:47:53 2009 (r194892) @@ -72,7 +72,7 @@ main(int argc, char **argv) enum fd_drivetype type; struct fd_type ft, newft, *fdtp; const char *name, *descr; - int fd, i, mode, autofmt; + int fd, i, autofmt; autofmt = 0; while((i = getopt(argc, argv, "aFf:s:v")) != -1) @@ -116,12 +116,7 @@ main(int argc, char **argv) if(argc != 1) usage(); - if (show || showfmt) - mode = O_RDONLY | O_NONBLOCK; - else - mode = O_RDWR; - - if((fd = open(argv[0], mode)) < 0) + if((fd = open(argv[0], O_RDONLY | O_NONBLOCK)) < 0) err(EX_UNAVAILABLE, "open(%s)", argv[0]); if (ioctl(fd, FD_GDTYPE, &type) == -1) Modified: head/usr.sbin/fdformat/fdformat.c ============================================================================== --- head/usr.sbin/fdformat/fdformat.c Wed Jun 24 19:30:31 2009 (r194891) +++ head/usr.sbin/fdformat/fdformat.c Wed Jun 24 19:47:53 2009 (r194892) @@ -146,7 +146,7 @@ main(int argc, char **argv) struct fdc_status fdcs[MAXPRINTERRS]; int format, fill, quiet, verify, verify_only, confirm; int fd, c, i, track, error, tracks_per_dot, bytes_per_track, errs; - int fdopts, flags; + int flags; char *fmtstring, *device; const char *name, *descr; @@ -250,11 +250,6 @@ main(int argc, char **argv) errx(EX_OSERR, "not a floppy disk: %s", device); if (ioctl(fd, FD_GDTYPE, &type) == -1) err(EX_OSERR, "ioctl(FD_GDTYPE)"); - if (ioctl(fd, FD_GOPTS, &fdopts) == -1) - err(EX_OSERR, "ioctl(FD_GOPTS)"); - fdopts |= FDOPT_NOERRLOG; - if (ioctl(fd, FD_SOPTS, &fdopts) == -1) - err(EX_OSERR, "ioctl(FD_SOPTS, FDOPT_NOERRLOG)"); if (format) { getname(type, &name, &descr); fdtp = get_fmt(format, type); Modified: head/usr.sbin/fdread/fdread.c ============================================================================== --- head/usr.sbin/fdread/fdread.c Wed Jun 24 19:30:31 2009 (r194891) +++ head/usr.sbin/fdread/fdread.c Wed Jun 24 19:47:53 2009 (r194892) @@ -166,9 +166,6 @@ doread(int fd, FILE *of, const char *_de if (ioctl(fd, FD_GTYPE, &fdt) == -1) err(EX_OSERR, "ioctl(FD_GTYPE) failed -- not a floppy?"); - fdopts = FDOPT_NOERRLOG; - if (ioctl(fd, FD_SOPTS, &fdopts) == -1) - err(EX_OSERR, "ioctl(FD_SOPTS, FDOPT_NOERRLOG)"); secsize = 128 << fdt.secsize; tracksize = fdt.sectrac * secsize; @@ -300,7 +297,7 @@ doread(int fd, FILE *of, const char *_de int doreadid(int fd, unsigned int numids, unsigned int trackno) { - int rv = 0, fdopts; + int rv = 0; unsigned int i; struct fdc_readid info; struct fdc_status fdcs; @@ -309,10 +306,6 @@ doreadid(int fd, unsigned int numids, un if (ioctl(fd, FD_GTYPE, &fdt) == -1) err(EX_OSERR, "ioctl(FD_GTYPE) failed -- not a floppy?"); - fdopts = FDOPT_NOERRLOG; - if (ioctl(fd, FD_SOPTS, &fdopts) == -1) - err(EX_OSERR, "ioctl(FD_SOPTS, FDOPT_NOERRLOG)"); - for (i = 0; i < numids; i++) { info.cyl = trackno / fdt.heads; info.head = fdt.heads > 1? trackno % fdt.heads: 0; Modified: head/usr.sbin/fdwrite/fdwrite.c ============================================================================== --- head/usr.sbin/fdwrite/fdwrite.c Wed Jun 24 19:30:31 2009 (r194891) +++ head/usr.sbin/fdwrite/fdwrite.c Wed Jun 24 19:47:53 2009 (r194892) @@ -66,7 +66,7 @@ main(int argc, char **argv) { int inputfd = -1, c, fdn = 0, i,j,fd; int bpt, verbose=1, nbytes=0, track; - int interactive = 1, fdopts; + int interactive = 1; const char *device= "/dev/fd0"; char *trackbuf = 0,*vrfybuf = 0; struct fd_type fdt; @@ -130,9 +130,6 @@ main(int argc, char **argv) if(ioctl(fd, FD_GTYPE, &fdt) < 0) errx(1, "not a floppy disk: %s", device); - fdopts = FDOPT_NOERRLOG; - if (ioctl(fd, FD_SOPTS, &fdopts) == -1) - err(1, "ioctl(FD_SOPTS, FDOPT_NOERRLOG)"); bpt = fdt.sectrac * (1< Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E53D71065670; Wed, 24 Jun 2009 19:49:18 +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 D2A5B8FC15; Wed, 24 Jun 2009 19:49:18 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OJnISJ026599; Wed, 24 Jun 2009 19:49:18 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OJnIhr026576; Wed, 24 Jun 2009 19:49:18 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200906241949.n5OJnIhr026576@svn.freebsd.org> From: Alexander Motin Date: Wed, 24 Jun 2009 19:49: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: r194893 - head/sys/dev/ata/chipsets X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 19:49:19 -0000 Author: mav Date: Wed Jun 24 19:49:18 2009 New Revision: 194893 URL: http://svn.freebsd.org/changeset/base/194893 Log: MFp4: Reduce default PCI ATA drivers priorities from absolute to default, to allow them been overriden. It was so before modularization. Modified: head/sys/dev/ata/chipsets/ata-acard.c head/sys/dev/ata/chipsets/ata-acerlabs.c head/sys/dev/ata/chipsets/ata-adaptec.c head/sys/dev/ata/chipsets/ata-amd.c head/sys/dev/ata/chipsets/ata-ati.c head/sys/dev/ata/chipsets/ata-cenatek.c head/sys/dev/ata/chipsets/ata-cypress.c head/sys/dev/ata/chipsets/ata-cyrix.c head/sys/dev/ata/chipsets/ata-highpoint.c head/sys/dev/ata/chipsets/ata-intel.c head/sys/dev/ata/chipsets/ata-ite.c head/sys/dev/ata/chipsets/ata-jmicron.c head/sys/dev/ata/chipsets/ata-marvell.c head/sys/dev/ata/chipsets/ata-micron.c head/sys/dev/ata/chipsets/ata-national.c head/sys/dev/ata/chipsets/ata-netcell.c head/sys/dev/ata/chipsets/ata-nvidia.c head/sys/dev/ata/chipsets/ata-promise.c head/sys/dev/ata/chipsets/ata-serverworks.c head/sys/dev/ata/chipsets/ata-siliconimage.c head/sys/dev/ata/chipsets/ata-sis.c head/sys/dev/ata/chipsets/ata-via.c Modified: head/sys/dev/ata/chipsets/ata-acard.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-acard.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-acard.c Wed Jun 24 19:49:18 2009 (r194893) @@ -93,7 +93,7 @@ ata_acard_probe(device_t dev) ata_set_desc(dev); ctlr->chipinit = ata_acard_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } static int Modified: head/sys/dev/ata/chipsets/ata-acerlabs.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-acerlabs.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-acerlabs.c Wed Jun 24 19:49:18 2009 (r194893) @@ -94,7 +94,7 @@ ata_ali_probe(device_t dev) ata_set_desc(dev); ctlr->chipinit = ata_ali_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } static int Modified: head/sys/dev/ata/chipsets/ata-adaptec.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-adaptec.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-adaptec.c Wed Jun 24 19:49:18 2009 (r194893) @@ -75,7 +75,7 @@ ata_adaptec_probe(device_t dev) ata_set_desc(dev); ctlr->chipinit = ata_marvell_edma_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } ATA_DECLARE_DRIVER(ata_adaptec); Modified: head/sys/dev/ata/chipsets/ata-amd.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-amd.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-amd.c Wed Jun 24 19:49:18 2009 (r194893) @@ -83,7 +83,7 @@ ata_amd_probe(device_t dev) ata_set_desc(dev); ctlr->chipinit = ata_amd_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } static int Modified: head/sys/dev/ata/chipsets/ata-ati.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ati.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-ati.c Wed Jun 24 19:49:18 2009 (r194893) @@ -136,7 +136,7 @@ ata_ati_probe(device_t dev) ctlr->chipinit = ata_ati_ahci_chipinit; break; } - return 0; + return (BUS_PROBE_DEFAULT); } static int Modified: head/sys/dev/ata/chipsets/ata-cenatek.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-cenatek.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-cenatek.c Wed Jun 24 19:49:18 2009 (r194893) @@ -69,7 +69,7 @@ ata_cenatek_probe(device_t dev) ctlr->chipinit = ata_cenatek_chipinit; device_set_desc(dev, "Cenatek Rocket Drive controller"); - return 0; + return (BUS_PROBE_DEFAULT); } static int Modified: head/sys/dev/ata/chipsets/ata-cypress.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-cypress.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-cypress.c Wed Jun 24 19:49:18 2009 (r194893) @@ -76,7 +76,7 @@ ata_cypress_probe(device_t dev) pci_get_subclass(dev) == PCIS_STORAGE_IDE) { device_set_desc(dev, "Cypress 82C693 ATA controller"); ctlr->chipinit = ata_cypress_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } return ENXIO; } Modified: head/sys/dev/ata/chipsets/ata-cyrix.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-cyrix.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-cyrix.c Wed Jun 24 19:49:18 2009 (r194893) @@ -67,7 +67,7 @@ ata_cyrix_probe(device_t dev) if (pci_get_devid(dev) == ATA_CYRIX_5530) { device_set_desc(dev, "Cyrix 5530 ATA33 controller"); ctlr->chipinit = ata_cyrix_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } return ENXIO; } Modified: head/sys/dev/ata/chipsets/ata-highpoint.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-highpoint.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-highpoint.c Wed Jun 24 19:49:18 2009 (r194893) @@ -104,7 +104,7 @@ ata_highpoint_probe(device_t dev) device_set_desc_copy(dev, buffer); ctlr->chip = idx; ctlr->chipinit = ata_highpoint_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } static int Modified: head/sys/dev/ata/chipsets/ata-intel.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-intel.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-intel.c Wed Jun 24 19:49:18 2009 (r194893) @@ -146,7 +146,7 @@ ata_intel_probe(device_t dev) ata_set_desc(dev); ctlr->chipinit = ata_intel_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } static int Modified: head/sys/dev/ata/chipsets/ata-ite.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ite.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-ite.c Wed Jun 24 19:49:18 2009 (r194893) @@ -78,7 +78,7 @@ ata_ite_probe(device_t dev) ata_set_desc(dev); ctlr->chipinit = ata_ite_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } static int Modified: head/sys/dev/ata/chipsets/ata-jmicron.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-jmicron.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-jmicron.c Wed Jun 24 19:49:18 2009 (r194893) @@ -94,7 +94,7 @@ ata_jmicron_probe(device_t dev) device_set_desc_copy(dev, buffer); ctlr->chip = idx; ctlr->chipinit = ata_jmicron_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } static int Modified: head/sys/dev/ata/chipsets/ata-marvell.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-marvell.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-marvell.c Wed Jun 24 19:49:18 2009 (r194893) @@ -125,7 +125,7 @@ ata_marvell_probe(device_t dev) ctlr->chipinit = ata_marvell_pata_chipinit; break; } - return 0; + return (BUS_PROBE_DEFAULT); } static int Modified: head/sys/dev/ata/chipsets/ata-micron.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-micron.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-micron.c Wed Jun 24 19:49:18 2009 (r194893) @@ -69,7 +69,7 @@ ata_micron_probe(device_t dev) device_set_desc(dev, "RZ 100? ATA controller !WARNING! data loss/corruption risk"); ctlr->chipinit = ata_micron_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } else return ENXIO; Modified: head/sys/dev/ata/chipsets/ata-national.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-national.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-national.c Wed Jun 24 19:49:18 2009 (r194893) @@ -68,7 +68,7 @@ ata_national_probe(device_t dev) if (pci_get_devid(dev) == ATA_SC1100) { device_set_desc(dev, "National Geode SC1100 ATA33 controller"); ctlr->chipinit = ata_national_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } return ENXIO; } Modified: head/sys/dev/ata/chipsets/ata-netcell.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-netcell.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-netcell.c Wed Jun 24 19:49:18 2009 (r194893) @@ -68,7 +68,7 @@ ata_netcell_probe(device_t dev) if (pci_get_devid(dev) == ATA_NETCELL_SR) { device_set_desc(dev, "Netcell SyncRAID SR3000/5000 RAID Controller"); ctlr->chipinit = ata_netcell_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } return ENXIO; } Modified: head/sys/dev/ata/chipsets/ata-nvidia.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-nvidia.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-nvidia.c Wed Jun 24 19:49:18 2009 (r194893) @@ -138,7 +138,7 @@ ata_nvidia_probe(device_t dev) ctlr->chipinit = ata_ahci_chipinit; else ctlr->chipinit = ata_nvidia_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } static int Modified: head/sys/dev/ata/chipsets/ata-promise.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-promise.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-promise.c Wed Jun 24 19:49:18 2009 (r194893) @@ -210,7 +210,7 @@ ata_promise_probe(device_t dev) device_set_desc_copy(dev, buffer); ctlr->chip = idx; ctlr->chipinit = ata_promise_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } static int Modified: head/sys/dev/ata/chipsets/ata-serverworks.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-serverworks.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-serverworks.c Wed Jun 24 19:49:18 2009 (r194893) @@ -98,7 +98,7 @@ ata_serverworks_probe(device_t dev) ata_set_desc(dev); ctlr->chipinit = ata_serverworks_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } #ifdef __powerpc__ Modified: head/sys/dev/ata/chipsets/ata-siliconimage.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-siliconimage.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-siliconimage.c Wed Jun 24 19:49:18 2009 (r194893) @@ -115,7 +115,7 @@ ata_sii_probe(device_t dev) ata_set_desc(dev); ctlr->chipinit = ata_sii_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } int Modified: head/sys/dev/ata/chipsets/ata-sis.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-sis.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-sis.c Wed Jun 24 19:49:18 2009 (r194893) @@ -155,7 +155,7 @@ ata_sis_probe(device_t dev) device_set_desc_copy(dev, buffer); ctlr->chip = idx; ctlr->chipinit = ata_sis_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } static int Modified: head/sys/dev/ata/chipsets/ata-via.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-via.c Wed Jun 24 19:47:53 2009 (r194892) +++ head/sys/dev/ata/chipsets/ata-via.c Wed Jun 24 19:49:18 2009 (r194893) @@ -120,7 +120,7 @@ ata_via_probe(device_t dev) ata_set_desc(dev); ctlr->chipinit = ata_via_chipinit; - return 0; + return (BUS_PROBE_DEFAULT); } static int From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 20:01:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DE8F1065670; Wed, 24 Jun 2009 20:01:14 +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 0B4518FC18; Wed, 24 Jun 2009 20:01:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OK1EJN026916; Wed, 24 Jun 2009 20:01:14 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OK1DcS026911; Wed, 24 Jun 2009 20:01:13 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906242001.n5OK1DcS026911@svn.freebsd.org> From: John Baldwin Date: Wed, 24 Jun 2009 20:01: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: r194894 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 20:01:14 -0000 Author: jhb Date: Wed Jun 24 20:01:13 2009 New Revision: 194894 URL: http://svn.freebsd.org/changeset/base/194894 Log: Deprecate the msgsys(), semsys(), and shmsys() system calls by moving them under COMPAT_FREEBSD[4567]. Starting with FreeBSD 5.0 the SYSV IPC API was implemented via direct system calls (e.g. msgctl(), msgget(), etc.) rather than indirecting through the var-args *sys() system calls. The shmsys() system call was already effectively deprecated for all but COMPAT_FREEBSD4 already as its implementation for the !COMPAT_FREEBSD4 case was to simply invoke nosys(). Modified: head/sys/kern/syscalls.master head/sys/kern/sysv_msg.c head/sys/kern/sysv_sem.c head/sys/kern/sysv_shm.c Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Wed Jun 24 19:49:18 2009 (r194893) +++ head/sys/kern/syscalls.master Wed Jun 24 20:01:13 2009 (r194894) @@ -334,15 +334,12 @@ struct rtprio *rtp); } 167 AUE_NULL UNIMPL nosys 168 AUE_NULL UNIMPL nosys -; 169 is initialized by the SYSVSEM code if present or loaded 169 AUE_SEMSYS NOSTD { int semsys(int which, int a2, int a3, \ int a4, int a5); } ; XXX should be { int semsys(int which, ...); } -; 170 is initialized by the SYSVMSG code if present or loaded 170 AUE_MSGSYS NOSTD { int msgsys(int which, int a2, int a3, \ int a4, int a5, int a6); } ; XXX should be { int msgsys(int which, ...); } -; 171 is initialized by the SYSVSHM code if present or loaded 171 AUE_SHMSYS NOSTD { int shmsys(int which, int a2, int a3, \ int a4); } ; XXX should be { int shmsys(int which, ...); } Modified: head/sys/kern/sysv_msg.c ============================================================================== --- head/sys/kern/sysv_msg.c Wed Jun 24 19:49:18 2009 (r194893) +++ head/sys/kern/sysv_msg.c Wed Jun 24 20:01:13 2009 (r194894) @@ -50,6 +50,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" #include "opt_sysvipc.h" #include @@ -85,12 +86,6 @@ static int sysvmsg_modload(struct module static void msg_freehdr(struct msg *msghdr); -/* XXX casting to (sy_call_t *) is bogus, as usual. */ -static sy_call_t *msgcalls[] = { - (sy_call_t *)msgctl, (sy_call_t *)msgget, - (sy_call_t *)msgsnd, (sy_call_t *)msgrcv -}; - #ifndef MSGSSZ #define MSGSSZ 8 /* Each segment must be 2^N long */ #endif @@ -308,7 +303,6 @@ static moduledata_t sysvmsg_mod = { NULL }; -SYSCALL_MODULE_HELPER(msgsys); SYSCALL_MODULE_HELPER(msgctl); SYSCALL_MODULE_HELPER(msgget); SYSCALL_MODULE_HELPER(msgsnd); @@ -317,33 +311,6 @@ SYSCALL_MODULE_HELPER(msgrcv); DECLARE_MODULE(sysvmsg, sysvmsg_mod, SI_SUB_SYSV_MSG, SI_ORDER_FIRST); MODULE_VERSION(sysvmsg, 1); -/* - * Entry point for all MSG calls. - */ -int -msgsys(td, uap) - struct thread *td; - /* XXX actually varargs. */ - struct msgsys_args /* { - int which; - int a2; - int a3; - int a4; - int a5; - int a6; - } */ *uap; -{ - int error; - - if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) - return (ENOSYS); - if (uap->which < 0 || - uap->which >= sizeof(msgcalls)/sizeof(msgcalls[0])) - return (EINVAL); - error = (*msgcalls[uap->which])(td, &uap->a2); - return (error); -} - static void msg_freehdr(msghdr) struct msg *msghdr; @@ -1289,3 +1256,42 @@ SYSCTL_INT(_kern_ipc, OID_AUTO, msgseg, "Number of message segments"); SYSCTL_PROC(_kern_ipc, OID_AUTO, msqids, CTLFLAG_RD, NULL, 0, sysctl_msqids, "", "Message queue IDs"); + +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) +SYSCALL_MODULE_HELPER(msgsys); + +/* XXX casting to (sy_call_t *) is bogus, as usual. */ +static sy_call_t *msgcalls[] = { + (sy_call_t *)msgctl, (sy_call_t *)msgget, + (sy_call_t *)msgsnd, (sy_call_t *)msgrcv +}; + +/* + * Entry point for all MSG calls. + */ +int +msgsys(td, uap) + struct thread *td; + /* XXX actually varargs. */ + struct msgsys_args /* { + int which; + int a2; + int a3; + int a4; + int a5; + int a6; + } */ *uap; +{ + int error; + + if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) + return (ENOSYS); + if (uap->which < 0 || + uap->which >= sizeof(msgcalls)/sizeof(msgcalls[0])) + return (EINVAL); + error = (*msgcalls[uap->which])(td, &uap->a2); + return (error); +} +#endif /* COMPAT_FREEBSD4 || COMPAT_FREEBSD5 || COMPAT_FREEBSD6 || + COMPAT_FREEBSD7 */ Modified: head/sys/kern/sysv_sem.c ============================================================================== --- head/sys/kern/sysv_sem.c Wed Jun 24 19:49:18 2009 (r194893) +++ head/sys/kern/sysv_sem.c Wed Jun 24 20:01:13 2009 (r194894) @@ -39,6 +39,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" #include "opt_sysvipc.h" #include @@ -90,12 +91,6 @@ static int semundo_adjust(struct thread int semid, int semseq, int semnum, int adjval); static void semundo_clear(int semid, int semnum); -/* XXX casting to (sy_call_t *) is bogus, as usual. */ -static sy_call_t *semcalls[] = { - (sy_call_t *)__semctl, (sy_call_t *)semget, - (sy_call_t *)semop -}; - static struct mtx sem_mtx; /* semaphore global lock */ static struct mtx sem_undo_mtx; static int semtot = 0; @@ -317,7 +312,6 @@ static moduledata_t sysvsem_mod = { NULL }; -SYSCALL_MODULE_HELPER(semsys); SYSCALL_MODULE_HELPER(__semctl); SYSCALL_MODULE_HELPER(semget); SYSCALL_MODULE_HELPER(semop); @@ -326,32 +320,6 @@ DECLARE_MODULE(sysvsem, sysvsem_mod, SI_ MODULE_VERSION(sysvsem, 1); /* - * Entry point for all SEM calls. - */ -int -semsys(td, uap) - struct thread *td; - /* XXX actually varargs. */ - struct semsys_args /* { - int which; - int a2; - int a3; - int a4; - int a5; - } */ *uap; -{ - int error; - - if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) - return (ENOSYS); - if (uap->which < 0 || - uap->which >= sizeof(semcalls)/sizeof(semcalls[0])) - return (EINVAL); - error = (*semcalls[uap->which])(td, &uap->a2); - return (error); -} - -/* * Allocate a new sem_undo structure for a process * (returns ptr to structure or NULL if no more room) */ @@ -1345,3 +1313,41 @@ sysctl_sema(SYSCTL_HANDLER_ARGS) return (SYSCTL_OUT(req, sema, sizeof(struct semid_kernel) * seminfo.semmni)); } + +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) +SYSCALL_MODULE_HELPER(semsys); + +/* XXX casting to (sy_call_t *) is bogus, as usual. */ +static sy_call_t *semcalls[] = { + (sy_call_t *)__semctl, (sy_call_t *)semget, + (sy_call_t *)semop +}; + +/* + * Entry point for all SEM calls. + */ +int +semsys(td, uap) + struct thread *td; + /* XXX actually varargs. */ + struct semsys_args /* { + int which; + int a2; + int a3; + int a4; + int a5; + } */ *uap; +{ + int error; + + if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) + return (ENOSYS); + if (uap->which < 0 || + uap->which >= sizeof(semcalls)/sizeof(semcalls[0])) + return (EINVAL); + error = (*semcalls[uap->which])(td, &uap->a2); + return (error); +} +#endif /* COMPAT_FREEBSD4 || COMPAT_FREEBSD5 || COMPAT_FREEBSD6 || + COMPAT_FREEBSD7 */ Modified: head/sys/kern/sysv_shm.c ============================================================================== --- head/sys/kern/sysv_shm.c Wed Jun 24 19:49:18 2009 (r194893) +++ head/sys/kern/sysv_shm.c Wed Jun 24 20:01:13 2009 (r194894) @@ -96,25 +96,11 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_SHM, "shm", "SVID compatible shared memory segments"); -#if defined(__i386__) && (defined(COMPAT_FREEBSD4) || defined(COMPAT_43)) -struct oshmctl_args; -static int oshmctl(struct thread *td, struct oshmctl_args *uap); -#endif - static int shmget_allocate_segment(struct thread *td, struct shmget_args *uap, int mode); static int shmget_existing(struct thread *td, struct shmget_args *uap, int mode, int segnum); -#if defined(__i386__) && (defined(COMPAT_FREEBSD4) || defined(COMPAT_43)) -/* XXX casting to (sy_call_t *) is bogus, as usual. */ -static sy_call_t *shmcalls[] = { - (sy_call_t *)shmat, (sy_call_t *)oshmctl, - (sy_call_t *)shmdt, (sy_call_t *)shmget, - (sy_call_t *)shmctl -}; -#endif - #define SHMSEG_FREE 0x0200 #define SHMSEG_REMOVED 0x0400 #define SHMSEG_ALLOCATED 0x0800 @@ -447,78 +433,6 @@ shmat(td, uap) return kern_shmat(td, uap->shmid, uap->shmaddr, uap->shmflg); } -#if defined(__i386__) && (defined(COMPAT_FREEBSD4) || defined(COMPAT_43)) -struct oshmid_ds { - struct ipc_perm shm_perm; /* operation perms */ - int shm_segsz; /* size of segment (bytes) */ - u_short shm_cpid; /* pid, creator */ - u_short shm_lpid; /* pid, last operation */ - short shm_nattch; /* no. of current attaches */ - time_t shm_atime; /* last attach time */ - time_t shm_dtime; /* last detach time */ - time_t shm_ctime; /* last change time */ - void *shm_handle; /* internal handle for shm segment */ -}; - -struct oshmctl_args { - int shmid; - int cmd; - struct oshmid_ds *ubuf; -}; -static int -oshmctl(td, uap) - struct thread *td; - struct oshmctl_args *uap; -{ -#ifdef COMPAT_43 - int error = 0; - struct shmid_kernel *shmseg; - struct oshmid_ds outbuf; - - if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) - return (ENOSYS); - mtx_lock(&Giant); - shmseg = shm_find_segment_by_shmid(uap->shmid); - if (shmseg == NULL) { - error = EINVAL; - goto done2; - } - switch (uap->cmd) { - case IPC_STAT: - error = ipcperm(td, &shmseg->u.shm_perm, IPC_R); - if (error) - goto done2; -#ifdef MAC - error = mac_sysvshm_check_shmctl(td->td_ucred, shmseg, uap->cmd); - if (error != 0) - goto done2; -#endif - outbuf.shm_perm = shmseg->u.shm_perm; - outbuf.shm_segsz = shmseg->u.shm_segsz; - outbuf.shm_cpid = shmseg->u.shm_cpid; - outbuf.shm_lpid = shmseg->u.shm_lpid; - outbuf.shm_nattch = shmseg->u.shm_nattch; - outbuf.shm_atime = shmseg->u.shm_atime; - outbuf.shm_dtime = shmseg->u.shm_dtime; - outbuf.shm_ctime = shmseg->u.shm_ctime; - outbuf.shm_handle = shmseg->u.shm_internal; - error = copyout(&outbuf, uap->ubuf, sizeof(outbuf)); - if (error) - goto done2; - break; - default: - error = shmctl(td, (struct shmctl_args *)uap); - break; - } -done2: - mtx_unlock(&Giant); - return (error); -#else - return (EINVAL); -#endif -} -#endif - int kern_shmctl(td, shmid, cmd, buf, bufsz) struct thread *td; @@ -839,34 +753,6 @@ done2: return (error); } -int -shmsys(td, uap) - struct thread *td; - /* XXX actually varargs. */ - struct shmsys_args /* { - int which; - int a2; - int a3; - int a4; - } */ *uap; -{ -#if defined(__i386__) && (defined(COMPAT_FREEBSD4) || defined(COMPAT_43)) - int error; - - if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) - return (ENOSYS); - if (uap->which < 0 || - uap->which >= sizeof(shmcalls)/sizeof(shmcalls[0])) - return (EINVAL); - mtx_lock(&Giant); - error = (*shmcalls[uap->which])(td, &uap->a2); - mtx_unlock(&Giant); - return (error); -#else - return (nosys(td, NULL)); -#endif -} - static void shmfork_myhook(p1, p2) struct proc *p1, *p2; @@ -991,6 +877,112 @@ sysctl_shmsegs(SYSCTL_HANDLER_ARGS) return (SYSCTL_OUT(req, shmsegs, shmalloced * sizeof(shmsegs[0]))); } +#if defined(__i386__) && (defined(COMPAT_FREEBSD4) || defined(COMPAT_43)) +struct oshmid_ds { + struct ipc_perm_old shm_perm; /* operation perms */ + int shm_segsz; /* size of segment (bytes) */ + u_short shm_cpid; /* pid, creator */ + u_short shm_lpid; /* pid, last operation */ + short shm_nattch; /* no. of current attaches */ + time_t shm_atime; /* last attach time */ + time_t shm_dtime; /* last detach time */ + time_t shm_ctime; /* last change time */ + void *shm_handle; /* internal handle for shm segment */ +}; + +struct oshmctl_args { + int shmid; + int cmd; + struct oshmid_ds *ubuf; +}; + +static int +oshmctl(td, uap) + struct thread *td; + struct oshmctl_args *uap; +{ +#ifdef COMPAT_43 + int error = 0; + struct shmid_kernel *shmseg; + struct oshmid_ds outbuf; + + if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) + return (ENOSYS); + mtx_lock(&Giant); + shmseg = shm_find_segment_by_shmid(uap->shmid); + if (shmseg == NULL) { + error = EINVAL; + goto done2; + } + switch (uap->cmd) { + case IPC_STAT: + error = ipcperm(td, &shmseg->u.shm_perm, IPC_R); + if (error) + goto done2; +#ifdef MAC + error = mac_sysvshm_check_shmctl(td->td_ucred, shmseg, uap->cmd); + if (error != 0) + goto done2; +#endif + ipcperm_new2old(&shmseg->u.shm_perm, &outbuf.shm_perm); + outbuf.shm_segsz = shmseg->u.shm_segsz; + outbuf.shm_cpid = shmseg->u.shm_cpid; + outbuf.shm_lpid = shmseg->u.shm_lpid; + outbuf.shm_nattch = shmseg->u.shm_nattch; + outbuf.shm_atime = shmseg->u.shm_atime; + outbuf.shm_dtime = shmseg->u.shm_dtime; + outbuf.shm_ctime = shmseg->u.shm_ctime; + outbuf.shm_handle = shmseg->object; + error = copyout(&outbuf, uap->ubuf, sizeof(outbuf)); + if (error) + goto done2; + break; + default: + error = freebsd7_shmctl(td, (struct shmctl_args *)uap); + break; + } +done2: + mtx_unlock(&Giant); + return (error); +#else + return (EINVAL); +#endif +} + +/* XXX casting to (sy_call_t *) is bogus, as usual. */ +static sy_call_t *shmcalls[] = { + (sy_call_t *)shmat, (sy_call_t *)oshmctl, + (sy_call_t *)shmdt, (sy_call_t *)shmget, + (sy_call_t *)shmctl +}; + +int +shmsys(td, uap) + struct thread *td; + /* XXX actually varargs. */ + struct shmsys_args /* { + int which; + int a2; + int a3; + int a4; + } */ *uap; +{ + int error; + + if (!prison_allow(td->td_ucred, PR_ALLOW_SYSVIPC)) + return (ENOSYS); + if (uap->which < 0 || + uap->which >= sizeof(shmcalls)/sizeof(shmcalls[0])) + return (EINVAL); + mtx_lock(&Giant); + error = (*shmcalls[uap->which])(td, &uap->a2); + mtx_unlock(&Giant); + return (error); +} + +SYSCALL_MODULE_HELPER(shmsys); +#endif /* i386 && (COMPAT_FREEBSD4 || COMPAT_43) */ + static int sysvshm_modload(struct module *module, int cmd, void *arg) { @@ -1018,7 +1010,6 @@ static moduledata_t sysvshm_mod = { NULL }; -SYSCALL_MODULE_HELPER(shmsys); SYSCALL_MODULE_HELPER(shmat); SYSCALL_MODULE_HELPER(shmctl); SYSCALL_MODULE_HELPER(shmdt); From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 20:06:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13412106564A; Wed, 24 Jun 2009 20:06:17 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01ACA8FC13; Wed, 24 Jun 2009 20:06:17 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OK6GCj027060; Wed, 24 Jun 2009 20:06:16 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OK6GGF027058; Wed, 24 Jun 2009 20:06:16 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906242006.n5OK6GGF027058@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 20:06:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194895 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 20:06:17 -0000 Author: rwatson Date: Wed Jun 24 20:06:16 2009 New Revision: 194895 URL: http://svn.freebsd.org/changeset/base/194895 Log: Remove kernel SLIP and PPP privileges, since they are no longer used. Suggested by: bz Modified: head/sys/sys/priv.h Modified: head/sys/sys/priv.h ============================================================================== --- head/sys/sys/priv.h Wed Jun 24 20:01:13 2009 (r194894) +++ head/sys/sys/priv.h Wed Jun 24 20:06:16 2009 (r194895) @@ -308,8 +308,8 @@ */ #define PRIV_NET_BRIDGE 390 /* Administer bridge. */ #define PRIV_NET_GRE 391 /* Administer GRE. */ -#define PRIV_NET_PPP 392 /* Administer PPP. */ -#define PRIV_NET_SLIP 393 /* Administer SLIP. */ +#define _PRIV_NET_PPP 392 /* Removed. */ +#define _PRIV_NET_SLIP 393 /* Removed. */ #define PRIV_NET_BPF 394 /* Monitor BPF. */ #define PRIV_NET_RAW 395 /* Open raw socket. */ #define PRIV_NET_ROUTE 396 /* Administer routing. */ From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 20:22:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 823D21065725; Wed, 24 Jun 2009 20:22:55 +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 149C68FC08; Wed, 24 Jun 2009 20:22:55 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OKMs8Z027537; Wed, 24 Jun 2009 20:22:54 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OKMs5G027535; Wed, 24 Jun 2009 20:22:54 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200906242022.n5OKMs5G027535@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 24 Jun 2009 20:22: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: r194897 - head/tools/regression/bin/sh/builtins X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 20:22:57 -0000 Author: jilles Date: Wed Jun 24 20:22:54 2009 New Revision: 194897 URL: http://svn.freebsd.org/changeset/base/194897 Log: Add test for r190698. Submitted by: Eygene Ryabinkin Approved by: ed (mentor) (implicit) Added: head/tools/regression/bin/sh/builtins/eval2.0 (contents, props changed) Added: head/tools/regression/bin/sh/builtins/eval2.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/builtins/eval2.0 Wed Jun 24 20:22:54 2009 (r194897) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +eval ' +false + +' && exit 1 +exit 0 From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 20:43:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C2386106564A; Wed, 24 Jun 2009 20:43:51 +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 B09118FC0A; Wed, 24 Jun 2009 20:43:51 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OKhplp028441; Wed, 24 Jun 2009 20:43:51 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OKhpLH028439; Wed, 24 Jun 2009 20:43:51 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200906242043.n5OKhpLH028439@svn.freebsd.org> From: Alexander Motin Date: Wed, 24 Jun 2009 20:43: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: r194900 - head/sys/dev/hptmv X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 20:43:52 -0000 Author: mav Date: Wed Jun 24 20:43:51 2009 New Revision: 194900 URL: http://svn.freebsd.org/changeset/base/194900 Log: MFp4: Remove unused ATAPI definitions, conflicting with ata.h. Submitted by: scottl Modified: head/sys/dev/hptmv/atapi.h Modified: head/sys/dev/hptmv/atapi.h ============================================================================== --- head/sys/dev/hptmv/atapi.h Wed Jun 24 20:40:10 2009 (r194899) +++ head/sys/dev/hptmv/atapi.h Wed Jun 24 20:43:51 2009 (r194900) @@ -180,200 +180,6 @@ typedef struct _IDE_REGISTERS_2 { #define MSNS_WRITE_PROTECT 0x40 #define MSNS_READ_PROTECT 0x80 -/*************************************************************************** - * ATAPI IO Register File - ***************************************************************************/ - -/* - * ATAPI register definition - */ - -typedef struct _ATAPI_REGISTERS_1 { - USHORT Data; - UCHAR InterruptReason; /* Atapi Phase Port */ - UCHAR Unused1; - UCHAR ByteCountLow; /* Byte Count LSB */ - UCHAR ByteCountHigh; /* Byte Count MSB */ - UCHAR DriveSelect; - UCHAR Command; -} ATAPI_REGISTERS_1, *PATAPI_REGISTERS_1; - -/* - * Atapi Error Status - */ -#define IDE_ERROR_END_OF_MEDIA IDE_ERROR_TRACK0_NOT_FOUND -#define IDE_ERROR_ILLEGAL_LENGTH IDE_ERROR_ADDRESS_NOT_FOUND - -/* - * ATAPI interrupt reasons - */ -#define ATAPI_IR_COD 0x01 -#define ATAPI_IR_IO 0x02 - -/* sense key */ -#define ATAPI_SENSE_NO_SENSE 0x00 -#define ATAPI_SENSE_RECOVERED_ERROR 0x01 -#define ATAPI_SENSE_NOT_READY 0x02 -#define ATAPI_SENSE_MEDIUM_ERROR 0x03 -#define ATAPI_SENSE_HARDWARE_ERROR 0x04 -#define ATAPI_SENSE_ILLEGAL_REQUEST 0x05 -#define ATAPI_SENSE_UNIT_ATTENTION 0x06 -#define ATAPI_SENSE_DATA_PROTECT 0x07 -#define ATAPI_SENSE_BLANK_CHECK 0x08 -#define ATAPI_SENSE_UNIQUE 0x09 -#define ATAPI_SENSE_COPY_ABORTED 0x0A -#define ATAPI_SENSE_ABORTED_COMMAND 0x0B -#define ATAPI_SENSE_EQUAL 0x0C -#define ATAPI_SENSE_VOL_OVERFLOW 0x0D -#define ATAPI_SENSE_MISCOMPARE 0x0E -#define ATAPI_SENSE_RESERVED 0x0F - -/* Additional Sense codes */ -#define ATAPI_ASC_NO_SENSE 0x00 -#define ATAPI_ASC_LUN_NOT_READY 0x04 -#define ATAPI_ASC_TRACK_ERROR 0x14 -#define ATAPI_ASC_SEEK_ERROR 0x15 -#define ATAPI_ASC_REC_DATA_NOECC 0x17 -#define ATAPI_ASC_REC_DATA_ECC 0x18 -#define ATAPI_ASC_ILLEGAL_COMMAND 0x20 -#define ATAPI_ASC_ILLEGAL_BLOCK 0x21 -#define ATAPI_ASC_INVALID_CDB 0x24 -#define ATAPI_ASC_INVALID_LUN 0x25 -#define ATAPI_ASC_PROTECT 0x27 -#define ATAPI_ASC_MEDIUM_CHANGED 0x28 -#define ATAPI_ASC_BUS_RESET 0x29 -#define ATAPI_ASC_NO_MEDIA_IN_DEVICE 0x3a -#define ATAPI_ASC_MUSIC_AREA 0xA0 -#define ATAPI_ASC_DATA_AREA 0xA1 -#define ATAPI_ASC_VOLUME_OVERFLOW 0xA7 - -/* - * IDE command definitions ( for ATAPI ) - */ - -#define IDE_COMMAND_ATAPI_RESET 0x08 /* Atapi Software Reset command */ -#define IDE_COMMAND_ATAPI_PACKET 0xA0 /* Atapi Identify command */ -#define IDE_COMMAND_ATAPI_IDENTIFY 0xA1 /* Atapi Packet Command */ - - -/* - * ATAPI command definitions - */ - -#define ATAPI_TEST_UNIT_READY 0x00 -#define ATAPI_REZERO_UNIT 0x01 -#define ATAPI_REQUEST_SENSE 0x03 -#define ATAPI_FORMAT_UNIT6 0x04 -#define ATAPI_FORMAT_UNIT 0x24 -#define ATAPI_INQUIRY 0x12 -#define ATAPI_MODE_SELECT 0x15 -#define ATAPI_RELEASE6 0x17 -#define ATAPI_MODE_SENSE 0x1A -#define ATAPI_START_STOP_UNIT 0x1B -#define ATAPI_LOAD_UNLOAD 0x1B -#define ATAPI_RECEIVE_DIAGNOSTIC 0x1C -#define ATAPI_SEND_DIAGNOSTIC 0x1D -#define ATAPI_MEDIUM_REMOVAL 0x1E -#define ATAPI_READ_FORMAT_CAPACITY 0x23 -#define ATAPI_READ_CAPACITY 0x25 -#define ATAPI_READ 0x28 -#define ATAPI_WRITE 0x2A -#define ATAPI_SEEK 0x2B -#define ATAPI_ERASE 0x2C -#define ATAPI_VERIFY 0x2F -#define ATAPI_WRITE_VERIFY 0x2E -#define ATAPI_SYNCHRONIZE_CACHE 0x35 -#define ATAPI_LOCK_CACHE 0x36 -#define ATAPI_COMPARE 0x39 -#define ATAPI_WRITE_BUFFER 0x3B -#define ATAPI_READ_DATA_BUFF 0x3C -#define ATAPI_READ_SUB_CHANNEL 0x42 -#define ATAPI_READ_TOC 0x43 -#define ATAPI_READ_HEADER 0x44 -#define ATAPI_PLAY_AUDIO10 0x45 -#define ATAPI_GET_CONFIGURATION 0x46 -#define ATAPI_PLAY_AUDIO_MSF 0x47 -#define ATAPI_GET_EVENT_STATUS_NOTIFICATION 0x4A -#define ATAPI_PAUSE_RESUME 0x4B -#define ATAPI_LOG_SELECT 0x4C -#define ATAPI_LOG_SENSE 0x4D -#define ATAPI_STOP_PLAY_SCAN 0x4E -#define ATAPI_READ_DISK_INFORMATION 0x51 -#define ATAPI_READ_TRACK_INFORMATION 0x52 -#define ATAPI_RESERVE_TRACK_RZONE 0x53 -#define ATAPI_SEND_OPC_INFORMATION 0x54 -#define ATAPI_MODE_SELECT10 0x55 -#define ATAPI_RELEASE10 0x57 -#define ATAPI_REPAIR_ZONE 0x58 -#define ATAPI_MODE_SENSE10 0x5A -#define ATAPI_CLOSE_TRACK_SESSION 0x5B -#define ATAPI_READ_BUFFER_CAPACITY 0x5C -#define ATAPI_SEND_CUE_SHEET 0x5D -#define ATAPI_BLANK_COMMAND 0xA1 /*Provide the ability to erase any part of a CD-RW disc.*/ -#define ATAPI_SEND_EVENT 0xA2 /* add for DVD */ -#define ATAPI_SEND_KEY 0xA3 /* add for DVD */ -#define ATAPI_REPORT_KEY 0xA4 -#define ATAPI_PLAY_AUDIO 0xA5 -#define ATAPI_LOAD_UNLOAD_MEDIUM 0xA6 -#define ATAPI_SET_READ_AHEAD 0xA7 -#define ATAPI_READ12 0xA8 -#define ATAPI_READ_DVD_STRUCTURE 0xAD -#define ATAPI_WRITE12 0xAA -#define ATAPI_GET_PERFORM_NOTIFICATION 0xAC /* add for DVD-RW */ -#define ATAPI_SET_STREAM 0xB6 /* add for DVD-RW */ -#define ATAPI_READ_CD_MSF 0xB9 -#define ATAPI_SCAN 0xBA -#define ATAPI_SET_SPEED 0xBB /* no payload */ -#define ATAPI_MECHANISM_STATUS 0xBD -#define ATAPI_READ_CD 0xBE -#define ATAPI_SEND_DVD_STRUCTURE 0xBF -#define ATAPI_SET_CDRW_SPEED 0xDA /*WindowsXP need*/ - -#define MODE_DSP_WRITE_PROTECT 0x80 - - -/*************************************************************************** - * ATAPI IO Register File - ***************************************************************************/ - - -typedef struct _ATAPI_REGISTERS_2 { - UCHAR AlternateStatus; -} ATAPI_REGISTERS_2, *PATAPI_REGISTERS_2; - - -/*************************************************************************** - * ATAPI packets - ***************************************************************************/ -typedef struct _ATAPI_SENSE_DATA { -#ifdef __BIG_ENDIAN_BITFIELD - UCHAR Valid:1; - UCHAR ErrorCode:7; - UCHAR SegmentNumber; - UCHAR FileMark:1; - UCHAR EndOfMedia:1; - UCHAR IncorrectLength:1; - UCHAR Reserved:1; - UCHAR SenseKey:4; -#else - UCHAR ErrorCode:7; - UCHAR Valid:1; - UCHAR SegmentNumber; - UCHAR SenseKey:4; - UCHAR Reserved:1; - UCHAR IncorrectLength:1; - UCHAR EndOfMedia:1; - UCHAR FileMark:1; -#endif - UCHAR Information[4]; - UCHAR AdditionalSenseLength; - UCHAR CommandSpecificInformation[4]; - UCHAR AdditionalSenseCode; - UCHAR AdditionalSenseCodeQualifier; - UCHAR FieldReplaceableUnitCode; - UCHAR SenseKeySpecific[3]; -} ATAPI_SENSE_DATA, *PATAPI_SENSE_DATA; - /* * IDENTIFY data */ @@ -580,6 +386,3 @@ typedef enum _DISK_MODE #pragma pack() #endif - - - From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 20:49:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C90251065670; Wed, 24 Jun 2009 20:49:02 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B6F568FC27; Wed, 24 Jun 2009 20:49:02 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OKn2k0028587; Wed, 24 Jun 2009 20:49:02 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OKn2U5028585; Wed, 24 Jun 2009 20:49:02 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200906242049.n5OKn2U5028585@svn.freebsd.org> From: Marius Strobl Date: Wed, 24 Jun 2009 20:49: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: r194901 - head/sys/sparc64/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 20:49:03 -0000 Author: marius Date: Wed Jun 24 20:49:02 2009 New Revision: 194901 URL: http://svn.freebsd.org/changeset/base/194901 Log: o merge from amd64: - r187144: Add a reference to the config(5) manpage and to the "env" kernel config option. - Add/enable the default USB drivers. Originally the USB controller and keyboard drivers were disabled as these interacted badly with the Open Firmware console driver, i.e. caused the keyboard to not work with ofw_console(4). Even when switch to uart(4) and the frame buffer drivers most of the USB drivers still were kept disabled as several of them, amongst others all of the drivers for USB Ethernet controllers, weren't endian clean. With the new USB stack these problem should be gone now so there's no longer a reason to not include the same set of USB drivers amd64 does. o Remove the commented out device ofw_console; apart from it being currently broken by some TTY changes one really needs to know how to actually enable and make it work correctly. Modified: head/sys/sparc64/conf/GENERIC Modified: head/sys/sparc64/conf/GENERIC ============================================================================== --- head/sys/sparc64/conf/GENERIC Wed Jun 24 20:43:51 2009 (r194900) +++ head/sys/sparc64/conf/GENERIC Wed Jun 24 20:49:02 2009 (r194901) @@ -1,8 +1,8 @@ # # GENERIC -- Generic kernel configuration file for FreeBSD/sparc64 # -# For more information on this file, please read the handbook section on -# Kernel Configuration Files: +# For more information on this file, please read the config(5) manual page, +# and/or the handbook section on Kernel Configuration Files: # # http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html # @@ -16,8 +16,6 @@ # If you are in doubt as to the purpose or necessity of a line, check first # in NOTES. # -# For hardware specific information check HARDWARE.TXT -# # $FreeBSD$ cpu SUN4U @@ -26,6 +24,12 @@ ident GENERIC # To statically compile in device wiring instead of /boot/device.hints #hints "GENERIC.hints" # Default places to look for devices. +# Use the following to compile in values accessible to the kernel +# through getenv() (or kenv(1) in userland). The format of the file +# is 'variable=value', see kenv(1) +# +# env "GENERIC.env" + makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols # Platforms supported @@ -76,7 +80,7 @@ options INVARIANT_SUPPORT # Extra sanit options WITNESS # Enable checks to detect deadlocks and cycles options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed -# To make an SMP kernel, the next line is needed +# Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel # Standard busses @@ -138,8 +142,6 @@ device machfb # ATI Mach64 framebuffer device splash # Splash screen and screen saver support options KBD_INSTALL_CDEV # install a CDEV entry in /dev -#device ofw_console # Open Firmware console device - # Builtin hardware device auxio # auxiliary I/O device device eeprom # eeprom (really a front-end for the MK48Txx) @@ -201,6 +203,7 @@ options IEEE80211_AMPDU_AGE # age frame device wlan_wep # 802.11 WEP support device wlan_ccmp # 802.11 CCMP support device wlan_tkip # 802.11 TKIP support +device wlan_amrr # AMRR transmit rate control algorithm device ath # Atheros pci/cardbus NIC's device ath_hal # Atheros HAL (Hardware Access Layer) options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors @@ -223,23 +226,38 @@ device firmware # firmware assist modul device bpf # Berkeley packet filter # USB support -#device uhci # UHCI PCI->USB interface +device uhci # UHCI PCI->USB interface device ohci # OHCI PCI->USB interface +device ehci # EHCI PCI->USB interface (USB 2.0) device usb # USB Bus (required) #device udbp # USB Double Bulk Pipe devices -#device uhid # "Human Interface Devices" +device uhid # "Human Interface Devices" device ukbd # Keyboard -#device ulpt # Printer -#device umass # Disks/Mass storage - Requires scbus and da +device ulpt # Printer +device umass # Disks/Mass storage - Requires scbus and da device ums # Mouse -#device urio # Diamond Rio 500 MP3 player -# USB Ethernet, requires mii -#device aue # ADMtek USB Ethernet -#device axe # ASIX Electronics USB Ethernet -#device cdce # Generic USB over Ethernet -#device cue # CATC USB Ethernet -#device kue # Kawasaki LSI USB Ethernet -#device rue # RealTek RTL8150 USB Ethernet +device rum # Ralink Technology RT2501USB wireless NICs +device uath # Atheros AR5523 wireless NICs +device ural # Ralink Technology RT2500USB wireless NICs +device zyd # ZyDAS zb1211/zb1211b wireless NICs +device urio # Diamond Rio 500 MP3 player +# USB Serial devices +device uark # Technologies ARK3116 based serial adapters +device ubsa # Belkin F5U103 and compatible serial adapters +device uftdi # For FTDI usb serial adapters +device uipaq # Some WinCE based devices +device uplcom # Prolific PL-2303 serial adapters +device uslcom # SI Labs CP2101/CP2102 serial adapters +device uvisor # Visor and Palm devices +device uvscom # USB serial support for DDI pocket's PHS +# USB Ethernet, requires miibus +device aue # ADMtek USB Ethernet +device axe # ASIX Electronics USB Ethernet +device cdce # Generic USB over Ethernet +device cue # CATC USB Ethernet +device kue # Kawasaki LSI USB Ethernet +device rue # RealTek RTL8150 USB Ethernet +device udav # Davicom DM9601E USB # FireWire support device firewire # FireWire bus code From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 20:52:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D1C21065690; Wed, 24 Jun 2009 20:52:37 +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 8B84D8FC14; Wed, 24 Jun 2009 20:52:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OKqbjF028681; Wed, 24 Jun 2009 20:52:37 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OKqb3W028679; Wed, 24 Jun 2009 20:52:37 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200906242052.n5OKqb3W028679@svn.freebsd.org> From: Alexander Motin Date: Wed, 24 Jun 2009 20:52: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: r194902 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 20:52:38 -0000 Author: mav Date: Wed Jun 24 20:52:37 2009 New Revision: 194902 URL: http://svn.freebsd.org/changeset/base/194902 Log: MFp4: Define several ATA capabilies bits. Modified: head/sys/sys/ata.h Modified: head/sys/sys/ata.h ============================================================================== --- head/sys/sys/ata.h Wed Jun 24 20:49:02 2009 (r194901) +++ head/sys/sys/ata.h Wed Jun 24 20:52:37 2009 (r194902) @@ -113,6 +113,9 @@ struct ata_params { #define ATA_SATA_GEN2 0x0004 #define ATA_SUPPORT_NCQ 0x0100 #define ATA_SUPPORT_IFPWRMNGTRCV 0x0200 +#define ATA_SUPPORT_PHYEVENTCNT 0x0400 +#define ATA_SUPPORT_NCQ_UNLOAD 0x0800 +#define ATA_SUPPORT_NCQ_PRIO 0x1000 u_int16_t reserved77; u_int16_t satasupport; From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 20:53:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 478E2106566C; Wed, 24 Jun 2009 20:53:00 +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 35DC28FC1A; Wed, 24 Jun 2009 20:53:00 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OKr02P028722; Wed, 24 Jun 2009 20:53:00 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OKr0dP028720; Wed, 24 Jun 2009 20:53:00 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200906242053.n5OKr0dP028720@svn.freebsd.org> From: Marius Strobl Date: Wed, 24 Jun 2009 20:53:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194903 - head/sys/dev/mpt X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 20:53:00 -0000 Author: marius Date: Wed Jun 24 20:52:59 2009 New Revision: 194903 URL: http://svn.freebsd.org/changeset/base/194903 Log: - Remove unused variables. [1] - Remove redundant zeroing of tmf_req which Coverity Prevent(tm) complains about. [2] Submitted by: Christoph Mallon [1] Found with: Coverity Prevent(tm) [2] CID: 2496 [2] MFC after: 2 weeks Modified: head/sys/dev/mpt/mpt_cam.c Modified: head/sys/dev/mpt/mpt_cam.c ============================================================================== --- head/sys/dev/mpt/mpt_cam.c Wed Jun 24 20:52:37 2009 (r194902) +++ head/sys/dev/mpt/mpt_cam.c Wed Jun 24 20:52:59 2009 (r194903) @@ -884,11 +884,6 @@ mpt_sata_pass_reply_handler(struct mpt_s if (req != NULL) { if (reply_frame != NULL) { - MSG_SATA_PASSTHROUGH_REQUEST *pass; - MSG_SATA_PASSTHROUGH_REPLY *reply; - - pass = (MSG_SATA_PASSTHROUGH_REQUEST *)req->req_vbuf; - reply = (MSG_SATA_PASSTHROUGH_REPLY *)reply_frame; req->IOCStatus = le16toh(reply_frame->IOCStatus); } req->state &= ~REQ_STATE_QUEUED; @@ -1063,7 +1058,7 @@ mpt_read_config_info_spi(struct mpt_soft static int mpt_set_initial_config_spi(struct mpt_softc *mpt) { - int i, j, pp1val = ((1 << mpt->mpt_ini_id) << 16) | mpt->mpt_ini_id; + int i, pp1val = ((1 << mpt->mpt_ini_id) << 16) | mpt->mpt_ini_id; int error; mpt->mpt_disc_enable = 0xff; @@ -1101,15 +1096,11 @@ mpt_set_initial_config_spi(struct mpt_so * all targets back to async/narrow. * * We skip this step if the BIOS has already negotiated - * speeds with the targets and does not require us to - * do Domain Validation. + * speeds with the targets. */ i = mpt->mpt_port_page2.PortSettings & MPI_SCSIPORTPAGE2_PORT_MASK_NEGO_MASTER_SETTINGS; - j = mpt->mpt_port_page2.PortFlags & - MPI_SCSIPORTPAGE2_PORT_FLAGS_DV_MASK; - if (i == MPI_SCSIPORTPAGE2_PORT_ALL_MASTER_SETTINGS /* && - j == MPI_SCSIPORTPAGE2_PORT_FLAGS_OFF_DV */) { + if (i == MPI_SCSIPORTPAGE2_PORT_ALL_MASTER_SETTINGS) { mpt_lprt(mpt, MPT_PRT_NEGOTIATION, "honoring BIOS transfer negotiations\n"); } else { @@ -2602,7 +2593,6 @@ mpt_scsi_reply_handler(struct mpt_softc { MSG_SCSI_IO_REQUEST *scsi_req; union ccb *ccb; - target_id_t tgt; if (req->state == REQ_STATE_FREE) { mpt_prt(mpt, "mpt_scsi_reply_handler: req already free\n"); @@ -2617,7 +2607,6 @@ mpt_scsi_reply_handler(struct mpt_softc return (TRUE); } - tgt = scsi_req->TargetID; mpt_req_untimeout(req, mpt_timeout, ccb); ccb->ccb_h.status &= ~CAM_SIM_QUEUED; @@ -2971,13 +2960,9 @@ mpt_fc_els_reply_handler(struct mpt_soft } if (tgt_req) { mpt_tgt_state_t *tgt = MPT_TGT_STATE(mpt, tgt_req); - uint8_t *vbuf; union ccb *ccb = tgt->ccb; uint32_t ct_id; - vbuf = tgt_req->req_vbuf; - vbuf += MPT_RQSL(mpt); - /* * Check to make sure we have the correct command * The reply descriptor in the target state should @@ -3079,7 +3064,6 @@ mpt_scsi_reply_frame_handler(struct mpt_ MSG_SCSI_IO_REPLY *scsi_io_reply; u_int ioc_status; u_int sstate; - u_int loginfo; MPT_DUMP_REPLY_FRAME(mpt, reply_frame); KASSERT(reply_frame->Function == MPI_FUNCTION_SCSI_IO_REQUEST @@ -3090,7 +3074,6 @@ mpt_scsi_reply_frame_handler(struct mpt_ scsi_io_reply = (MSG_SCSI_IO_REPLY *)reply_frame; ioc_status = le16toh(scsi_io_reply->IOCStatus); - loginfo = ioc_status & MPI_IOCSTATUS_FLAG_LOG_INFO_AVAILABLE; ioc_status &= MPI_IOCSTATUS_MASK; sstate = scsi_io_reply->SCSIState; @@ -4037,16 +4020,11 @@ mpt_scsi_send_tmf(struct mpt_softc *mpt, memset(tmf_req, 0, sizeof(*tmf_req)); tmf_req->TargetID = target; tmf_req->Bus = channel; - tmf_req->ChainOffset = 0; tmf_req->Function = MPI_FUNCTION_SCSI_TASK_MGMT; - tmf_req->Reserved = 0; tmf_req->TaskType = type; - tmf_req->Reserved1 = 0; tmf_req->MsgFlags = flags; tmf_req->MsgContext = htole32(mpt->tmf_req->index | scsi_tmf_handler_id); - memset(&tmf_req->LUN, 0, - sizeof(tmf_req->LUN) + sizeof(tmf_req->Reserved2)); if (lun > 256) { tmf_req->LUN[0] = 0x40 | ((lun >> 8) & 0x3f); tmf_req->LUN[1] = lun & 0xff; From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 20:56:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C5DF106567F; Wed, 24 Jun 2009 20:56:07 +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 1897E8FC0C; Wed, 24 Jun 2009 20:56:07 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OKu7qY028839; Wed, 24 Jun 2009 20:56:07 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OKu7Ql028836; Wed, 24 Jun 2009 20:56:07 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200906242056.n5OKu7Ql028836@svn.freebsd.org> From: Marius Strobl Date: Wed, 24 Jun 2009 20:56: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: r194904 - head/sys/dev/cas X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 20:56:08 -0000 Author: marius Date: Wed Jun 24 20:56:06 2009 New Revision: 194904 URL: http://svn.freebsd.org/changeset/base/194904 Log: - Change this driver to do taskqueue(9) based TX and interrupt handling in order to reduce interrupt overhead which results in better performance. - Call ether_ifdetach(9) before stopping the controller and the callouts detach in order to prevent active BPF listeners to clear promiscuous mode which may lead to the tick callout being restarted which will trigger a panic once it's actually gone. - Add explicit IFF_DRV_RUNNING checking in order to prevent extra link up/down events when using dhclient(8). - Use the correct macro for deciding whether 2/3 of the available TX descriptors are used. - Wrap the RX fault printing in #ifdef CAS_DEBUG in order to not unnecessarily frighten users and as debugging was the actual intention. Real errors caused by these faults still will be accumulated as input errors. It might be a good idea to later on add driver specific counters for the faults though. Submitted by: yongari (original patch) Modified: head/sys/dev/cas/if_cas.c head/sys/dev/cas/if_casvar.h Modified: head/sys/dev/cas/if_cas.c ============================================================================== --- head/sys/dev/cas/if_cas.c Wed Jun 24 20:52:59 2009 (r194903) +++ head/sys/dev/cas/if_cas.c Wed Jun 24 20:56:06 2009 (r194904) @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #include #include @@ -135,7 +135,8 @@ static void cas_free(void *arg1, void* a static void cas_init(void *xsc); static void cas_init_locked(struct cas_softc *sc); static void cas_init_regs(struct cas_softc *sc); -static void cas_intr(void *v); +static int cas_intr(void *v); +static void cas_intr_task(void *arg, int pending __unused); static int cas_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); static int cas_load_txmbuf(struct cas_softc *sc, struct mbuf **m_head); static int cas_mediachange(struct ifnet *ifp); @@ -159,13 +160,13 @@ static void cas_rxdma_callback(void *xsc int nsegs, int error); static void cas_setladrf(struct cas_softc *sc); static void cas_start(struct ifnet *ifp); -static void cas_start_locked(struct ifnet *ifp); static void cas_stop(struct ifnet *ifp); static void cas_suspend(struct cas_softc *sc); static void cas_tick(void *arg); static void cas_tint(struct cas_softc *sc); +static void cas_tx_task(void *arg, int pending __unused); static inline void cas_txkick(struct cas_softc *sc); -static int cas_watchdog(struct cas_softc *sc); +static void cas_watchdog(struct cas_softc *sc); static devclass_t cas_devclass; @@ -201,7 +202,19 @@ cas_attach(struct cas_softc *sc) IFQ_SET_READY(&ifp->if_snd); callout_init_mtx(&sc->sc_tick_ch, &sc->sc_mtx, 0); - callout_init_mtx(&sc->sc_rx_ch, &sc->sc_mtx, 0); + callout_init(&sc->sc_rx_ch, 1); + /* Create local taskq. */ + TASK_INIT(&sc->sc_intr_task, 0, cas_intr_task, sc); + TASK_INIT(&sc->sc_tx_task, 1, cas_tx_task, ifp); + sc->sc_tq = taskqueue_create_fast("cas_taskq", M_WAITOK, + taskqueue_thread_enqueue, &sc->sc_tq); + if (sc->sc_tq == NULL) { + device_printf(sc->sc_dev, "could not create taskqueue\n"); + error = ENXIO; + goto fail_ifnet; + } + taskqueue_start_threads(&sc->sc_tq, 1, PI_NET, "%s taskq", + device_get_nameunit(sc->sc_dev)); /* Make sure the chip is stopped. */ cas_reset(sc); @@ -211,7 +224,7 @@ cas_attach(struct cas_softc *sc) BUS_SPACE_MAXSIZE, 0, BUS_SPACE_MAXSIZE, 0, NULL, NULL, &sc->sc_pdmatag); if (error != 0) - goto fail_ifnet; + goto fail_taskq; error = bus_dma_tag_create(sc->sc_pdmatag, 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, @@ -422,6 +435,8 @@ cas_attach(struct cas_softc *sc) bus_dma_tag_destroy(sc->sc_rdmatag); fail_ptag: bus_dma_tag_destroy(sc->sc_pdmatag); + fail_taskq: + taskqueue_free(sc->sc_tq); fail_ifnet: if_free(ifp); return (error); @@ -433,13 +448,16 @@ cas_detach(struct cas_softc *sc) struct ifnet *ifp = sc->sc_ifp; int i; + ether_ifdetach(ifp); CAS_LOCK(sc); cas_stop(ifp); CAS_UNLOCK(sc); callout_drain(&sc->sc_tick_ch); callout_drain(&sc->sc_rx_ch); - ether_ifdetach(ifp); + taskqueue_drain(sc->sc_tq, &sc->sc_intr_task); + taskqueue_drain(sc->sc_tq, &sc->sc_tx_task); if_free(ifp); + taskqueue_free(sc->sc_tq); device_delete_child(sc->sc_dev, sc->sc_miibus); for (i = 0; i < CAS_NRXDESC; i++) @@ -586,12 +604,11 @@ static void cas_tick(void *arg) { struct cas_softc *sc = arg; - struct ifnet *ifp; + struct ifnet *ifp = sc->sc_ifp; uint32_t v; CAS_LOCK_ASSERT(sc, MA_OWNED); - ifp = sc->sc_ifp; /* * Unload collision and error counters. */ @@ -622,8 +639,10 @@ cas_tick(void *arg) mii_tick(sc->sc_mii); - if (cas_watchdog(sc) == EJUSTRETURN) - return; + if (sc->sc_txfree != CAS_MAXTXFREE) + cas_tint(sc); + + cas_watchdog(sc); callout_reset(&sc->sc_tick_ch, hz, cas_tick, sc); } @@ -915,6 +934,9 @@ cas_init_locked(struct cas_softc *sc) CAS_LOCK_ASSERT(sc, MA_OWNED); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; + #ifdef CAS_DEBUG CTR2(KTR_CAS, "%s: %s: calling stop", device_get_name(sc->sc_dev), __func__); @@ -994,7 +1016,7 @@ cas_init_locked(struct cas_softc *sc) /* Set up interrupts. */ CAS_WRITE_4(sc, CAS_INTMASK, - ~(CAS_INTR_TX_INT_ME | CAS_INTR_TX_ALL | CAS_INTR_TX_TAG_ERR | + ~(CAS_INTR_TX_INT_ME | CAS_INTR_TX_TAG_ERR | CAS_INTR_RX_DONE | CAS_INTR_RX_BUF_NA | CAS_INTR_RX_TAG_ERR | CAS_INTR_RX_COMP_FULL | CAS_INTR_RX_BUF_AEMPTY | CAS_INTR_RX_COMP_AFULL | CAS_INTR_RX_LEN_MMATCH | @@ -1003,6 +1025,8 @@ cas_init_locked(struct cas_softc *sc) | CAS_INTR_PCS_INT | CAS_INTR_MIF #endif )); + /* Don't clear top level interrupts when CAS_STATUS_ALIAS is read. */ + CAS_WRITE_4(sc, CAS_CLEAR_ALIAS, 0); CAS_WRITE_4(sc, CAS_MAC_RX_MASK, ~CAS_MAC_RX_OVERFLOW); CAS_WRITE_4(sc, CAS_MAC_TX_MASK, ~(CAS_MAC_TX_UNDERRUN | CAS_MAC_TX_MAX_PKT_ERR)); @@ -1240,7 +1264,7 @@ cas_load_txmbuf(struct cas_softc *sc, st CTR3(KTR_CAS, "%s: start of frame at segment %d, TX %d", __func__, seg, nexttx); #endif - if (sc->sc_txwin += nsegs > CAS_NTXSEGS * 2 / 3) { + if (sc->sc_txwin += nsegs > CAS_MAXTXFREE * 2 / 3) { sc->sc_txwin = 0; sc->sc_txdescs[txs->txs_firstdesc].cd_flags |= htole64(cflags | CAS_TD_START_OF_FRAME | CAS_TD_INT_ME); @@ -1351,13 +1375,12 @@ cas_init_regs(struct cas_softc *sc) } static void -cas_start(struct ifnet *ifp) +cas_tx_task(void *arg, int pending __unused) { - struct cas_softc *sc = ifp->if_softc; + struct ifnet *ifp; - CAS_LOCK(sc); - cas_start_locked(ifp); - CAS_UNLOCK(sc); + ifp = (struct ifnet *)arg; + cas_start(ifp); } static inline void @@ -1379,17 +1402,22 @@ cas_txkick(struct cas_softc *sc) } static void -cas_start_locked(struct ifnet *ifp) +cas_start(struct ifnet *ifp) { struct cas_softc *sc = ifp->if_softc; struct mbuf *m; int kicked, ntx; - CAS_LOCK_ASSERT(sc, MA_OWNED); + CAS_LOCK(sc); if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING || (sc->sc_flags & CAS_LINK) == 0) + IFF_DRV_RUNNING || (sc->sc_flags & CAS_LINK) == 0) { + CAS_UNLOCK(sc); return; + } + + if (sc->sc_txfree < CAS_MAXTXFREE / 4) + cas_tint(sc); #ifdef CAS_DEBUG CTR4(KTR_CAS, "%s: %s: txfree %d, txnext %d", @@ -1434,6 +1462,8 @@ cas_start_locked(struct ifnet *ifp) sc->sc_wdog_timer); #endif } + + CAS_UNLOCK(sc); } static void @@ -1530,17 +1560,10 @@ cas_tint(struct cas_softc *sc) #endif if (progress) { - if (sc->sc_txfree == CAS_NTXDESC - 1) - sc->sc_txwin = 0; - - /* - * We freed some descriptors, so reset IFF_DRV_OACTIVE - * and restart. - */ + /* We freed some descriptors, so reset IFF_DRV_OACTIVE. */ ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; if (STAILQ_EMPTY(&sc->sc_txdirtyq)) sc->sc_wdog_timer = 0; - cas_start_locked(ifp); } #ifdef CAS_DEBUG @@ -1554,7 +1577,7 @@ cas_rint_timeout(void *arg) { struct cas_softc *sc = arg; - CAS_LOCK_ASSERT(sc, MA_OWNED); + CAS_LOCK_ASSERT(sc, MA_NOTOWNED); cas_rint(sc); } @@ -1569,7 +1592,7 @@ cas_rint(struct cas_softc *sc) uint32_t rxhead; u_int idx, idx2, len, off, skip; - CAS_LOCK_ASSERT(sc, MA_OWNED); + CAS_LOCK_ASSERT(sc, MA_NOTOWNED); callout_stop(&sc->sc_rx_ch); @@ -1695,9 +1718,7 @@ cas_rint(struct cas_softc *sc) cas_rxcksum(m, CAS_GET(word4, CAS_RC4_TCP_CSUM)); /* Pass it on. */ - CAS_UNLOCK(sc); (*ifp->if_input)(ifp, m); - CAS_LOCK(sc); } else ifp->if_ierrors++; @@ -1781,9 +1802,7 @@ cas_rint(struct cas_softc *sc) cas_rxcksum(m, CAS_GET(word4, CAS_RC4_TCP_CSUM)); /* Pass it on. */ - CAS_UNLOCK(sc); (*ifp->if_input)(ifp, m); - CAS_LOCK(sc); } else ifp->if_ierrors++; @@ -1799,6 +1818,8 @@ cas_rint(struct cas_softc *sc) skip: cas_rxcompinit(&sc->sc_rxcomps[sc->sc_rxcptr]); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + break; } CAS_CDSYNC(sc, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); CAS_WRITE_4(sc, CAS_RX_COMP_TAIL, sc->sc_rxcptr); @@ -1819,7 +1840,7 @@ cas_free(void *arg1, void *arg2) { struct cas_rxdsoft *rxds; struct cas_softc *sc; - u_int idx, locked; + u_int idx; #if __FreeBSD_version < 800016 rxds = arg2; @@ -1837,18 +1858,17 @@ cas_free(void *arg1, void *arg2) * NB: this function can be called via m_freem(9) within * this driver! */ - if ((locked = CAS_LOCK_OWNED(sc)) == 0) - CAS_LOCK(sc); + cas_add_rxdesc(sc, idx); - if (locked == 0) - CAS_UNLOCK(sc); } static inline void cas_add_rxdesc(struct cas_softc *sc, u_int idx) { + u_int locked; - CAS_LOCK_ASSERT(sc, MA_OWNED); + if ((locked = CAS_LOCK_OWNED(sc)) == 0) + CAS_LOCK(sc); bus_dmamap_sync(sc->sc_rdmatag, sc->sc_rxdsoft[idx].rxds_dmamap, BUS_DMASYNC_PREREAD); @@ -1866,13 +1886,19 @@ cas_add_rxdesc(struct cas_softc *sc, u_i CAS_WRITE_4(sc, CAS_RX_KICK, (sc->sc_rxdptr + CAS_NRXDESC - 4) & CAS_NRXDESC_MASK); } + + if (locked == 0) + CAS_UNLOCK(sc); } static void cas_eint(struct cas_softc *sc, u_int status) { + struct ifnet *ifp = sc->sc_ifp; + + CAS_LOCK_ASSERT(sc, MA_NOTOWNED); - sc->sc_ifp->if_ierrors++; + ifp->if_ierrors++; device_printf(sc->sc_dev, "%s: status 0x%x", __func__, status); if ((status & CAS_INTR_PCI_ERROR_INT) != 0) { @@ -1886,21 +1912,43 @@ cas_eint(struct cas_softc *sc, u_int sta } printf("\n"); - cas_init_locked(sc); - cas_start_locked(sc->sc_ifp); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + cas_init(sc); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + taskqueue_enqueue(sc->sc_tq, &sc->sc_tx_task); } -static void +static int cas_intr(void *v) { struct cas_softc *sc = v; + + if (__predict_false((CAS_READ_4(sc, CAS_STATUS_ALIAS) & + CAS_INTR_SUMMARY) == 0)) + return (FILTER_STRAY); + + /* Disable interrupts. */ + CAS_WRITE_4(sc, CAS_INTMASK, 0xffffffff); + taskqueue_enqueue(sc->sc_tq, &sc->sc_intr_task); + + return (FILTER_HANDLED); +} + +static void +cas_intr_task(void *arg, int pending __unused) +{ + struct cas_softc *sc = arg; + struct ifnet *ifp = sc->sc_ifp; uint32_t status, status2; - status = CAS_READ_4(sc, CAS_STATUS); - if (__predict_false((status & CAS_INTR_SUMMARY) == 0)) + CAS_LOCK_ASSERT(sc, MA_NOTOWNED); + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) return; - CAS_LOCK(sc); + status = CAS_READ_4(sc, CAS_STATUS); + if (__predict_false((status & CAS_INTR_SUMMARY) == 0)) + goto done; #ifdef CAS_DEBUG CTR4(KTR_CAS, "%s: %s: cplt %x, status %x", @@ -1941,7 +1989,6 @@ cas_intr(void *v) (CAS_INTR_TX_TAG_ERR | CAS_INTR_RX_TAG_ERR | CAS_INTR_RX_LEN_MMATCH | CAS_INTR_PCI_ERROR_INT)) != 0)) { cas_eint(sc, status); - CAS_UNLOCK(sc); return; } @@ -1968,21 +2015,48 @@ cas_intr(void *v) (CAS_INTR_RX_DONE | CAS_INTR_RX_BUF_NA | CAS_INTR_RX_COMP_FULL | CAS_INTR_RX_BUF_AEMPTY | CAS_INTR_RX_COMP_AFULL)) != 0) { cas_rint(sc); +#ifdef CAS_DEBUG if (__predict_false((status & (CAS_INTR_RX_BUF_NA | CAS_INTR_RX_COMP_FULL | CAS_INTR_RX_BUF_AEMPTY | CAS_INTR_RX_COMP_AFULL)) != 0)) device_printf(sc->sc_dev, "RX fault, status %x\n", status); +#endif } if ((status & - (CAS_INTR_TX_INT_ME | CAS_INTR_TX_ALL | CAS_INTR_TX_DONE)) != 0) + (CAS_INTR_TX_INT_ME | CAS_INTR_TX_ALL | CAS_INTR_TX_DONE)) != 0) { + CAS_LOCK(sc); cas_tint(sc); + CAS_UNLOCK(sc); + } - CAS_UNLOCK(sc); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + else if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + taskqueue_enqueue(sc->sc_tq, &sc->sc_tx_task); + + status = CAS_READ_4(sc, CAS_STATUS_ALIAS); + if (__predict_false((status & CAS_INTR_SUMMARY) != 0)) { + taskqueue_enqueue(sc->sc_tq, &sc->sc_intr_task); + return; + } + + done: + /* Re-enable interrupts. */ + CAS_WRITE_4(sc, CAS_INTMASK, + ~(CAS_INTR_TX_INT_ME | CAS_INTR_TX_TAG_ERR | + CAS_INTR_RX_DONE | CAS_INTR_RX_BUF_NA | CAS_INTR_RX_TAG_ERR | + CAS_INTR_RX_COMP_FULL | CAS_INTR_RX_BUF_AEMPTY | + CAS_INTR_RX_COMP_AFULL | CAS_INTR_RX_LEN_MMATCH | + CAS_INTR_PCI_ERROR_INT +#ifdef CAS_DEBUG + | CAS_INTR_PCS_INT | CAS_INTR_MIF +#endif + )); } -static int +static void cas_watchdog(struct cas_softc *sc) { struct ifnet *ifp = sc->sc_ifp; @@ -2003,7 +2077,7 @@ cas_watchdog(struct cas_softc *sc) #endif if (sc->sc_wdog_timer == 0 || --sc->sc_wdog_timer != 0) - return (0); + return; if ((sc->sc_flags & CAS_LINK) != 0) device_printf(sc->sc_dev, "device timeout\n"); @@ -2012,9 +2086,10 @@ cas_watchdog(struct cas_softc *sc) ++ifp->if_oerrors; /* Try to get more packets going. */ + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; cas_init_locked(sc); - cas_start_locked(ifp); - return (EJUSTRETURN); + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + taskqueue_enqueue(sc->sc_tq, &sc->sc_tx_task); } static void @@ -2378,7 +2453,8 @@ cas_ioctl(struct ifnet *ifp, u_long cmd, case SIOCADDMULTI: case SIOCDELMULTI: CAS_LOCK(sc); - cas_setladrf(sc); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + cas_setladrf(sc); CAS_UNLOCK(sc); break; case SIOCSIFMTU: @@ -2729,7 +2805,7 @@ cas_pci_attach(device_t dev) } if (bus_setup_intr(dev, sc->sc_res[CAS_RES_INTR], INTR_TYPE_NET | - INTR_MPSAFE, NULL, cas_intr, sc, &sc->sc_ih) != 0) { + INTR_MPSAFE, cas_intr, NULL, sc, &sc->sc_ih) != 0) { device_printf(dev, "failed to set up interrupt\n"); cas_detach(sc); goto fail; Modified: head/sys/dev/cas/if_casvar.h ============================================================================== --- head/sys/dev/cas/if_casvar.h Wed Jun 24 20:52:59 2009 (r194903) +++ head/sys/dev/cas/if_casvar.h Wed Jun 24 20:56:06 2009 (r194904) @@ -138,6 +138,9 @@ struct cas_softc { u_char sc_enaddr[ETHER_ADDR_LEN]; struct callout sc_tick_ch; /* tick callout */ struct callout sc_rx_ch; /* delayed RX callout */ + struct task sc_intr_task; + struct task sc_tx_task; + struct taskqueue *sc_tq; u_int sc_wdog_timer; /* watchdog timer */ void *sc_ih; From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 20:57:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C030410656D3; Wed, 24 Jun 2009 20:57:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AD2798FC13; Wed, 24 Jun 2009 20:57:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OKvoL0028919; Wed, 24 Jun 2009 20:57:50 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OKvoZf028913; Wed, 24 Jun 2009 20:57:50 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906242057.n5OKvoZf028913@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 20:57: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: r194905 - head/sys/netipx X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 20:57:51 -0000 Author: rwatson Date: Wed Jun 24 20:57:50 2009 New Revision: 194905 URL: http://svn.freebsd.org/changeset/base/194905 Log: Use queue(9) instead of hand-crafted link lists for the global IPX address list (ipx_ifaddr -> ipx_ifaddrhead), and generally adopt the naming and usage conventions found in netinet. MFC after: 6 weeks Modified: head/sys/netipx/ipx.c head/sys/netipx/ipx_if.h head/sys/netipx/ipx_input.c head/sys/netipx/ipx_outputfl.c head/sys/netipx/ipx_pcb.c Modified: head/sys/netipx/ipx.c ============================================================================== --- head/sys/netipx/ipx.c Wed Jun 24 20:56:06 2009 (r194904) +++ head/sys/netipx/ipx.c Wed Jun 24 20:57:50 2009 (r194905) @@ -85,7 +85,7 @@ __FBSDID("$FreeBSD$"); * The IPX-layer address list is protected by ipx_ifaddr_rw. */ struct rwlock ipx_ifaddr_rw; -struct ipx_ifaddr *ipx_ifaddr; +struct ipx_ifaddrhead ipx_ifaddrhead; static void ipx_ifscrub(struct ifnet *ifp, struct ipx_ifaddr *ia); static int ipx_ifinit(struct ifnet *ifp, struct ipx_ifaddr *ia, @@ -100,7 +100,7 @@ ipx_control(struct socket *so, u_long cm { struct ifreq *ifr = (struct ifreq *)data; struct ipx_aliasreq *ifra = (struct ipx_aliasreq *)data; - struct ipx_ifaddr *ia, *ia_temp, *oia; + struct ipx_ifaddr *ia; struct ifaddr *ifa; int dstIsNew, hostIsNew; int error, priv; @@ -112,9 +112,10 @@ ipx_control(struct socket *so, u_long cm return (EADDRNOTAVAIL); IPX_IFADDR_RLOCK(); - for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) + TAILQ_FOREACH(ia, &ipx_ifaddrhead, ia_link) { if (ia->ia_ifp == ifp) break; + } if (ia != NULL) ifa_ref(&ia->ia_ifa); IPX_IFADDR_RUNLOCK(); @@ -164,7 +165,9 @@ ipx_control(struct socket *so, u_long cm IPX_IFADDR_RLOCK(); if (ifra->ifra_addr.sipx_family == AF_IPX) { - for (oia = ia; ia != NULL; ia = ia->ia_next) { + struct ipx_ifaddr *oia; + + for (oia = ia; ia; ia = TAILQ_NEXT(ia, ia_link)) { if (ia->ia_ifp == ifp && ipx_neteq(ia->ia_addr.sipx_addr, ifra->ifra_addr.sipx_addr)) @@ -205,15 +208,9 @@ ipx_control(struct socket *so, u_long cm ia->ia_broadaddr.sipx_addr.x_host = ipx_broadhost; } - ifa_ref(&ia->ia_ifa); /* ipx_ifaddr */ + ifa_ref(&ia->ia_ifa); /* ipx_ifaddrhead */ IPX_IFADDR_WLOCK(); - if ((ia_temp = ipx_ifaddr) != NULL) { - for (; ia_temp->ia_next != NULL; - ia_temp = ia_temp->ia_next) - ; - ia_temp->ia_next = ia; - } else - ipx_ifaddr = ia; + TAILQ_INSERT_TAIL(&ipx_ifaddrhead, ia, ia_link); IPX_IFADDR_WUNLOCK(); ifa_ref(&ia->ia_ifa); /* if_addrhead */ @@ -262,18 +259,9 @@ ipx_control(struct socket *so, u_long cm ifa_free(ifa); /* if_addrhead */ IPX_IFADDR_WLOCK(); - if (ia == (ia_temp = ipx_ifaddr)) { - ipx_ifaddr = ia->ia_next; - } else { - while (ia_temp->ia_next && (ia_temp->ia_next != ia)) - ia_temp = ia_temp->ia_next; - if (ia_temp->ia_next) - ia_temp->ia_next = ia->ia_next; - else - panic("Didn't unlink ipxifadr from list\n"); - } + TAILQ_REMOVE(&ipx_ifaddrhead, ia, ia_link); IPX_IFADDR_WUNLOCK(); - ifa_free(&ia->ia_ifa); /* ipx_ifaddr */ + ifa_free(&ia->ia_ifa); /* ipx_ifaddrhead */ goto out; case SIOCAIFADDR: @@ -395,7 +383,7 @@ ipx_iaonnetof(struct ipx_addr *dst) IPX_IFADDR_LOCK_ASSERT(); - for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) { + TAILQ_FOREACH(ia, &ipx_ifaddrhead, ia_link) { if ((ifp = ia->ia_ifp) != NULL) { if (ifp->if_flags & IFF_POINTOPOINT) { compare = &satoipx_addr(ia->ia_dstaddr); Modified: head/sys/netipx/ipx_if.h ============================================================================== --- head/sys/netipx/ipx_if.h Wed Jun 24 20:56:06 2009 (r194904) +++ head/sys/netipx/ipx_if.h Wed Jun 24 20:57:50 2009 (r194905) @@ -75,7 +75,7 @@ struct ipx_ifaddr { struct ifaddr ia_ifa; /* protocol-independent info */ #define ia_ifp ia_ifa.ifa_ifp #define ia_flags ia_ifa.ifa_flags - struct ipx_ifaddr *ia_next; /* next in list of ipx addresses */ + TAILQ_ENTRY(ipx_ifaddr) ia_link; /* list of IPv6 addresses */ struct sockaddr_ipx ia_addr; /* reserve space for my address */ struct sockaddr_ipx ia_dstaddr; /* space for my broadcast address */ #define ia_broadaddr ia_dstaddr @@ -88,6 +88,12 @@ struct ipx_aliasreq { struct sockaddr_ipx ifra_broadaddr; #define ifra_dstaddr ifra_broadaddr }; + +/* + * List of ipx_ifaddr's. + */ +TAILQ_HEAD(ipx_ifaddrhead, ipx_ifaddr); + /* * Given a pointer to an ipx_ifaddr (ifaddr), * return a pointer to the addr as a sockadd_ipx. @@ -106,7 +112,7 @@ struct ipx_aliasreq { #ifdef _KERNEL extern struct rwlock ipx_ifaddr_rw; -extern struct ipx_ifaddr *ipx_ifaddr; +extern struct ipx_ifaddrhead ipx_ifaddrhead; #define IPX_IFADDR_LOCK_INIT() rw_init(&ipx_ifaddr_rw, "ipx_ifaddr_rw") #define IPX_IFADDR_LOCK_ASSERT() rw_assert(&ipx_ifaddr_rw, RA_LOCKED) Modified: head/sys/netipx/ipx_input.c ============================================================================== --- head/sys/netipx/ipx_input.c Wed Jun 24 20:56:06 2009 (r194904) +++ head/sys/netipx/ipx_input.c Wed Jun 24 20:57:50 2009 (r194905) @@ -1,7 +1,7 @@ /*- * Copyright (c) 1984, 1985, 1986, 1987, 1993 * The Regents of the University of California. - * Copyright (c) 2004-2005 Robert N. M. Watson + * Copyright (c) 2004-2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -146,6 +146,7 @@ ipx_init(void) LIST_INIT(&ipxpcb_list); LIST_INIT(&ipxrawpcb_list); + TAILQ_INIT(&ipx_ifaddrhead); IPX_LIST_LOCK_INIT(); IPX_IFADDR_LOCK_INIT(); @@ -175,7 +176,7 @@ ipxintr(struct mbuf *m) * If no IPX addresses have been set yet but the interfaces * are receiving, can't do anything with incoming packets yet. */ - if (ipx_ifaddr == NULL) { + if (TAILQ_EMPTY(&ipx_ifaddrhead)) { m_freem(m); return; } @@ -257,13 +258,14 @@ ipxintr(struct mbuf *m) * received from, treat it as ours. */ IPX_IFADDR_RLOCK(); - for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) - if((ia->ia_ifa.ifa_ifp == m->m_pkthdr.rcvif) && - ipx_neteq(ia->ia_addr.sipx_addr, - ipx->ipx_dna)) { + TAILQ_FOREACH(ia, &ipx_ifaddrhead, ia_link) { + if ((ia->ia_ifa.ifa_ifp == m->m_pkthdr.rcvif) + && ipx_neteq(ia->ia_addr.sipx_addr, + ipx->ipx_dna)) { IPX_IFADDR_RUNLOCK(); goto ours; } + } IPX_IFADDR_RUNLOCK(); /* @@ -286,11 +288,12 @@ ipxintr(struct mbuf *m) */ } else { IPX_IFADDR_RLOCK(); - for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) + TAILQ_FOREACH(ia, &ipx_ifaddrhead, ia_link) { if (ipx_hosteq(ipx->ipx_dna, ia->ia_addr.sipx_addr) && (ipx_neteq(ipx->ipx_dna, ia->ia_addr.sipx_addr) || ipx_neteqnn(ipx->ipx_dna.x_net, ipx_zeronet))) break; + } IPX_IFADDR_RUNLOCK(); if (ia == NULL) { ipx_forward(m); Modified: head/sys/netipx/ipx_outputfl.c ============================================================================== --- head/sys/netipx/ipx_outputfl.c Wed Jun 24 20:56:06 2009 (r194904) +++ head/sys/netipx/ipx_outputfl.c Wed Jun 24 20:57:50 2009 (r194905) @@ -179,7 +179,7 @@ ipx_output_type20(struct mbuf *m) { struct ipx *ipx; union ipx_net *nbnet; - struct ipx_ifaddr *ia, *tia = NULL; + struct ipx_ifaddr *ia, *tia; int error = 0; struct mbuf *m1; int i; @@ -204,19 +204,21 @@ ipx_output_type20(struct mbuf *m) /* * Now see if we have already seen this. */ + tia = NULL; IPX_IFADDR_RLOCK(); - for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) - if(ia->ia_ifa.ifa_ifp == m->m_pkthdr.rcvif) { - if(tia == NULL) + TAILQ_FOREACH(ia, &ipx_ifaddrhead, ia_link) { + if (ia->ia_ifa.ifa_ifp == m->m_pkthdr.rcvif) { + if (tia == NULL) tia = ia; - - for (i=0;iipx_tc;i++,nbnet++) - if(ipx_neteqnn(ia->ia_addr.sipx_addr.x_net, - *nbnet)) { + for (i=0; i < ipx->ipx_tc; i++, nbnet++) { + if (ipx_neteqnn(ia->ia_addr.sipx_addr.x_net, + *nbnet)) { IPX_IFADDR_RUNLOCK(); goto bad; } + } } + } /* * Don't route the packet if the interface where it come from @@ -250,12 +252,12 @@ ipx_output_type20(struct mbuf *m) dst.sipx_len = 12; dst.sipx_addr.x_host = ipx_broadhost; - for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) - if(ia->ia_ifa.ifa_ifp != m->m_pkthdr.rcvif) { + TAILQ_FOREACH(ia, &ipx_ifaddrhead, ia_link) { + if (ia->ia_ifa.ifa_ifp != m->m_pkthdr.rcvif) { nbnet = (union ipx_net *)(ipx + 1); - for (i=0;iipx_tc;i++,nbnet++) - if(ipx_neteqnn(ia->ia_addr.sipx_addr.x_net, - *nbnet)) + for (i=0; i < ipx->ipx_tc; i++, nbnet++) + if (ipx_neteqnn(ia->ia_addr.sipx_addr.x_net, + *nbnet)) goto skip_this; /* @@ -276,6 +278,7 @@ ipx_output_type20(struct mbuf *m) } skip_this: ; } + } IPX_IFADDR_RUNLOCK(); bad: Modified: head/sys/netipx/ipx_pcb.c ============================================================================== --- head/sys/netipx/ipx_pcb.c Wed Jun 24 20:56:06 2009 (r194904) +++ head/sys/netipx/ipx_pcb.c Wed Jun 24 20:57:50 2009 (r194905) @@ -1,7 +1,7 @@ /*- * Copyright (c) 1984, 1985, 1986, 1987, 1993 * The Regents of the University of California. - * Copyright (c) 2004-2006 Robert N. M. Watson + * Copyright (c) 2004-2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -223,11 +223,12 @@ ipx_pcbconnect(struct ipxpcb *ipxp, stru */ if (ro->ro_rt != NULL && (ifp = ro->ro_rt->rt_ifp) != NULL) { IPX_IFADDR_RLOCK(); - for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) + TAILQ_FOREACH(ia, &ipx_ifaddrhead, ia_link) { if (ia->ia_ifp == ifp) { ifa_ref(&ia->ia_ifa); break; } + } IPX_IFADDR_RUNLOCK(); } if (ia == NULL) { @@ -245,7 +246,7 @@ ipx_pcbconnect(struct ipxpcb *ipxp, stru } if (ia == NULL) { IPX_IFADDR_RLOCK(); - ia = ipx_ifaddr; + ia = TAILQ_FIRST(&ipx_ifaddrhead); if (ia != NULL) ifa_ref(&ia->ia_ifa); IPX_IFADDR_RUNLOCK(); @@ -269,11 +270,12 @@ ipx_pcbconnect(struct ipxpcb *ipxp, stru */ if (ro->ro_rt != NULL && (ifp = ro->ro_rt->rt_ifp) != NULL) { IPX_IFADDR_RLOCK(); - for (ia = ipx_ifaddr; ia != NULL; ia = ia->ia_next) + TAILQ_FOREACH(ia, &ipx_ifaddrhead, ia_link) { if (ia->ia_ifp == ifp) { ifa_ref(&ia->ia_ifa); break; } + } IPX_IFADDR_RUNLOCK(); } if (ia == NULL) { @@ -291,7 +293,7 @@ ipx_pcbconnect(struct ipxpcb *ipxp, stru } if (ia == NULL) { IPX_IFADDR_RLOCK(); - ia = ipx_ifaddr; + ia = TAILQ_FIRST(&ipx_ifaddrhead); if (ia != NULL) ifa_ref(&ia->ia_ifa); IPX_IFADDR_RUNLOCK(); From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 21:00:14 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05C211065672; Wed, 24 Jun 2009 21:00:14 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E843D8FC17; Wed, 24 Jun 2009 21:00:13 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OL0DQf029045; Wed, 24 Jun 2009 21:00:13 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OL0DgJ029043; Wed, 24 Jun 2009 21:00:13 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <200906242100.n5OL0DgJ029043@svn.freebsd.org> From: Olivier Houchard Date: Wed, 24 Jun 2009 21:00: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: r194906 - head/sys/arm/arm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 21:00:14 -0000 Author: cognet Date: Wed Jun 24 21:00:13 2009 New Revision: 194906 URL: http://svn.freebsd.org/changeset/base/194906 Log: Fix typo. Modified: head/sys/arm/arm/vm_machdep.c Modified: head/sys/arm/arm/vm_machdep.c ============================================================================== --- head/sys/arm/arm/vm_machdep.c Wed Jun 24 20:57:50 2009 (r194905) +++ head/sys/arm/arm/vm_machdep.c Wed Jun 24 21:00:13 2009 (r194906) @@ -483,7 +483,7 @@ arm_ptovirt(vm_paddr_t pa) int i; vm_offset_t addr = alloc_firstaddr; - KASSERT(alloc_firstaddr != 0, ("arm_ptovirt called to early ?")); + KASSERT(alloc_firstaddr != 0, ("arm_ptovirt called too early ?")); for (i = 0; dump_avail[i + 1]; i += 2) { if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) break; From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 21:00:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9117810656C5; Wed, 24 Jun 2009 21:00:25 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7E12E8FC0C; Wed, 24 Jun 2009 21:00:25 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OL0P8j029099; Wed, 24 Jun 2009 21:00:25 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OL0PXA029087; Wed, 24 Jun 2009 21:00:25 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906242100.n5OL0PXA029087@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 21:00: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: r194907 - in head/sys: netinet netinet6 netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 21:00:26 -0000 Author: rwatson Date: Wed Jun 24 21:00:25 2009 New Revision: 194907 URL: http://svn.freebsd.org/changeset/base/194907 Log: Convert netinet6 to using queue(9) rather than hand-crafted linked lists for the global IPv6 address list (in6_ifaddr -> in6_ifaddrhead). Adopt the code styles and conventions present in netinet where possible. Reviewed by: gnn, bz MFC after: 6 weeks (possibly not MFCable?) Modified: head/sys/netinet/ip_carp.c head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_pcb.c head/sys/netinet6/in6_src.c head/sys/netinet6/in6_var.h head/sys/netinet6/ip6_input.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6_rtr.c head/sys/netinet6/vinet6.h head/sys/netipsec/key.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Wed Jun 24 21:00:13 2009 (r194906) +++ head/sys/netinet/ip_carp.c Wed Jun 24 21:00:25 2009 (r194907) @@ -1667,7 +1667,7 @@ carp_set_addr6(struct carp_softc *sc, st /* we have to do it by hands to check we won't match on us */ ia_if = NULL; own = 0; - for (ia = V_in6_ifaddr; ia; ia = ia->ia_next) { + TAILQ_FOREACH(ia6, &V_in6_ifaddrhead, ia_link) { int i; for (i = 0; i < 4; i++) { Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Wed Jun 24 21:00:13 2009 (r194906) +++ head/sys/netinet6/in6.c Wed Jun 24 21:00:25 2009 (r194907) @@ -684,7 +684,6 @@ in6_update_ifa(struct ifnet *ifp, struct { INIT_VNET_INET6(ifp->if_vnet); int error = 0, hostIsNew = 0, plen = -1; - struct in6_ifaddr *oia; struct sockaddr_in6 dst6; struct in6_addrlifetime *lt; struct in6_multi_mship *imm; @@ -826,19 +825,13 @@ in6_update_ifa(struct ifnet *ifp, struct ia->ia_ifa.ifa_dstaddr = NULL; } ia->ia_ifa.ifa_netmask = (struct sockaddr *)&ia->ia_prefixmask; - ia->ia_ifp = ifp; - if ((oia = V_in6_ifaddr) != NULL) { - for ( ; oia->ia_next; oia = oia->ia_next) - continue; - oia->ia_next = ia; - } else - V_in6_ifaddr = ia; - ifa_ref(&ia->ia_ifa); /* if_addrhead */ IF_ADDR_LOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_UNLOCK(ifp); + + TAILQ_INSERT_TAIL(&V_in6_ifaddrhead, ia, ia_link); } /* update timestamp */ @@ -1375,7 +1368,6 @@ static void in6_unlink_ifa(struct in6_ifaddr *ia, struct ifnet *ifp) { INIT_VNET_INET6(ifp->if_vnet); - struct in6_ifaddr *oia; int s = splnet(); IF_ADDR_LOCK(ifp); @@ -1383,31 +1375,19 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st IF_ADDR_UNLOCK(ifp); ifa_free(&ia->ia_ifa); /* if_addrhead */ - oia = ia; - if (oia == (ia = V_in6_ifaddr)) - V_in6_ifaddr = ia->ia_next; - else { - while (ia->ia_next && (ia->ia_next != oia)) - ia = ia->ia_next; - if (ia->ia_next) - ia->ia_next = oia->ia_next; - else { - /* search failed */ - printf("Couldn't unlink in6_ifaddr from in6_ifaddr\n"); - } - } + TAILQ_REMOVE(&V_in6_ifaddrhead, ia, ia_link); /* * Release the reference to the base prefix. There should be a * positive reference. */ - if (oia->ia6_ndpr == NULL) { + if (ia->ia6_ndpr == NULL) { nd6log((LOG_NOTICE, "in6_unlink_ifa: autoconf'ed address " - "%p has no prefix\n", oia)); + "%p has no prefix\n", ia)); } else { - oia->ia6_ndpr->ndpr_refcnt--; - oia->ia6_ndpr = NULL; + ia->ia6_ndpr->ndpr_refcnt--; + ia->ia6_ndpr = NULL; } /* @@ -1415,7 +1395,7 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st * pfxlist_onlink_check() since the release might affect the status of * other (detached) addresses. */ - if ((oia->ia6_flags & IN6_IFF_AUTOCONF)) { + if ((ia->ia6_flags & IN6_IFF_AUTOCONF)) { pfxlist_onlink_check(); } @@ -1423,7 +1403,7 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st * release another refcnt for the link from in6_ifaddr. * Note that we should decrement the refcnt at least once for all *BSD. */ - ifa_free(&oia->ia_ifa); + ifa_free(&ia->ia_ifa); splx(s); } @@ -1941,7 +1921,7 @@ in6_localaddr(struct in6_addr *in6) if (IN6_IS_ADDR_LOOPBACK(in6) || IN6_IS_ADDR_LINKLOCAL(in6)) return 1; - for (ia = V_in6_ifaddr; ia; ia = ia->ia_next) { + TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { if (IN6_ARE_MASKED_ADDR_EQUAL(in6, &ia->ia_addr.sin6_addr, &ia->ia_prefixmask.sin6_addr)) { return 1; @@ -1957,7 +1937,7 @@ in6_is_addr_deprecated(struct sockaddr_i INIT_VNET_INET6(curvnet); struct in6_ifaddr *ia; - for (ia = V_in6_ifaddr; ia; ia = ia->ia_next) { + TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { if (IN6_ARE_ADDR_EQUAL(&ia->ia_addr.sin6_addr, &sa6->sin6_addr) && (ia->ia6_flags & IN6_IFF_DEPRECATED) != 0) Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Wed Jun 24 21:00:13 2009 (r194906) +++ head/sys/netinet6/in6_ifattach.c Wed Jun 24 21:00:25 2009 (r194907) @@ -784,7 +784,7 @@ in6_ifdetach(struct ifnet *ifp) { INIT_VNET_INET(ifp->if_vnet); INIT_VNET_INET6(ifp->if_vnet); - struct in6_ifaddr *ia, *oia; + struct in6_ifaddr *ia; struct ifaddr *ifa, *next; struct radix_node_head *rnh; struct rtentry *rt; @@ -832,27 +832,12 @@ in6_ifdetach(struct ifnet *ifp) /* remove from the linked list */ IF_ADDR_LOCK(ifp); - TAILQ_REMOVE(&ifp->if_addrhead, (struct ifaddr *)ia, ifa_link); + TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); IF_ADDR_UNLOCK(ifp); - ifa_free(&ia->ia_ifa); + ifa_free(ifa); /* if_addrhead */ - /* also remove from the IPv6 address chain(itojun&jinmei) */ - oia = ia; - if (oia == (ia = V_in6_ifaddr)) - V_in6_ifaddr = ia->ia_next; - else { - while (ia->ia_next && (ia->ia_next != oia)) - ia = ia->ia_next; - if (ia->ia_next) - ia->ia_next = oia->ia_next; - else { - nd6log((LOG_ERR, - "%s: didn't unlink in6ifaddr from list\n", - if_name(ifp))); - } - } - - ifa_free(&oia->ia_ifa); + TAILQ_REMOVE(&V_in6_ifaddrhead, ia, ia_link); + ifa_free(ifa); } in6_pcbpurgeif0(&V_udbinfo, ifp); Modified: head/sys/netinet6/in6_pcb.c ============================================================================== --- head/sys/netinet6/in6_pcb.c Wed Jun 24 21:00:13 2009 (r194906) +++ head/sys/netinet6/in6_pcb.c Wed Jun 24 21:00:25 2009 (r194907) @@ -123,7 +123,7 @@ in6_pcbbind(register struct inpcb *inp, INP_INFO_WLOCK_ASSERT(pcbinfo); INP_WLOCK_ASSERT(inp); - if (!V_in6_ifaddr) /* XXX broken! */ + if (TAILQ_EMPTY(&V_in6_ifaddrhead)) /* XXX broken! */ return (EADDRNOTAVAIL); if (inp->inp_lport || !IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) return (EINVAL); @@ -313,7 +313,7 @@ in6_pcbladdr(register struct inpcb *inp, if ((error = sa6_embedscope(sin6, V_ip6_use_defzone)) != 0) return(error); - if (V_in6_ifaddr) { + if (!TAILQ_EMPTY(&V_in6_ifaddrhead)) { /* * If the destination address is UNSPECIFIED addr, * use the loopback addr, e.g ::1. Modified: head/sys/netinet6/in6_src.c ============================================================================== --- head/sys/netinet6/in6_src.c Wed Jun 24 21:00:13 2009 (r194906) +++ head/sys/netinet6/in6_src.c Wed Jun 24 21:00:25 2009 (r194907) @@ -289,7 +289,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso if (error) return (error); - for (ia = V_in6_ifaddr; ia; ia = ia->ia_next) { + TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { int new_scope = -1, new_matchlen = -1; struct in6_addrpolicy *new_policy = NULL; u_int32_t srczone, osrczone, dstzone; Modified: head/sys/netinet6/in6_var.h ============================================================================== --- head/sys/netinet6/in6_var.h Wed Jun 24 21:00:13 2009 (r194906) +++ head/sys/netinet6/in6_var.h Wed Jun 24 21:00:25 2009 (r194907) @@ -117,7 +117,7 @@ struct in6_ifaddr { struct sockaddr_in6 ia_dstaddr; /* space for destination addr */ struct sockaddr_in6 ia_prefixmask; /* prefix mask */ u_int32_t ia_plen; /* prefix length */ - struct in6_ifaddr *ia_next; /* next in6 list of IP6 addresses */ + TAILQ_ENTRY(in6_ifaddr) ia_link; /* list of IPv6 addresses */ int ia6_flags; struct in6_addrlifetime ia6_lifetime; @@ -133,6 +133,9 @@ struct in6_ifaddr { LIST_HEAD(, in6_multi_mship) ia6_memberships; }; +/* List of in6_ifaddr's. */ +TAILQ_HEAD(in6_ifaddrhead, in6_ifaddr); + /* control structure to manage address selection policy */ struct in6_addrpolicy { struct sockaddr_in6 addr; /* prefix address */ Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Wed Jun 24 21:00:13 2009 (r194906) +++ head/sys/netinet6/ip6_input.c Wed Jun 24 21:00:25 2009 (r194907) @@ -134,7 +134,7 @@ struct vnet_inet6 vnet_inet6_0; #endif #ifdef VIMAGE_GLOBALS -struct in6_ifaddr *in6_ifaddr; +struct in6_ifaddrhead in6_ifaddrhead; struct ip6stat ip6stat; extern struct callout in6_tmpaddrtimer_ch; @@ -257,6 +257,8 @@ ip6_init(void) /* 40 1K datagrams */ V_dad_init = 0; + TAILQ_INIT(&V_in6_ifaddrhead); + scope6_init(); addrsel_policy_init(); nd6_init(); Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Wed Jun 24 21:00:13 2009 (r194906) +++ head/sys/netinet6/nd6.c Wed Jun 24 21:00:25 2009 (r194907) @@ -626,8 +626,7 @@ nd6_timer(void *arg) * rather separate address lifetimes and prefix lifetimes. */ addrloop: - for (ia6 = V_in6_ifaddr; ia6; ia6 = nia6) { - nia6 = ia6->ia_next; + TAILQ_FOREACH_SAFE(ia6, &V_in6_ifaddrhead, ia_link, nia6) { /* check address lifetime */ lt6 = &ia6->ia6_lifetime; if (IFA6_IS_INVALID(ia6)) { @@ -1329,10 +1328,8 @@ nd6_ioctl(u_long cmd, caddr_t data, stru continue; /* XXX */ /* do we really have to remove addresses as well? */ - for (ia = V_in6_ifaddr; ia; ia = ia_next) { - /* ia might be removed. keep the next ptr. */ - ia_next = ia->ia_next; - + TAILQ_FOREACH_SAFE(ia, &V_in6_ifaddrhead, ia_link, + ia_next) { if ((ia->ia6_flags & IN6_IFF_AUTOCONF) == 0) continue; Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Wed Jun 24 21:00:13 2009 (r194906) +++ head/sys/netinet6/nd6_rtr.c Wed Jun 24 21:00:25 2009 (r194907) @@ -1501,7 +1501,7 @@ pfxlist_onlink_check() * always be attached. * The precise detection logic is same as the one for prefixes. */ - for (ifa = V_in6_ifaddr; ifa; ifa = ifa->ia_next) { + TAILQ_FOREACH(ifa, &V_in6_ifaddrhead, ia_link) { if (!(ifa->ia6_flags & IN6_IFF_AUTOCONF)) continue; @@ -1518,7 +1518,7 @@ pfxlist_onlink_check() break; } if (ifa) { - for (ifa = V_in6_ifaddr; ifa; ifa = ifa->ia_next) { + TAILQ_FOREACH(ifa, &V_in6_ifaddrhead, ia_link) { if ((ifa->ia6_flags & IN6_IFF_AUTOCONF) == 0) continue; @@ -1537,7 +1537,7 @@ pfxlist_onlink_check() } } else { - for (ifa = V_in6_ifaddr; ifa; ifa = ifa->ia_next) { + TAILQ_FOREACH(ifa, &V_in6_ifaddrhead, ia_link) { if ((ifa->ia6_flags & IN6_IFF_AUTOCONF) == 0) continue; @@ -1949,7 +1949,7 @@ in6_tmpifadd(const struct in6_ifaddr *ia * there may be a time lag between generation of the ID and generation * of the address. So, we'll do one more sanity check. */ - for (ia = V_in6_ifaddr; ia; ia = ia->ia_next) { + TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { if (IN6_ARE_ADDR_EQUAL(&ia->ia_addr.sin6_addr, &ifra.ifra_addr.sin6_addr)) { if (trylimit-- == 0) { Modified: head/sys/netinet6/vinet6.h ============================================================================== --- head/sys/netinet6/vinet6.h Wed Jun 24 21:00:13 2009 (r194906) +++ head/sys/netinet6/vinet6.h Wed Jun 24 21:00:25 2009 (r194907) @@ -48,7 +48,7 @@ #include struct vnet_inet6 { - struct in6_ifaddr * _in6_ifaddr; + struct in6_ifaddrhead _in6_ifaddrhead; u_int _frag6_nfragpackets; u_int _frag6_nfrags; @@ -189,7 +189,7 @@ extern struct vnet_inet6 vnet_inet6_0; #define V_icmp6errppslim VNET_INET6(icmp6errppslim) #define V_icmp6errppslim_last VNET_INET6(icmp6errppslim_last) #define V_icmp6stat VNET_INET6(icmp6stat) -#define V_in6_ifaddr VNET_INET6(in6_ifaddr) +#define V_in6_ifaddrhead VNET_INET6(in6_ifaddrhead) #define V_in6_maxmtu VNET_INET6(in6_maxmtu) #define V_in6_tmpaddrtimer_ch VNET_INET6(in6_tmpaddrtimer_ch) #define V_interface_timers_running6 \ Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Wed Jun 24 21:00:13 2009 (r194906) +++ head/sys/netipsec/key.c Wed Jun 24 21:00:25 2009 (r194907) @@ -3979,7 +3979,7 @@ key_ismyaddr6(sin6) struct in6_multi *in6m; #endif - for (ia = V_in6_ifaddr; ia; ia = ia->ia_next) { + TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { if (key_sockaddrcmp((struct sockaddr *)&sin6, (struct sockaddr *)&ia->ia_addr, 0) == 0) return 1; From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 21:04:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 680D71065670; Wed, 24 Jun 2009 21:04:01 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B5A18FC19; Wed, 24 Jun 2009 21:04:01 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OL3xwg029205; Wed, 24 Jun 2009 21:03:59 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OL3xbb029203; Wed, 24 Jun 2009 21:03:59 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <200906242103.n5OL3xbb029203@svn.freebsd.org> From: Olivier Houchard Date: Wed, 24 Jun 2009 21:03:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194908 - head/sys/arm/arm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 21:04:02 -0000 Author: cognet Date: Wed Jun 24 21:03:59 2009 New Revision: 194908 URL: http://svn.freebsd.org/changeset/base/194908 Log: Fix typo. Modified: head/sys/arm/arm/pmap.c Modified: head/sys/arm/arm/pmap.c ============================================================================== --- head/sys/arm/arm/pmap.c Wed Jun 24 21:00:25 2009 (r194907) +++ head/sys/arm/arm/pmap.c Wed Jun 24 21:03:59 2009 (r194908) @@ -2947,7 +2947,7 @@ pmap_kenter_user(vm_offset_t va, vm_padd } /* - * remove a page rom the kernel pagetables + * remove a page from the kernel pagetables */ void pmap_kremove(vm_offset_t va) From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 21:09:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4851D10656C7; Wed, 24 Jun 2009 21:09:57 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1D22D8FC12; Wed, 24 Jun 2009 21:09:57 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OL9ver029383; Wed, 24 Jun 2009 21:09:57 GMT (envelope-from gallatin@svn.freebsd.org) Received: (from gallatin@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OL9uVb029380; Wed, 24 Jun 2009 21:09:56 GMT (envelope-from gallatin@svn.freebsd.org) Message-Id: <200906242109.n5OL9uVb029380@svn.freebsd.org> From: Andrew Gallatin Date: Wed, 24 Jun 2009 21:09: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: r194909 - head/sys/dev/mxge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 21:09:58 -0000 Author: gallatin Date: Wed Jun 24 21:09:56 2009 New Revision: 194909 URL: http://svn.freebsd.org/changeset/base/194909 Log: Add a dying flag to prevent races at detach. I tried re-ordering ether_ifdetach(), but this created a new race where sometimes, when under heavy receive load (>1Mpps) and running tcpdump, the machine would panic. At panic, the ithread was still in the original (not dead) if_input() path, and was accessing stale BPF data structs. By using a dying flag, I can close the interface prior to if_detach() to be certain the interface cannot send packets up in the middle of ether_ifdetach. Modified: head/sys/dev/mxge/if_mxge.c head/sys/dev/mxge/if_mxge_var.h Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Wed Jun 24 21:03:59 2009 (r194908) +++ head/sys/dev/mxge/if_mxge.c Wed Jun 24 21:09:56 2009 (r194909) @@ -3906,6 +3906,10 @@ mxge_ioctl(struct ifnet *ifp, u_long com case SIOCSIFFLAGS: mtx_lock(&sc->driver_mtx); + if (sc->dying) { + mtx_unlock(&sc->driver_mtx); + return EINVAL; + } if (ifp->if_flags & IFF_UP) { if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) { err = mxge_open(sc); @@ -4590,6 +4594,7 @@ mxge_attach(device_t dev) mxge_media_status); mxge_set_media(sc, IFM_ETHER | IFM_AUTO); mxge_media_probe(sc); + sc->dying = 0; ether_ifattach(ifp, sc->mac_addr); /* ether_ifattach sets mtu to ETHERMTU */ if (mxge_initial_mtu != ETHERMTU) @@ -4637,6 +4642,7 @@ mxge_detach(device_t dev) return EBUSY; } mtx_lock(&sc->driver_mtx); + sc->dying = 1; if (sc->ifp->if_drv_flags & IFF_DRV_RUNNING) mxge_close(sc); mtx_unlock(&sc->driver_mtx); Modified: head/sys/dev/mxge/if_mxge_var.h ============================================================================== --- head/sys/dev/mxge/if_mxge_var.h Wed Jun 24 21:03:59 2009 (r194908) +++ head/sys/dev/mxge/if_mxge_var.h Wed Jun 24 21:09:56 2009 (r194909) @@ -266,6 +266,7 @@ struct mxge_softc { int need_media_probe; int num_slices; int rx_ring_size; + int dying; mxge_dma_t dmabench_dma; struct callout co_hdl; struct sysctl_oid *slice_sysctl_tree; From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 21:10:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D22F106566C; Wed, 24 Jun 2009 21:10:52 +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 681908FC0C; Wed, 24 Jun 2009 21:10:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OLAqnL029459; Wed, 24 Jun 2009 21:10:52 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OLAq6c029444; Wed, 24 Jun 2009 21:10:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906242110.n5OLAq6c029444@svn.freebsd.org> From: John Baldwin Date: Wed, 24 Jun 2009 21:10: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: r194910 - in head: lib/libc/gen lib/libc/include lib/libc/sys sys/compat/freebsd32 sys/compat/linux sys/compat/svr4 sys/i386/ibcs2 sys/kern sys/sys usr.bin/ipcs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 21:10:52 -0000 Author: jhb Date: Wed Jun 24 21:10:52 2009 New Revision: 194910 URL: http://svn.freebsd.org/changeset/base/194910 Log: Change the ABI of some of the structures used by the SYSV IPC API: - The uid/cuid members of struct ipc_perm are now uid_t instead of unsigned short. - The gid/cgid members of struct ipc_perm are now gid_t instead of unsigned short. - The mode member of struct ipc_perm is now mode_t instead of unsigned short (this is merely a style bug). - The rather dubious padding fields for ABI compat with SV/I386 have been removed from struct msqid_ds and struct semid_ds. - The shm_segsz member of struct shmid_ds is now a size_t instead of an int. This removes the need for the shm_bsegsz member in struct shmid_kernel and should allow for complete support of SYSV SHM regions >= 2GB. - The shm_nattch member of struct shmid_ds is now an int instead of a short. - The shm_internal member of struct shmid_ds is now gone. The internal VM object pointer for SHM regions has been moved into struct shmid_kernel. - The existing __semctl(), msgctl(), and shmctl() system call entries are now marked COMPAT7 and new versions of those system calls which support the new ABI are now present. - The new system calls are assigned to the FBSD-1.1 version in libc. The FBSD-1.0 symbols in libc now refer to the old COMPAT7 system calls. - A simplistic framework for tagging system calls with compatibility symbol versions has been added to libc. Version tags are added to system calls by adding an appropriate __sym_compat() entry to src/lib/libc/incldue/compat.h. [1] PR: kern/16195 kern/113218 bin/129855 Reviewed by: arch@, rwatson Discussed with: kan, kib [1] Added: head/lib/libc/include/compat.h (contents, props changed) Modified: head/lib/libc/gen/Symbol.map head/lib/libc/gen/semctl.c head/lib/libc/sys/Makefile.inc head/lib/libc/sys/Symbol.map head/sys/compat/freebsd32/freebsd32_ipc.h head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/syscalls.master head/sys/compat/linux/linux_ipc.c head/sys/compat/svr4/svr4_ipc.c head/sys/i386/ibcs2/ibcs2_ipc.c head/sys/kern/syscalls.master head/sys/kern/sysv_ipc.c head/sys/kern/sysv_msg.c head/sys/kern/sysv_sem.c head/sys/kern/sysv_shm.c head/sys/sys/ipc.h head/sys/sys/msg.h head/sys/sys/sem.h head/sys/sys/shm.h head/usr.bin/ipcs/ipcs.c Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Wed Jun 24 21:09:56 2009 (r194909) +++ head/lib/libc/gen/Symbol.map Wed Jun 24 21:10:52 2009 (r194910) @@ -247,7 +247,6 @@ FBSD_1.0 { sem_timedwait; sem_post; sem_getvalue; - semctl; setdomainname; sethostname; longjmperror; @@ -362,6 +361,7 @@ FBSD_1.1 { posix_spawnattr_setsigdefault; posix_spawnattr_setsigmask; posix_spawnp; + semctl; tcgetsid; tcsetsid; }; Modified: head/lib/libc/gen/semctl.c ============================================================================== --- head/lib/libc/gen/semctl.c Wed Jun 24 21:09:56 2009 (r194909) +++ head/lib/libc/gen/semctl.c Wed Jun 24 21:10:52 2009 (r194910) @@ -29,15 +29,19 @@ #include __FBSDID("$FreeBSD$"); +#define _WANT_SEMUN_OLD + #include #include #include #include #include -extern int __semctl(int semid, int semnum, int cmd, union semun *arg); +int __semctl(int semid, int semnum, int cmd, union semun *arg); +int freebsd7___semctl(int semid, int semnum, int cmd, union semun_old *arg); -int semctl(int semid, int semnum, int cmd, ...) +int +semctl(int semid, int semnum, int cmd, ...) { va_list ap; union semun semun; @@ -55,3 +59,25 @@ int semctl(int semid, int semnum, int cm return (__semctl(semid, semnum, cmd, semun_ptr)); } + +int +freebsd7_semctl(int semid, int semnum, int cmd, ...) +{ + va_list ap; + union semun_old semun; + union semun_old *semun_ptr; + + va_start(ap, cmd); + if (cmd == IPC_SET || cmd == IPC_STAT || cmd == GETALL + || cmd == SETVAL || cmd == SETALL) { + semun = va_arg(ap, union semun_old); + semun_ptr = &semun; + } else { + semun_ptr = NULL; + } + va_end(ap); + + return (freebsd7___semctl(semid, semnum, cmd, semun_ptr)); +} + +__sym_compat(semctl, freebsd7_semctl, FBSD_1.0); Added: head/lib/libc/include/compat.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/include/compat.h Wed Jun 24 21:10:52 2009 (r194910) @@ -0,0 +1,48 @@ +/*- + * Copyright (c) 2009 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* + * This file defines compatiblity symbol versions for old system calls. It + * is included in all generated system call files. + */ + +#ifndef __LIBC_COMPAT_H__ +#define __LIBC_COMPAT_H__ + +#define __sym_compat(sym,impl,verid) \ + .symver impl , sym @ verid + +__sym_compat(__semctl, freebsd7___semctl, FBSD_1.0); +__sym_compat(msgctl, freebsd7_msgctl, FBSD_1.0); +__sym_compat(shmctl, freebsd7_shmctl, FBSD_1.0); + +#undef __sym_compat + +#endif /* __LIBC_COMPAT_H__ */ + Modified: head/lib/libc/sys/Makefile.inc ============================================================================== --- head/lib/libc/sys/Makefile.inc Wed Jun 24 21:09:56 2009 (r194909) +++ head/lib/libc/sys/Makefile.inc Wed Jun 24 21:10:52 2009 (r194910) @@ -53,11 +53,13 @@ SYM_MAPS+= ${.CURDIR}/sys/Symbol.map CLEANFILES+= ${SASM} ${SPSEUDO} ${SASM}: - printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' > ${.TARGET} + printf '#include "compat.h"\n' > ${.TARGET} + printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' >> ${.TARGET} ${SPSEUDO}: + printf '#include "compat.h"\n' > ${.TARGET} printf '#include "SYS.h"\nPSEUDO(${.PREFIX:S/_//})\n' \ - > ${.TARGET} + >> ${.TARGET} MAN+= abort2.2 accept.2 access.2 acct.2 adjtime.2 \ aio_cancel.2 aio_error.2 aio_read.2 aio_return.2 \ Modified: head/lib/libc/sys/Symbol.map ============================================================================== --- head/lib/libc/sys/Symbol.map Wed Jun 24 21:09:56 2009 (r194909) +++ head/lib/libc/sys/Symbol.map Wed Jun 24 21:10:52 2009 (r194910) @@ -31,7 +31,6 @@ FBSD_1.0 { __mac_set_file; __mac_set_link; __mac_set_proc; - __semctl; __setugid; __syscall; __sysctl; @@ -184,7 +183,6 @@ FBSD_1.0 { modstat; mount; mprotect; - msgctl; msgget; msgrcv; msgsnd; @@ -267,7 +265,6 @@ FBSD_1.0 { shm_open; shm_unlink; shmat; - shmctl; shmdt; shmget; shmsys; @@ -332,6 +329,7 @@ FBSD_1.0 { }; FBSD_1.1 { + __semctl; closefrom; cpuset; cpuset_getid; @@ -351,10 +349,12 @@ FBSD_1.1 { mkdirat; mkfifoat; mknodat; + msgctl; openat; readlinkat; renameat; setfib; + shmctl; symlinkat; unlinkat; }; Modified: head/sys/compat/freebsd32/freebsd32_ipc.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_ipc.h Wed Jun 24 21:09:56 2009 (r194909) +++ head/sys/compat/freebsd32/freebsd32_ipc.h Wed Jun 24 21:10:52 2009 (r194910) @@ -30,11 +30,11 @@ #define _COMPAT_FREEBSD32_FREEBSD32_IPC_H_ struct ipc_perm32 { - uint16_t cuid; - uint16_t cgid; - uint16_t uid; - uint16_t gid; - uint16_t mode; + uid_t cuid; + gid_t cgid; + uid_t uid; + gid_t gid; + mode_t mode; uint16_t seq; uint32_t key; }; @@ -44,10 +44,7 @@ struct semid_ds32 { uint32_t sem_base; unsigned short sem_nsems; int32_t sem_otime; - int32_t sem_pad1; int32_t sem_ctime; - int32_t sem_pad2; - int32_t sem_pad3[4]; }; union semun32 { @@ -66,24 +63,19 @@ struct msqid_ds32 { pid_t msg_lspid; pid_t msg_lrpid; int32_t msg_stime; - int32_t msg_pad1; int32_t msg_rtime; - int32_t msg_pad2; int32_t msg_ctime; - int32_t msg_pad3; - int32_t msg_pad4[4]; }; struct shmid_ds32 { struct ipc_perm32 shm_perm; int32_t shm_segsz; - int32_t shm_lpid; - int32_t shm_cpid; - int16_t shm_nattch; + pid_t shm_lpid; + pid_t shm_cpid; + int shm_nattch; int32_t shm_atime; int32_t shm_dtime; int32_t shm_ctime; - uint32_t shm_internal; }; struct shm_info32 { @@ -103,4 +95,58 @@ struct shminfo32 { uint32_t shmall; }; +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) +struct ipc_perm32_old { + uint16_t cuid; + uint16_t cgid; + uint16_t uid; + uint16_t gid; + uint16_t mode; + uint16_t seq; + uint32_t key; +}; + +struct semid_ds32_old { + struct ipc_perm32_old sem_perm; + uint32_t sem_base; + unsigned short sem_nsems; + int32_t sem_otime; + int32_t sem_pad1; + int32_t sem_ctime; + int32_t sem_pad2; + int32_t sem_pad3[4]; +}; + +struct msqid_ds32_old { + struct ipc_perm32_old msg_perm; + uint32_t msg_first; + uint32_t msg_last; + uint32_t msg_cbytes; + uint32_t msg_qnum; + uint32_t msg_qbytes; + pid_t msg_lspid; + pid_t msg_lrpid; + int32_t msg_stime; + int32_t msg_pad1; + int32_t msg_rtime; + int32_t msg_pad2; + int32_t msg_ctime; + int32_t msg_pad3; + int32_t msg_pad4[4]; +}; + +struct shmid_ds32_old { + struct ipc_perm32_old shm_perm; + int32_t shm_segsz; + pid_t shm_lpid; + pid_t shm_cpid; + int16_t shm_nattch; + int32_t shm_atime; + int32_t shm_dtime; + int32_t shm_ctime; + uint32_t shm_internal; +}; +#endif + #endif /* !_COMPAT_FREEBSD32_FREEBSD32_IPC_H_ */ Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Wed Jun 24 21:09:56 2009 (r194909) +++ head/sys/compat/freebsd32/freebsd32_misc.c Wed Jun 24 21:10:52 2009 (r194910) @@ -1353,6 +1353,35 @@ freebsd4_freebsd32_fhstatfs(struct threa } #endif +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) +static void +freebsd32_ipcperm_old_in(struct ipc_perm32_old *ip32, struct ipc_perm *ip) +{ + + CP(*ip32, *ip, cuid); + CP(*ip32, *ip, cgid); + CP(*ip32, *ip, uid); + CP(*ip32, *ip, gid); + CP(*ip32, *ip, mode); + CP(*ip32, *ip, seq); + CP(*ip32, *ip, key); +} + +static void +freebsd32_ipcperm_old_out(struct ipc_perm *ip, struct ipc_perm32_old *ip32) +{ + + CP(*ip, *ip32, cuid); + CP(*ip, *ip32, cgid); + CP(*ip, *ip32, uid); + CP(*ip, *ip32, gid); + CP(*ip, *ip32, mode); + CP(*ip, *ip32, seq); + CP(*ip, *ip32, key); +} +#endif + static void freebsd32_ipcperm_in(struct ipc_perm32 *ip32, struct ipc_perm *ip) { @@ -1383,6 +1412,8 @@ int freebsd32_semsys(struct thread *td, struct freebsd32_semsys_args *uap) { +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) switch (uap->which) { case 0: return (freebsd32_semctl(td, @@ -1390,7 +1421,85 @@ freebsd32_semsys(struct thread *td, stru default: return (semsys(td, (struct semsys_args *)uap)); } +#else + return (nosys(td, NULL)); +#endif +} + +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) +int +freebsd7_freebsd32_semctl(struct thread *td, + struct freebsd7_freebsd32_semctl_args *uap) +{ + struct semid_ds32_old dsbuf32; + struct semid_ds dsbuf; + union semun semun; + union semun32 arg; + register_t rval; + int error; + + switch (uap->cmd) { + case SEM_STAT: + case IPC_SET: + case IPC_STAT: + case GETALL: + case SETVAL: + case SETALL: + error = copyin(uap->arg, &arg, sizeof(arg)); + if (error) + return (error); + break; + } + + switch (uap->cmd) { + case SEM_STAT: + case IPC_STAT: + semun.buf = &dsbuf; + break; + case IPC_SET: + error = copyin(PTRIN(arg.buf), &dsbuf32, sizeof(dsbuf32)); + if (error) + return (error); + freebsd32_ipcperm_old_in(&dsbuf32.sem_perm, &dsbuf.sem_perm); + PTRIN_CP(dsbuf32, dsbuf, sem_base); + CP(dsbuf32, dsbuf, sem_nsems); + CP(dsbuf32, dsbuf, sem_otime); + CP(dsbuf32, dsbuf, sem_ctime); + semun.buf = &dsbuf; + break; + case GETALL: + case SETALL: + semun.array = PTRIN(arg.array); + break; + case SETVAL: + semun.val = arg.val; + break; + } + + error = kern_semctl(td, uap->semid, uap->semnum, uap->cmd, &semun, + &rval); + if (error) + return (error); + + switch (uap->cmd) { + case SEM_STAT: + case IPC_STAT: + bzero(&dsbuf32, sizeof(dsbuf32)); + freebsd32_ipcperm_old_out(&dsbuf.sem_perm, &dsbuf32.sem_perm); + PTROUT_CP(dsbuf, dsbuf32, sem_base); + CP(dsbuf, dsbuf32, sem_nsems); + CP(dsbuf, dsbuf32, sem_otime); + CP(dsbuf, dsbuf32, sem_ctime); + error = copyout(&dsbuf32, PTRIN(arg.buf), sizeof(dsbuf32)); + break; + } + + if (error == 0) + td->td_retval[0] = rval; + return (error); } +#endif int freebsd32_semctl(struct thread *td, struct freebsd32_semctl_args *uap) @@ -1428,13 +1537,7 @@ freebsd32_semctl(struct thread *td, stru PTRIN_CP(dsbuf32, dsbuf, sem_base); CP(dsbuf32, dsbuf, sem_nsems); CP(dsbuf32, dsbuf, sem_otime); - CP(dsbuf32, dsbuf, sem_pad1); CP(dsbuf32, dsbuf, sem_ctime); - CP(dsbuf32, dsbuf, sem_pad2); - CP(dsbuf32, dsbuf, sem_pad3[0]); - CP(dsbuf32, dsbuf, sem_pad3[1]); - CP(dsbuf32, dsbuf, sem_pad3[2]); - CP(dsbuf32, dsbuf, sem_pad3[3]); semun.buf = &dsbuf; break; case GETALL: @@ -1454,17 +1557,12 @@ freebsd32_semctl(struct thread *td, stru switch (uap->cmd) { case SEM_STAT: case IPC_STAT: + bzero(&dsbuf32, sizeof(dsbuf32)); freebsd32_ipcperm_out(&dsbuf.sem_perm, &dsbuf32.sem_perm); PTROUT_CP(dsbuf, dsbuf32, sem_base); CP(dsbuf, dsbuf32, sem_nsems); CP(dsbuf, dsbuf32, sem_otime); - CP(dsbuf, dsbuf32, sem_pad1); CP(dsbuf, dsbuf32, sem_ctime); - CP(dsbuf, dsbuf32, sem_pad2); - CP(dsbuf, dsbuf32, sem_pad3[0]); - CP(dsbuf, dsbuf32, sem_pad3[1]); - CP(dsbuf, dsbuf32, sem_pad3[2]); - CP(dsbuf, dsbuf32, sem_pad3[3]); error = copyout(&dsbuf32, PTRIN(arg.buf), sizeof(dsbuf32)); break; } @@ -1478,6 +1576,8 @@ int freebsd32_msgsys(struct thread *td, struct freebsd32_msgsys_args *uap) { +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) switch (uap->which) { case 0: return (freebsd32_msgctl(td, @@ -1491,8 +1591,59 @@ freebsd32_msgsys(struct thread *td, stru default: return (msgsys(td, (struct msgsys_args *)uap)); } +#else + return (nosys(td, NULL)); +#endif } +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) +int +freebsd7_freebsd32_msgctl(struct thread *td, + struct freebsd7_freebsd32_msgctl_args *uap) +{ + struct msqid_ds msqbuf; + struct msqid_ds32_old msqbuf32; + int error; + + if (uap->cmd == IPC_SET) { + error = copyin(uap->buf, &msqbuf32, sizeof(msqbuf32)); + if (error) + return (error); + freebsd32_ipcperm_old_in(&msqbuf32.msg_perm, &msqbuf.msg_perm); + PTRIN_CP(msqbuf32, msqbuf, msg_first); + PTRIN_CP(msqbuf32, msqbuf, msg_last); + CP(msqbuf32, msqbuf, msg_cbytes); + CP(msqbuf32, msqbuf, msg_qnum); + CP(msqbuf32, msqbuf, msg_qbytes); + CP(msqbuf32, msqbuf, msg_lspid); + CP(msqbuf32, msqbuf, msg_lrpid); + CP(msqbuf32, msqbuf, msg_stime); + CP(msqbuf32, msqbuf, msg_rtime); + CP(msqbuf32, msqbuf, msg_ctime); + } + error = kern_msgctl(td, uap->msqid, uap->cmd, &msqbuf); + if (error) + return (error); + if (uap->cmd == IPC_STAT) { + bzero(&msqbuf32, sizeof(msqbuf32)); + freebsd32_ipcperm_old_out(&msqbuf.msg_perm, &msqbuf32.msg_perm); + PTROUT_CP(msqbuf, msqbuf32, msg_first); + PTROUT_CP(msqbuf, msqbuf32, msg_last); + CP(msqbuf, msqbuf32, msg_cbytes); + CP(msqbuf, msqbuf32, msg_qnum); + CP(msqbuf, msqbuf32, msg_qbytes); + CP(msqbuf, msqbuf32, msg_lspid); + CP(msqbuf, msqbuf32, msg_lrpid); + CP(msqbuf, msqbuf32, msg_stime); + CP(msqbuf, msqbuf32, msg_rtime); + CP(msqbuf, msqbuf32, msg_ctime); + error = copyout(&msqbuf32, uap->buf, sizeof(struct msqid_ds32)); + } + return (error); +} +#endif + int freebsd32_msgctl(struct thread *td, struct freebsd32_msgctl_args *uap) { @@ -1513,15 +1664,8 @@ freebsd32_msgctl(struct thread *td, stru CP(msqbuf32, msqbuf, msg_lspid); CP(msqbuf32, msqbuf, msg_lrpid); CP(msqbuf32, msqbuf, msg_stime); - CP(msqbuf32, msqbuf, msg_pad1); CP(msqbuf32, msqbuf, msg_rtime); - CP(msqbuf32, msqbuf, msg_pad2); CP(msqbuf32, msqbuf, msg_ctime); - CP(msqbuf32, msqbuf, msg_pad3); - CP(msqbuf32, msqbuf, msg_pad4[0]); - CP(msqbuf32, msqbuf, msg_pad4[1]); - CP(msqbuf32, msqbuf, msg_pad4[2]); - CP(msqbuf32, msqbuf, msg_pad4[3]); } error = kern_msgctl(td, uap->msqid, uap->cmd, &msqbuf); if (error) @@ -1536,15 +1680,8 @@ freebsd32_msgctl(struct thread *td, stru CP(msqbuf, msqbuf32, msg_lspid); CP(msqbuf, msqbuf32, msg_lrpid); CP(msqbuf, msqbuf32, msg_stime); - CP(msqbuf, msqbuf32, msg_pad1); CP(msqbuf, msqbuf32, msg_rtime); - CP(msqbuf, msqbuf32, msg_pad2); CP(msqbuf, msqbuf32, msg_ctime); - CP(msqbuf, msqbuf32, msg_pad3); - CP(msqbuf, msqbuf32, msg_pad4[0]); - CP(msqbuf, msqbuf32, msg_pad4[1]); - CP(msqbuf, msqbuf32, msg_pad4[2]); - CP(msqbuf, msqbuf32, msg_pad4[3]); error = copyout(&msqbuf32, uap->buf, sizeof(struct msqid_ds32)); } return (error); @@ -1588,6 +1725,8 @@ int freebsd32_shmsys(struct thread *td, struct freebsd32_shmsys_args *uap) { +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) switch (uap->which) { case 0: { /* shmat */ struct shmat_args ap; @@ -1623,8 +1762,99 @@ freebsd32_shmsys(struct thread *td, stru default: return (EINVAL); } +#else + return (nosys(td, NULL)); +#endif } +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) +int +freebsd7_freebsd32_shmctl(struct thread *td, + struct freebsd7_freebsd32_shmctl_args *uap) +{ + int error = 0; + union { + struct shmid_ds shmid_ds; + struct shm_info shm_info; + struct shminfo shminfo; + } u; + union { + struct shmid_ds32_old shmid_ds32; + struct shm_info32 shm_info32; + struct shminfo32 shminfo32; + } u32; + size_t sz; + + if (uap->cmd == IPC_SET) { + if ((error = copyin(uap->buf, &u32.shmid_ds32, + sizeof(u32.shmid_ds32)))) + goto done; + freebsd32_ipcperm_old_in(&u32.shmid_ds32.shm_perm, + &u.shmid_ds.shm_perm); + CP(u32.shmid_ds32, u.shmid_ds, shm_segsz); + CP(u32.shmid_ds32, u.shmid_ds, shm_lpid); + CP(u32.shmid_ds32, u.shmid_ds, shm_cpid); + CP(u32.shmid_ds32, u.shmid_ds, shm_nattch); + CP(u32.shmid_ds32, u.shmid_ds, shm_atime); + CP(u32.shmid_ds32, u.shmid_ds, shm_dtime); + CP(u32.shmid_ds32, u.shmid_ds, shm_ctime); + } + + error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&u, &sz); + if (error) + goto done; + + /* Cases in which we need to copyout */ + switch (uap->cmd) { + case IPC_INFO: + CP(u.shminfo, u32.shminfo32, shmmax); + CP(u.shminfo, u32.shminfo32, shmmin); + CP(u.shminfo, u32.shminfo32, shmmni); + CP(u.shminfo, u32.shminfo32, shmseg); + CP(u.shminfo, u32.shminfo32, shmall); + error = copyout(&u32.shminfo32, uap->buf, + sizeof(u32.shminfo32)); + break; + case SHM_INFO: + CP(u.shm_info, u32.shm_info32, used_ids); + CP(u.shm_info, u32.shm_info32, shm_rss); + CP(u.shm_info, u32.shm_info32, shm_tot); + CP(u.shm_info, u32.shm_info32, shm_swp); + CP(u.shm_info, u32.shm_info32, swap_attempts); + CP(u.shm_info, u32.shm_info32, swap_successes); + error = copyout(&u32.shm_info32, uap->buf, + sizeof(u32.shm_info32)); + break; + case SHM_STAT: + case IPC_STAT: + freebsd32_ipcperm_old_out(&u.shmid_ds.shm_perm, + &u32.shmid_ds32.shm_perm); + if (u.shmid_ds.shm_segsz > INT32_MAX) + u32.shmid_ds32.shm_segsz = INT32_MAX; + else + CP(u.shmid_ds, u32.shmid_ds32, shm_segsz); + CP(u.shmid_ds, u32.shmid_ds32, shm_lpid); + CP(u.shmid_ds, u32.shmid_ds32, shm_cpid); + CP(u.shmid_ds, u32.shmid_ds32, shm_nattch); + CP(u.shmid_ds, u32.shmid_ds32, shm_atime); + CP(u.shmid_ds, u32.shmid_ds32, shm_dtime); + CP(u.shmid_ds, u32.shmid_ds32, shm_ctime); + u32.shmid_ds32.shm_internal = 0; + error = copyout(&u32.shmid_ds32, uap->buf, + sizeof(u32.shmid_ds32)); + break; + } + +done: + if (error) { + /* Invalidate the return value */ + td->td_retval[0] = -1; + } + return (error); +} +#endif + int freebsd32_shmctl(struct thread *td, struct freebsd32_shmctl_args *uap) { @@ -1654,7 +1884,6 @@ freebsd32_shmctl(struct thread *td, stru CP(u32.shmid_ds32, u.shmid_ds, shm_atime); CP(u32.shmid_ds32, u.shmid_ds, shm_dtime); CP(u32.shmid_ds32, u.shmid_ds, shm_ctime); - PTRIN_CP(u32.shmid_ds32, u.shmid_ds, shm_internal); } error = kern_shmctl(td, uap->shmid, uap->cmd, (void *)&u, &sz); @@ -1686,14 +1915,16 @@ freebsd32_shmctl(struct thread *td, stru case IPC_STAT: freebsd32_ipcperm_out(&u.shmid_ds.shm_perm, &u32.shmid_ds32.shm_perm); - CP(u.shmid_ds, u32.shmid_ds32, shm_segsz); + if (u.shmid_ds.shm_segsz > INT32_MAX) + u32.shmid_ds32.shm_segsz = INT32_MAX; + else + CP(u.shmid_ds, u32.shmid_ds32, shm_segsz); CP(u.shmid_ds, u32.shmid_ds32, shm_lpid); CP(u.shmid_ds, u32.shmid_ds32, shm_cpid); CP(u.shmid_ds, u32.shmid_ds32, shm_nattch); CP(u.shmid_ds, u32.shmid_ds32, shm_atime); CP(u.shmid_ds, u32.shmid_ds32, shm_dtime); CP(u.shmid_ds, u32.shmid_ds32, shm_ctime); - PTROUT_CP(u.shmid_ds, u32.shmid_ds32, shm_internal); error = copyout(&u32.shmid_ds32, uap->buf, sizeof(u32.shmid_ds32)); break; Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Wed Jun 24 21:09:56 2009 (r194909) +++ head/sys/compat/freebsd32/syscalls.master Wed Jun 24 21:10:52 2009 (r194910) @@ -405,15 +405,15 @@ ; The following were introduced with NetBSD/4.4Lite-2 ; They are initialized by thier respective modules/sysinits ; XXX PROBLEM!! -220 AUE_SEMCTL STD { int freebsd32_semctl(int semid, int semnum, \ +220 AUE_SEMCTL COMPAT7 { int freebsd32_semctl(int semid, int semnum, \ int cmd, union semun32 *arg); } 221 AUE_SEMGET NOPROTO { int semget(key_t key, int nsems, \ int semflg); } 222 AUE_SEMOP NOPROTO { int semop(int semid, struct sembuf *sops, \ u_int nsops); } 223 AUE_NULL UNIMPL semconfig -224 AUE_MSGCTL STD { int freebsd32_msgctl(int msqid, int cmd, \ - struct msqid_ds32 *buf); } +224 AUE_MSGCTL COMPAT7 { int freebsd32_msgctl(int msqid, int cmd, \ + struct msqid_ds32_old *buf); } 225 AUE_MSGGET NOPROTO { int msgget(key_t key, int msgflg); } 226 AUE_MSGSND STD { int freebsd32_msgsnd(int msqid, void *msgp, \ size_t msgsz, int msgflg); } @@ -421,8 +421,8 @@ size_t msgsz, long msgtyp, int msgflg); } 228 AUE_SHMAT NOPROTO { int shmat(int shmid, void *shmaddr, \ int shmflg); } -229 AUE_SHMCTL STD { int freebsd32_shmctl(int shmid, int cmd, \ - struct shmid_ds *buf); } +229 AUE_SHMCTL COMPAT7 { int freebsd32_shmctl(int shmid, int cmd, \ + struct shmid_ds32_old *buf); } 230 AUE_SHMDT NOPROTO { int shmdt(void *shmaddr); } 231 AUE_SHMGET NOPROTO { int shmget(key_t key, int size, \ int shmflg); } @@ -894,3 +894,9 @@ unsigned int iovcnt, int flags); } 508 AUE_NULL NOPROTO { int jail_remove(int jid); } 509 AUE_CLOSEFROM NOPROTO { int closefrom(int lowfd); } +510 AUE_SEMCTL STD { int freebsd32_semctl(int semid, int semnum, \ + int cmd, union semun32 *arg); } +511 AUE_MSGCTL STD { int freebsd32_msgctl(int msqid, int cmd, \ + struct msqid_ds32 *buf); } +512 AUE_SHMCTL STD { int freebsd32_shmctl(int shmid, int cmd, \ + struct shmid_ds32 *buf); } Modified: head/sys/compat/linux/linux_ipc.c ============================================================================== --- head/sys/compat/linux/linux_ipc.c Wed Jun 24 21:09:56 2009 (r194909) +++ head/sys/compat/linux/linux_ipc.c Wed Jun 24 21:10:52 2009 (r194910) @@ -230,23 +230,26 @@ linux_to_bsd_shmid_ds(struct l_shmid_ds bsp->shm_atime = lsp->shm_atime; bsp->shm_dtime = lsp->shm_dtime; bsp->shm_ctime = lsp->shm_ctime; - /* this goes (yet) SOS */ - bsp->shm_internal = PTRIN(lsp->private3); } static void bsd_to_linux_shmid_ds(struct shmid_ds *bsp, struct l_shmid_ds *lsp) { bsd_to_linux_ipc_perm(&bsp->shm_perm, &lsp->shm_perm); - lsp->shm_segsz = bsp->shm_segsz; + if (bsp->shm_segsz > INT_MAX) + lsp->shm_segsz = INT_MAX; + else + lsp->shm_segsz = bsp->shm_segsz; lsp->shm_lpid = bsp->shm_lpid; lsp->shm_cpid = bsp->shm_cpid; - lsp->shm_nattch = bsp->shm_nattch; + if (bsp->shm_nattch > SHRT_MAX) + lsp->shm_nattch = SHRT_MAX; + else + lsp->shm_nattch = bsp->shm_nattch; lsp->shm_atime = bsp->shm_atime; lsp->shm_dtime = bsp->shm_dtime; lsp->shm_ctime = bsp->shm_ctime; - /* this goes (yet) SOS */ - lsp->private3 = PTROUT(bsp->shm_internal); + lsp->private3 = 0; } static void @@ -424,6 +427,15 @@ linux_shmid_pushdown(l_int ver, struct l { struct l_shmid64_ds linux_shmid64; + /* + * XXX: This is backwards and loses information in shm_nattch + * and shm_segsz. We should probably either expose the BSD + * shmid structure directly and convert it to either the + * non-64 or 64 variant directly or the code should always + * convert to the 64 variant and then truncate values into the + * non-64 variant if needed since the 64 variant has more + * precision. + */ if (ver == LINUX_IPC_64) { bzero(&linux_shmid64, sizeof(linux_shmid64)); Modified: head/sys/compat/svr4/svr4_ipc.c ============================================================================== --- head/sys/compat/svr4/svr4_ipc.c Wed Jun 24 21:09:56 2009 (r194909) +++ head/sys/compat/svr4/svr4_ipc.c Wed Jun 24 21:10:52 2009 (r194910) @@ -169,13 +169,12 @@ bsd_to_svr4_semid_ds(bds, sds) const struct semid_ds *bds; struct svr4_semid_ds *sds; { + bzero(sds, sizeof(*sds)); bsd_to_svr4_ipc_perm(&bds->sem_perm, &sds->sem_perm); sds->sem_base = (struct svr4_sem *) bds->sem_base; sds->sem_nsems = bds->sem_nsems; sds->sem_otime = bds->sem_otime; - sds->sem_pad1 = bds->sem_pad1; sds->sem_ctime = bds->sem_ctime; - sds->sem_pad2 = bds->sem_pad2; } static void @@ -187,9 +186,7 @@ svr4_to_bsd_semid_ds(sds, bds) bds->sem_base = (struct sem *) bds->sem_base; bds->sem_nsems = sds->sem_nsems; bds->sem_otime = sds->sem_otime; - bds->sem_pad1 = sds->sem_pad1; bds->sem_ctime = sds->sem_ctime; - bds->sem_pad2 = sds->sem_pad2; } struct svr4_sys_semctl_args { @@ -350,6 +347,7 @@ bsd_to_svr4_msqid_ds(bds, sds) const struct msqid_ds *bds; struct svr4_msqid_ds *sds; { + bzero(sds, sizeof(*sds)); bsd_to_svr4_ipc_perm(&bds->msg_perm, &sds->msg_perm); sds->msg_first = (struct svr4_msg *) bds->msg_first; sds->msg_last = (struct svr4_msg *) bds->msg_last; @@ -359,18 +357,8 @@ bsd_to_svr4_msqid_ds(bds, sds) sds->msg_lspid = bds->msg_lspid; sds->msg_lrpid = bds->msg_lrpid; sds->msg_stime = bds->msg_stime; - sds->msg_pad1 = bds->msg_pad1; sds->msg_rtime = bds->msg_rtime; - sds->msg_pad2 = bds->msg_pad2; sds->msg_ctime = bds->msg_ctime; - sds->msg_pad3 = bds->msg_pad3; - - /* use the padding for the rest of the fields */ - { - const short *pad = (const short *) bds->msg_pad4; - sds->msg_cv = pad[0]; - sds->msg_qnum_cv = pad[1]; - } } static void @@ -387,18 +375,8 @@ svr4_to_bsd_msqid_ds(sds, bds) bds->msg_lspid = sds->msg_lspid; bds->msg_lrpid = sds->msg_lrpid; bds->msg_stime = sds->msg_stime; - bds->msg_pad1 = sds->msg_pad1; bds->msg_rtime = sds->msg_rtime; - bds->msg_pad2 = sds->msg_pad2; bds->msg_ctime = sds->msg_ctime; - bds->msg_pad3 = sds->msg_pad3; - - /* use the padding for the rest of the fields */ - { - short *pad = (short *) bds->msg_pad4; - pad[0] = sds->msg_cv; - pad[1] = sds->msg_qnum_cv; - } } struct svr4_sys_msgsnd_args { @@ -543,20 +521,18 @@ bsd_to_svr4_shmid_ds(bds, sds) const struct shmid_ds *bds; struct svr4_shmid_ds *sds; { + bzero(sds, sizeof(*sds)); bsd_to_svr4_ipc_perm(&bds->shm_perm, &sds->shm_perm); sds->shm_segsz = bds->shm_segsz; sds->shm_lkcnt = 0; sds->shm_lpid = bds->shm_lpid; sds->shm_cpid = bds->shm_cpid; - sds->shm_amp = bds->shm_internal; + sds->shm_amp = 0; sds->shm_nattch = bds->shm_nattch; sds->shm_cnattch = 0; sds->shm_atime = bds->shm_atime; - sds->shm_pad1 = 0; sds->shm_dtime = bds->shm_dtime; - sds->shm_pad2 = 0; sds->shm_ctime = bds->shm_ctime; - sds->shm_pad3 = 0; } static void @@ -568,7 +544,6 @@ svr4_to_bsd_shmid_ds(sds, bds) bds->shm_segsz = sds->shm_segsz; bds->shm_lpid = sds->shm_lpid; bds->shm_cpid = sds->shm_cpid; - bds->shm_internal = sds->shm_amp; bds->shm_nattch = sds->shm_nattch; bds->shm_atime = sds->shm_atime; bds->shm_dtime = sds->shm_dtime; Modified: head/sys/i386/ibcs2/ibcs2_ipc.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_ipc.c Wed Jun 24 21:09:56 2009 (r194909) +++ head/sys/i386/ibcs2/ibcs2_ipc.c Wed Jun 24 21:10:52 2009 (r194910) @@ -415,7 +415,10 @@ struct ibcs2_shmid_ds *ibp; ibp->shm_segsz = bp->shm_segsz; ibp->shm_lpid = bp->shm_lpid; ibp->shm_cpid = bp->shm_cpid; - ibp->shm_nattch = bp->shm_nattch; + if (bp->shm_nattch > SHRT_MAX) + ibp->shm_nattch = SHRT_MAX; + else + ibp->shm_nattch = bp->shm_nattch; ibp->shm_cnattch = 0; /* ignored anyway */ ibp->shm_atime = bp->shm_atime; ibp->shm_dtime = bp->shm_dtime; @@ -436,7 +439,6 @@ struct shmid_ds *bp; bp->shm_atime = ibp->shm_atime; bp->shm_dtime = ibp->shm_dtime; bp->shm_ctime = ibp->shm_ctime; - bp->shm_internal = (void *)0; /* ignored anyway */ return; } Modified: head/sys/kern/syscalls.master ============================================================================== --- head/sys/kern/syscalls.master Wed Jun 24 21:09:56 2009 (r194909) +++ head/sys/kern/syscalls.master Wed Jun 24 21:10:52 2009 (r194910) @@ -417,15 +417,15 @@ ; ; The following were introduced with NetBSD/4.4Lite-2 -220 AUE_SEMCTL NOSTD { int __semctl(int semid, int semnum, \ - int cmd, union semun *arg); } +220 AUE_SEMCTL COMPAT7|NOSTD { int __semctl(int semid, int semnum, \ + int cmd, union semun_old *arg); } 221 AUE_SEMGET NOSTD { int semget(key_t key, int nsems, \ int semflg); } 222 AUE_SEMOP NOSTD { int semop(int semid, struct sembuf *sops, \ size_t nsops); } 223 AUE_NULL UNIMPL semconfig -224 AUE_MSGCTL NOSTD { int msgctl(int msqid, int cmd, \ - struct msqid_ds *buf); } +224 AUE_MSGCTL COMPAT7|NOSTD { int msgctl(int msqid, int cmd, \ + struct msqid_ds_old *buf); } 225 AUE_MSGGET NOSTD { int msgget(key_t key, int msgflg); } 226 AUE_MSGSND NOSTD { int msgsnd(int msqid, const void *msgp, \ size_t msgsz, int msgflg); } @@ -433,8 +433,8 @@ size_t msgsz, long msgtyp, int msgflg); } 228 AUE_SHMAT NOSTD { int shmat(int shmid, const void *shmaddr, \ int shmflg); } -229 AUE_SHMCTL NOSTD { int shmctl(int shmid, int cmd, \ - struct shmid_ds *buf); } +229 AUE_SHMCTL COMPAT7|NOSTD { int shmctl(int shmid, int cmd, \ + struct shmid_ds_old *buf); } 230 AUE_SHMDT NOSTD { int shmdt(const void *shmaddr); } 231 AUE_SHMGET NOSTD { int shmget(key_t key, size_t size, \ int shmflg); } @@ -904,5 +904,11 @@ unsigned int iovcnt, int flags); } 508 AUE_NULL STD { int jail_remove(int jid); } 509 AUE_CLOSEFROM STD { int closefrom(int lowfd); } +510 AUE_SEMCTL NOSTD { int __semctl(int semid, int semnum, \ + int cmd, union semun *arg); } +511 AUE_MSGCTL NOSTD { int msgctl(int msqid, int cmd, \ + struct msqid_ds *buf); } +512 AUE_SHMCTL NOSTD { int shmctl(int shmid, int cmd, \ + struct shmid_ds *buf); } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master Modified: head/sys/kern/sysv_ipc.c ============================================================================== --- head/sys/kern/sysv_ipc.c Wed Jun 24 21:09:56 2009 (r194909) +++ head/sys/kern/sysv_ipc.c Wed Jun 24 21:10:52 2009 (r194910) @@ -36,6 +36,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" #include "opt_sysvipc.h" #include @@ -147,3 +148,33 @@ ipcperm(struct thread *td, struct ipc_pe else return (EACCES); } + +#if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ + defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) +void +ipcperm_old2new(struct ipc_perm_old *old, struct ipc_perm *new) +{ + + new->cuid = old->cuid; + new->cgid = old->cgid; + new->uid = old->uid; + new->gid = old->gid; + new->mode = old->mode; + new->seq = old->seq; + new->key = old->key; +} + +void +ipcperm_new2old(struct ipc_perm *new, struct ipc_perm_old *old) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 21:18:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0E40106566C; Wed, 24 Jun 2009 21:18:53 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.freebsd.org (Postfix) with ESMTP id B5B548FC15; Wed, 24 Jun 2009 21:18:53 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from trouble.errno.com (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n5OLIqxj033007 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Jun 2009 14:18:53 -0700 (PDT) (envelope-from sam@freebsd.org) Message-ID: <4A42983C.6050307@freebsd.org> Date: Wed, 24 Jun 2009 14:18:52 -0700 From: Sam Leffler Organization: FreeBSD Project User-Agent: Thunderbird 2.0.0.21 (X11/20090411) MIME-Version: 1.0 To: Andrew Gallatin References: <200906242109.n5OL9uVb029380@svn.freebsd.org> In-Reply-To: <200906242109.n5OL9uVb029380@svn.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-DCC-x.dcc-servers-Metrics: ebb.errno.com; whitelist Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194909 - head/sys/dev/mxge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 21:18:54 -0000 Andrew Gallatin wrote: > Author: gallatin > Date: Wed Jun 24 21:09:56 2009 > New Revision: 194909 > URL: http://svn.freebsd.org/changeset/base/194909 > > Log: > Add a dying flag to prevent races at detach. > > I tried re-ordering ether_ifdetach(), but this created a new race > where sometimes, when under heavy receive load (>1Mpps) and running > tcpdump, the machine would panic. At panic, the ithread was still in > the original (not dead) if_input() path, and was accessing stale BPF > data structs. By using a dying flag, I can close the interface prior > to if_detach() to be certain the interface cannot send packets up in > the middle of ether_ifdetach. > > There's something else wrong. This is just covering up the real bug. Sam From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 21:32:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 471941065680; Wed, 24 Jun 2009 21:32: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 358B38FC14; Wed, 24 Jun 2009 21:32:52 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OLWqU9030032; Wed, 24 Jun 2009 21:32:52 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OLWqMS030030; Wed, 24 Jun 2009 21:32:52 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200906242132.n5OLWqMS030030@svn.freebsd.org> From: Jack F Vogel Date: Wed, 24 Jun 2009 21:32: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: r194911 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 21:32:52 -0000 Author: jfv Date: Wed Jun 24 21:32:51 2009 New Revision: 194911 URL: http://svn.freebsd.org/changeset/base/194911 Log: Fix lint issue. Modified: head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Wed Jun 24 21:10:52 2009 (r194910) +++ head/sys/dev/e1000/if_igb.c Wed Jun 24 21:32:51 2009 (r194911) @@ -4661,8 +4661,8 @@ igb_print_debug_info(struct adapter *ada device_printf(dev, "Queue(%d) tdh = %d, tdt = %d\n", i, E1000_READ_REG(&adapter->hw, E1000_TDH(i)), E1000_READ_REG(&adapter->hw, E1000_TDT(i))); - device_printf(dev, "no descriptors avail event = %lu\n", - txr->no_desc_avail); + device_printf(dev, "TX(%d) no descriptors avail event = %lld\n", + txr->me, (long long)txr->no_desc_avail); device_printf(dev, "TX(%d) MSIX IRQ Handled = %lld\n", txr->me, (long long)txr->tx_irq); device_printf(dev, "TX(%d) Packets sent = %lld\n", txr->me, From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 21:34:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96021106564A; Wed, 24 Jun 2009 21:34:38 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8484D8FC23; Wed, 24 Jun 2009 21:34:38 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OLYccG030165; Wed, 24 Jun 2009 21:34:38 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OLYcVZ030163; Wed, 24 Jun 2009 21:34:38 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906242134.n5OLYcVZ030163@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 21:34: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: r194912 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 21:34:39 -0000 Author: rwatson Date: Wed Jun 24 21:34:38 2009 New Revision: 194912 URL: http://svn.freebsd.org/changeset/base/194912 Log: Fix CARP build. Reported by: bz Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Wed Jun 24 21:32:51 2009 (r194911) +++ head/sys/netinet/ip_carp.c Wed Jun 24 21:34:38 2009 (r194912) @@ -1667,7 +1667,7 @@ carp_set_addr6(struct carp_softc *sc, st /* we have to do it by hands to check we won't match on us */ ia_if = NULL; own = 0; - TAILQ_FOREACH(ia6, &V_in6_ifaddrhead, ia_link) { + TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { int i; for (i = 0; i < 4; i++) { From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 21:36:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 835C2106564A; Wed, 24 Jun 2009 21:36:09 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7098D8FC13; Wed, 24 Jun 2009 21:36:09 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OLa9Yc030246; Wed, 24 Jun 2009 21:36:09 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OLa9fo030238; Wed, 24 Jun 2009 21:36:09 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906242136.n5OLa9fo030238@svn.freebsd.org> From: Robert Watson Date: Wed, 24 Jun 2009 21:36: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: r194913 - head/sys/netatalk X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 21:36:09 -0000 Author: rwatson Date: Wed Jun 24 21:36:09 2009 New Revision: 194913 URL: http://svn.freebsd.org/changeset/base/194913 Log: Use queue(9) instead of hand-crafted link lists for the global netatalk address list. Generally follow the style and convention of similar parts in netinet. MFC after: 6 weeks Modified: head/sys/netatalk/aarp.c head/sys/netatalk/at_control.c head/sys/netatalk/at_var.h head/sys/netatalk/ddp_input.c head/sys/netatalk/ddp_output.c head/sys/netatalk/ddp_pcb.c head/sys/netatalk/ddp_usrreq.c Modified: head/sys/netatalk/aarp.c ============================================================================== --- head/sys/netatalk/aarp.c Wed Jun 24 21:34:38 2009 (r194912) +++ head/sys/netatalk/aarp.c Wed Jun 24 21:36:09 2009 (r194913) @@ -154,7 +154,7 @@ at_ifawithnet_locked(struct sockaddr_at AT_IFADDR_LOCK_ASSERT(); - for (aa = at_ifaddr_list; aa != NULL; aa = aa->aa_next) { + TAILQ_FOREACH(aa, &at_ifaddrhead, aa_link) { sat2 = &(aa->aa_addr); if (sat2->sat_addr.s_net == sat->sat_addr.s_net) break; Modified: head/sys/netatalk/at_control.c ============================================================================== --- head/sys/netatalk/at_control.c Wed Jun 24 21:34:38 2009 (r194912) +++ head/sys/netatalk/at_control.c Wed Jun 24 21:36:09 2009 (r194913) @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); #include struct rwlock at_ifaddr_rw; -struct at_ifaddr *at_ifaddr_list; +struct at_ifaddrhead at_ifaddrhead; RW_SYSINIT(at_ifaddr_rw, &at_ifaddr_rw, "at_ifaddr_rw"); @@ -79,9 +79,8 @@ at_control(struct socket *so, u_long cmd struct sockaddr_at *sat; struct netrange *nr; struct at_aliasreq *ifra = (struct at_aliasreq *)data; - struct at_ifaddr *aa_temp; struct at_ifaddr *aa; - struct ifaddr *ifa, *ifa0; + struct ifaddr *ifa; int error; /* @@ -90,7 +89,7 @@ at_control(struct socket *so, u_long cmd aa = NULL; AT_IFADDR_RLOCK(); if (ifp != NULL) { - for (aa = at_ifaddr_list; aa != NULL; aa = aa->aa_next) { + TAILQ_FOREACH(aa, &at_ifaddrhead, aa_link) { if (aa->aa_ifp == ifp) break; } @@ -118,7 +117,7 @@ at_control(struct socket *so, u_long cmd struct at_ifaddr *oaa; AT_IFADDR_RLOCK(); - for (oaa = aa; aa; aa = aa->aa_next) { + for (oaa = aa; aa; aa = TAILQ_NEXT(aa, aa_link)) { if (aa->aa_ifp == ifp && sateqaddr(&aa->aa_addr, &ifra->ifra_addr)) break; @@ -161,7 +160,7 @@ at_control(struct socket *so, u_long cmd * the NEXT interface! */ AT_IFADDR_RLOCK(); - for (oaa = aa; aa; aa = aa->aa_next) { + for (oaa = aa; aa; aa = TAILQ_NEXT(aa, aa_link)) { if (aa->aa_ifp == ifp && (aa->aa_flags & AFA_PHASE2) == 0) break; @@ -180,7 +179,7 @@ at_control(struct socket *so, u_long cmd * the NEXT interface! */ AT_IFADDR_RLOCK(); - for (oaa = aa; aa; aa = aa->aa_next) { + for (oaa = aa; aa; aa = TAILQ_NEXT(aa, aa_link)) { if (aa->aa_ifp == ifp && (aa->aa_flags & AFA_PHASE2)) break; @@ -228,9 +227,9 @@ at_control(struct socket *so, u_long cmd else aa->aa_flags |= AFA_PHASE2; - ifa_ref(&aa->aa_ifa); /* at_ifaddr_list */ + ifa_ref(&aa->aa_ifa); /* at_ifaddrhead */ AT_IFADDR_WLOCK(); - if ((aa_temp = at_ifaddr_list) != NULL) { + if (!TAILQ_EMPTY(&at_ifaddrhead)) { /* * Don't let the loopback be first, since the * first address is the machine's default @@ -238,18 +237,16 @@ at_control(struct socket *so, u_long cmd * ourself in front, otherwise go to the back * of the list. */ - if (at_ifaddr_list->aa_ifp->if_flags & - IFF_LOOPBACK) { - aa->aa_next = at_ifaddr_list; - at_ifaddr_list = aa; - } else { - for (; aa_temp->aa_next; aa_temp = - aa_temp->aa_next) - ; - aa_temp->aa_next = aa; - } + if (TAILQ_FIRST(&at_ifaddrhead)->aa_ifp-> + if_flags & IFF_LOOPBACK) + TAILQ_INSERT_HEAD(&at_ifaddrhead, aa, + aa_link); + else + TAILQ_INSERT_TAIL(&at_ifaddrhead, aa, + aa_link); } else - at_ifaddr_list = aa; + TAILQ_INSERT_HEAD(&at_ifaddrhead, aa, + aa_link); AT_IFADDR_WUNLOCK(); /* @@ -280,7 +277,7 @@ at_control(struct socket *so, u_long cmd * only look at a phase one address */ AT_IFADDR_RUNLOCK(); - for (oaa = aa; aa; aa = aa->aa_next) { + for (oaa = aa; aa; aa = TAILQ_NEXT(aa, aa_link)) { if (aa->aa_ifp == ifp && (aa->aa_flags & AFA_PHASE2) == 0) break; @@ -297,7 +294,7 @@ at_control(struct socket *so, u_long cmd * default to phase 2 */ AT_IFADDR_RLOCK(); - for (oaa = aa; aa; aa = aa->aa_next) { + for (oaa = aa; aa; aa = TAILQ_NEXT(aa, aa_link)) { if (aa->aa_ifp == ifp && (aa->aa_flags & AFA_PHASE2)) break; @@ -359,11 +356,11 @@ at_control(struct socket *so, u_long cmd /* * remove the ifaddr from the interface */ - ifa0 = (struct ifaddr *)aa; + ifa = (struct ifaddr *)aa; IF_ADDR_LOCK(ifp); - TAILQ_REMOVE(&ifp->if_addrhead, ifa0, ifa_link); + TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); IF_ADDR_UNLOCK(ifp); - ifa_free(ifa0); /* if_addrhead */ + ifa_free(ifa); /* if_addrhead */ /* * Now remove the at_ifaddr from the parallel structure @@ -371,24 +368,9 @@ at_control(struct socket *so, u_long cmd */ AT_IFADDR_WLOCK(); - if (aa == (aa_temp = at_ifaddr_list)) { - at_ifaddr_list = aa->aa_next; - } else { - while (aa_temp->aa_next && (aa_temp->aa_next != aa)) - aa_temp = aa_temp->aa_next; - - /* - * if we found it, remove it, otherwise we - * screwed up. - */ - if (aa_temp->aa_next) - aa_temp->aa_next = aa->aa_next; - else - panic("at_control"); - } + TAILQ_REMOVE(&at_ifaddrhead, aa, aa_link); AT_IFADDR_WUNLOCK(); - ifa_free(ifa0); /* at_ifaddr_list */ - aa = aa_temp; + ifa_free(ifa); /* at_ifaddrhead */ break; default: @@ -760,7 +742,7 @@ at_broadcast(struct sockaddr_at *sat) /* * failing that, if the net is one we have, it's a broadcast as well. */ - for (aa = at_ifaddr_list; aa != NULL; aa = aa->aa_next) { + TAILQ_FOREACH(aa, &at_ifaddrhead, aa_link) { if ((aa->aa_ifp->if_flags & IFF_BROADCAST) && (ntohs(sat->sat_addr.s_net) >= ntohs(aa->aa_firstnet) && ntohs(sat->sat_addr.s_net) <= ntohs(aa->aa_lastnet))) Modified: head/sys/netatalk/at_var.h ============================================================================== --- head/sys/netatalk/at_var.h Wed Jun 24 21:34:38 2009 (r194912) +++ head/sys/netatalk/at_var.h Wed Jun 24 21:36:09 2009 (r194913) @@ -40,11 +40,13 @@ struct at_ifaddr { u_short aa_lastnet; int aa_probcnt; struct callout aa_callout; - struct at_ifaddr *aa_next; + TAILQ_ENTRY(at_ifaddr) aa_link; }; #define aa_ifp aa_ifa.ifa_ifp #define aa_dstaddr aa_broadaddr; +TAILQ_HEAD(at_ifaddrhead, at_ifaddr); + struct at_aliasreq { char ifra_name[IFNAMSIZ]; struct sockaddr_at ifra_addr; @@ -61,8 +63,8 @@ struct at_aliasreq { #define AFA_PHASE2 0x0004 #ifdef _KERNEL -extern struct rwlock at_ifaddr_rw; -extern struct at_ifaddr *at_ifaddr_list; +extern struct rwlock at_ifaddr_rw; +extern struct at_ifaddrhead at_ifaddrhead; #define AT_IFADDR_LOCK_INIT() rw_init(&at_ifaddr_rw, "at_ifaddr_rw") #define AT_IFADDR_LOCK_ASSERT() rw_assert(&at_ifaddr_rw, RA_LOCKED) Modified: head/sys/netatalk/ddp_input.c ============================================================================== --- head/sys/netatalk/ddp_input.c Wed Jun 24 21:34:38 2009 (r194912) +++ head/sys/netatalk/ddp_input.c Wed Jun 24 21:36:09 2009 (r194913) @@ -162,7 +162,7 @@ ddp_input(struct mbuf *m, struct ifnet * * it's valid for this packet. */ AT_IFADDR_RLOCK(); - for (aa = at_ifaddr_list; aa != NULL; aa = aa->aa_next) { + TAILQ_FOREACH(aa, &at_ifaddrhead, aa_link) { if ((aa->aa_ifp == ifp) && ((aa->aa_flags & AFA_PHASE2) == 0) && ((to.sat_addr.s_node == @@ -224,8 +224,7 @@ ddp_input(struct mbuf *m, struct ifnet * * what we want, but it's probably safe in 99.999% of * cases. */ - for (aa = at_ifaddr_list; aa != NULL; - aa = aa->aa_next) { + TAILQ_FOREACH(aa, &at_ifaddrhead, aa_link) { if (phase == 1 && (aa->aa_flags & AFA_PHASE2)) continue; @@ -244,8 +243,7 @@ ddp_input(struct mbuf *m, struct ifnet * * A destination network was given. We just try to * find which ifaddr info matches it. */ - for (aa = at_ifaddr_list; aa != NULL; - aa = aa->aa_next) { + TAILQ_FOREACH(aa, &at_ifaddrhead, aa_link) { /* * This is a kludge. Accept packets that are * for any router on a local netrange. Modified: head/sys/netatalk/ddp_output.c ============================================================================== --- head/sys/netatalk/ddp_output.c Wed Jun 24 21:34:38 2009 (r194912) +++ head/sys/netatalk/ddp_output.c Wed Jun 24 21:36:09 2009 (r194913) @@ -143,7 +143,7 @@ ddp_route(struct mbuf *m, struct route * (ifp = ro->ro_rt->rt_ifa->ifa_ifp)) { net = ntohs(satosat(ro->ro_rt->rt_gateway)->sat_addr.s_net); AT_IFADDR_RLOCK(); - for (aa = at_ifaddr_list; aa != NULL; aa = aa->aa_next) { + TAILQ_FOREACH(aa, &at_ifaddrhead, aa_link) { if (((net == 0) || (aa->aa_ifp == ifp)) && net >= ntohs(aa->aa_firstnet) && net <= ntohs(aa->aa_lastnet)) Modified: head/sys/netatalk/ddp_pcb.c ============================================================================== --- head/sys/netatalk/ddp_pcb.c Wed Jun 24 21:34:38 2009 (r194912) +++ head/sys/netatalk/ddp_pcb.c Wed Jun 24 21:36:09 2009 (r194913) @@ -113,8 +113,7 @@ at_pcbsetaddr(struct ddpcb *ddp, struct if (sat->sat_addr.s_node != ATADDR_ANYNODE || sat->sat_addr.s_net != ATADDR_ANYNET) { AT_IFADDR_RLOCK(); - for (aa = at_ifaddr_list; aa != NULL; - aa = aa->aa_next) { + TAILQ_FOREACH(aa, &at_ifaddrhead, aa_link) { if ((sat->sat_addr.s_net == AA_SAT(aa)->sat_addr.s_net) && (sat->sat_addr.s_node == @@ -146,11 +145,11 @@ at_pcbsetaddr(struct ddpcb *ddp, struct if (sat->sat_addr.s_node == ATADDR_ANYNODE && sat->sat_addr.s_net == ATADDR_ANYNET) { AT_IFADDR_RLOCK(); - if (at_ifaddr_list == NULL) { + if (TAILQ_EMPTY(&at_ifaddrhead)) { AT_IFADDR_RUNLOCK(); return (EADDRNOTAVAIL); } - sat->sat_addr = AA_SAT(at_ifaddr_list)->sat_addr; + sat->sat_addr = AA_SAT(TAILQ_FIRST(&at_ifaddrhead))->sat_addr; AT_IFADDR_RUNLOCK(); } ddp->ddp_lsat = *sat; @@ -229,8 +228,7 @@ at_pcbconnect(struct ddpcb *ddp, struct aa = NULL; AT_IFADDR_RLOCK(); if ((ifp = ro->ro_rt->rt_ifp) != NULL) { - for (aa = at_ifaddr_list; aa != NULL; - aa = aa->aa_next) { + TAILQ_FOREACH(aa, &at_ifaddrhead, aa_link) { if (aa->aa_ifp == ifp && ntohs(net) >= ntohs(aa->aa_firstnet) && ntohs(net) <= ntohs(aa->aa_lastnet)) @@ -268,7 +266,7 @@ at_pcbconnect(struct ddpcb *ddp, struct aa = NULL; if (ro->ro_rt && (ifp = ro->ro_rt->rt_ifp)) { AT_IFADDR_RLOCK(); - for (aa = at_ifaddr_list; aa != NULL; aa = aa->aa_next) { + TAILQ_FOREACH(aa, &at_ifaddrhead, aa_link) { if (aa->aa_ifp == ifp) break; } Modified: head/sys/netatalk/ddp_usrreq.c ============================================================================== --- head/sys/netatalk/ddp_usrreq.c Wed Jun 24 21:34:38 2009 (r194912) +++ head/sys/netatalk/ddp_usrreq.c Wed Jun 24 21:36:09 2009 (r194913) @@ -276,6 +276,7 @@ ddp_init(void) { DDP_LIST_LOCK_INIT(); + TAILQ_INIT(&at_ifaddrhead); netisr_register(&atalk1_nh); netisr_register(&atalk2_nh); netisr_register(&aarp_nh); From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 21:39:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE691106564A; Wed, 24 Jun 2009 21:39:50 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C6F38FC08; Wed, 24 Jun 2009 21:39:50 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OLdoIv030398; Wed, 24 Jun 2009 21:39:50 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OLdoBB030396; Wed, 24 Jun 2009 21:39:50 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200906242139.n5OLdoBB030396@svn.freebsd.org> From: Jamie Gritton Date: Wed, 24 Jun 2009 21:39: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: r194915 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 21:39:51 -0000 Author: jamie Date: Wed Jun 24 21:39:50 2009 New Revision: 194915 URL: http://svn.freebsd.org/changeset/base/194915 Log: In case of prisons with their own network stack, permit additional privileges as well as not restricting the type of sockets a user can open. Note: the VIMAGE/vnet fetaure of of jails is still considered experimental and cannot guarantee that privileged users can be kept imprisoned if enabled. Reviewed by: rwatson Approved by: bz (mentor) Modified: head/sys/kern/kern_jail.c Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Wed Jun 24 21:37:38 2009 (r194914) +++ head/sys/kern/kern_jail.c Wed Jun 24 21:39:50 2009 (r194915) @@ -3151,6 +3151,10 @@ prison_check_af(struct ucred *cred, int KASSERT(cred != NULL, ("%s: cred is NULL", __func__)); pr = cred->cr_prison; + /* Prisons with their own network stack are not limited. */ + if (pr->pr_flags & PR_VNET) + return (0); + error = 0; switch (af) { @@ -3412,6 +3416,130 @@ prison_priv_check(struct ucred *cred, in if (!jailed(cred)) return (0); +#ifdef VIMAGE + /* + * Privileges specific to prisons with a virtual network stack. + * There might be a duplicate entry here in case the privilege + * is only granted conditionally in the legacy jail case. + */ + switch (priv) { +#ifdef notyet + /* + * NFS-specific privileges. + */ + case PRIV_NFS_DAEMON: + case PRIV_NFS_LOCKD: +#endif + /* + * Network stack privileges. + */ + case PRIV_NET_BRIDGE: + case PRIV_NET_GRE: + case PRIV_NET_BPF: + case PRIV_NET_RAW: /* Dup, cond. in legacy jail case. */ + case PRIV_NET_ROUTE: + case PRIV_NET_TAP: + case PRIV_NET_SETIFMTU: + case PRIV_NET_SETIFFLAGS: + case PRIV_NET_SETIFCAP: + case PRIV_NET_SETIFNAME : + case PRIV_NET_SETIFMETRIC: + case PRIV_NET_SETIFPHYS: + case PRIV_NET_SETIFMAC: + case PRIV_NET_ADDMULTI: + case PRIV_NET_DELMULTI: + case PRIV_NET_HWIOCTL: + case PRIV_NET_SETLLADDR: + case PRIV_NET_ADDIFGROUP: + case PRIV_NET_DELIFGROUP: + case PRIV_NET_IFCREATE: + case PRIV_NET_IFDESTROY: + case PRIV_NET_ADDIFADDR: + case PRIV_NET_DELIFADDR: + case PRIV_NET_LAGG: + case PRIV_NET_GIF: + case PRIV_NET_SETIFVNET: + + /* + * 802.11-related privileges. + */ + case PRIV_NET80211_GETKEY: +#ifdef notyet + case PRIV_NET80211_MANAGE: /* XXX-BZ discuss with sam@ */ +#endif + +#ifdef notyet + /* + * AppleTalk privileges. + */ + case PRIV_NETATALK_RESERVEDPORT: + + /* + * ATM privileges. + */ + case PRIV_NETATM_CFG: + case PRIV_NETATM_ADD: + case PRIV_NETATM_DEL: + case PRIV_NETATM_SET: + + /* + * Bluetooth privileges. + */ + case PRIV_NETBLUETOOTH_RAW: +#endif + + /* + * Netgraph and netgraph module privileges. + */ + case PRIV_NETGRAPH_CONTROL: +#ifdef notyet + case PRIV_NETGRAPH_TTY: +#endif + + /* + * IPv4 and IPv6 privileges. + */ + case PRIV_NETINET_IPFW: + case PRIV_NETINET_DIVERT: + case PRIV_NETINET_PF: + case PRIV_NETINET_DUMMYNET: + case PRIV_NETINET_CARP: + case PRIV_NETINET_MROUTE: + case PRIV_NETINET_RAW: + case PRIV_NETINET_ADDRCTRL6: + case PRIV_NETINET_ND6: + case PRIV_NETINET_SCOPE6: + case PRIV_NETINET_ALIFETIME6: + case PRIV_NETINET_IPSEC: + case PRIV_NETINET_BINDANY: + +#ifdef notyet + /* + * IPX/SPX privileges. + */ + case PRIV_NETIPX_RESERVEDPORT: + case PRIV_NETIPX_RAW: + + /* + * NCP privileges. + */ + case PRIV_NETNCP: + + /* + * SMB privileges. + */ + case PRIV_NETSMB: +#endif + + /* + * No default: or deny here. + * In case of no permit fall through to next switch(). + */ + if (cred->cr_prison->pr_flags & PR_VNET) + return (0); + } +#endif /* VIMAGE */ + switch (priv) { /* From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 21:51:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A59F41065670; Wed, 24 Jun 2009 21:51:02 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 864088FC16; Wed, 24 Jun 2009 21:51:02 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OLp2kG030793; Wed, 24 Jun 2009 21:51:02 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OLp2DQ030789; Wed, 24 Jun 2009 21:51:02 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906242151.n5OLp2DQ030789@svn.freebsd.org> From: Xin LI Date: Wed, 24 Jun 2009 21:51: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: r194916 - head/usr.bin/gzip X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 21:51:03 -0000 Author: delphij Date: Wed Jun 24 21:51:02 2009 New Revision: 194916 URL: http://svn.freebsd.org/changeset/base/194916 Log: Sync with NetBSD: - gzip -n does not store timestamp; [1] - Reduce diff against NetBSD by moving some casts in our local versions. PR: bin/134955 Obtained from: NetBSD MFC after: 1 month Modified: head/usr.bin/gzip/gzip.1 head/usr.bin/gzip/gzip.c head/usr.bin/gzip/zuncompress.c Modified: head/usr.bin/gzip/gzip.1 ============================================================================== --- head/usr.bin/gzip/gzip.1 Wed Jun 24 21:39:50 2009 (r194915) +++ head/usr.bin/gzip/gzip.1 Wed Jun 24 21:51:02 2009 (r194916) @@ -1,4 +1,4 @@ -.\" $NetBSD: gzip.1,v 1.19 2008/05/29 14:51:27 mrg Exp $ +.\" $NetBSD: gzip.1,v 1.20 2009/04/01 08:15:37 mrg Exp $ .\" .\" Copyright (c) 1997, 2003, 2004 Matthew R. Green .\" All rights reserved. @@ -25,7 +25,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd June 30, 2008 +.Dd June 24, 2009 .Dt GZIP 1 .Os .Sh NAME @@ -152,8 +152,8 @@ embedded in the file. This option causes the stored filename in the input file to be used as the output file. .It Fl n , -no-name -This option stops the filename from being stored in the output -file. +This option stops the filename and timestamp from being stored in +the output file. .It Fl q , -quiet With this option, no warnings or errors are printed. .It Fl r , -recursive @@ -206,7 +206,7 @@ This implementation of was ported based on the .Nx .Nm -20060927, and first appeared in +20090412, and first appeared in .Fx 7.0 . .Sh AUTHORS This implementation of Modified: head/usr.bin/gzip/gzip.c ============================================================================== --- head/usr.bin/gzip/gzip.c Wed Jun 24 21:39:50 2009 (r194915) +++ head/usr.bin/gzip/gzip.c Wed Jun 24 21:51:02 2009 (r194916) @@ -1,4 +1,4 @@ -/* $NetBSD: gzip.c,v 1.92 2008/07/21 14:19:22 lukem Exp $ */ +/* $NetBSD: gzip.c,v 1.94 2009/04/12 10:31:14 lukem Exp $ */ /*- * Copyright (c) 1997, 1998, 2003, 2004, 2006 Matthew R. Green @@ -1360,10 +1360,10 @@ file_uncompress(char *file, char *outfil #ifndef SMALL if (method == FT_GZIP && Nflag) { unsigned char ts[4]; /* timestamp */ - int rv; + ssize_t rv; rv = pread(fd, ts, sizeof ts, GZIP_TIMESTAMP); - if (rv >= 0 && (size_t)rv < sizeof ts) + if (rv >= 0 && rv < (ssize_t)(sizeof ts)) goto unexpected_EOF; if (rv == -1) { if (!fflag) Modified: head/usr.bin/gzip/zuncompress.c ============================================================================== --- head/usr.bin/gzip/zuncompress.c Wed Jun 24 21:39:50 2009 (r194915) +++ head/usr.bin/gzip/zuncompress.c Wed Jun 24 21:51:02 2009 (r194916) @@ -1,4 +1,4 @@ -/* $NetBSD: zuncompress.c,v 1.6 2005/11/22 09:05:30 mrg Exp $ */ +/* $NetBSD: zuncompress.c,v 1.7 2009/04/12 10:31:14 lukem Exp $ */ /*- * Copyright (c) 1985, 1986, 1992, 1993 @@ -147,7 +147,7 @@ zuncompress(FILE *in, FILE *out, char *p compressed_pre = NULL; while ((bin = fread(buf, 1, sizeof(buf), in)) != 0) { - if (tflag == 0 && fwrite(buf, 1, bin, out) != (size_t)bin) { + if (tflag == 0 && (off_t)fwrite(buf, 1, bin, out) != bin) { free(buf); return -1; } From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 21:51:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92EBE1065677; Wed, 24 Jun 2009 21:51:42 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 81B6C8FC29; Wed, 24 Jun 2009 21:51:42 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OLpg53030839; Wed, 24 Jun 2009 21:51:42 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OLpg4b030837; Wed, 24 Jun 2009 21:51:42 GMT (envelope-from np@svn.freebsd.org) Message-Id: <200906242151.n5OLpg4b030837@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 24 Jun 2009 21:51:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194917 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 21:51:43 -0000 Author: np Date: Wed Jun 24 21:51:42 2009 New Revision: 194917 URL: http://svn.freebsd.org/changeset/base/194917 Log: About to add 10Gbase-T to known media types, this is just a whitespace cleanup before that commit. No functional impact. Approved by: gnn (mentor) Modified: head/sys/net/if_media.h Modified: head/sys/net/if_media.h ============================================================================== --- head/sys/net/if_media.h Wed Jun 24 21:51:02 2009 (r194916) +++ head/sys/net/if_media.h Wed Jun 24 21:51:42 2009 (r194917) @@ -145,10 +145,10 @@ uint64_t ifmedia_baudrate(int); #define IFM_10G_SR 19 /* 10GBase-SR 850nm Multi-mode */ #define IFM_10G_CX4 20 /* 10GBase CX4 copper */ #define IFM_2500_SX 21 /* 2500BaseSX - multi-mode fiber */ -#define IFM_10G_TWINAX 22 /* 10GBase Twinax copper */ -#define IFM_10G_TWINAX_LONG 23 /* 10GBase Twinax Long copper */ -#define IFM_10G_LRM 24 /* 10GBase-LRM 850nm Multi-mode */ -#define IFM_UNKNOWN 25 /* New media types that have not been defined yet */ +#define IFM_10G_TWINAX 22 /* 10GBase Twinax copper */ +#define IFM_10G_TWINAX_LONG 23 /* 10GBase Twinax Long copper */ +#define IFM_10G_LRM 24 /* 10GBase-LRM 850nm Multi-mode */ +#define IFM_UNKNOWN 25 /* media types not defined yet */ /* note 31 is the max! */ @@ -354,10 +354,10 @@ struct ifmedia_description { { IFM_10G_SR, "10Gbase-SR" }, \ { IFM_10G_CX4, "10Gbase-CX4" }, \ { IFM_2500_SX, "2500BaseSX" }, \ - { IFM_10G_LRM, "10Gbase-LRM" }, \ - { IFM_10G_TWINAX, "10Gbase-Twinax" }, \ - { IFM_10G_TWINAX_LONG, "10Gbase-Twinax-Long" }, \ - { IFM_UNKNOWN, "Unknown" }, \ + { IFM_10G_LRM, "10Gbase-LRM" }, \ + { IFM_10G_TWINAX, "10Gbase-Twinax" }, \ + { IFM_10G_TWINAX_LONG, "10Gbase-Twinax-Long" }, \ + { IFM_UNKNOWN, "Unknown" }, \ { 0, NULL }, \ } @@ -613,7 +613,7 @@ struct ifmedia_baudrate { { IFM_ETHER | IFM_10G_CX4, IF_Gbps(10ULL) }, \ { IFM_ETHER | IFM_2500_SX, IF_Mbps(2500ULL) }, \ { IFM_ETHER | IFM_10G_TWINAX, IF_Gbps(10ULL) }, \ - { IFM_ETHER | IFM_10G_TWINAX_LONG, IF_Gbps(10ULL) }, \ + { IFM_ETHER | IFM_10G_TWINAX_LONG, IF_Gbps(10ULL) }, \ { IFM_ETHER | IFM_10G_LRM, IF_Gbps(10ULL) }, \ \ { IFM_TOKEN | IFM_TOK_STP4, IF_Mbps(4) }, \ From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 21:53:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A799E1065675; Wed, 24 Jun 2009 21:53:25 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 961428FC2D; Wed, 24 Jun 2009 21:53:25 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OLrPqG030918; Wed, 24 Jun 2009 21:53:25 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OLrPEV030916; Wed, 24 Jun 2009 21:53:25 GMT (envelope-from np@svn.freebsd.org) Message-Id: <200906242153.n5OLrPEV030916@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 24 Jun 2009 21:53: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: r194918 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 21:53:26 -0000 Author: np Date: Wed Jun 24 21:53:25 2009 New Revision: 194918 URL: http://svn.freebsd.org/changeset/base/194918 Log: Add 10Gbase-T to known ethernet media types. Approved by: gnn (mentor) MFC after: 1 week. Modified: head/sys/net/if_media.h Modified: head/sys/net/if_media.h ============================================================================== --- head/sys/net/if_media.h Wed Jun 24 21:51:42 2009 (r194917) +++ head/sys/net/if_media.h Wed Jun 24 21:53:25 2009 (r194918) @@ -149,6 +149,7 @@ uint64_t ifmedia_baudrate(int); #define IFM_10G_TWINAX_LONG 23 /* 10GBase Twinax Long copper */ #define IFM_10G_LRM 24 /* 10GBase-LRM 850nm Multi-mode */ #define IFM_UNKNOWN 25 /* media types not defined yet */ +#define IFM_10G_T 26 /* 10GBase-T - RJ45 */ /* note 31 is the max! */ @@ -358,6 +359,7 @@ struct ifmedia_description { { IFM_10G_TWINAX, "10Gbase-Twinax" }, \ { IFM_10G_TWINAX_LONG, "10Gbase-Twinax-Long" }, \ { IFM_UNKNOWN, "Unknown" }, \ + { IFM_10G_T, "10Gbase-T" }, \ { 0, NULL }, \ } @@ -615,6 +617,7 @@ struct ifmedia_baudrate { { IFM_ETHER | IFM_10G_TWINAX, IF_Gbps(10ULL) }, \ { IFM_ETHER | IFM_10G_TWINAX_LONG, IF_Gbps(10ULL) }, \ { IFM_ETHER | IFM_10G_LRM, IF_Gbps(10ULL) }, \ + { IFM_ETHER | IFM_10G_T, IF_Gbps(10ULL) }, \ \ { IFM_TOKEN | IFM_TOK_STP4, IF_Mbps(4) }, \ { IFM_TOKEN | IFM_TOK_STP16, IF_Mbps(16) }, \ From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 21:54:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05B1E1065672; Wed, 24 Jun 2009 21:54:09 +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 E675D8FC0C; Wed, 24 Jun 2009 21:54:08 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OLs88Q030978; Wed, 24 Jun 2009 21:54:08 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OLs86f030967; Wed, 24 Jun 2009 21:54:08 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906242154.n5OLs86f030967@svn.freebsd.org> From: John Baldwin Date: Wed, 24 Jun 2009 21:54: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: r194919 - in head/sys: compat/freebsd32 kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 21:54:09 -0000 Author: jhb Date: Wed Jun 24 21:54:08 2009 New Revision: 194919 URL: http://svn.freebsd.org/changeset/base/194919 Log: Regen. Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/kern/init_sysent.c head/sys/kern/syscalls.c head/sys/kern/systrace_args.c head/sys/sys/syscall.h head/sys/sys/syscall.mk head/sys/sys/sysproto.h Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Wed Jun 24 21:53:25 2009 (r194918) +++ head/sys/compat/freebsd32/freebsd32_proto.h Wed Jun 24 21:54:08 2009 (r194919) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194645 2009-06-22 20:12:40Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194910 2009-06-24 21:10:52Z jhb */ #ifndef _FREEBSD32_SYSPROTO_H_ @@ -174,17 +174,6 @@ struct freebsd32_futimes_args { char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; char tptr_l_[PADL_(struct timeval32 *)]; struct timeval32 * tptr; char tptr_r_[PADR_(struct timeval32 *)]; }; -struct freebsd32_semctl_args { - char semid_l_[PADL_(int)]; int semid; char semid_r_[PADR_(int)]; - char semnum_l_[PADL_(int)]; int semnum; char semnum_r_[PADR_(int)]; - char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; - char arg_l_[PADL_(union semun32 *)]; union semun32 * arg; char arg_r_[PADR_(union semun32 *)]; -}; -struct freebsd32_msgctl_args { - char msqid_l_[PADL_(int)]; int msqid; char msqid_r_[PADR_(int)]; - char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; - char buf_l_[PADL_(struct msqid_ds32 *)]; struct msqid_ds32 * buf; char buf_r_[PADR_(struct msqid_ds32 *)]; -}; struct freebsd32_msgsnd_args { char msqid_l_[PADL_(int)]; int msqid; char msqid_r_[PADR_(int)]; char msgp_l_[PADL_(void *)]; void * msgp; char msgp_r_[PADR_(void *)]; @@ -198,11 +187,6 @@ struct freebsd32_msgrcv_args { char msgtyp_l_[PADL_(long)]; long msgtyp; char msgtyp_r_[PADR_(long)]; char msgflg_l_[PADL_(int)]; int msgflg; char msgflg_r_[PADR_(int)]; }; -struct freebsd32_shmctl_args { - char shmid_l_[PADL_(int)]; int shmid; char shmid_r_[PADR_(int)]; - char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; - char buf_l_[PADL_(struct shmid_ds *)]; struct shmid_ds * buf; char buf_r_[PADR_(struct shmid_ds *)]; -}; struct freebsd32_clock_gettime_args { char clock_id_l_[PADL_(clockid_t)]; clockid_t clock_id; char clock_id_r_[PADR_(clockid_t)]; char tp_l_[PADL_(struct timespec32 *)]; struct timespec32 * tp; char tp_r_[PADR_(struct timespec32 *)]; @@ -453,6 +437,22 @@ struct freebsd32_jail_set_args { char iovcnt_l_[PADL_(unsigned int)]; unsigned int iovcnt; char iovcnt_r_[PADR_(unsigned int)]; char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; }; +struct freebsd32_semctl_args { + char semid_l_[PADL_(int)]; int semid; char semid_r_[PADR_(int)]; + char semnum_l_[PADL_(int)]; int semnum; char semnum_r_[PADR_(int)]; + char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; + char arg_l_[PADL_(union semun32 *)]; union semun32 * arg; char arg_r_[PADR_(union semun32 *)]; +}; +struct freebsd32_msgctl_args { + char msqid_l_[PADL_(int)]; int msqid; char msqid_r_[PADR_(int)]; + char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; + char buf_l_[PADL_(struct msqid_ds32 *)]; struct msqid_ds32 * buf; char buf_r_[PADR_(struct msqid_ds32 *)]; +}; +struct freebsd32_shmctl_args { + char shmid_l_[PADL_(int)]; int shmid; char shmid_r_[PADR_(int)]; + char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; + char buf_l_[PADL_(struct shmid_ds32 *)]; struct shmid_ds32 * buf; char buf_r_[PADR_(struct shmid_ds32 *)]; +}; int freebsd32_wait4(struct thread *, struct freebsd32_wait4_args *); int freebsd32_recvmsg(struct thread *, struct freebsd32_recvmsg_args *); int freebsd32_sendmsg(struct thread *, struct freebsd32_sendmsg_args *); @@ -480,11 +480,8 @@ int freebsd32_lstat(struct thread *, str int freebsd32_getdirentries(struct thread *, struct freebsd32_getdirentries_args *); int freebsd32_sysctl(struct thread *, struct freebsd32_sysctl_args *); int freebsd32_futimes(struct thread *, struct freebsd32_futimes_args *); -int freebsd32_semctl(struct thread *, struct freebsd32_semctl_args *); -int freebsd32_msgctl(struct thread *, struct freebsd32_msgctl_args *); int freebsd32_msgsnd(struct thread *, struct freebsd32_msgsnd_args *); int freebsd32_msgrcv(struct thread *, struct freebsd32_msgrcv_args *); -int freebsd32_shmctl(struct thread *, struct freebsd32_shmctl_args *); int freebsd32_clock_gettime(struct thread *, struct freebsd32_clock_gettime_args *); int freebsd32_clock_settime(struct thread *, struct freebsd32_clock_settime_args *); int freebsd32_clock_getres(struct thread *, struct freebsd32_clock_getres_args *); @@ -536,6 +533,9 @@ int freebsd32_fstatat(struct thread *, s int freebsd32_futimesat(struct thread *, struct freebsd32_futimesat_args *); int freebsd32_jail_get(struct thread *, struct freebsd32_jail_get_args *); int freebsd32_jail_set(struct thread *, struct freebsd32_jail_set_args *); +int freebsd32_semctl(struct thread *, struct freebsd32_semctl_args *); +int freebsd32_msgctl(struct thread *, struct freebsd32_msgctl_args *); +int freebsd32_shmctl(struct thread *, struct freebsd32_shmctl_args *); #ifdef COMPAT_43 @@ -682,6 +682,31 @@ int freebsd6_freebsd32_ftruncate(struct #endif /* COMPAT_FREEBSD6 */ + +#ifdef COMPAT_FREEBSD7 + +struct freebsd7_freebsd32_semctl_args { + char semid_l_[PADL_(int)]; int semid; char semid_r_[PADR_(int)]; + char semnum_l_[PADL_(int)]; int semnum; char semnum_r_[PADR_(int)]; + char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; + char arg_l_[PADL_(union semun32 *)]; union semun32 * arg; char arg_r_[PADR_(union semun32 *)]; +}; +struct freebsd7_freebsd32_msgctl_args { + char msqid_l_[PADL_(int)]; int msqid; char msqid_r_[PADR_(int)]; + char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; + char buf_l_[PADL_(struct msqid_ds32_old *)]; struct msqid_ds32_old * buf; char buf_r_[PADR_(struct msqid_ds32_old *)]; +}; +struct freebsd7_freebsd32_shmctl_args { + char shmid_l_[PADL_(int)]; int shmid; char shmid_r_[PADR_(int)]; + char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; + char buf_l_[PADL_(struct shmid_ds32_old *)]; struct shmid_ds32_old * buf; char buf_r_[PADR_(struct shmid_ds32_old *)]; +}; +int freebsd7_freebsd32_semctl(struct thread *, struct freebsd7_freebsd32_semctl_args *); +int freebsd7_freebsd32_msgctl(struct thread *, struct freebsd7_freebsd32_msgctl_args *); +int freebsd7_freebsd32_shmctl(struct thread *, struct freebsd7_freebsd32_shmctl_args *); + +#endif /* COMPAT_FREEBSD7 */ + #define FREEBSD32_SYS_AUE_freebsd32_wait4 AUE_WAIT4 #define FREEBSD32_SYS_AUE_freebsd4_freebsd32_getfsstat AUE_GETFSSTAT #define FREEBSD32_SYS_AUE_freebsd32_recvmsg AUE_RECVMSG @@ -726,11 +751,11 @@ int freebsd6_freebsd32_ftruncate(struct #define FREEBSD32_SYS_AUE_freebsd6_freebsd32_ftruncate AUE_FTRUNCATE #define FREEBSD32_SYS_AUE_freebsd32_sysctl AUE_SYSCTL #define FREEBSD32_SYS_AUE_freebsd32_futimes AUE_FUTIMES -#define FREEBSD32_SYS_AUE_freebsd32_semctl AUE_SEMCTL -#define FREEBSD32_SYS_AUE_freebsd32_msgctl AUE_MSGCTL +#define FREEBSD32_SYS_AUE_freebsd7_freebsd32_semctl AUE_SEMCTL +#define FREEBSD32_SYS_AUE_freebsd7_freebsd32_msgctl AUE_MSGCTL #define FREEBSD32_SYS_AUE_freebsd32_msgsnd AUE_MSGSND #define FREEBSD32_SYS_AUE_freebsd32_msgrcv AUE_MSGRCV -#define FREEBSD32_SYS_AUE_freebsd32_shmctl AUE_SHMCTL +#define FREEBSD32_SYS_AUE_freebsd7_freebsd32_shmctl AUE_SHMCTL #define FREEBSD32_SYS_AUE_freebsd32_clock_gettime AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_clock_settime AUE_CLOCK_SETTIME #define FREEBSD32_SYS_AUE_freebsd32_clock_getres AUE_NULL @@ -786,6 +811,9 @@ int freebsd6_freebsd32_ftruncate(struct #define FREEBSD32_SYS_AUE_freebsd32_futimesat AUE_FUTIMESAT #define FREEBSD32_SYS_AUE_freebsd32_jail_get AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_jail_set AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_semctl AUE_SEMCTL +#define FREEBSD32_SYS_AUE_freebsd32_msgctl AUE_MSGCTL +#define FREEBSD32_SYS_AUE_freebsd32_shmctl AUE_SHMCTL #undef PAD_ #undef PADL_ Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Wed Jun 24 21:53:25 2009 (r194918) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Wed Jun 24 21:54:08 2009 (r194919) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194645 2009-06-22 20:12:40Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194910 2009-06-24 21:10:52Z jhb */ #define FREEBSD32_SYS_syscall 0 @@ -190,15 +190,15 @@ #define FREEBSD32_SYS_freebsd32_futimes 206 #define FREEBSD32_SYS_getpgid 207 #define FREEBSD32_SYS_poll 209 -#define FREEBSD32_SYS_freebsd32_semctl 220 +#define FREEBSD32_SYS_freebsd7_freebsd32_semctl 220 #define FREEBSD32_SYS_semget 221 #define FREEBSD32_SYS_semop 222 -#define FREEBSD32_SYS_freebsd32_msgctl 224 +#define FREEBSD32_SYS_freebsd7_freebsd32_msgctl 224 #define FREEBSD32_SYS_msgget 225 #define FREEBSD32_SYS_freebsd32_msgsnd 226 #define FREEBSD32_SYS_freebsd32_msgrcv 227 #define FREEBSD32_SYS_shmat 228 -#define FREEBSD32_SYS_freebsd32_shmctl 229 +#define FREEBSD32_SYS_freebsd7_freebsd32_shmctl 229 #define FREEBSD32_SYS_shmdt 230 #define FREEBSD32_SYS_shmget 231 #define FREEBSD32_SYS_freebsd32_clock_gettime 232 @@ -378,4 +378,7 @@ #define FREEBSD32_SYS_freebsd32_jail_set 507 #define FREEBSD32_SYS_jail_remove 508 #define FREEBSD32_SYS_closefrom 509 -#define FREEBSD32_SYS_MAXSYSCALL 510 +#define FREEBSD32_SYS_freebsd32_semctl 510 +#define FREEBSD32_SYS_freebsd32_msgctl 511 +#define FREEBSD32_SYS_freebsd32_shmctl 512 +#define FREEBSD32_SYS_MAXSYSCALL 513 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Wed Jun 24 21:53:25 2009 (r194918) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Wed Jun 24 21:54:08 2009 (r194919) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194645 2009-06-22 20:12:40Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194910 2009-06-24 21:10:52Z jhb */ const char *freebsd32_syscallnames[] = { @@ -227,16 +227,16 @@ const char *freebsd32_syscallnames[] = { "lkmnosys", /* 217 = lkmnosys */ "lkmnosys", /* 218 = lkmnosys */ "lkmnosys", /* 219 = lkmnosys */ - "freebsd32_semctl", /* 220 = freebsd32_semctl */ + "compat7.freebsd32_semctl", /* 220 = freebsd7 freebsd32_semctl */ "semget", /* 221 = semget */ "semop", /* 222 = semop */ "#223", /* 223 = semconfig */ - "freebsd32_msgctl", /* 224 = freebsd32_msgctl */ + "compat7.freebsd32_msgctl", /* 224 = freebsd7 freebsd32_msgctl */ "msgget", /* 225 = msgget */ "freebsd32_msgsnd", /* 226 = freebsd32_msgsnd */ "freebsd32_msgrcv", /* 227 = freebsd32_msgrcv */ "shmat", /* 228 = shmat */ - "freebsd32_shmctl", /* 229 = freebsd32_shmctl */ + "compat7.freebsd32_shmctl", /* 229 = freebsd7 freebsd32_shmctl */ "shmdt", /* 230 = shmdt */ "shmget", /* 231 = shmget */ "freebsd32_clock_gettime", /* 232 = freebsd32_clock_gettime */ @@ -517,4 +517,7 @@ const char *freebsd32_syscallnames[] = { "freebsd32_jail_set", /* 507 = freebsd32_jail_set */ "jail_remove", /* 508 = jail_remove */ "closefrom", /* 509 = closefrom */ + "freebsd32_semctl", /* 510 = freebsd32_semctl */ + "freebsd32_msgctl", /* 511 = freebsd32_msgctl */ + "freebsd32_shmctl", /* 512 = freebsd32_shmctl */ }; Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Wed Jun 24 21:53:25 2009 (r194918) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Wed Jun 24 21:54:08 2009 (r194919) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194645 2009-06-22 20:12:40Z jhb + * created from FreeBSD: head/sys/compat/freebsd32/syscalls.master 194910 2009-06-24 21:10:52Z jhb */ #include "opt_compat.h" @@ -36,6 +36,12 @@ #define compat6(n, name) 0, (sy_call_t *)nosys #endif +#ifdef COMPAT_FREEBSD7 +#define compat7(n, name) n, (sy_call_t *)__CONCAT(freebsd7_,name) +#else +#define compat7(n, name) 0, (sy_call_t *)nosys +#endif + /* The casts are bogus but will do for now. */ struct sysent freebsd32_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 0 = syscall */ @@ -258,16 +264,16 @@ struct sysent freebsd32_sysent[] = { { AS(nosys_args), (sy_call_t *)lkmnosys, AUE_NULL, NULL, 0, 0, 0 }, /* 217 = lkmnosys */ { AS(nosys_args), (sy_call_t *)lkmnosys, AUE_NULL, NULL, 0, 0, 0 }, /* 218 = lkmnosys */ { AS(nosys_args), (sy_call_t *)lkmnosys, AUE_NULL, NULL, 0, 0, 0 }, /* 219 = lkmnosys */ - { AS(freebsd32_semctl_args), (sy_call_t *)freebsd32_semctl, AUE_SEMCTL, NULL, 0, 0, 0 }, /* 220 = freebsd32_semctl */ + { compat7(AS(freebsd7_freebsd32_semctl_args),freebsd32_semctl), AUE_SEMCTL, NULL, 0, 0, 0 }, /* 220 = freebsd7 freebsd32_semctl */ { AS(semget_args), (sy_call_t *)semget, AUE_SEMGET, NULL, 0, 0, 0 }, /* 221 = semget */ { AS(semop_args), (sy_call_t *)semop, AUE_SEMOP, NULL, 0, 0, 0 }, /* 222 = semop */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 223 = semconfig */ - { AS(freebsd32_msgctl_args), (sy_call_t *)freebsd32_msgctl, AUE_MSGCTL, NULL, 0, 0, 0 }, /* 224 = freebsd32_msgctl */ + { compat7(AS(freebsd7_freebsd32_msgctl_args),freebsd32_msgctl), AUE_MSGCTL, NULL, 0, 0, 0 }, /* 224 = freebsd7 freebsd32_msgctl */ { AS(msgget_args), (sy_call_t *)msgget, AUE_MSGGET, NULL, 0, 0, 0 }, /* 225 = msgget */ { AS(freebsd32_msgsnd_args), (sy_call_t *)freebsd32_msgsnd, AUE_MSGSND, NULL, 0, 0, 0 }, /* 226 = freebsd32_msgsnd */ { AS(freebsd32_msgrcv_args), (sy_call_t *)freebsd32_msgrcv, AUE_MSGRCV, NULL, 0, 0, 0 }, /* 227 = freebsd32_msgrcv */ { AS(shmat_args), (sy_call_t *)shmat, AUE_SHMAT, NULL, 0, 0, 0 }, /* 228 = shmat */ - { AS(freebsd32_shmctl_args), (sy_call_t *)freebsd32_shmctl, AUE_SHMCTL, NULL, 0, 0, 0 }, /* 229 = freebsd32_shmctl */ + { compat7(AS(freebsd7_freebsd32_shmctl_args),freebsd32_shmctl), AUE_SHMCTL, NULL, 0, 0, 0 }, /* 229 = freebsd7 freebsd32_shmctl */ { AS(shmdt_args), (sy_call_t *)shmdt, AUE_SHMDT, NULL, 0, 0, 0 }, /* 230 = shmdt */ { AS(shmget_args), (sy_call_t *)shmget, AUE_SHMGET, NULL, 0, 0, 0 }, /* 231 = shmget */ { AS(freebsd32_clock_gettime_args), (sy_call_t *)freebsd32_clock_gettime, AUE_NULL, NULL, 0, 0, 0 }, /* 232 = freebsd32_clock_gettime */ @@ -548,4 +554,7 @@ struct sysent freebsd32_sysent[] = { { AS(freebsd32_jail_set_args), (sy_call_t *)freebsd32_jail_set, AUE_NULL, NULL, 0, 0, 0 }, /* 507 = freebsd32_jail_set */ { AS(jail_remove_args), (sy_call_t *)jail_remove, AUE_NULL, NULL, 0, 0, 0 }, /* 508 = jail_remove */ { AS(closefrom_args), (sy_call_t *)closefrom, AUE_CLOSEFROM, NULL, 0, 0, 0 }, /* 509 = closefrom */ + { AS(freebsd32_semctl_args), (sy_call_t *)freebsd32_semctl, AUE_SEMCTL, NULL, 0, 0, 0 }, /* 510 = freebsd32_semctl */ + { AS(freebsd32_msgctl_args), (sy_call_t *)freebsd32_msgctl, AUE_MSGCTL, NULL, 0, 0, 0 }, /* 511 = freebsd32_msgctl */ + { AS(freebsd32_shmctl_args), (sy_call_t *)freebsd32_shmctl, AUE_SHMCTL, NULL, 0, 0, 0 }, /* 512 = freebsd32_shmctl */ }; Modified: head/sys/kern/init_sysent.c ============================================================================== --- head/sys/kern/init_sysent.c Wed Jun 24 21:53:25 2009 (r194918) +++ head/sys/kern/init_sysent.c Wed Jun 24 21:54:08 2009 (r194919) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 194645 2009-06-22 20:12:40Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 194910 2009-06-24 21:10:52Z jhb */ #include "opt_compat.h" @@ -26,6 +26,12 @@ #define compat4(n, name) 0, (sy_call_t *)nosys #endif +#ifdef COMPAT_FREEBSD7 +#define compat7(n, name) n, (sy_call_t *)__CONCAT(freebsd7_,name) +#else +#define compat7(n, name) 0, (sy_call_t *)nosys +#endif + /* The casts are bogus but will do for now. */ struct sysent sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 0 = syscall */ @@ -248,16 +254,16 @@ struct sysent sysent[] = { { AS(nosys_args), (sy_call_t *)lkmnosys, AUE_NULL, NULL, 0, 0, 0 }, /* 217 = lkmnosys */ { AS(nosys_args), (sy_call_t *)lkmnosys, AUE_NULL, NULL, 0, 0, 0 }, /* 218 = lkmnosys */ { AS(nosys_args), (sy_call_t *)lkmnosys, AUE_NULL, NULL, 0, 0, 0 }, /* 219 = lkmnosys */ - { AS(__semctl_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 220 = __semctl */ + { 0, (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 220 = freebsd7 __semctl */ { AS(semget_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 221 = semget */ { AS(semop_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 222 = semop */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0 }, /* 223 = semconfig */ - { AS(msgctl_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 224 = msgctl */ + { 0, (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 224 = freebsd7 msgctl */ { AS(msgget_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 225 = msgget */ { AS(msgsnd_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 226 = msgsnd */ { AS(msgrcv_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 227 = msgrcv */ { AS(shmat_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 228 = shmat */ - { AS(shmctl_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 229 = shmctl */ + { 0, (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 229 = freebsd7 shmctl */ { AS(shmdt_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 230 = shmdt */ { AS(shmget_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 231 = shmget */ { AS(clock_gettime_args), (sy_call_t *)clock_gettime, AUE_NULL, NULL, 0, 0, 0 }, /* 232 = clock_gettime */ @@ -538,4 +544,7 @@ struct sysent sysent[] = { { AS(jail_set_args), (sy_call_t *)jail_set, AUE_NULL, NULL, 0, 0, 0 }, /* 507 = jail_set */ { AS(jail_remove_args), (sy_call_t *)jail_remove, AUE_NULL, NULL, 0, 0, 0 }, /* 508 = jail_remove */ { AS(closefrom_args), (sy_call_t *)closefrom, AUE_CLOSEFROM, NULL, 0, 0, 0 }, /* 509 = closefrom */ + { AS(__semctl_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 510 = __semctl */ + { AS(msgctl_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 511 = msgctl */ + { AS(shmctl_args), (sy_call_t *)lkmressys, AUE_NULL, NULL, 0, 0, 0 }, /* 512 = shmctl */ }; Modified: head/sys/kern/syscalls.c ============================================================================== --- head/sys/kern/syscalls.c Wed Jun 24 21:53:25 2009 (r194918) +++ head/sys/kern/syscalls.c Wed Jun 24 21:54:08 2009 (r194919) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 194645 2009-06-22 20:12:40Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 194910 2009-06-24 21:10:52Z jhb */ const char *syscallnames[] = { @@ -227,16 +227,16 @@ const char *syscallnames[] = { "lkmnosys", /* 217 = lkmnosys */ "lkmnosys", /* 218 = lkmnosys */ "lkmnosys", /* 219 = lkmnosys */ - "__semctl", /* 220 = __semctl */ + "compat7.__semctl", /* 220 = freebsd7 __semctl */ "semget", /* 221 = semget */ "semop", /* 222 = semop */ "#223", /* 223 = semconfig */ - "msgctl", /* 224 = msgctl */ + "compat7.msgctl", /* 224 = freebsd7 msgctl */ "msgget", /* 225 = msgget */ "msgsnd", /* 226 = msgsnd */ "msgrcv", /* 227 = msgrcv */ "shmat", /* 228 = shmat */ - "shmctl", /* 229 = shmctl */ + "compat7.shmctl", /* 229 = freebsd7 shmctl */ "shmdt", /* 230 = shmdt */ "shmget", /* 231 = shmget */ "clock_gettime", /* 232 = clock_gettime */ @@ -517,4 +517,7 @@ const char *syscallnames[] = { "jail_set", /* 507 = jail_set */ "jail_remove", /* 508 = jail_remove */ "closefrom", /* 509 = closefrom */ + "__semctl", /* 510 = __semctl */ + "msgctl", /* 511 = msgctl */ + "shmctl", /* 512 = shmctl */ }; Modified: head/sys/kern/systrace_args.c ============================================================================== --- head/sys/kern/systrace_args.c Wed Jun 24 21:53:25 2009 (r194918) +++ head/sys/kern/systrace_args.c Wed Jun 24 21:54:08 2009 (r194919) @@ -1192,16 +1192,6 @@ systrace_args(int sysnum, void *params, *n_args = 0; break; } - /* __semctl */ - case 220: { - struct __semctl_args *p = params; - iarg[0] = p->semid; /* int */ - iarg[1] = p->semnum; /* int */ - iarg[2] = p->cmd; /* int */ - uarg[3] = (intptr_t) p->arg; /* union semun * */ - *n_args = 4; - break; - } /* semget */ case 221: { struct semget_args *p = params; @@ -1220,15 +1210,6 @@ systrace_args(int sysnum, void *params, *n_args = 3; break; } - /* msgctl */ - case 224: { - struct msgctl_args *p = params; - iarg[0] = p->msqid; /* int */ - iarg[1] = p->cmd; /* int */ - uarg[2] = (intptr_t) p->buf; /* struct msqid_ds * */ - *n_args = 3; - break; - } /* msgget */ case 225: { struct msgget_args *p = params; @@ -1267,15 +1248,6 @@ systrace_args(int sysnum, void *params, *n_args = 3; break; } - /* shmctl */ - case 229: { - struct shmctl_args *p = params; - iarg[0] = p->shmid; /* int */ - iarg[1] = p->cmd; /* int */ - uarg[2] = (intptr_t) p->buf; /* struct shmid_ds * */ - *n_args = 3; - break; - } /* shmdt */ case 230: { struct shmdt_args *p = params; @@ -3064,6 +3036,34 @@ systrace_args(int sysnum, void *params, *n_args = 1; break; } + /* __semctl */ + case 510: { + struct __semctl_args *p = params; + iarg[0] = p->semid; /* int */ + iarg[1] = p->semnum; /* int */ + iarg[2] = p->cmd; /* int */ + uarg[3] = (intptr_t) p->arg; /* union semun * */ + *n_args = 4; + break; + } + /* msgctl */ + case 511: { + struct msgctl_args *p = params; + iarg[0] = p->msqid; /* int */ + iarg[1] = p->cmd; /* int */ + uarg[2] = (intptr_t) p->buf; /* struct msqid_ds * */ + *n_args = 3; + break; + } + /* shmctl */ + case 512: { + struct shmctl_args *p = params; + iarg[0] = p->shmid; /* int */ + iarg[1] = p->cmd; /* int */ + uarg[2] = (intptr_t) p->buf; /* struct shmid_ds * */ + *n_args = 3; + break; + } default: *n_args = 0; break; @@ -4953,25 +4953,6 @@ systrace_setargdesc(int sysnum, int ndx, /* lkmnosys */ case 219: break; - /* __semctl */ - case 220: - switch(ndx) { - case 0: - p = "int"; - break; - case 1: - p = "int"; - break; - case 2: - p = "int"; - break; - case 3: - p = "union semun *"; - break; - default: - break; - }; - break; /* semget */ case 221: switch(ndx) { @@ -5004,22 +4985,6 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; - /* msgctl */ - case 224: - switch(ndx) { - case 0: - p = "int"; - break; - case 1: - p = "int"; - break; - case 2: - p = "struct msqid_ds *"; - break; - default: - break; - }; - break; /* msgget */ case 225: switch(ndx) { @@ -5090,22 +5055,6 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; - /* shmctl */ - case 229: - switch(ndx) { - case 0: - p = "int"; - break; - case 1: - p = "int"; - break; - case 2: - p = "struct shmid_ds *"; - break; - default: - break; - }; - break; /* shmdt */ case 230: switch(ndx) { @@ -8133,6 +8082,57 @@ systrace_setargdesc(int sysnum, int ndx, break; }; break; + /* __semctl */ + case 510: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "int"; + break; + case 2: + p = "int"; + break; + case 3: + p = "union semun *"; + break; + default: + break; + }; + break; + /* msgctl */ + case 511: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "int"; + break; + case 2: + p = "struct msqid_ds *"; + break; + default: + break; + }; + break; + /* shmctl */ + case 512: + switch(ndx) { + case 0: + p = "int"; + break; + case 1: + p = "int"; + break; + case 2: + p = "struct shmid_ds *"; + break; + default: + break; + }; + break; default: break; }; Modified: head/sys/sys/syscall.h ============================================================================== --- head/sys/sys/syscall.h Wed Jun 24 21:53:25 2009 (r194918) +++ head/sys/sys/syscall.h Wed Jun 24 21:54:08 2009 (r194919) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 194645 2009-06-22 20:12:40Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 194910 2009-06-24 21:10:52Z jhb */ #define SYS_syscall 0 @@ -196,15 +196,15 @@ #define SYS_futimes 206 #define SYS_getpgid 207 #define SYS_poll 209 -#define SYS___semctl 220 +#define SYS_freebsd7___semctl 220 #define SYS_semget 221 #define SYS_semop 222 -#define SYS_msgctl 224 +#define SYS_freebsd7_msgctl 224 #define SYS_msgget 225 #define SYS_msgsnd 226 #define SYS_msgrcv 227 #define SYS_shmat 228 -#define SYS_shmctl 229 +#define SYS_freebsd7_shmctl 229 #define SYS_shmdt 230 #define SYS_shmget 231 #define SYS_clock_gettime 232 @@ -424,4 +424,7 @@ #define SYS_jail_set 507 #define SYS_jail_remove 508 #define SYS_closefrom 509 -#define SYS_MAXSYSCALL 510 +#define SYS___semctl 510 +#define SYS_msgctl 511 +#define SYS_shmctl 512 +#define SYS_MAXSYSCALL 513 Modified: head/sys/sys/syscall.mk ============================================================================== --- head/sys/sys/syscall.mk Wed Jun 24 21:53:25 2009 (r194918) +++ head/sys/sys/syscall.mk Wed Jun 24 21:54:08 2009 (r194919) @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. # $FreeBSD$ -# created from FreeBSD: head/sys/kern/syscalls.master 194645 2009-06-22 20:12:40Z jhb +# created from FreeBSD: head/sys/kern/syscalls.master 194910 2009-06-24 21:10:52Z jhb MIASM = \ syscall.o \ exit.o \ @@ -148,15 +148,15 @@ MIASM = \ futimes.o \ getpgid.o \ poll.o \ - __semctl.o \ + freebsd7___semctl.o \ semget.o \ semop.o \ - msgctl.o \ + freebsd7_msgctl.o \ msgget.o \ msgsnd.o \ msgrcv.o \ shmat.o \ - shmctl.o \ + freebsd7_shmctl.o \ shmdt.o \ shmget.o \ clock_gettime.o \ @@ -372,4 +372,7 @@ MIASM = \ jail_get.o \ jail_set.o \ jail_remove.o \ - closefrom.o + closefrom.o \ + __semctl.o \ + msgctl.o \ + shmctl.o Modified: head/sys/sys/sysproto.h ============================================================================== --- head/sys/sys/sysproto.h Wed Jun 24 21:53:25 2009 (r194918) +++ head/sys/sys/sysproto.h Wed Jun 24 21:54:08 2009 (r194919) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/kern/syscalls.master 194645 2009-06-22 20:12:40Z jhb + * created from FreeBSD: head/sys/kern/syscalls.master 194910 2009-06-24 21:10:52Z jhb */ #ifndef _SYS_SYSPROTO_H_ @@ -649,12 +649,6 @@ struct poll_args { char nfds_l_[PADL_(u_int)]; u_int nfds; char nfds_r_[PADR_(u_int)]; char timeout_l_[PADL_(int)]; int timeout; char timeout_r_[PADR_(int)]; }; -struct __semctl_args { - char semid_l_[PADL_(int)]; int semid; char semid_r_[PADR_(int)]; - char semnum_l_[PADL_(int)]; int semnum; char semnum_r_[PADR_(int)]; - char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; - char arg_l_[PADL_(union semun *)]; union semun * arg; char arg_r_[PADR_(union semun *)]; -}; struct semget_args { char key_l_[PADL_(key_t)]; key_t key; char key_r_[PADR_(key_t)]; char nsems_l_[PADL_(int)]; int nsems; char nsems_r_[PADR_(int)]; @@ -665,11 +659,6 @@ struct semop_args { char sops_l_[PADL_(struct sembuf *)]; struct sembuf * sops; char sops_r_[PADR_(struct sembuf *)]; char nsops_l_[PADL_(size_t)]; size_t nsops; char nsops_r_[PADR_(size_t)]; }; -struct msgctl_args { - char msqid_l_[PADL_(int)]; int msqid; char msqid_r_[PADR_(int)]; - char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; - char buf_l_[PADL_(struct msqid_ds *)]; struct msqid_ds * buf; char buf_r_[PADR_(struct msqid_ds *)]; -}; struct msgget_args { char key_l_[PADL_(key_t)]; key_t key; char key_r_[PADR_(key_t)]; char msgflg_l_[PADL_(int)]; int msgflg; char msgflg_r_[PADR_(int)]; @@ -692,11 +681,6 @@ struct shmat_args { char shmaddr_l_[PADL_(const void *)]; const void * shmaddr; char shmaddr_r_[PADR_(const void *)]; char shmflg_l_[PADL_(int)]; int shmflg; char shmflg_r_[PADR_(int)]; }; -struct shmctl_args { - char shmid_l_[PADL_(int)]; int shmid; char shmid_r_[PADR_(int)]; - char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; - char buf_l_[PADL_(struct shmid_ds *)]; struct shmid_ds * buf; char buf_r_[PADR_(struct shmid_ds *)]; -}; struct shmdt_args { char shmaddr_l_[PADL_(const void *)]; const void * shmaddr; char shmaddr_r_[PADR_(const void *)]; }; @@ -1637,6 +1621,22 @@ struct jail_remove_args { struct closefrom_args { char lowfd_l_[PADL_(int)]; int lowfd; char lowfd_r_[PADR_(int)]; }; +struct __semctl_args { + char semid_l_[PADL_(int)]; int semid; char semid_r_[PADR_(int)]; + char semnum_l_[PADL_(int)]; int semnum; char semnum_r_[PADR_(int)]; + char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; + char arg_l_[PADL_(union semun *)]; union semun * arg; char arg_r_[PADR_(union semun *)]; +}; +struct msgctl_args { + char msqid_l_[PADL_(int)]; int msqid; char msqid_r_[PADR_(int)]; + char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; + char buf_l_[PADL_(struct msqid_ds *)]; struct msqid_ds * buf; char buf_r_[PADR_(struct msqid_ds *)]; +}; +struct shmctl_args { + char shmid_l_[PADL_(int)]; int shmid; char shmid_r_[PADR_(int)]; + char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; + char buf_l_[PADL_(struct shmid_ds *)]; struct shmid_ds * buf; char buf_r_[PADR_(struct shmid_ds *)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_exit(struct thread *, struct sys_exit_args *); int fork(struct thread *, struct fork_args *); @@ -1775,15 +1775,12 @@ int undelete(struct thread *, struct und int futimes(struct thread *, struct futimes_args *); int getpgid(struct thread *, struct getpgid_args *); int poll(struct thread *, struct poll_args *); -int __semctl(struct thread *, struct __semctl_args *); int semget(struct thread *, struct semget_args *); int semop(struct thread *, struct semop_args *); -int msgctl(struct thread *, struct msgctl_args *); int msgget(struct thread *, struct msgget_args *); int msgsnd(struct thread *, struct msgsnd_args *); int msgrcv(struct thread *, struct msgrcv_args *); int shmat(struct thread *, struct shmat_args *); -int shmctl(struct thread *, struct shmctl_args *); int shmdt(struct thread *, struct shmdt_args *); int shmget(struct thread *, struct shmget_args *); int clock_gettime(struct thread *, struct clock_gettime_args *); @@ -1994,6 +1991,9 @@ int jail_get(struct thread *, struct jai int jail_set(struct thread *, struct jail_set_args *); int jail_remove(struct thread *, struct jail_remove_args *); int closefrom(struct thread *, struct closefrom_args *); +int __semctl(struct thread *, struct __semctl_args *); +int msgctl(struct thread *, struct msgctl_args *); +int shmctl(struct thread *, struct shmctl_args *); #ifdef COMPAT_43 @@ -2233,6 +2233,31 @@ int freebsd4_sigreturn(struct thread *, #endif /* COMPAT_FREEBSD6 */ + +#ifdef COMPAT_FREEBSD7 + +struct freebsd7___semctl_args { + char semid_l_[PADL_(int)]; int semid; char semid_r_[PADR_(int)]; + char semnum_l_[PADL_(int)]; int semnum; char semnum_r_[PADR_(int)]; + char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; + char arg_l_[PADL_(union semun_old *)]; union semun_old * arg; char arg_r_[PADR_(union semun_old *)]; +}; +struct freebsd7_msgctl_args { + char msqid_l_[PADL_(int)]; int msqid; char msqid_r_[PADR_(int)]; + char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; + char buf_l_[PADL_(struct msqid_ds_old *)]; struct msqid_ds_old * buf; char buf_r_[PADR_(struct msqid_ds_old *)]; +}; +struct freebsd7_shmctl_args { + char shmid_l_[PADL_(int)]; int shmid; char shmid_r_[PADR_(int)]; + char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; + char buf_l_[PADL_(struct shmid_ds_old *)]; struct shmid_ds_old * buf; char buf_r_[PADR_(struct shmid_ds_old *)]; +}; +int freebsd7___semctl(struct thread *, struct freebsd7___semctl_args *); +int freebsd7_msgctl(struct thread *, struct freebsd7_msgctl_args *); +int freebsd7_shmctl(struct thread *, struct freebsd7_shmctl_args *); + +#endif /* COMPAT_FREEBSD7 */ + #define SYS_AUE_syscall AUE_NULL #define SYS_AUE_exit AUE_EXIT #define SYS_AUE_fork AUE_FORK @@ -2414,15 +2439,15 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_futimes AUE_FUTIMES #define SYS_AUE_getpgid AUE_GETPGID #define SYS_AUE_poll AUE_POLL -#define SYS_AUE___semctl AUE_SEMCTL +#define SYS_AUE_freebsd7___semctl AUE_SEMCTL #define SYS_AUE_semget AUE_SEMGET #define SYS_AUE_semop AUE_SEMOP -#define SYS_AUE_msgctl AUE_MSGCTL +#define SYS_AUE_freebsd7_msgctl AUE_MSGCTL #define SYS_AUE_msgget AUE_MSGGET #define SYS_AUE_msgsnd AUE_MSGSND #define SYS_AUE_msgrcv AUE_MSGRCV #define SYS_AUE_shmat AUE_SHMAT -#define SYS_AUE_shmctl AUE_SHMCTL +#define SYS_AUE_freebsd7_shmctl AUE_SHMCTL #define SYS_AUE_shmdt AUE_SHMDT #define SYS_AUE_shmget AUE_SHMGET #define SYS_AUE_clock_gettime AUE_NULL @@ -2637,6 +2662,9 @@ int freebsd4_sigreturn(struct thread *, #define SYS_AUE_jail_set AUE_NULL #define SYS_AUE_jail_remove AUE_NULL #define SYS_AUE_closefrom AUE_CLOSEFROM +#define SYS_AUE___semctl AUE_SEMCTL +#define SYS_AUE_msgctl AUE_MSGCTL +#define SYS_AUE_shmctl AUE_SHMCTL #undef PAD_ #undef PADL_ From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 21:55:18 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECC581065672; Wed, 24 Jun 2009 21:55: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 DBBDD8FC17; Wed, 24 Jun 2009 21:55:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OLtIFS031067; Wed, 24 Jun 2009 21:55:18 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OLtIMJ031065; Wed, 24 Jun 2009 21:55:18 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906242155.n5OLtIMJ031065@svn.freebsd.org> From: John Baldwin Date: Wed, 24 Jun 2009 21:55: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: r194920 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 21:55:19 -0000 Author: jhb Date: Wed Jun 24 21:55:18 2009 New Revision: 194920 URL: http://svn.freebsd.org/changeset/base/194920 Log: Bump __FreeBSD_version for SYSVIPC ABI change (along with other changes today). Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Wed Jun 24 21:54:08 2009 (r194919) +++ head/sys/sys/param.h Wed Jun 24 21:55:18 2009 (r194920) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 800099 /* Master, propagated to newvers */ +#define __FreeBSD_version 800100 /* Master, propagated to newvers */ #ifndef LOCORE #include From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 21:56:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F06C210656E5; Wed, 24 Jun 2009 21:56:05 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DDB488FC1F; Wed, 24 Jun 2009 21:56:05 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OLu5hG031119; Wed, 24 Jun 2009 21:56:05 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OLu5Yk031117; Wed, 24 Jun 2009 21:56:05 GMT (envelope-from np@svn.freebsd.org) Message-Id: <200906242156.n5OLu5Yk031117@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 24 Jun 2009 21:56:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194921 - head/sys/dev/cxgb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 21:56:06 -0000 Author: np Date: Wed Jun 24 21:56:05 2009 New Revision: 194921 URL: http://svn.freebsd.org/changeset/base/194921 Log: Various ifmedia related fixes in cxgb(4), including: - build ifmedia list based on phy->caps, not string comparisons. - rebuild media list when a transceiver change is detected. - return EOPNOTSUPP instead of ENXIO in cxgb_media_status. Approved by: gnn (mentor) MFC after: 2 weeks. Modified: head/sys/dev/cxgb/cxgb_main.c Modified: head/sys/dev/cxgb/cxgb_main.c ============================================================================== --- head/sys/dev/cxgb/cxgb_main.c Wed Jun 24 21:55:18 2009 (r194920) +++ head/sys/dev/cxgb/cxgb_main.c Wed Jun 24 21:56:05 2009 (r194921) @@ -93,6 +93,7 @@ static int cxgb_uninit_synchronized(stru static int cxgb_ioctl(struct ifnet *, unsigned long, caddr_t); static int cxgb_media_change(struct ifnet *); static int cxgb_ifm_type(int); +static void cxgb_build_medialist(struct port_info *); static void cxgb_media_status(struct ifnet *, struct ifmediareq *); static int setup_sge_qsets(adapter_t *); static void cxgb_async_intr(void *); @@ -1021,7 +1022,7 @@ cxgb_port_attach(device_t dev) { struct port_info *p; struct ifnet *ifp; - int err, media_flags; + int err; struct adapter *sc; @@ -1082,53 +1083,12 @@ cxgb_port_attach(device_t dev) printf("makedev failed %d\n", err); return (err); } + + /* Create a list of media supported by this port */ ifmedia_init(&p->media, IFM_IMASK, cxgb_media_change, cxgb_media_status); + cxgb_build_medialist(p); - if (!strcmp(p->phy.desc, "10GBASE-CX4")) { - media_flags = IFM_ETHER | IFM_10G_CX4 | IFM_FDX; - } else if (!strcmp(p->phy.desc, "10GBASE-SR")) { - media_flags = IFM_ETHER | IFM_10G_SR | IFM_FDX; - } else if (!strcmp(p->phy.desc, "10GBASE-R")) { - media_flags = cxgb_ifm_type(p->phy.modtype); - } else if (!strcmp(p->phy.desc, "10/100/1000BASE-T")) { - ifmedia_add(&p->media, IFM_ETHER | IFM_10_T, 0, NULL); - ifmedia_add(&p->media, IFM_ETHER | IFM_10_T | IFM_FDX, - 0, NULL); - ifmedia_add(&p->media, IFM_ETHER | IFM_100_TX, - 0, NULL); - ifmedia_add(&p->media, IFM_ETHER | IFM_100_TX | IFM_FDX, - 0, NULL); - ifmedia_add(&p->media, IFM_ETHER | IFM_1000_T | IFM_FDX, - 0, NULL); - media_flags = 0; - } else if (!strcmp(p->phy.desc, "1000BASE-X")) { - /* - * XXX: This is not very accurate. Fix when common code - * returns more specific value - eg 1000BASE-SX, LX, etc. - * - * XXX: In the meantime, don't lie. Consider setting IFM_AUTO - * instead of SX. - */ - media_flags = IFM_ETHER | IFM_1000_SX | IFM_FDX; - } else { - printf("unsupported media type %s\n", p->phy.desc); - return (ENXIO); - } - if (media_flags) { - /* - * Note the modtype on which we based our flags. If modtype - * changes, we'll redo the ifmedia for this ifp. modtype may - * change when transceivers are plugged in/out, and in other - * situations. - */ - ifmedia_add(&p->media, media_flags, p->phy.modtype, NULL); - ifmedia_set(&p->media, media_flags); - } else { - ifmedia_add(&p->media, IFM_ETHER | IFM_AUTO, 0, NULL); - ifmedia_set(&p->media, IFM_ETHER | IFM_AUTO); - } - t3_sge_init_port(p); return (err); @@ -1304,16 +1264,18 @@ void t3_os_phymod_changed(struct adapter static const char *mod_str[] = { NULL, "SR", "LR", "LRM", "TWINAX", "TWINAX", "unknown" }; - struct port_info *pi = &adap->port[port_id]; + int mod = pi->phy.modtype; - if (pi->phy.modtype == phy_modtype_none) - device_printf(adap->dev, "PHY module unplugged\n"); + if (mod != pi->media.ifm_cur->ifm_data) + cxgb_build_medialist(pi); + + if (mod == phy_modtype_none) + if_printf(pi->ifp, "PHY module unplugged\n"); else { - KASSERT(pi->phy.modtype < ARRAY_SIZE(mod_str), - ("invalid PHY module type %d", pi->phy.modtype)); - device_printf(adap->dev, "%s PHY module inserted\n", - mod_str[pi->phy.modtype]); + KASSERT(mod < ARRAY_SIZE(mod_str), + ("invalid PHY module type %d", mod)); + if_printf(pi->ifp, "%s PHY module inserted\n", mod_str[mod]); } } @@ -2198,48 +2160,102 @@ cxgb_ioctl(struct ifnet *ifp, unsigned l static int cxgb_media_change(struct ifnet *ifp) { - if_printf(ifp, "media change not supported\n"); - return (ENXIO); + return (EOPNOTSUPP); } /* - * Translates from phy->modtype to IFM_TYPE. + * Translates phy->modtype to the correct Ethernet media subtype. */ static int -cxgb_ifm_type(int phymod) +cxgb_ifm_type(int mod) { - int rc = IFM_ETHER | IFM_FDX; - - switch (phymod) { + switch (mod) { case phy_modtype_sr: - rc |= IFM_10G_SR; - break; + return (IFM_10G_SR); case phy_modtype_lr: - rc |= IFM_10G_LR; - break; + return (IFM_10G_LR); case phy_modtype_lrm: -#ifdef IFM_10G_LRM - rc |= IFM_10G_LRM; -#endif - break; + return (IFM_10G_LRM); case phy_modtype_twinax: -#ifdef IFM_10G_TWINAX - rc |= IFM_10G_TWINAX; -#endif - break; + return (IFM_10G_TWINAX); case phy_modtype_twinax_long: -#ifdef IFM_10G_TWINAX_LONG - rc |= IFM_10G_TWINAX_LONG; -#endif - break; + return (IFM_10G_TWINAX_LONG); case phy_modtype_none: - rc = IFM_ETHER | IFM_NONE; - break; + return (IFM_NONE); case phy_modtype_unknown: - break; + return (IFM_UNKNOWN); } - return (rc); + KASSERT(0, ("%s: modtype %d unknown", __func__, mod)); + return (IFM_UNKNOWN); +} + +/* + * Rebuilds the ifmedia list for this port, and sets the current media. + */ +static void +cxgb_build_medialist(struct port_info *p) +{ + struct cphy *phy = &p->phy; + struct ifmedia *media = &p->media; + int mod = phy->modtype; + int m = IFM_ETHER | IFM_FDX; + + PORT_LOCK(p); + + ifmedia_removeall(media); + if (phy->caps & SUPPORTED_TP && phy->caps & SUPPORTED_Autoneg) { + /* Copper (RJ45) */ + + if (phy->caps & SUPPORTED_10000baseT_Full) + ifmedia_add(media, m | IFM_10G_T, mod, NULL); + + if (phy->caps & SUPPORTED_1000baseT_Full) + ifmedia_add(media, m | IFM_1000_T, mod, NULL); + + if (phy->caps & SUPPORTED_100baseT_Full) + ifmedia_add(media, m | IFM_100_TX, mod, NULL); + + if (phy->caps & SUPPORTED_10baseT_Full) + ifmedia_add(media, m | IFM_10_T, mod, NULL); + + ifmedia_add(media, IFM_ETHER | IFM_AUTO, mod, NULL); + ifmedia_set(media, IFM_ETHER | IFM_AUTO); + + } else if (phy->caps & SUPPORTED_TP) { + /* Copper (CX4) */ + + KASSERT(phy->caps & SUPPORTED_10000baseT_Full, + ("%s: unexpected cap 0x%x", __func__, phy->caps)); + + ifmedia_add(media, m | IFM_10G_CX4, mod, NULL); + ifmedia_set(media, m | IFM_10G_CX4); + + } else if (phy->caps & SUPPORTED_FIBRE && + phy->caps & SUPPORTED_10000baseT_Full) { + /* 10G optical (but includes SFP+ twinax) */ + + m |= cxgb_ifm_type(mod); + if (IFM_SUBTYPE(m) == IFM_NONE) + m &= ~IFM_FDX; + + ifmedia_add(media, m, mod, NULL); + ifmedia_set(media, m); + + } else if (phy->caps & SUPPORTED_FIBRE && + phy->caps & SUPPORTED_1000baseT_Full) { + /* 1G optical */ + + /* XXX: Lie and claim to be SX, could actually be any 1G-X */ + ifmedia_add(media, m | IFM_1000_SX, mod, NULL); + ifmedia_set(media, m | IFM_1000_SX); + + } else { + KASSERT(0, ("%s: don't know how to handle 0x%x.", __func__, + phy->caps)); + } + + PORT_UNLOCK(p); } static void @@ -2247,47 +2263,40 @@ cxgb_media_status(struct ifnet *ifp, str { struct port_info *p = ifp->if_softc; struct ifmedia_entry *cur = p->media.ifm_cur; - int m; - - if (cur->ifm_data != p->phy.modtype) { + int speed = p->link_config.speed; - PORT_LOCK(p); - m = cxgb_ifm_type(p->phy.modtype); - ifmedia_removeall(&p->media); - ifmedia_add(&p->media, m, p->phy.modtype, NULL); - ifmedia_set(&p->media, m); - cur = p->media.ifm_cur; /* ifmedia_set modified ifm_cur */ - ifmr->ifm_current = m; - PORT_UNLOCK(p); + if (cur->ifm_data != p->phy.modtype) { + cxgb_build_medialist(p); + cur = p->media.ifm_cur; } ifmr->ifm_status = IFM_AVALID; - ifmr->ifm_active = IFM_ETHER; - if (!p->link_config.link_ok) return; ifmr->ifm_status |= IFM_ACTIVE; - switch (p->link_config.speed) { - case 10: - ifmr->ifm_active |= IFM_10_T; - break; - case 100: - ifmr->ifm_active |= IFM_100_TX; - break; - case 1000: + /* + * active and current will differ iff current media is autoselect. That + * can happen only for copper RJ45. + */ + if (IFM_SUBTYPE(cur->ifm_media) != IFM_AUTO) + return; + KASSERT(p->phy.caps & SUPPORTED_TP && p->phy.caps & SUPPORTED_Autoneg, + ("%s: unexpected PHY caps 0x%x", __func__, p->phy.caps)); + + ifmr->ifm_active = IFM_ETHER | IFM_FDX; + if (speed == SPEED_10000) + ifmr->ifm_active |= IFM_10G_T; + else if (speed == SPEED_1000) ifmr->ifm_active |= IFM_1000_T; - break; - case 10000: - ifmr->ifm_active |= IFM_SUBTYPE(cur->ifm_media); - break; - } - - if (p->link_config.duplex) - ifmr->ifm_active |= IFM_FDX; + else if (speed == SPEED_100) + ifmr->ifm_active |= IFM_100_TX; + else if (speed == SPEED_10) + ifmr->ifm_active |= IFM_10_T; else - ifmr->ifm_active |= IFM_HDX; + KASSERT(0, ("%s: link up but speed unknown (%u)", __func__, + speed)); } static void From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 22:04:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB11A1065674; Wed, 24 Jun 2009 22:04:04 +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 D80DA8FC12; Wed, 24 Jun 2009 22:04:04 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OM44IL031373; Wed, 24 Jun 2009 22:04:04 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OM44Kx031369; Wed, 24 Jun 2009 22:04:04 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200906242204.n5OM44Kx031369@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 24 Jun 2009 22:04: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: r194922 - in head: bin/sh tools/regression/bin/sh/builtins X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 22:04:05 -0000 Author: jilles Date: Wed Jun 24 22:04:04 2009 New Revision: 194922 URL: http://svn.freebsd.org/changeset/base/194922 Log: Designate special builtins as such in command -V and type. Also document various properties of special builtins that we implement. Approved by: ed (mentor) (implicit) Modified: head/bin/sh/exec.c head/bin/sh/sh.1 head/tools/regression/bin/sh/builtins/command5.0.stdout Modified: head/bin/sh/exec.c ============================================================================== --- head/bin/sh/exec.c Wed Jun 24 21:56:05 2009 (r194921) +++ head/bin/sh/exec.c Wed Jun 24 22:04:04 2009 (r194922) @@ -756,6 +756,7 @@ typecmd_impl(int argc, char **argv, int if ((cmdp = cmdlookup(argv[i], 0)) != NULL) { entry.cmdtype = cmdp->cmdtype; entry.u = cmdp->param; + entry.special = cmdp->special; } else { /* Finally use brute force */ @@ -804,6 +805,9 @@ typecmd_impl(int argc, char **argv, int case CMDBUILTIN: if (cmd == TYPECMD_SMALLV) out1fmt("%s\n", argv[i]); + else if (entry.special) + out1fmt("%s is a special shell builtin\n", + argv[i]); else out1fmt("%s is a shell builtin\n", argv[i]); break; Modified: head/bin/sh/sh.1 ============================================================================== --- head/bin/sh/sh.1 Wed Jun 24 21:56:05 2009 (r194921) +++ head/bin/sh/sh.1 Wed Jun 24 22:04:04 2009 (r194922) @@ -606,6 +606,12 @@ This all occurs within the current shell .Pp Shell built-in commands are executed internally to the shell, without spawning a new process. +There are two kinds of built-in commands: regular and special. +Assignments before special builtins persist after they finish +executing and assignment errors, redirection errors and certain +operand errors cause a script to be aborted. +Both regular and special builtins can affect the shell in ways +normal programs cannot. .Pp Otherwise, if the command name does not match a function or built-in command, the command is searched for as a normal @@ -885,7 +891,7 @@ loops. The .Ic continue command continues with the next iteration of the innermost loop. -These are implemented as built-in commands. +These are implemented as special built-in commands. .Pp The syntax of the .Ic case @@ -1001,7 +1007,7 @@ It terminates the current executional sc nested function, sourced script, or shell instance, in that order. The .Ic return -command is implemented as a built-in command. +command is implemented as a special built-in command. .Ss Variables and Parameters The shell maintains a set of parameters. A parameter @@ -1590,6 +1596,7 @@ where is either the path name to .Ar utility , +a special shell builtin, a shell builtin, a shell function, a shell keyword @@ -2114,7 +2121,8 @@ Interpret each .Ar name as a command and print the resolution of the command search. Possible resolutions are: -shell keyword, alias, shell built-in command, command, tracked alias +shell keyword, alias, special shell builtin, shell builtin, command, +tracked alias and not found. For aliases the alias expansion is printed; for commands and tracked aliases Modified: head/tools/regression/bin/sh/builtins/command5.0.stdout ============================================================================== --- head/tools/regression/bin/sh/builtins/command5.0.stdout Wed Jun 24 21:56:05 2009 (r194921) +++ head/tools/regression/bin/sh/builtins/command5.0.stdout Wed Jun 24 22:04:04 2009 (r194922) @@ -2,7 +2,7 @@ ls is /bin/ls true is a shell builtin /bin/ls is /bin/ls fun is a shell function -break is a shell builtin +break is a special shell builtin if is a shell keyword { is a shell keyword foo is an alias for bar From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 22:06:57 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 423E010656B1; Wed, 24 Jun 2009 22:06:57 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 304408FC1F; Wed, 24 Jun 2009 22:06:57 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OM6uIx031487; Wed, 24 Jun 2009 22:06:56 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OM6ulP031485; Wed, 24 Jun 2009 22:06:56 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200906242206.n5OM6ulP031485@svn.freebsd.org> From: Jamie Gritton Date: Wed, 24 Jun 2009 22:06: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: r194923 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 22:06:57 -0000 Author: jamie Date: Wed Jun 24 22:06:56 2009 New Revision: 194923 URL: http://svn.freebsd.org/changeset/base/194923 Log: Wrap a PR_VNET inside "#ifdef VIMAGE" since that the only place it applies. bz wants the blame for this. Noticed by: rwatson Approved by: bz (mentor) Modified: head/sys/kern/kern_jail.c Modified: head/sys/kern/kern_jail.c ============================================================================== --- head/sys/kern/kern_jail.c Wed Jun 24 22:04:04 2009 (r194922) +++ head/sys/kern/kern_jail.c Wed Jun 24 22:06:56 2009 (r194923) @@ -3151,9 +3151,11 @@ prison_check_af(struct ucred *cred, int KASSERT(cred != NULL, ("%s: cred is NULL", __func__)); pr = cred->cr_prison; +#ifdef VIMAGE /* Prisons with their own network stack are not limited. */ if (pr->pr_flags & PR_VNET) return (0); +#endif error = 0; switch (af) From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 22:09:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B477E1065674; Wed, 24 Jun 2009 22:09:30 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 980128FC16; Wed, 24 Jun 2009 22:09:30 +0000 (UTC) (envelope-from lulf@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OM9UvR031584; Wed, 24 Jun 2009 22:09:30 GMT (envelope-from lulf@svn.freebsd.org) Received: (from lulf@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OM9UXe031582; Wed, 24 Jun 2009 22:09:30 GMT (envelope-from lulf@svn.freebsd.org) Message-Id: <200906242209.n5OM9UXe031582@svn.freebsd.org> From: Ulf Lilleengen Date: Wed, 24 Jun 2009 22:09:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194924 - head/sys/geom/linux_lvm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 22:09:31 -0000 Author: lulf Date: Wed Jun 24 22:09:30 2009 New Revision: 194924 URL: http://svn.freebsd.org/changeset/base/194924 Log: - Apply the same naming rules of LVM names as done in the LVM code itself. PR: kern/135874 Modified: head/sys/geom/linux_lvm/g_linux_lvm.c Modified: head/sys/geom/linux_lvm/g_linux_lvm.c ============================================================================== --- head/sys/geom/linux_lvm/g_linux_lvm.c Wed Jun 24 22:06:56 2009 (r194923) +++ head/sys/geom/linux_lvm/g_linux_lvm.c Wed Jun 24 22:09:30 2009 (r194924) @@ -826,14 +826,6 @@ llvm_md_decode(const u_char *data, struc return (0); } -#define GRAB_NAME(tok, name, len) \ - len = 0; \ - while (tok[len] && (isalpha(tok[len]) || isdigit(tok[len])) && \ - len < G_LLVM_NAMELEN - 1) \ - len++; \ - bcopy(tok, name, len); \ - name[len] = '\0'; - #define GRAB_INT(key, tok1, tok2, v) \ if (tok1 && tok2 && strncmp(tok1, key, sizeof(key)) == 0) { \ v = strtol(tok2, &tok1, 10); \ @@ -864,6 +856,27 @@ llvm_md_decode(const u_char *data, struc break; \ } +static size_t +llvm_grab_name(char *name, const char *tok) +{ + size_t len; + + len = 0; + if (tok == NULL) + return (0); + if (tok[0] == '-') + return (0); + if (strcmp(tok, ".") == 0 || strcmp(tok, "..") == 0) + return (0); + while (tok[len] && (isalpha(tok[len]) || isdigit(tok[len]) || + tok[len] == '.' || tok[len] == '_' || tok[len] == '-' || + tok[len] == '+') && len < G_LLVM_NAMELEN - 1) + len++; + bcopy(tok, name, len); + name[len] = '\0'; + return (len); +} + static int llvm_textconf_decode(u_char *data, int buflen, struct g_llvm_metadata *md) { @@ -872,7 +885,7 @@ llvm_textconf_decode(u_char *data, int b char *tok, *v; char name[G_LLVM_NAMELEN]; char uuid[G_LLVM_UUIDLEN]; - int len; + size_t len; if (buf == NULL || *buf == '\0') return (EINVAL); @@ -880,7 +893,7 @@ llvm_textconf_decode(u_char *data, int b tok = strsep(&buf, "\n"); if (tok == NULL) return (EINVAL); - GRAB_NAME(tok, name, len); + len = llvm_grab_name(name, tok); if (len == 0) return (EINVAL); @@ -970,7 +983,7 @@ llvm_textconf_decode_pv(char **buf, char { struct g_llvm_pv *pv; char *v; - int len; + size_t len; if (*buf == NULL || **buf == '\0') return (EINVAL); @@ -983,7 +996,7 @@ llvm_textconf_decode_pv(char **buf, char len = 0; if (tok == NULL) goto bad; - GRAB_NAME(tok, pv->pv_name, len); + len = llvm_grab_name(pv->pv_name, tok); if (len == 0) goto bad; @@ -1024,7 +1037,7 @@ llvm_textconf_decode_lv(char **buf, char struct g_llvm_lv *lv; struct g_llvm_segment *sg; char *v; - int len; + size_t len; if (*buf == NULL || **buf == '\0') return (EINVAL); @@ -1036,10 +1049,9 @@ llvm_textconf_decode_lv(char **buf, char lv->lv_vg = vg; LIST_INIT(&lv->lv_segs); - len = 0; if (tok == NULL) goto bad; - GRAB_NAME(tok, lv->lv_name, len); + len = llvm_grab_name(lv->lv_name, tok); if (len == 0) goto bad; @@ -1162,7 +1174,6 @@ bad: free(sg, M_GLLVM); return (-1); } -#undef GRAB_NAME #undef GRAB_INT #undef GRAB_STR #undef SPLIT From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 22:16:02 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BCB9106564A; Wed, 24 Jun 2009 22:16:02 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5A30D8FC17; Wed, 24 Jun 2009 22:16:02 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OMG2bi031805; Wed, 24 Jun 2009 22:16:02 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OMG2qY031803; Wed, 24 Jun 2009 22:16:02 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200906242216.n5OMG2qY031803@svn.freebsd.org> From: Jack F Vogel Date: Wed, 24 Jun 2009 22:16: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: r194925 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 22:16:02 -0000 Author: jfv Date: Wed Jun 24 22:16:02 2009 New Revision: 194925 URL: http://svn.freebsd.org/changeset/base/194925 Log: need to make intr_bind call architecture specific for global builds (failing sun4v lint build) Modified: head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Wed Jun 24 22:09:30 2009 (r194924) +++ head/sys/dev/e1000/if_igb.c Wed Jun 24 22:16:02 2009 (r194925) @@ -2189,7 +2189,7 @@ igb_allocate_msix(struct adapter *adapte txr->eims = E1000_EICR_TX_QUEUE0 << i; else txr->eims = 1 << vector; -#if __FreeBSD_version >= 800000 +#if defined(__i386__) || defined(__amd64__) /* ** Bind the msix vector, and thus the ** ring to the corresponding cpu. @@ -2226,7 +2226,7 @@ igb_allocate_msix(struct adapter *adapte rxr->eims = 1 << vector; /* Get a mask for local timer */ adapter->rx_mask |= rxr->eims; -#if __FreeBSD_version >= 800000 +#if defined(__i386__) || defined(__amd64__) /* ** Bind the msix vector, and thus the ** ring to the corresponding cpu. From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 22:17:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E9D61065672; Wed, 24 Jun 2009 22:17:40 +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 4D4E08FC16; Wed, 24 Jun 2009 22:17:40 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OMHeVj031871; Wed, 24 Jun 2009 22:17:40 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OMHeja031869; Wed, 24 Jun 2009 22:17:40 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200906242217.n5OMHeja031869@svn.freebsd.org> From: Jack F Vogel Date: Wed, 24 Jun 2009 22:17: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: r194926 - head/sys/dev/ixgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 22:17:40 -0000 Author: jfv Date: Wed Jun 24 22:17:40 2009 New Revision: 194926 URL: http://svn.freebsd.org/changeset/base/194926 Log: Make CPU bind call architecture specific to satisfy LINT Modified: head/sys/dev/ixgbe/ixgbe.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Wed Jun 24 22:16:02 2009 (r194925) +++ head/sys/dev/ixgbe/ixgbe.c Wed Jun 24 22:17:40 2009 (r194926) @@ -2152,7 +2152,7 @@ ixgbe_allocate_msix(struct adapter *adap return (error); } txr->msix = vector; -#if __FreeBSD_version >= 800000 +#if defined(__i386__) || defined(__amd64__) /* ** Bind the msix vector, and thus the ** ring to the corresponding cpu. @@ -2189,7 +2189,7 @@ ixgbe_allocate_msix(struct adapter *adap rxr->msix = vector; /* used in local timer */ adapter->rx_mask |= (u64)(1 << vector); -#if __FreeBSD_version >= 800000 +#if defined(__i386__) || defined(__amd64__) /* ** Bind the msix vector, and thus the ** ring to the corresponding cpu. From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 22:21:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 32D19106564A; Wed, 24 Jun 2009 22:21:31 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F3F68FC17; Wed, 24 Jun 2009 22:21:31 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OMLVBU032006; Wed, 24 Jun 2009 22:21:31 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OMLVxb032003; Wed, 24 Jun 2009 22:21:31 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200906242221.n5OMLVxb032003@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 24 Jun 2009 22:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194927 - in head: share/man/man4 sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 22:21:31 -0000 Author: bz Date: Wed Jun 24 22:21:30 2009 New Revision: 194927 URL: http://svn.freebsd.org/changeset/base/194927 Log: Merge from p4: CH154790,154793,154874 Import if_epair(4), a virtual cross-over Ethernet-like interface pair. Note these files are 1:1 from p4 and not yet connected to the build not knowing about the new netisr interface. Sponsored by: The FreeBSD Foundation Added: head/share/man/man4/epair.4 (contents, props changed) head/sys/net/if_epair.c (contents, props changed) Added: head/share/man/man4/epair.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/epair.4 Wed Jun 24 22:21:30 2009 (r194927) @@ -0,0 +1,120 @@ +.\"- +.\" Copyright (c) 2008 The FreeBSD Foundation +.\" All rights reserved. +.\" +.\" This software was developed by CK Software GmbH under sponsorship +.\" from the FreeBSD Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 15, 2008 +.Dt EPAIR 4 +.Os +.Sh NAME +.Nm epair +.Nd Virtual cross-over Ethernet-like interface pair. +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device epair" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_epair_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +is a pair of Ethernet-like software interfaces, +which are directly connected by a virtual cross-over cable. +.Pp +Each +.Nm +interface pair is created at runtime using interface cloning. +This is most easily done with the +.Xr ifconfig 8 +.Cm create +command or using the +.Va cloned_interfaces +variable in +.Xr rc.conf 5 . +While for cloning you only give either +.Pa epair +or +.Pa epair +the +.Nm +pair will be named like +.Pa epair[ab] . +This means the names of the first +.Nm +interfaces will be +.Pa epair0a +and +.Pa epair0b . +.Pp +Like any other Ethernet interface, an +.Nm +needs to have a network address. +Each +.Nm +will be assigned a locally administered address by default, +that is only guaranteed to be unique within one network stack. +To change the default addresses one may use the SIOCSIFADDR ioctl(2) or +ifconfig(8) utility. +.Pp +The basic intend is to provide connectivity between two virtual +network stack instances. +When connected to a +.Xr if_bridge 4 +one end of the interface pair can also be part of another (virtual) LAN. +As with any other Ethernet interface one can configure +.Xr vlan 4 +support on top of it. +.Pp +.Sh SEE ALSO +.Xr ioctl 2 , +.Xr altq 4 , +.Xr bpf 4 , +.Xr if_bridge 4 , +.Xr vlan 4 , +.Xr loader.conf 5, +.Xr rc.conf 5 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +interface first appeared in +.Fx 8.0 . +.Sh AUTHORS +The +.Nm +interface was written by +.An Bjoern A. Zeeb, CK Software GmbH, +under sponsorship from the FreeBSD Foundation. Added: head/sys/net/if_epair.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net/if_epair.c Wed Jun 24 22:21:30 2009 (r194927) @@ -0,0 +1,728 @@ +/*- + * Copyright (c) 2008 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by CK Software GmbH under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * A pair of virtual ethernet interfaces directly connected with + * a virtual cross-over cable. + * This is mostly intended to be used to provide connectivity between + * different virtual network stack instances. + */ +/* + * Things to re-think once we have more experience: + * - ifp->if_reassign function once we can test with vimage. + * - Real random etheraddrs that are checked to be uniquish; + * in case we bridge we may need this or let the user handle that case? + * - netisr and callback logic. + * - netisr queue lengths. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#define EPAIRNAME "epair" + +#ifdef DEBUG_EPAIR +static int epair_debug = 0; +SYSCTL_DECL(_net_link); +SYSCTL_NODE(_net_link, OID_AUTO, epair, CTLFLAG_RW, 0, "epair sysctl"); +SYSCTL_XINT(_net_link_epair, OID_AUTO, epair_debug, CTLFLAG_RW, + &epair_debug, 0, "if_epair(4) debugging."); +#define DPRINTF(fmt, arg...) if (epair_debug) \ + printf("[%s:%d] " fmt, __func__, __LINE__, ##arg) +#else +#define DPRINTF(fmt, arg...) +#endif + +struct epair_softc { + struct ifnet *ifp; + struct ifnet *oifp; + u_int refcount; + void (*if_qflush)(struct ifnet *); +}; + +struct epair_ifp_drain { + STAILQ_ENTRY(epair_ifp_drain) ifp_next; + struct ifnet *ifp; +}; + +static STAILQ_HEAD(, epair_ifp_drain) epair_ifp_drain_list = + STAILQ_HEAD_INITIALIZER(epair_ifp_drain_list); + +#define ADD_IFQ_FOR_DRAINING(ifp) \ + do { \ + struct epair_ifp_drain *elm = NULL; \ + \ + STAILQ_FOREACH(elm, &epair_ifp_drain_list, ifp_next) { \ + if (elm->ifp == (ifp)) \ + break; \ + } \ + if (elm == NULL) { \ + elm = malloc(sizeof(struct epair_ifp_drain), \ + M_EPAIR, M_ZERO); \ + if (elm != NULL) { \ + elm->ifp = (ifp); \ + STAILQ_INSERT_TAIL( \ + &epair_ifp_drain_list, \ + elm, ifp_next); \ + } \ + } \ + } while(0) + +/* Our "hw" tx queue. */ +static struct ifqueue epairinq; +static int epair_drv_flags; + +static struct mtx if_epair_mtx; +#define EPAIR_LOCK_INIT() mtx_init(&if_epair_mtx, "if_epair", \ + NULL, MTX_DEF) +#define EPAIR_LOCK_DESTROY() mtx_destroy(&if_epair_mtx) +#define EPAIR_LOCK_ASSERT() mtx_assert(&if_epair_mtx, MA_OWNED) +#define EPAIR_LOCK() mtx_lock(&if_epair_mtx) +#define EPAIR_UNLOCK() mtx_unlock(&if_epair_mtx) + +static MALLOC_DEFINE(M_EPAIR, EPAIRNAME, + "Pair of virtual cross-over connected Ethernet-like interfaces"); + +static int epair_clone_match(struct if_clone *, const char *); +static int epair_clone_create(struct if_clone *, char *, size_t, caddr_t); +static int epair_clone_destroy(struct if_clone *, struct ifnet *); + +static void epair_start_locked(struct ifnet *); + +static struct if_clone epair_cloner = IFC_CLONE_INITIALIZER( + EPAIRNAME, NULL, IF_MAXUNIT, + NULL, epair_clone_match, epair_clone_create, epair_clone_destroy); + + +/* + * Netisr handler functions. + */ +static void +epair_sintr(struct mbuf *m) +{ + struct ifnet *ifp; + struct epair_softc *sc; + + ifp = m->m_pkthdr.rcvif; + (*ifp->if_input)(ifp, m); + sc = ifp->if_softc; + refcount_release(&sc->refcount); + DPRINTF("ifp=%p refcount=%u\n", ifp, sc->refcount); +} + +static void +epair_sintr_drained(void) +{ + struct epair_ifp_drain *elm, *tvar; + struct ifnet *ifp; + + EPAIR_LOCK(); + /* + * Assume our "hw" queue and possibly ifq will be emptied + * again. In case we will overflow the "hw" queue while + * draining, epair_start_locked will set IFF_DRV_OACTIVE + * again and we will stop and return. + */ + STAILQ_FOREACH_SAFE(elm, &epair_ifp_drain_list, ifp_next, tvar) { + ifp = elm->ifp; + epair_drv_flags &= ~IFF_DRV_OACTIVE; + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; + epair_start_locked(ifp); + + IFQ_LOCK(&ifp->if_snd); + if (IFQ_IS_EMPTY(&ifp->if_snd)) { + STAILQ_REMOVE(&epair_ifp_drain_list, elm, + epair_ifp_drain, ifp_next); + free(elm, M_EPAIR); + } + IFQ_UNLOCK(&ifp->if_snd); + + if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) != 0) { + /* Our "hw"q overflew again. */ + epair_drv_flags |= IFF_DRV_OACTIVE + DPRINTF("hw queue length overflow at %u\n", + epairinq.ifq_maxlen); +#if 0 + /* ``Auto-tuning.'' */ + epairinq.ifq_maxlen += ifqmaxlen; +#endif + break; + } + } + EPAIR_UNLOCK(); +} + +/* + * Network interface (`if') related functions. + */ +static void +epair_start_locked(struct ifnet *ifp) +{ + struct mbuf *m; + struct epair_softc *sc; + struct ifnet *oifp; + int error; + + EPAIR_LOCK_ASSERT(); + DPRINTF("ifp=%p\n", ifp); + + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) + return; + if ((ifp->if_flags & IFF_UP) == 0) + return; + + /* + * We get patckets here from ether_output via if_handoff() + * and ned to put them into the input queue of the oifp + * and call oifp->if_input() via netisr/epair_sintr(). + */ + sc = ifp->if_softc; + oifp = sc->oifp; + sc = oifp->if_softc; + for (;;) { + IFQ_DEQUEUE(&ifp->if_snd, m); + if (m == NULL) + break; + BPF_MTAP(ifp, m); + + /* + * In case the outgoing interface is not usable, + * drop the packet. + */ + if ((oifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || + (oifp->if_flags & IFF_UP) ==0) { + ifp->if_oerrors++; + m_freem(m); + continue; + } + DPRINTF("packet %s -> %s\n", ifp->if_xname, oifp->if_xname); + + /* + * Add a reference so the interface cannot go while the + * packet is in transit as we rely on rcvif to stay valid. + */ + refcount_acquire(&sc->refcount); + m->m_pkthdr.rcvif = oifp; + CURVNET_SET_QUIET(oifp->if_vnet); + error = netisr_queue(NETISR_EPAIR, m); + CURVNET_RESTORE(); + if (!error) { + ifp->if_opackets++; + /* Someone else received the packet. */ + oifp->if_ipackets++; + } else { + epair_drv_flags |= IFF_DRV_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + ADD_IFQ_FOR_DRAINING(ifp); + refcount_release(&sc->refcount); + } + } +} + +static void +epair_start(struct ifnet *ifp) +{ + + EPAIR_LOCK(); + epair_start_locked(ifp); + EPAIR_UNLOCK(); +} + +static int +epair_transmit_locked(struct ifnet *ifp, struct mbuf *m) +{ + struct epair_softc *sc; + struct ifnet *oifp; + int error, len; + short mflags; + + EPAIR_LOCK_ASSERT(); + DPRINTF("ifp=%p m=%p\n", ifp, m); + + if (m == NULL) + return (0); + + /* + * We are not going to use the interface en/dequeue mechanism + * on the TX side. We are called from ether_output_frame() + * and will put the packet into the incoming queue of the + * other interface of our pair via the netsir. + */ + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + m_freem(m); + return (ENXIO); + } + if ((ifp->if_flags & IFF_UP) == 0) { + m_freem(m); + return (ENETDOWN); + } + + BPF_MTAP(ifp, m); + + /* + * In case the outgoing interface is not usable, + * drop the packet. + */ + sc = ifp->if_softc; + oifp = sc->oifp; + if ((oifp->if_drv_flags & IFF_DRV_RUNNING) == 0 || + (oifp->if_flags & IFF_UP) ==0) { + ifp->if_oerrors++; + m_freem(m); + return (0); + } + len = m->m_pkthdr.len; + mflags = m->m_flags; + DPRINTF("packet %s -> %s\n", ifp->if_xname, oifp->if_xname); + +#ifdef ALTQ + /* Support ALTQ via the clasic if_start() path. */ + IF_LOCK(&ifp->if_snd); + if (ALTQ_IS_ENABLED(&ifp->if_snd)) { + ALTQ_ENQUEUE(&ifp->if_snd, m, NULL, error); + if (error) + ifp->if_snd.ifq_drops++; + IF_UNLOCK(&ifp->if_snd); + if (!error) { + ifp->if_obytes += len; + if (mflags & (M_BCAST|M_MCAST)) + ifp->if_omcasts++; + + if ((ifp->if_drv_flags & IFF_DRV_OACTIVE) == 0) + epair_start_locked(ifp); + else + ADD_IFQ_FOR_DRAINING(ifp); + } + return (error); + } + IF_UNLOCK(&ifp->if_snd); +#endif + + if ((epair_drv_flags & IFF_DRV_OACTIVE) != 0) { + /* + * Our hardware queue is full, try to fall back + * queuing to the ifq but do not call ifp->if_start. + * Either we are lucky or the packet is gone. + */ + IFQ_ENQUEUE(&ifp->if_snd, m, error); + if (!error) + ADD_IFQ_FOR_DRAINING(ifp); + return (error); + } + sc = oifp->if_softc; + /* + * Add a reference so the interface cannot go while the + * packet is in transit as we rely on rcvif to stay valid. + */ + refcount_acquire(&sc->refcount); + m->m_pkthdr.rcvif = oifp; + CURVNET_SET_QUIET(oifp->if_vnet); + error = netisr_queue(NETISR_EPAIR, m); + CURVNET_RESTORE(); + if (!error) { + ifp->if_opackets++; + /* + * IFQ_HANDOFF_ADJ/ip_handoff() update statistics, + * but as we bypass all this we have to duplicate + * the logic another time. + */ + ifp->if_obytes += len; + if (mflags & (M_BCAST|M_MCAST)) + ifp->if_omcasts++; + /* Someone else received the packet. */ + oifp->if_ipackets++; + } else { + /* The packet was freed already. */ + refcount_release(&sc->refcount); + epair_drv_flags |= IFF_DRV_OACTIVE; + ifp->if_drv_flags |= IFF_DRV_OACTIVE; + } + + return (error); +} + +static int +epair_transmit(struct ifnet *ifp, struct mbuf *m) +{ + int error; + + EPAIR_LOCK(); + error = epair_transmit_locked(ifp, m); + EPAIR_UNLOCK(); + return (error); +} + +static void +epair_qflush(struct ifnet *ifp) +{ + struct epair_softc *sc; + struct ifaltq *ifq; + + EPAIR_LOCK(); + sc = ifp->if_softc; + ifq = &ifp->if_snd; + DPRINTF("ifp=%p sc refcnt=%u ifq_len=%u\n", + ifp, sc->refcount, ifq->ifq_len); + /* + * Instead of calling refcount_release(&sc->refcount); + * n times, just subtract for the cleanup. + */ + sc->refcount -= ifq->ifq_len; + EPAIR_UNLOCK(); + if (sc->if_qflush) + sc->if_qflush(ifp); +} + +static int +epair_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) +{ + struct ifreq *ifr; + int error; + + ifr = (struct ifreq *)data; + switch (cmd) { + case SIOCSIFFLAGS: + case SIOCADDMULTI: + case SIOCDELMULTI: + error = 0; + break; + + default: + /* Let the common ethernet handler process this. */ + error = ether_ioctl(ifp, cmd, data); + break; + } + + return (error); +} + +static void +epair_init(void *dummy __unused) +{ +} + + +/* + * Interface cloning functions. + * We use our private ones so that we can create/destroy our secondary + * device along with the primary one. + */ +static int +epair_clone_match(struct if_clone *ifc, const char *name) +{ + const char *cp; + + DPRINTF("name='%s'\n", name); + + /* + * Our base name is epair. + * Our interfaces will be named epair[ab]. + * So accept anything of the following list: + * - epair + * - epair + * but not the epair[ab] versions. + */ + if (strncmp(EPAIRNAME, name, sizeof(EPAIRNAME)-1) != 0) + return (0); + + for (cp = name + sizeof(EPAIRNAME) - 1; *cp != '\0'; cp++) { + if (*cp < '0' || *cp > '9') + return (0); + } + + return (1); +} + +static int +epair_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) +{ + struct epair_softc *sca, *scb; + struct ifnet *ifp; + char *dp; + int error, unit, wildcard; + uint8_t eaddr[ETHER_ADDR_LEN]; /* 00:00:00:00:00:00 */ + + /* + * We are abusing params to create our second interface. + * Actually we already created it and called if_clone_createif() + * for it to do the official insertion procedure the moment we knew + * it cannot fail anymore. So just do attach it here. + */ + if (params) { + scb = (struct epair_softc *)params; + ifp = scb->ifp; + /* Assign a hopefully unique, locally administered etheraddr. */ + eaddr[0] = 0x02; + eaddr[3] = (ifp->if_index >> 8) & 0xff; + eaddr[4] = ifp->if_index & 0xff; + eaddr[5] = 0x0b; + ether_ifattach(ifp, eaddr); + /* Correctly set the name for the cloner list. */ + strlcpy(name, scb->ifp->if_xname, len); + return (0); + } + + /* Try to see if a special unit was requested. */ + error = ifc_name2unit(name, &unit); + if (error != 0) + return (error); + wildcard = (unit < 0); + + error = ifc_alloc_unit(ifc, &unit); + if (error != 0) + return (error); + + /* + * If no unit had been given, we need to adjust the ifName. + * Also make sure there is space for our extra [ab] suffix. + */ + for (dp = name; *dp != '\0'; dp++); + if (wildcard) { + error = snprintf(dp, len - (dp - name), "%d", unit); + if (error > len - (dp - name) - 1) { + /* ifName too long. */ + ifc_free_unit(ifc, unit); + return (ENOSPC); + } + dp += error; + } + if (len - (dp - name) - 1 < 1) { + /* No space left for our [ab] suffix. */ + ifc_free_unit(ifc, unit); + return (ENOSPC); + } + *dp = 'a'; + /* Must not change dp so we can replace 'a' by 'b' later. */ + *(dp+1) = '\0'; + + /* Allocate memory for both [ab] interfaces */ + sca = malloc(sizeof(struct epair_softc), M_EPAIR, M_WAITOK | M_ZERO); + refcount_init(&sca->refcount, 1); + sca->ifp = if_alloc(IFT_ETHER); + if (sca->ifp == NULL) { + free(sca, M_EPAIR); + ifc_free_unit(ifc, unit); + return (ENOSPC); + } + + scb = malloc(sizeof(struct epair_softc), M_EPAIR, M_WAITOK | M_ZERO); + refcount_init(&scb->refcount, 1); + scb->ifp = if_alloc(IFT_ETHER); + if (scb->ifp == NULL) { + free(scb, M_EPAIR); + if_free(sca->ifp); + free(sca, M_EPAIR); + ifc_free_unit(ifc, unit); + return (ENOSPC); + } + + /* + * Cross-reference the interfaces so we will be able to free both. + */ + sca->oifp = scb->ifp; + scb->oifp = sca->ifp; + + /* Finish initialization of interface a. */ + ifp = sca->ifp; + ifp->if_softc = sca; + strlcpy(ifp->if_xname, name, IFNAMSIZ); + ifp->if_dname = ifc->ifc_name; + ifp->if_dunit = unit; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_start = epair_start; + ifp->if_ioctl = epair_ioctl; + ifp->if_init = epair_init; + ifp->if_snd.ifq_maxlen = ifqmaxlen; + /* Assign a hopefully unique, locally administered etheraddr. */ + eaddr[0] = 0x02; + eaddr[3] = (ifp->if_index >> 8) & 0xff; + eaddr[4] = ifp->if_index & 0xff; + eaddr[5] = 0x0a; + ether_ifattach(ifp, eaddr); + sca->if_qflush = ifp->if_qflush; + ifp->if_qflush = epair_qflush; + ifp->if_transmit = epair_transmit; + ifp->if_baudrate = IF_Gbps(10UL); /* arbitrary maximum */ + + /* Swap the name and finish initialization of interface b. */ + *dp = 'b'; + + ifp = scb->ifp; + ifp->if_softc = scb; + strlcpy(ifp->if_xname, name, IFNAMSIZ); + ifp->if_dname = ifc->ifc_name; + ifp->if_dunit = unit; + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_start = epair_start; + ifp->if_ioctl = epair_ioctl; + ifp->if_init = epair_init; + ifp->if_snd.ifq_maxlen = ifqmaxlen; + /* We need to play some tricks here for the second interface. */ + strlcpy(name, EPAIRNAME, len); + error = if_clone_create(name, len, (caddr_t)scb); + if (error) + panic("%s: if_clone_createif() for our 2nd iface failed: %d", + __func__, error); + scb->if_qflush = ifp->if_qflush; + ifp->if_qflush = epair_qflush; + ifp->if_transmit = epair_transmit; + ifp->if_baudrate = IF_Gbps(10UL); /* arbitrary maximum */ + + /* + * Restore name to a as the ifp for this will go into the + * cloner list for the initial call. + */ + strlcpy(name, sca->ifp->if_xname, len); + DPRINTF("name='%s/%db' created sca=%p scb=%p\n", name, unit, sca, scb); + + /* Tell the world, that we are ready to rock. */ + sca->ifp->if_drv_flags |= IFF_DRV_RUNNING; + scb->ifp->if_drv_flags |= IFF_DRV_RUNNING; + + return (0); +} + +static int +epair_clone_destroy(struct if_clone *ifc, struct ifnet *ifp) +{ + struct ifnet *oifp; + struct epair_softc *sca, *scb; + int unit, error; + + DPRINTF("ifp=%p\n", ifp); + + /* + * In case we called into if_clone_destroyif() ourselves + * again to remove the second interface, the softc will be + * NULL. In that case so not do anything but return success. + */ + if (ifp->if_softc == NULL) + return (0); + + unit = ifp->if_dunit; + sca = ifp->if_softc; + oifp = sca->oifp; + scb = oifp->if_softc; + + DPRINTF("ifp=%p oifp=%p\n", ifp, oifp); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; + oifp->if_drv_flags &= ~IFF_DRV_RUNNING; + ether_ifdetach(oifp); + ether_ifdetach(ifp); + /* + * Wait for all packets to be dispatched to if_input. + * The numbers can only go down as the interfaces are + * detached so there is no need to use atomics. + */ + DPRINTF("sca refcnt=%u scb refcnt=%u\n", sca->refcount, scb->refcount); + KASSERT(sca->refcount == 1 && scb->refcount == 1, + ("%s: sca->refcount!=1: %d || scb->refcount!=1: %d", + __func__, sca->refcount, scb->refcount)); + + /* + * Get rid of our second half. + */ + oifp->if_softc = NULL; + error = if_clone_destroyif(ifc, oifp); + if (error) + panic("%s: if_clone_destroyif() for our 2nd iface failed: %d", + __func__, error); + + /* Finish cleaning up. Free them and release the unit. */ + if_free_type(oifp, IFT_ETHER); + if_free_type(ifp, IFT_ETHER); + free(scb, M_EPAIR); + free(sca, M_EPAIR); + ifc_free_unit(ifc, unit); + + return (0); +} + +static int +epair_modevent(module_t mod, int type, void *data) +{ + int tmp; + + switch (type) { + case MOD_LOAD: + /* For now limit us to one global mutex and one inq. */ + EPAIR_LOCK_INIT(); + epair_drv_flags = 0; + epairinq.ifq_maxlen = 16 * ifqmaxlen; /* What is a good 16? */ + if (TUNABLE_INT_FETCH("net.link.epair.netisr_maxqlen", &tmp)) + epairinq.ifq_maxlen = tmp; + mtx_init(&epairinq.ifq_mtx, "epair_inq", NULL, MTX_DEF); + netisr_register2(NETISR_EPAIR, (netisr_t *)epair_sintr, + epair_sintr_drained, &epairinq, 0); + if_clone_attach(&epair_cloner); + if (bootverbose) + printf("%s initialized.\n", EPAIRNAME); + break; + case MOD_UNLOAD: + if_clone_detach(&epair_cloner); + netisr_unregister(NETISR_EPAIR); + mtx_destroy(&epairinq.ifq_mtx); + EPAIR_LOCK_DESTROY(); + if (bootverbose) + printf("%s unloaded.\n", EPAIRNAME); + break; + default: + return (EOPNOTSUPP); + } + return (0); +} + +static moduledata_t epair_mod = { + "if_epair", + epair_modevent, + 0 +}; + +DECLARE_MODULE(if_epair, epair_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); +MODULE_VERSION(if_epair, 1); From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 22:25:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB03410656E1; Wed, 24 Jun 2009 22:25:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3]) by mx1.freebsd.org (Postfix) with ESMTP id 625038FC13; Wed, 24 Jun 2009 22:25:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id A707941C86F; Thu, 25 Jun 2009 00:25:05 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([195.88.108.3]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id rpw0cIrefEJh; Thu, 25 Jun 2009 00:25:05 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id 4B80641C874; Thu, 25 Jun 2009 00:25:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id C14D64448E6; Wed, 24 Jun 2009 22:24:39 +0000 (UTC) Date: Wed, 24 Jun 2009 22:24:39 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <200906242221.n5OMLVxb032003@svn.freebsd.org> Message-ID: <20090624222244.D22887@maildrop.int.zabbadoz.net> References: <200906242221.n5OMLVxb032003@svn.freebsd.org> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Subject: Re: svn commit: r194927 - in head: share/man/man4 sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 22:25:07 -0000 On Wed, 24 Jun 2009, Bjoern A. Zeeb wrote: > Author: bz > Date: Wed Jun 24 22:21:30 2009 > New Revision: 194927 > URL: http://svn.freebsd.org/changeset/base/194927 > > Log: > Merge from p4: CH154790,154793,154874 > > Import if_epair(4), a virtual cross-over Ethernet-like interface pair. > > Note these files are 1:1 from p4 and not yet connected to the build > not knowing about the new netisr interface. Obviously I have updates to address that as well as other things, also using dpcpu already;-) waiting for the builds to finish over night. > Sponsored by: The FreeBSD Foundation > > Added: > head/share/man/man4/epair.4 (contents, props changed) > head/sys/net/if_epair.c (contents, props changed) -- Bjoern A. Zeeb The greatest risk is not taking one. From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 22:28:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97433106564A; Wed, 24 Jun 2009 22:28:48 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 851AF8FC18; Wed, 24 Jun 2009 22:28:48 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OMSmWB032251; Wed, 24 Jun 2009 22:28:48 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OMSmtX032249; Wed, 24 Jun 2009 22:28:48 GMT (envelope-from np@svn.freebsd.org) Message-Id: <200906242228.n5OMSmtX032249@svn.freebsd.org> From: Navdeep Parhar Date: Wed, 24 Jun 2009 22:28: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: r194928 - head/usr.sbin/cxgbtool X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 22:28:49 -0000 Author: np Date: Wed Jun 24 22:28:48 2009 New Revision: 194928 URL: http://svn.freebsd.org/changeset/base/194928 Log: This adds a new "stdio" mode to cxgbtool - it's an interactive mode meant primarily for _non_ interactive use. Scripts that run cxgbtool repeatedly to perform register r/w or mdio will benefit from this. Instead of fork/exec'ing a new cxgbtool for every regio/mdio you can simply open a pair of pipes to/from cxgbtool and run cmds over them. Approved by: gnn (mentor) Modified: head/usr.sbin/cxgbtool/cxgbtool.c Modified: head/usr.sbin/cxgbtool/cxgbtool.c ============================================================================== --- head/usr.sbin/cxgbtool/cxgbtool.c Wed Jun 24 22:21:30 2009 (r194927) +++ head/usr.sbin/cxgbtool/cxgbtool.c Wed Jun 24 22:28:48 2009 (r194928) @@ -1408,26 +1408,11 @@ static int get_up_ioqs(int argc, char *a return 0; } -int main(int argc, char *argv[]) +static int +run_cmd(int argc, char *argv[], const char *iff_name) { int r = -1; - const char *iff_name; - - progname = argv[0]; - - if (argc == 2) { - if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) - usage(stdout); - if (!strcmp(argv[1], "-v") || !strcmp(argv[1], "--version")) { - printf("%s version %s\n", PROGNAME, VERSION); - printf("%s\n", COPYRIGHT); - exit(0); - } - } - - if (argc < 3) usage(stderr); - iff_name = argv[1]; if (!strcmp(argv[2], "reg")) r = register_io(argc, argv, 3, iff_name); else if (!strcmp(argv[2], "mdio")) @@ -1474,5 +1459,85 @@ int main(int argc, char *argv[]) if (r == -1) usage(stderr); - return 0; + return (0); +} + +static int +run_cmd_loop(int argc, char *argv[], const char *iff_name) +{ + int n, i; + char buf[64]; + char *args[8], *s; + + args[0] = argv[0]; + args[1] = argv[1]; + + /* + * Fairly simplistic loop. Displays a "> " prompt and processes any + * input as a cxgbtool command. You're supposed to enter only the part + * after "cxgbtool cxgbX". Use "quit" or "exit" to exit. Any error in + * the command will also terminate cxgbtool. + */ + for (;;) { + fprintf(stdout, "> "); + fflush(stdout); + n = read(STDIN_FILENO, buf, sizeof(buf)); + if (n > sizeof(buf) - 1) { + fprintf(stdout, "too much input.\n"); + return (0); + } else if (n <= 0) + return (0); + + if (buf[--n] != '\n') + continue; + else + buf[n] = 0; + + s = &buf[0]; + for (i = 2; i < sizeof(args)/sizeof(args[0]) - 1; i++) { + while (s && (*s == ' ' || *s == '\t')) + s++; + if ((args[i] = strsep(&s, " \t")) == NULL) + break; + } + args[sizeof(args)/sizeof(args[0]) - 1] = 0; + + if (!strcmp(args[2], "quit") || !strcmp(args[2], "exit")) + return (0); + + (void) run_cmd(i, args, iff_name); + } + + /* Can't really get here */ + return (0); +} + +int +main(int argc, char *argv[]) +{ + int r = -1; + const char *iff_name; + + progname = argv[0]; + + if (argc == 2) { + if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) + usage(stdout); + if (!strcmp(argv[1], "-v") || !strcmp(argv[1], "--version")) { + printf("%s version %s\n", PROGNAME, VERSION); + printf("%s\n", COPYRIGHT); + exit(0); + } + } + + if (argc < 3) usage(stderr); + + iff_name = argv[1]; + + if (argc == 3 && !strcmp(argv[2], "stdio")) + r = run_cmd_loop(argc, argv, iff_name); + else + r = run_cmd(argc, argv, iff_name); + + return (r); } From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 22:53:10 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A7D44106566C; Wed, 24 Jun 2009 22:53:10 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from pele.citylink.co.nz (pele.citylink.co.nz [202.8.44.226]) by mx1.freebsd.org (Postfix) with ESMTP id 68B898FC14; Wed, 24 Jun 2009 22:53:10 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from localhost (localhost [127.0.0.1]) by pele.citylink.co.nz (Postfix) with ESMTP id 91373FFE7; Thu, 25 Jun 2009 10:53:09 +1200 (NZST) X-Virus-Scanned: Debian amavisd-new at citylink.co.nz Received: from pele.citylink.co.nz ([127.0.0.1]) by localhost (pele.citylink.co.nz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IWUOewvjwr5N; Thu, 25 Jun 2009 10:53:05 +1200 (NZST) Received: from citylink.fud.org.nz (unknown [202.8.44.45]) by pele.citylink.co.nz (Postfix) with ESMTP; Thu, 25 Jun 2009 10:53:05 +1200 (NZST) Received: by citylink.fud.org.nz (Postfix, from userid 1001) id BCE4411434; Thu, 25 Jun 2009 10:53:04 +1200 (NZST) Date: Wed, 24 Jun 2009 15:53:04 -0700 From: Andrew Thompson To: "Bjoern A. Zeeb" Message-ID: <20090624225304.GB76680@citylink.fud.org.nz> References: <200906242221.n5OMLVxb032003@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200906242221.n5OMLVxb032003@svn.freebsd.org> User-Agent: Mutt/1.5.17 (2007-11-01) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194927 - in head: share/man/man4 sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 22:53:11 -0000 On Wed, Jun 24, 2009 at 10:21:31PM +0000, Bjoern A. Zeeb wrote: > Author: bz > Date: Wed Jun 24 22:21:30 2009 > New Revision: 194927 > URL: http://svn.freebsd.org/changeset/base/194927 > > Log: > Merge from p4: CH154790,154793,154874 > > Import if_epair(4), a virtual cross-over Ethernet-like interface pair. > +The basic intend is to provide connectivity between two virtual > +network stack instances. > +When connected to a > +.Xr if_bridge 4 ... > +.Sh SEE ALSO > +.Xr if_bridge 4 , I wonder if we should start just using bridge(4) again. 6.x is the last release series to include the old bridge code and from 7.0 onwards there is a MLINK for it. Its the only pseudo interface to have a if_ prefix on it when referred to. Andrew From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 22:57:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E9221065675; Wed, 24 Jun 2009 22:57:08 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0ACC98FC1C; Wed, 24 Jun 2009 22:57:08 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5OMv7fc033003; Wed, 24 Jun 2009 22:57:07 GMT (envelope-from oleg@svn.freebsd.org) Received: (from oleg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5OMv71d032996; Wed, 24 Jun 2009 22:57:07 GMT (envelope-from oleg@svn.freebsd.org) Message-Id: <200906242257.n5OMv71d032996@svn.freebsd.org> From: Oleg Bulyzhin Date: Wed, 24 Jun 2009 22:57: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: r194930 - in head: sbin/ipfw sys/netinet sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 22:57:08 -0000 Author: oleg Date: Wed Jun 24 22:57:07 2009 New Revision: 194930 URL: http://svn.freebsd.org/changeset/base/194930 Log: - fix dummynet 'fast' mode for WF2Q case. - fix printing of pipe profile data. - introduce new pipe parameter: 'burst' - how much data can be sent through pipe bypassing bandwidth limit. Modified: head/sbin/ipfw/Makefile head/sbin/ipfw/dummynet.c head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.h head/sys/netinet/ip_dummynet.h head/sys/netinet/ipfw/ip_dummynet.c Modified: head/sbin/ipfw/Makefile ============================================================================== --- head/sbin/ipfw/Makefile Wed Jun 24 22:42:52 2009 (r194929) +++ head/sbin/ipfw/Makefile Wed Jun 24 22:57:07 2009 (r194930) @@ -3,6 +3,7 @@ PROG= ipfw SRCS= ipfw2.c dummynet.c ipv6.c main.c nat.c altq.c WARNS?= 2 +LDADD= -lutil MAN= ipfw.8 .include Modified: head/sbin/ipfw/dummynet.c ============================================================================== --- head/sbin/ipfw/dummynet.c Wed Jun 24 22:42:52 2009 (r194929) +++ head/sbin/ipfw/dummynet.c Wed Jun 24 22:57:07 2009 (r194930) @@ -32,6 +32,8 @@ #include #include +#include +#include #include #include #include @@ -70,6 +72,7 @@ static struct _s_x dummynet_params[] = { { "src-ipv6", TOK_SRCIP6}, { "src-ip6", TOK_SRCIP6}, { "profile", TOK_PIPE_PROFILE}, + { "burst", TOK_BURST}, { "dummynet-params", TOK_NULL }, { NULL, 0 } /* terminator */ }; @@ -236,7 +239,7 @@ print_flowset_parms(struct dn_flow_set * plr[0] = '\0'; if (fs->flags_fs & DN_IS_RED) /* RED parameters */ sprintf(red, - "\n\t %cRED w_q %f min_th %d max_th %d max_p %f", + "\n\t %cRED w_q %f min_th %d max_th %d max_p %f", (fs->flags_fs & DN_IS_GENTLE_RED) ? 'G' : ' ', 1.0 * fs->w_q / (double)(1 << SCALE_RED), SCALE_VAL(fs->min_th), @@ -250,7 +253,7 @@ print_flowset_parms(struct dn_flow_set * } static void -print_extra_delay_parms(struct dn_pipe *p, char *prefix) +print_extra_delay_parms(struct dn_pipe *p) { double loss; if (p->samples_no <= 0) @@ -258,8 +261,8 @@ print_extra_delay_parms(struct dn_pipe * loss = p->loss_level; loss /= p->samples_no; - printf("%s profile: name \"%s\" loss %f samples %d\n", - prefix, p->name, loss, p->samples_no); + printf("\t profile: name \"%s\" loss %f samples %d\n", + p->name, loss, p->samples_no); } void @@ -280,6 +283,7 @@ ipfw_list_pipes(void *data, uint nbytes, double b = p->bandwidth; char buf[30]; char prefix[80]; + char burst[5 + 7]; if (SLIST_NEXT(p, next) != (struct dn_pipe *)DN_IS_PIPE) break; /* done with pipes, now queues */ @@ -311,10 +315,16 @@ ipfw_list_pipes(void *data, uint nbytes, sprintf(prefix, "%05d: %s %4d ms ", p->pipe_nr, buf, p->delay); - print_extra_delay_parms(p, prefix); - print_flowset_parms(&(p->fs), prefix); + if (humanize_number(burst, sizeof(burst), p->burst, + "Byte", HN_AUTOSCALE, 0) < 0 || co.verbose) + printf("\t burst: %ju Byte\n", p->burst); + else + printf("\t burst: %s\n", burst); + + print_extra_delay_parms(p); + q = (struct dn_flow_queue *)(p+1); list_queues(&(p->fs), q); } @@ -933,6 +943,21 @@ end_mask: --ac; ++av; break; + case TOK_BURST: + if (co.do_pipe != 1) + errx(EX_DATAERR, "burst only valid for pipes"); + NEED1("burst needs argument\n"); + errno = 0; + if (expand_number(av[0], &p.burst) < 0) + if (errno != ERANGE) + errx(EX_DATAERR, + "burst: invalid argument"); + if (errno || p.burst > (1ULL << 48) - 1) + errx(EX_DATAERR, + "burst: out of range (0..2^48-1)"); + ac--; av++; + break; + default: errx(EX_DATAERR, "unrecognised option ``%s''", av[-1]); } Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Wed Jun 24 22:42:52 2009 (r194929) +++ head/sbin/ipfw/ipfw.8 Wed Jun 24 22:57:07 2009 (r194930) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 9, 2009 +.Dd June 24, 2009 .Dt IPFW 8 .Os .Sh NAME @@ -1943,6 +1943,20 @@ to reduce the granularity to 1ms or less). Default value is 0, meaning no delay. .Pp +.It Cm burst Ar size +If the data rate exceeds the pipe bandwith limit +(and pipe was idle long enough), +.Ar size +bytes of data is allowed to bypass the +.Nm dummynet +scheduler (i.e. it will be sent without shaping), then transmission rate +will not exceed pipe bandwidth. Effective burst size calculated as follows: +MAX( +.Ar size +, +.Nm bw +* pipe_idle_time). +.Pp .It Cm profile Ar filename A file specifying the additional overhead incurred in the transmission of a packet on the link. Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Wed Jun 24 22:42:52 2009 (r194929) +++ head/sbin/ipfw/ipfw2.h Wed Jun 24 22:57:07 2009 (r194930) @@ -154,6 +154,7 @@ enum tokens { TOK_BW, TOK_DELAY, TOK_PIPE_PROFILE, + TOK_BURST, TOK_RED, TOK_GRED, TOK_DROPTAIL, Modified: head/sys/netinet/ip_dummynet.h ============================================================================== --- head/sys/netinet/ip_dummynet.h Wed Jun 24 22:42:52 2009 (r194929) +++ head/sys/netinet/ip_dummynet.h Wed Jun 24 22:57:07 2009 (r194930) @@ -229,7 +229,7 @@ struct dn_flow_queue { int avg ; /* average queue length est. (scaled) */ int count ; /* arrivals since last RED drop */ int random ; /* random value (scaled) */ - dn_key q_time; /* start of queue idle time */ + dn_key idle_time; /* start of queue idle time */ /* WF2Q+ support */ struct dn_flow_set *fs ; /* parent flow set */ @@ -341,8 +341,10 @@ struct dn_pipe { /* a pipe */ /* Same as in dn_flow_queue, numbytes can become large */ int64_t numbytes; /* bits I can transmit (more or less). */ + uint64_t burst; /* burst size, scaled: bits * hz */ dn_key sched_time ; /* time pipe was scheduled in ready_heap */ + dn_key idle_time; /* start of pipe idle time */ /* * When the tx clock come from an interface (if_name[0] != '\0'), its name Modified: head/sys/netinet/ipfw/ip_dummynet.c ============================================================================== --- head/sys/netinet/ipfw/ip_dummynet.c Wed Jun 24 22:42:52 2009 (r194929) +++ head/sys/netinet/ipfw/ip_dummynet.c Wed Jun 24 22:57:07 2009 (r194930) @@ -661,7 +661,7 @@ ready_event(struct dn_flow_queue *q, str * queue on error hoping next time we are luckier. */ } else /* RED needs to know when the queue becomes empty. */ - q->q_time = curr_time; + q->idle_time = curr_time; /* * If the delay line was empty call transmit_event() now. @@ -761,23 +761,26 @@ ready_event_wfq(struct dn_pipe *p, struc break; } } - if (sch->elements == 0 && neh->elements == 0 && p->numbytes >= 0 && - p->idle_heap.elements > 0) { + if (sch->elements == 0 && neh->elements == 0 && p->numbytes >= 0) { + p->idle_time = curr_time; /* * No traffic and no events scheduled. * We can get rid of idle-heap. */ - int i; + if (p->idle_heap.elements > 0) { + int i; - for (i = 0; i < p->idle_heap.elements; i++) { - struct dn_flow_queue *q = p->idle_heap.p[i].object; - - q->F = 0; - q->S = q->F + 1; + for (i = 0; i < p->idle_heap.elements; i++) { + struct dn_flow_queue *q; + + q = p->idle_heap.p[i].object; + q->F = 0; + q->S = q->F + 1; + } + p->sum = 0; + p->V = 0; + p->idle_heap.elements = 0; } - p->sum = 0; - p->V = 0; - p->idle_heap.elements = 0; } /* * If we are getting clocks from dummynet (not a real interface) and @@ -1042,7 +1045,7 @@ create_queue(struct dn_flow_set *fs, int q->hash_slot = i; q->next = fs->rq[i]; q->S = q->F + 1; /* hack - mark timestamp as invalid. */ - q->numbytes = io_fast ? fs->pipe->bandwidth : 0; + q->numbytes = fs->pipe->burst + (io_fast ? fs->pipe->bandwidth : 0); fs->rq[i] = q; fs->rq_elements++; return (q); @@ -1204,7 +1207,7 @@ red_drops(struct dn_flow_set *fs, struct * XXX check wraps... */ if (q->avg) { - u_int t = (curr_time - q->q_time) / fs->lookup_step; + u_int t = (curr_time - q->idle_time) / fs->lookup_step; q->avg = (t < fs->lookup_depth) ? SCALE_MUL(q->avg, fs->w_q_lookup[t]) : 0; @@ -1401,9 +1404,30 @@ dummynet_io(struct mbuf **m0, int dir, s if (q->head != m) /* Flow was not idle, we are done. */ goto done; - if (q->q_time < curr_time) - q->numbytes = io_fast ? fs->pipe->bandwidth : 0; - q->q_time = curr_time; + if (is_pipe) { /* Fixed rate queues. */ + if (q->idle_time < curr_time) { + /* Calculate available burst size. */ + q->numbytes += + (curr_time - q->idle_time) * pipe->bandwidth; + if (q->numbytes > pipe->burst) + q->numbytes = pipe->burst; + if (io_fast) + q->numbytes += pipe->bandwidth; + } + } else { /* WF2Q. */ + if (pipe->idle_time < curr_time) { + /* Calculate available burst size. */ + pipe->numbytes += + (curr_time - pipe->idle_time) * pipe->bandwidth; + if (pipe->numbytes > pipe->burst) + pipe->numbytes = pipe->burst; + if (io_fast) + pipe->numbytes += pipe->bandwidth; + } + pipe->idle_time = curr_time; + } + /* Necessary for both: fixed rate & WF2Q queues. */ + q->idle_time = curr_time; /* * If we reach this point the flow was previously idle, so we need @@ -1731,6 +1755,8 @@ config_pipe(struct dn_pipe *p) * qsize = slots/bytes */ p->delay = (p->delay * hz) / 1000; + /* Scale burst size: bytes -> bits * hz */ + p->burst *= 8 * hz; /* We need either a pipe number or a flow_set number. */ if (p->pipe_nr == 0 && pfs->fs_nr == 0) return (EINVAL); @@ -1762,11 +1788,14 @@ config_pipe(struct dn_pipe *p) } else /* Flush accumulated credit for all queues. */ for (i = 0; i <= pipe->fs.rq_size; i++) - for (q = pipe->fs.rq[i]; q; q = q->next) - q->numbytes = io_fast ? p->bandwidth : 0; + for (q = pipe->fs.rq[i]; q; q = q->next) { + q->numbytes = p->burst + + (io_fast ? p->bandwidth : 0); + } pipe->bandwidth = p->bandwidth; - pipe->numbytes = 0; /* just in case... */ + pipe->burst = p->burst; + pipe->numbytes = pipe->burst + (io_fast ? pipe->bandwidth : 0); bcopy(p->if_name, pipe->if_name, sizeof(p->if_name)); pipe->ifp = NULL; /* reset interface ptr */ pipe->delay = p->delay; @@ -2107,6 +2136,7 @@ dummynet_get(struct sockopt *sopt) */ bcopy(pipe, bp, sizeof(*pipe)); pipe_bp->delay = (pipe_bp->delay * 1000) / hz; + pipe_bp->burst /= 8 * hz; /* * XXX the following is a hack based on ->next being the * first field in dn_pipe and dn_flow_set. The correct From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 23:17:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF460106566C; Wed, 24 Jun 2009 23:17:00 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB9658FC19; Wed, 24 Jun 2009 23:17:00 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5ONH0K2033457; Wed, 24 Jun 2009 23:17:00 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5ONH0pj033448; Wed, 24 Jun 2009 23:17:00 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <200906242317.n5ONH0pj033448@svn.freebsd.org> From: Colin Percival Date: Wed, 24 Jun 2009 23:17: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: r194931 - head/usr.sbin/sysinstall X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 23:17:01 -0000 Author: cperciva Date: Wed Jun 24 23:17:00 2009 New Revision: 194931 URL: http://svn.freebsd.org/changeset/base/194931 Log: Make sysinstall search for /dev/daXa and register such devices as USB disks. This covers the common case of unsliced USB drives, and makes it possible to select them as installation source media. PR: 61152, 115197, 135016 Submitted by: randi MFC after: 1 month Added: head/usr.sbin/sysinstall/usb.c (contents, props changed) Modified: head/usr.sbin/sysinstall/Makefile head/usr.sbin/sysinstall/devices.c head/usr.sbin/sysinstall/dispatch.c head/usr.sbin/sysinstall/media.c head/usr.sbin/sysinstall/menus.c head/usr.sbin/sysinstall/options.c head/usr.sbin/sysinstall/sysinstall.h Modified: head/usr.sbin/sysinstall/Makefile ============================================================================== --- head/usr.sbin/sysinstall/Makefile Wed Jun 24 22:57:07 2009 (r194930) +++ head/usr.sbin/sysinstall/Makefile Wed Jun 24 23:17:00 2009 (r194931) @@ -11,7 +11,7 @@ SRCS= anonFTP.c cdrom.c command.c config ftp.c globals.c http.c index.c install.c installUpgrade.c keymap.c \ label.c main.c makedevs.c media.c menus.c misc.c modules.c \ mouse.c msg.c network.c nfs.c options.c package.c \ - system.c tcpip.c termcap.c ttys.c ufs.c user.c \ + system.c tcpip.c termcap.c ttys.c ufs.c usb.c user.c \ variable.c ${_wizard} keymap.h countries.h CFLAGS+= -DUSE_GZIP=1 Modified: head/usr.sbin/sysinstall/devices.c ============================================================================== --- head/usr.sbin/sysinstall/devices.c Wed Jun 24 22:57:07 2009 (r194930) +++ head/usr.sbin/sysinstall/devices.c Wed Jun 24 23:17:00 2009 (r194931) @@ -65,6 +65,8 @@ static int numDevs; DEVICE_ENTRY(DEVICE_TYPE_NETWORK, name, descr, 0) #define SERIAL(name, descr, max) \ DEVICE_ENTRY(DEVICE_TYPE_NETWORK, name, descr, max) +#define USB(name, descr, max) \ + DEVICE_ENTRY(DEVICE_TYPE_USB, name, descr, max) static struct _devname { DeviceType type; @@ -89,6 +91,7 @@ static struct _devname { DISK("mfid%d", "LSI MegaRAID SAS array", 4), FLOPPY("fd%d", "floppy drive unit A", 4), SERIAL("cuad%d", "%s on device %s (COM%d)", 16), + USB("da%da", "USB Mass Storage Device", 16), NETWORK("ae", "Attansic/Atheros L2 Fast Ethernet"), NETWORK("age", "Attansic/Atheros L1 Gigabit Ethernet"), NETWORK("alc", "Atheros AR8131/AR8132 PCIe Ethernet"), @@ -392,6 +395,22 @@ skipif: } break; + case DEVICE_TYPE_USB: + fd = deviceTry(device_names[i], try, j); + if (fd >= 0) { + char n[BUFSIZ]; + + close(fd); + snprintf(n, sizeof(n), device_names[i].name, j); + deviceRegister(strdup(n), device_names[i].description, + strdup(try), DEVICE_TYPE_USB, TRUE, mediaInitUSB, + mediaGetUSB, mediaShutdownUSB, NULL); + + if (isDebug()) + msgDebug("Found a USB disk for %s\n", try); + } + break; + case DEVICE_TYPE_NETWORK: fd = deviceTry(device_names[i], try, j); /* The only network devices that you can open this way are serial ones */ Modified: head/usr.sbin/sysinstall/dispatch.c ============================================================================== --- head/usr.sbin/sysinstall/dispatch.c Wed Jun 24 22:57:07 2009 (r194930) +++ head/usr.sbin/sysinstall/dispatch.c Wed Jun 24 23:17:00 2009 (r194931) @@ -96,6 +96,7 @@ static struct _word { { "mediaClose", dispatch_mediaClose }, { "mediaSetCDROM", mediaSetCDROM }, { "mediaSetFloppy", mediaSetFloppy }, + { "mediaSetUSB", mediaSetUSB }, { "mediaSetDOS", mediaSetDOS }, { "mediaSetFTP", mediaSetFTP }, { "mediaSetFTPActive", mediaSetFTPActive }, @@ -511,7 +512,8 @@ dispatch_load_menu(dialogMenuItem *self) Device **devlist; char *err; int what, i, j, msize, count; - DeviceType dtypes[] = {DEVICE_TYPE_FLOPPY, DEVICE_TYPE_CDROM, DEVICE_TYPE_DOS, DEVICE_TYPE_UFS}; + DeviceType dtypes[] = {DEVICE_TYPE_FLOPPY, DEVICE_TYPE_CDROM, + DEVICE_TYPE_DOS, DEVICE_TYPE_UFS, DEVICE_TYPE_USB}; fprintf(stderr, "dispatch_load_menu called\n"); Modified: head/usr.sbin/sysinstall/media.c ============================================================================== --- head/usr.sbin/sysinstall/media.c Wed Jun 24 22:57:07 2009 (r194930) +++ head/usr.sbin/sysinstall/media.c Wed Jun 24 23:17:00 2009 (r194931) @@ -221,6 +221,52 @@ mediaSetFloppy(dialogMenuItem *self) } static int +USBHook(dialogMenuItem *self) +{ + return genericHook(self, DEVICE_TYPE_USB); +} + + +/* + * Attempt to use USB as the installation media type. + */ +int +mediaSetUSB(dialogMenuItem *self) +{ + Device **devs; + int cnt; + + mediaClose(); + devs = deviceFind(NULL, DEVICE_TYPE_USB); + cnt = deviceCount(devs); + + if (!cnt) { + msgConfirm("No USB devices found!"); + return DITEM_FAILURE | DITEM_CONTINUE; + } + else if (cnt > 1) { + DMenu *menu; + int status; + + menu = deviceCreateMenu(&MenuMediaUSB, DEVICE_TYPE_USB, USBHook, + NULL); + if (!menu) + msgFatal("Unable to create USB menu! Something is " \ + "seriously wrong."); + status = dmenuOpenSimple(menu, FALSE); + free(menu); + if (!status) + return DITEM_FAILURE; + } + else + mediaDevice = devs[0]; + if (mediaDevice) + mediaDevice->private = NULL; + msgConfirm("Using USB device: %s", mediaDevice->name); + return (mediaDevice ? DITEM_LEAVE_MENU : DITEM_FAILURE); +} + +static int DOSHook(dialogMenuItem *self) { return genericHook(self, DEVICE_TYPE_DOS); Modified: head/usr.sbin/sysinstall/menus.c ============================================================================== --- head/usr.sbin/sysinstall/menus.c Wed Jun 24 22:57:07 2009 (r194930) +++ head/usr.sbin/sysinstall/menus.c Wed Jun 24 23:17:00 2009 (r194931) @@ -191,6 +191,7 @@ DMenu MenuIndex = { { " Media, NFS", "Select NFS installation media.", NULL, mediaSetNFS }, { " Media, Floppy", "Select floppy installation media.", NULL, mediaSetFloppy }, { " Media, CDROM/DVD", "Select CDROM/DVD installation media.", NULL, mediaSetCDROM }, + { " Media, USB", "Select USB installation media.", NULL, mediaSetUSB }, { " Media, DOS", "Select DOS installation media.", NULL, mediaSetDOS }, { " Media, UFS", "Select UFS installation media.", NULL, mediaSetUFS }, { " Media, FTP", "Select FTP installation media.", NULL, mediaSetFTP }, @@ -428,6 +429,16 @@ DMenu MenuMediaFloppy = { { { NULL } }, }; +DMenu MenuMediaUSB = { + DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, + "Choose a USB drive", + "You have more than one USB drive. Please choose which drive\n" + "you would like to use.", + NULL, + NULL, + { { NULL } }, +}; + DMenu MenuMediaDOS = { DMENU_NORMAL_TYPE | DMENU_SELECTION_RETURNS, "Choose a DOS partition", @@ -850,6 +861,7 @@ DMenu MenuMedia = { { "6 NFS", "Install over NFS", NULL, mediaSetNFS }, { "7 File System", "Install from an existing filesystem", NULL, mediaSetUFS }, { "8 Floppy", "Install from a floppy disk set", NULL, mediaSetFloppy }, + { "9 USB", "Install from a USB drive", NULL, mediaSetUSB }, { "X Options", "Go to the Options screen", NULL, optionsEditor }, { NULL } }, }; Modified: head/usr.sbin/sysinstall/options.c ============================================================================== --- head/usr.sbin/sysinstall/options.c Wed Jun 24 22:57:07 2009 (r194930) +++ head/usr.sbin/sysinstall/options.c Wed Jun 24 23:17:00 2009 (r194931) @@ -78,6 +78,9 @@ mediaCheck(Option *opt) case DEVICE_TYPE_CDROM: return "CDROM"; + case DEVICE_TYPE_USB: + return "USB"; + case DEVICE_TYPE_DOS: return "DOS"; Modified: head/usr.sbin/sysinstall/sysinstall.h ============================================================================== --- head/usr.sbin/sysinstall/sysinstall.h Wed Jun 24 22:57:07 2009 (r194930) +++ head/usr.sbin/sysinstall/sysinstall.h Wed Jun 24 23:17:00 2009 (r194931) @@ -271,6 +271,7 @@ typedef enum { DEVICE_TYPE_FTP, DEVICE_TYPE_NETWORK, DEVICE_TYPE_CDROM, + DEVICE_TYPE_USB, DEVICE_TYPE_DOS, DEVICE_TYPE_UFS, DEVICE_TYPE_NFS, @@ -440,6 +441,7 @@ extern DMenu MenuMedia; /* Media type extern DMenu MenuMouse; /* Mouse type menu */ #endif extern DMenu MenuMediaCDROM; /* CDROM media menu */ +extern DMenu MenuMediaUSB; /* USB media menu */ extern DMenu MenuMediaDOS; /* DOS media menu */ extern DMenu MenuMediaFloppy; /* Floppy media menu */ extern DMenu MenuMediaFTP; /* FTP media menu */ @@ -717,6 +719,7 @@ extern void mediaClose(void); extern int mediaTimeout(void); extern int mediaSetCDROM(dialogMenuItem *self); extern int mediaSetFloppy(dialogMenuItem *self); +extern int mediaSetUSB(dialogMenuItem *self); extern int mediaSetDOS(dialogMenuItem *self); extern int mediaSetFTP(dialogMenuItem *self); extern int mediaSetFTPActive(dialogMenuItem *self); @@ -848,6 +851,11 @@ extern void mediaShutdownUFS(Device *dev extern Boolean mediaInitUFS(Device *dev); extern FILE *mediaGetUFS(Device *dev, char *file, Boolean probe); +/* usb.c */ +extern Boolean mediaInitUSB(Device *dev); +extern FILE *mediaGetUSB(Device *dev, char *file, Boolean probe); +extern void mediaShutdownUSB(Device *dev); + /* user.c */ extern int userAddGroup(dialogMenuItem *self); extern int userAddUser(dialogMenuItem *self); Added: head/usr.sbin/sysinstall/usb.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/sysinstall/usb.c Wed Jun 24 23:17:00 2009 (r194931) @@ -0,0 +1,88 @@ +/* + * 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, + * verbatim and that no modifications are made prior to this + * point in the file. + * 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 JORDAN HUBBARD ``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 JORDAN HUBBARD OR HIS PETS 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, LIFE 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. + * + * used floppy.c and cdrom.c as templates, edited as necessary. + * + * $FreeBSD$ + */ + +#include +#include +#include + +#include + +#include "sysinstall.h" + +static Boolean USBMounted; +static char mountpoint[] = "/dist"; + +Boolean +mediaInitUSB(Device *dev) +{ + struct ufs_args ufsargs; + + if (USBMounted) + return TRUE; + + Mkdir(mountpoint); + + memset(&ufsargs, 0, sizeof(ufsargs)); + ufsargs.fspec = dev->devname; + + if (mount("ufs", mountpoint, MNT_RDONLY, (caddr_t)&ufsargs) != -1) { + USBMounted = TRUE; + return TRUE; + } + + msgConfirm("Error mounting USB drive %s (%s) on %s : %s", + dev->name, dev->devname, mountpoint, strerror(errno)); + return FALSE; +} + + +FILE * +mediaGetUSB(Device *dev, char *file, Boolean probe) +{ + return mediaGenericGet(mountpoint, file); +} + + +/* + * When sysinstall terminates, all USB drives handled by deviceRegister will + * be checked and unmounted if necessary. + */ +void +mediaShutdownUSB(Device *dev) +{ + if (!USBMounted) + return; + + if (unmount(mountpoint, MNT_FORCE) != 0) + msgConfirm("Could not unmount the USB drive from %s: %s", + mountpoint, strerror(errno)); + else + USBMounted = FALSE; + +} From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 23:17:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BD0610656C0; Wed, 24 Jun 2009 23:17:16 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8972A8FC0A; Wed, 24 Jun 2009 23:17:16 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5ONHGkS033502; Wed, 24 Jun 2009 23:17:16 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5ONHGLU033500; Wed, 24 Jun 2009 23:17:16 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906242317.n5ONHGLU033500@svn.freebsd.org> From: Xin LI Date: Wed, 24 Jun 2009 23:17:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194932 - head/lib/libc/rpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 23:17:17 -0000 Author: delphij Date: Wed Jun 24 23:17:16 2009 New Revision: 194932 URL: http://svn.freebsd.org/changeset/base/194932 Log: Lock around access to nc_file and netconfig_info ("ni"). The RPC part of libc is still not thread safe but this would at least reduce the problems we have. PR: threads/118544 Submitted by: Changming Sun MFC after: 2 weeks Modified: head/lib/libc/rpc/getnetconfig.c Modified: head/lib/libc/rpc/getnetconfig.c ============================================================================== --- head/lib/libc/rpc/getnetconfig.c Wed Jun 24 23:17:00 2009 (r194931) +++ head/lib/libc/rpc/getnetconfig.c Wed Jun 24 23:17:16 2009 (r194932) @@ -130,7 +130,11 @@ static struct netconfig *dup_ncp(struct static FILE *nc_file; /* for netconfig db */ +static pthread_mutex_t nc_file_lock = PTHREAD_MUTEX_INITIALIZER; + static struct netconfig_info ni = { 0, 0, NULL, NULL}; +static pthread_mutex_t ni_lock = PTHREAD_MUTEX_INITIALIZER; + #define MAXNETCONFIGLINE 1000 @@ -204,14 +208,24 @@ setnetconfig() * For multiple calls, i.e. nc_file is not NULL, we just return the * handle without reopening the netconfig db. */ + mutex_lock(&ni_lock); ni.ref++; + mutex_unlock(&ni_lock); + + mutex_lock(&nc_file_lock); if ((nc_file != NULL) || (nc_file = fopen(NETCONFIG, "r")) != NULL) { nc_vars->valid = NC_VALID; nc_vars->flag = 0; nc_vars->nc_configs = ni.head; + mutex_unlock(&nc_file_lock); return ((void *)nc_vars); } + mutex_unlock(&nc_file_lock); + + mutex_lock(&ni_lock); ni.ref--; + mutex_unlock(&ni_lock); + nc_error = NC_NONETCONFIG; free(nc_vars); return (NULL); @@ -234,14 +248,18 @@ void *handlep; char *stringp; /* tmp string pointer */ struct netconfig_list *list; struct netconfig *np; + struct netconfig *result; /* * Verify that handle is valid */ + mutex_lock(&nc_file_lock); if (ncp == NULL || nc_file == NULL) { nc_error = NC_NOTINIT; + mutex_unlock(&nc_file_lock); return (NULL); } + mutex_unlock(&nc_file_lock); switch (ncp->valid) { case NC_VALID: @@ -255,7 +273,9 @@ void *handlep; */ if (ncp->flag == 0) { /* first time */ ncp->flag = 1; + mutex_lock(&ni_lock); ncp->nc_configs = ni.head; + mutex_unlock(&ni_lock); if (ncp->nc_configs != NULL) /* entry already exist */ return(ncp->nc_configs->ncp); } @@ -268,7 +288,13 @@ void *handlep; * If we cannot find the entry in the list and is end of file, * we give up. */ - if (ni.eof == 1) return(NULL); + mutex_lock(&ni_lock); + if (ni.eof == 1) { + mutex_unlock(&ni_lock); + return(NULL); + } + mutex_unlock(&ni_lock); + break; default: nc_error = NC_NOTINIT; @@ -289,13 +315,18 @@ void *handlep; /* * Read a line from netconfig file. */ + mutex_lock(&nc_file_lock); do { if (fgets(stringp, MAXNETCONFIGLINE, nc_file) == NULL) { free(stringp); + mutex_lock(&ni_lock); ni.eof = 1; + mutex_unlock(&ni_lock); + mutex_unlock(&nc_file_lock); return (NULL); } } while (*stringp == '#'); + mutex_unlock(&nc_file_lock); list = (struct netconfig_list *) malloc(sizeof (struct netconfig_list)); if (list == NULL) { @@ -325,6 +356,7 @@ void *handlep; * Reposition the current pointer of the handle to the last entry * in the list. */ + mutex_lock(&ni_lock); if (ni.head == NULL) { /* first entry */ ni.head = ni.tail = list; } @@ -333,7 +365,9 @@ void *handlep; ni.tail = ni.tail->next; } ncp->nc_configs = ni.tail; - return(ni.tail->ncp); + result = ni.tail->ncp; + mutex_unlock(&ni_lock); + return(result); } } @@ -367,7 +401,9 @@ void *handlep; nc_handlep->valid = NC_INVALID; nc_handlep->flag = 0; nc_handlep->nc_configs = NULL; + mutex_lock(&ni_lock); if (--ni.ref > 0) { + mutex_unlock(&ni_lock); free(nc_handlep); return(0); } @@ -380,6 +416,8 @@ void *handlep; ni.eof = ni.ref = 0; ni.head = NULL; ni.tail = NULL; + mutex_unlock(&ni_lock); + while (q) { p = q->next; if (q->ncp->nc_lookups != NULL) free(q->ncp->nc_lookups); @@ -390,8 +428,11 @@ void *handlep; } free(nc_handlep); + mutex_lock(&nc_file_lock); fclose(nc_file); nc_file = NULL; + mutex_unlock(&nc_file_lock); + return (0); } @@ -427,15 +468,20 @@ getnetconfigent(netid) * If all the netconfig db has been read and placed into the list and * there is no match for the netid, return NULL. */ + mutex_lock(&ni_lock); if (ni.head != NULL) { for (list = ni.head; list; list = list->next) { if (strcmp(list->ncp->nc_netid, netid) == 0) { + mutex_unlock(&ni_lock); return(dup_ncp(list->ncp)); } } - if (ni.eof == 1) /* that's all the entries */ + if (ni.eof == 1) { /* that's all the entries */ + mutex_unlock(&ni_lock); return(NULL); + } } + mutex_unlock(&ni_lock); if ((file = fopen(NETCONFIG, "r")) == NULL) { From owner-svn-src-head@FreeBSD.ORG Wed Jun 24 23:44:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08E94106566C; Wed, 24 Jun 2009 23:44:11 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: from mail-ew0-f213.google.com (mail-ew0-f213.google.com [209.85.219.213]) by mx1.freebsd.org (Postfix) with ESMTP id CAAA58FC13; Wed, 24 Jun 2009 23:44:09 +0000 (UTC) (envelope-from minimarmot@gmail.com) Received: by ewy9 with SMTP id 9so410034ewy.43 for ; Wed, 24 Jun 2009 16:44:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=RirIuDYt2KsJ8t/t2oHxLtoB4yZ7YnFkI7p1lNqNAkY=; b=s7frlg4W4dUP18j7u6MuPCpHHAoRDtibqYunTxBKpPSQPiC3pvcGYbAL+jKbQF5ozJ eFA476gGwL+KRQXdaZzBbYBPbUdcHPcRJ5S4jHAmnfo7drtJzCfJXmWRsxvdwQ5m87zj AEn47hf68uZwDLtzj/Csb+IyxoOuPKPIwtXcY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=ebWk6y2nxVwZ/nsxYE1uYK9S5EAUorfJzcHpS6+glCfW/2u6OPtDSWI5dkOVaPwQsC x6l5iXnYYH+isbTlYChTBiWqgKXRbRRKVKWflTrtQ0opQ2QbBhtgbR0pUnmix8tGZsWh nKzcEKdQxF2NzwuyyCIon5qdS4os8BsWLczt8= MIME-Version: 1.0 Received: by 10.210.79.3 with SMTP id c3mr2121307ebb.7.1245887044149; Wed, 24 Jun 2009 16:44:04 -0700 (PDT) In-Reply-To: <200906242257.n5OMv71d032996@svn.freebsd.org> References: <200906242257.n5OMv71d032996@svn.freebsd.org> Date: Wed, 24 Jun 2009 19:44:04 -0400 Message-ID: <47d0403c0906241644v70f35ba5r7c6440a45c95c369@mail.gmail.com> From: Ben Kaduk To: Oleg Bulyzhin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, freebsd-doc@freebsd.org Subject: Re: svn commit: r194930 - in head: sbin/ipfw sys/netinet sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Jun 2009 23:44:11 -0000 On Wed, Jun 24, 2009 at 6:57 PM, Oleg Bulyzhin wrote: > Author: oleg > Date: Wed Jun 24 22:57:07 2009 > New Revision: 194930 > URL: http://svn.freebsd.org/changeset/base/194930 > > Log: > =A0- fix dummynet 'fast' mode for WF2Q case. > =A0- fix printing of pipe profile data. > =A0- introduce new pipe parameter: 'burst' - how much data can be sent th= rough > =A0 =A0pipe bypassing bandwidth limit. > > Modified: > =A0head/sbin/ipfw/Makefile > =A0head/sbin/ipfw/dummynet.c > =A0head/sbin/ipfw/ipfw.8 > =A0head/sbin/ipfw/ipfw2.h > =A0head/sys/netinet/ip_dummynet.h > =A0head/sys/netinet/ipfw/ip_dummynet.c > [snip] > > Modified: head/sbin/ipfw/ipfw.8 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=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/sbin/ipfw/ipfw.8 =A0 =A0 =A0 Wed Jun 24 22:42:52 2009 =A0 =A0 = =A0 =A0(r194929) > +++ head/sbin/ipfw/ipfw.8 =A0 =A0 =A0 Wed Jun 24 22:57:07 2009 =A0 =A0 = =A0 =A0(r194930) > @@ -1,7 +1,7 @@ > =A0.\" > =A0.\" $FreeBSD$ > =A0.\" > -.Dd April 9, 2009 > +.Dd June 24, 2009 > =A0.Dt IPFW 8 > =A0.Os > =A0.Sh NAME > @@ -1943,6 +1943,20 @@ to reduce > =A0the granularity to 1ms or less). > =A0Default value is 0, meaning no delay. > =A0.Pp > +.It Cm burst Ar size > +If the data rate exceeds the pipe bandwith limit > +(and pipe was idle long enough), > +.Ar size > +bytes of data is allowed to bypass the > +.Nm dummynet > +scheduler (i.e. it will be sent without shaping), then transmission rate > +will not exceed pipe bandwidth. Effective burst size calculated as follo= ws: There's a grammar error and a style error, here. I'm actually not entirely sure what the intended meaning is, so it's a bit hard to fix the grammar error. Looking at the code, it seems that in burst mode, extra data will be allowed to be sent, though it is capped to not exceed the pipe bandwidth. Perhaps "... bytes of data is allowed to bypass the dummynet scheduler (...), though the transmission rate will still be capped so as to not exceed the pipe's bandwidth."? The style error is that the new sentence ("Effective burst size ...") should start on a new line. I would also prefer to see the new sentence be an actual complete sentence (i.e., "The effective burst size is calculated as follows"), though there appears to be at least one other bug of this form in the file already (see, for example, the quoted text at the beginning of this hunk: "Default value is no delay.", wh= ich would benefit from a "the".) Unrelated to this commit, there is a grammar error early in the file: 312 Once 313 .Fl p 314 has been specified, any additional arguments as passed on to the pr= eproc essor 315 for interpretation. The 'as' in line 314 should be 'are'. (This is from CVS r1.220, so the line numbers may not be current.) Thanks, Ben Kaduk > +MAX( > +.Ar size > +, > +.Nm bw > +* pipe_idle_time). > +.Pp > =A0.It Cm profile Ar filename > =A0A file specifying the additional overhead incurred in the transmission > =A0of a packet on the link. > From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 00:14:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D888B106564A; Thu, 25 Jun 2009 00:14:27 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C665A8FC0C; Thu, 25 Jun 2009 00:14:27 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5P0ERCj034795; Thu, 25 Jun 2009 00:14:27 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5P0ERE7034793; Thu, 25 Jun 2009 00:14:27 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200906250014.n5P0ERE7034793@svn.freebsd.org> From: Jeff Roberson Date: Thu, 25 Jun 2009 00:14:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194933 - head/sys/powerpc/powerpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 00:14:28 -0000 Author: jeff Date: Thu Jun 25 00:14:27 2009 New Revision: 194933 URL: http://svn.freebsd.org/changeset/base/194933 Log: - Add the right includes to use kmem_alloc(). This was broken by my DPCPU commit. Reported by: bz Modified: head/sys/powerpc/powerpc/mp_machdep.c Modified: head/sys/powerpc/powerpc/mp_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/mp_machdep.c Wed Jun 24 23:17:16 2009 (r194932) +++ head/sys/powerpc/powerpc/mp_machdep.c Thu Jun 25 00:14:27 2009 (r194933) @@ -37,6 +37,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include +#include +#include + #include #include #include From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 00:28:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADE9D106566C; Thu, 25 Jun 2009 00:28:44 +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 9AD518FC0A; Thu, 25 Jun 2009 00:28:44 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5P0Sh8J035079; Thu, 25 Jun 2009 00:28:43 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5P0Shvh035077; Thu, 25 Jun 2009 00:28:43 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200906250028.n5P0Shvh035077@svn.freebsd.org> From: Rick Macklem Date: Thu, 25 Jun 2009 00:28: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: r194934 - head/sys/rpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 00:28:45 -0000 Author: rmacklem Date: Thu Jun 25 00:28:43 2009 New Revision: 194934 URL: http://svn.freebsd.org/changeset/base/194934 Log: Fix two known problems in clnt_rc.c, plus issues w.r.t. smp noted during reading of the code. Change the code so that it never accesses rc_connecting, rc_closed or rc_client when the rc_lock mutex is not held. Also, it now performs the CLNT_CLOSE(client) and CLNT_RELEASE(client) calls after the rc_lock mutex has been released, since those calls do msleep()s with another mutex held. Change clnt_reconnect_call() so that releasing the reference count is delayed until after the "if (rc->rc_client == client)" check, so that rc_client cannot have been recycled. Tested by: pho Reviewed by: dfr Approved by: kib (mentor) Modified: head/sys/rpc/clnt_rc.c Modified: head/sys/rpc/clnt_rc.c ============================================================================== --- head/sys/rpc/clnt_rc.c Thu Jun 25 00:14:27 2009 (r194933) +++ head/sys/rpc/clnt_rc.c Thu Jun 25 00:28:43 2009 (r194934) @@ -146,33 +146,33 @@ clnt_reconnect_connect(CLIENT *cl) int error; int one = 1; struct ucred *oldcred; + CLIENT *newclient = NULL; mtx_lock(&rc->rc_lock); -again: + while (rc->rc_connecting) { + error = msleep(rc, &rc->rc_lock, + rc->rc_intr ? PCATCH : 0, "rpcrecon", 0); + if (error) { + mtx_unlock(&rc->rc_lock); + return (RPC_INTR); + } + } if (rc->rc_closed) { mtx_unlock(&rc->rc_lock); return (RPC_CANTSEND); } - if (rc->rc_connecting) { - while (!rc->rc_closed && !rc->rc_client && rc->rc_connecting) { - error = msleep(rc, &rc->rc_lock, - rc->rc_intr ? PCATCH : 0, "rpcrecon", 0); - if (error) { - mtx_unlock(&rc->rc_lock); - return (RPC_INTR); - } - } - /* - * If the other guy failed to connect, we might as - * well have another go. - */ - if (!rc->rc_client || rc->rc_closed) - goto again; + if (rc->rc_client) { mtx_unlock(&rc->rc_lock); return (RPC_SUCCESS); - } else { - rc->rc_connecting = TRUE; } + + /* + * My turn to attempt a connect. The rc_connecting variable + * serializes the following code sequence, so it is guaranteed + * that rc_client will still be NULL after it is re-locked below, + * since that is the only place it is set non-NULL. + */ + rc->rc_connecting = TRUE; mtx_unlock(&rc->rc_lock); so = __rpc_nconf2socket(rc->rc_nconf); @@ -188,43 +188,52 @@ again: bindresvport(so, NULL); if (rc->rc_nconf->nc_semantics == NC_TPI_CLTS) - rc->rc_client = clnt_dg_create(so, + newclient = clnt_dg_create(so, (struct sockaddr *) &rc->rc_addr, rc->rc_prog, rc->rc_vers, rc->rc_sendsz, rc->rc_recvsz); else - rc->rc_client = clnt_vc_create(so, + newclient = clnt_vc_create(so, (struct sockaddr *) &rc->rc_addr, rc->rc_prog, rc->rc_vers, rc->rc_sendsz, rc->rc_recvsz); td->td_ucred = oldcred; - if (!rc->rc_client) { + if (!newclient) { soclose(so); rc->rc_err = rpc_createerr.cf_error; stat = rpc_createerr.cf_stat; goto out; } - CLNT_CONTROL(rc->rc_client, CLSET_FD_CLOSE, 0); - CLNT_CONTROL(rc->rc_client, CLSET_CONNECT, &one); - CLNT_CONTROL(rc->rc_client, CLSET_TIMEOUT, &rc->rc_timeout); - CLNT_CONTROL(rc->rc_client, CLSET_RETRY_TIMEOUT, &rc->rc_retry); - CLNT_CONTROL(rc->rc_client, CLSET_WAITCHAN, rc->rc_waitchan); - CLNT_CONTROL(rc->rc_client, CLSET_INTERRUPTIBLE, &rc->rc_intr); + CLNT_CONTROL(newclient, CLSET_FD_CLOSE, 0); + CLNT_CONTROL(newclient, CLSET_CONNECT, &one); + CLNT_CONTROL(newclient, CLSET_TIMEOUT, &rc->rc_timeout); + CLNT_CONTROL(newclient, CLSET_RETRY_TIMEOUT, &rc->rc_retry); + CLNT_CONTROL(newclient, CLSET_WAITCHAN, rc->rc_waitchan); + CLNT_CONTROL(newclient, CLSET_INTERRUPTIBLE, &rc->rc_intr); stat = RPC_SUCCESS; out: mtx_lock(&rc->rc_lock); - if (rc->rc_closed) { - if (rc->rc_client) { - CLNT_CLOSE(rc->rc_client); - CLNT_RELEASE(rc->rc_client); - rc->rc_client = NULL; - } + KASSERT(rc->rc_client == NULL, ("rc_client not null")); + if (!rc->rc_closed) { + rc->rc_client = newclient; + newclient = NULL; } rc->rc_connecting = FALSE; wakeup(rc); mtx_unlock(&rc->rc_lock); + if (newclient) { + /* + * It has been closed, so discard the new client. + * nb: clnt_[dg|vc]_close()/clnt_[dg|vc]_destroy() cannot + * be called with the rc_lock mutex held, since they may + * msleep() while holding a different mutex. + */ + CLNT_CLOSE(newclient); + CLNT_RELEASE(newclient); + } + return (stat); } @@ -240,19 +249,24 @@ clnt_reconnect_call( struct rc_data *rc = (struct rc_data *)cl->cl_private; CLIENT *client; enum clnt_stat stat; - int tries; + int tries, error; tries = 0; do { + mtx_lock(&rc->rc_lock); if (rc->rc_closed) { + mtx_unlock(&rc->rc_lock); return (RPC_CANTSEND); } if (!rc->rc_client) { + mtx_unlock(&rc->rc_lock); stat = clnt_reconnect_connect(cl); if (stat == RPC_SYSTEMERROR) { - (void) tsleep(&fake_wchan, 0, - "rpccon", hz); + error = tsleep(&fake_wchan, + rc->rc_intr ? PCATCH : 0, "rpccon", hz); + if (error == EINTR || error == ERESTART) + return (RPC_INTR); tries++; if (tries >= rc->rc_retries) return (stat); @@ -260,9 +274,9 @@ clnt_reconnect_call( } if (stat != RPC_SUCCESS) return (stat); + mtx_lock(&rc->rc_lock); } - mtx_lock(&rc->rc_lock); if (!rc->rc_client) { mtx_unlock(&rc->rc_lock); stat = RPC_FAILED; @@ -279,7 +293,6 @@ clnt_reconnect_call( CLNT_GETERR(client, &rc->rc_err); } - CLNT_RELEASE(client); if (stat == RPC_TIMEDOUT) { /* * Check for async send misfeature for NLM @@ -290,6 +303,7 @@ clnt_reconnect_call( || (rc->rc_timeout.tv_sec == -1 && utimeout.tv_sec == 0 && utimeout.tv_usec == 0)) { + CLNT_RELEASE(client); break; } } @@ -297,8 +311,10 @@ clnt_reconnect_call( if (stat == RPC_TIMEDOUT || stat == RPC_CANTSEND || stat == RPC_CANTRECV) { tries++; - if (tries >= rc->rc_retries) + if (tries >= rc->rc_retries) { + CLNT_RELEASE(client); break; + } if (ext && ext->rc_feedback) ext->rc_feedback(FEEDBACK_RECONNECT, proc, @@ -307,14 +323,22 @@ clnt_reconnect_call( mtx_lock(&rc->rc_lock); /* * Make sure that someone else hasn't already - * reconnected. + * reconnected by checking if rc_client has changed. + * If not, we are done with the client and must + * do CLNT_RELEASE(client) twice to dispose of it, + * because there is both an initial refcnt and one + * acquired by CLNT_ACQUIRE() above. */ if (rc->rc_client == client) { - CLNT_RELEASE(rc->rc_client); rc->rc_client = NULL; + mtx_unlock(&rc->rc_lock); + CLNT_RELEASE(client); + } else { + mtx_unlock(&rc->rc_lock); } - mtx_unlock(&rc->rc_lock); + CLNT_RELEASE(client); } else { + CLNT_RELEASE(client); break; } } while (stat != RPC_SUCCESS); @@ -333,6 +357,10 @@ clnt_reconnect_geterr(CLIENT *cl, struct *errp = rc->rc_err; } +/* + * Since this function requires that rc_client be valid, it can + * only be called when that is guaranteed to be the case. + */ static bool_t clnt_reconnect_freeres(CLIENT *cl, xdrproc_t xdr_res, void *res_ptr) { @@ -347,6 +375,10 @@ clnt_reconnect_abort(CLIENT *h) { } +/* + * CLNT_CONTROL() on the client returned by clnt_reconnect_create() must + * always be called before CLNT_CALL_MBUF() by a single thread only. + */ static bool_t clnt_reconnect_control(CLIENT *cl, u_int request, void *info) { From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 01:32:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E3CE106566C; Thu, 25 Jun 2009 01:32:00 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5F7A8FC19; Thu, 25 Jun 2009 01:31:59 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5P1Vxd2036300; Thu, 25 Jun 2009 01:31:59 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5P1VxnP036297; Thu, 25 Jun 2009 01:31:59 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200906250131.n5P1VxnP036297@svn.freebsd.org> From: Jeff Roberson Date: Thu, 25 Jun 2009 01:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194935 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 01:32:00 -0000 Author: jeff Date: Thu Jun 25 01:31:59 2009 New Revision: 194935 URL: http://svn.freebsd.org/changeset/base/194935 Log: - Add a sysctl_dpcpu_long to support long typed pcpu stats. - Remove the #ifndef SMP case as the SMP code works on UP as well. Reviewed by: sam Modified: head/sys/kern/subr_pcpu.c head/sys/sys/sysctl.h Modified: head/sys/kern/subr_pcpu.c ============================================================================== --- head/sys/kern/subr_pcpu.c Thu Jun 25 00:28:43 2009 (r194934) +++ head/sys/kern/subr_pcpu.c Thu Jun 25 01:31:59 2009 (r194935) @@ -264,9 +264,8 @@ pcpu_find(u_int cpuid) int sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS) { - int64_t count; -#ifdef SMP uintptr_t dpcpu; + int64_t count; int i; count = 0; @@ -276,18 +275,31 @@ sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS) continue; count += *(int64_t *)(dpcpu + (uintptr_t)arg1); } -#else - count = *(int64_t *)(dpcpu_off[0] + (uintptr_t)arg1); -#endif + return (SYSCTL_OUT(req, &count, sizeof(count))); +} + +int +sysctl_dpcpu_long(SYSCTL_HANDLER_ARGS) +{ + uintptr_t dpcpu; + long count; + int i; + + count = 0; + for (i = 0; i < mp_ncpus; ++i) { + dpcpu = dpcpu_off[i]; + if (dpcpu == 0) + continue; + count += *(long *)(dpcpu + (uintptr_t)arg1); + } return (SYSCTL_OUT(req, &count, sizeof(count))); } int sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS) { - int count; -#ifdef SMP uintptr_t dpcpu; + int count; int i; count = 0; @@ -297,9 +309,6 @@ sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS) continue; count += *(int *)(dpcpu + (uintptr_t)arg1); } -#else - count = *(int *)(dpcpu_off[0] + (uintptr_t)arg1); -#endif return (SYSCTL_OUT(req, &count, sizeof(count))); } Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Thu Jun 25 00:28:43 2009 (r194934) +++ head/sys/sys/sysctl.h Thu Jun 25 01:31:59 2009 (r194935) @@ -179,6 +179,7 @@ int sysctl_handle_string(SYSCTL_HANDLER_ int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS); int sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS); +int sysctl_dpcpu_long(SYSCTL_HANDLER_ARGS); int sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS); #ifdef VIMAGE From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 01:33:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67928106564A; Thu, 25 Jun 2009 01:33:51 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 54F498FC0A; Thu, 25 Jun 2009 01:33:51 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5P1XpJc036380; Thu, 25 Jun 2009 01:33:51 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5P1Xp3S036377; Thu, 25 Jun 2009 01:33:51 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <200906250133.n5P1Xp3S036377@svn.freebsd.org> From: Jeff Roberson Date: Thu, 25 Jun 2009 01:33: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: r194936 - in head/sys: kern sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 01:33:51 -0000 Author: jeff Date: Thu Jun 25 01:33:51 2009 New Revision: 194936 URL: http://svn.freebsd.org/changeset/base/194936 Log: - Use DPCPU for SCHED_STATS. This is somewhat awkward because the offset of the stat is not known until link time so we must emit a function to call SYSCTL_ADD_PROC rather than using SYSCTL_PROC directly. - Eliminate the atomic from SCHED_STAT_INC now that it's using per-cpu variables. Sched stats are always incremented while we're holding a spinlock so no further protection is required. Reviewed by: sam Modified: head/sys/kern/kern_switch.c head/sys/sys/sched.h Modified: head/sys/kern/kern_switch.c ============================================================================== --- head/sys/kern/kern_switch.c Thu Jun 25 01:31:59 2009 (r194935) +++ head/sys/kern/kern_switch.c Thu Jun 25 01:33:51 2009 (r194936) @@ -79,31 +79,45 @@ SYSCTL_INT(_kern_sched, OID_AUTO, preemp * with SCHED_STAT_DEFINE(). */ #ifdef SCHED_STATS -long sched_switch_stats[SWT_COUNT]; /* Switch reasons from mi_switch(). */ - SYSCTL_NODE(_kern_sched, OID_AUTO, stats, CTLFLAG_RW, 0, "switch stats"); -SCHED_STAT_DEFINE_VAR(uncategorized, &sched_switch_stats[SWT_NONE], ""); -SCHED_STAT_DEFINE_VAR(preempt, &sched_switch_stats[SWT_PREEMPT], ""); -SCHED_STAT_DEFINE_VAR(owepreempt, &sched_switch_stats[SWT_OWEPREEMPT], ""); -SCHED_STAT_DEFINE_VAR(turnstile, &sched_switch_stats[SWT_TURNSTILE], ""); -SCHED_STAT_DEFINE_VAR(sleepq, &sched_switch_stats[SWT_SLEEPQ], ""); -SCHED_STAT_DEFINE_VAR(sleepqtimo, &sched_switch_stats[SWT_SLEEPQTIMO], ""); -SCHED_STAT_DEFINE_VAR(relinquish, &sched_switch_stats[SWT_RELINQUISH], ""); -SCHED_STAT_DEFINE_VAR(needresched, &sched_switch_stats[SWT_NEEDRESCHED], ""); -SCHED_STAT_DEFINE_VAR(idle, &sched_switch_stats[SWT_IDLE], ""); -SCHED_STAT_DEFINE_VAR(iwait, &sched_switch_stats[SWT_IWAIT], ""); -SCHED_STAT_DEFINE_VAR(suspend, &sched_switch_stats[SWT_SUSPEND], ""); -SCHED_STAT_DEFINE_VAR(remotepreempt, &sched_switch_stats[SWT_REMOTEPREEMPT], - ""); -SCHED_STAT_DEFINE_VAR(remotewakeidle, &sched_switch_stats[SWT_REMOTEWAKEIDLE], - ""); + +/* Switch reasons from mi_switch(). */ +DPCPU_DEFINE(long, sched_switch_stats[SWT_COUNT]); +SCHED_STAT_DEFINE_VAR(uncategorized, + &DPCPU_NAME(sched_switch_stats[SWT_NONE]), ""); +SCHED_STAT_DEFINE_VAR(preempt, + &DPCPU_NAME(sched_switch_stats[SWT_PREEMPT]), ""); +SCHED_STAT_DEFINE_VAR(owepreempt, + &DPCPU_NAME(sched_switch_stats[SWT_OWEPREEMPT]), ""); +SCHED_STAT_DEFINE_VAR(turnstile, + &DPCPU_NAME(sched_switch_stats[SWT_TURNSTILE]), ""); +SCHED_STAT_DEFINE_VAR(sleepq, + &DPCPU_NAME(sched_switch_stats[SWT_SLEEPQ]), ""); +SCHED_STAT_DEFINE_VAR(sleepqtimo, + &DPCPU_NAME(sched_switch_stats[SWT_SLEEPQTIMO]), ""); +SCHED_STAT_DEFINE_VAR(relinquish, + &DPCPU_NAME(sched_switch_stats[SWT_RELINQUISH]), ""); +SCHED_STAT_DEFINE_VAR(needresched, + &DPCPU_NAME(sched_switch_stats[SWT_NEEDRESCHED]), ""); +SCHED_STAT_DEFINE_VAR(idle, + &DPCPU_NAME(sched_switch_stats[SWT_IDLE]), ""); +SCHED_STAT_DEFINE_VAR(iwait, + &DPCPU_NAME(sched_switch_stats[SWT_IWAIT]), ""); +SCHED_STAT_DEFINE_VAR(suspend, + &DPCPU_NAME(sched_switch_stats[SWT_SUSPEND]), ""); +SCHED_STAT_DEFINE_VAR(remotepreempt, + &DPCPU_NAME(sched_switch_stats[SWT_REMOTEPREEMPT]), ""); +SCHED_STAT_DEFINE_VAR(remotewakeidle, + &DPCPU_NAME(sched_switch_stats[SWT_REMOTEWAKEIDLE]), ""); static int sysctl_stats_reset(SYSCTL_HANDLER_ARGS) { struct sysctl_oid *p; + uintptr_t counter; int error; int val; + int i; val = 0; error = sysctl_handle_int(oidp, &val, 0, req); @@ -118,7 +132,12 @@ sysctl_stats_reset(SYSCTL_HANDLER_ARGS) SLIST_FOREACH(p, oidp->oid_parent, oid_link) { if (p == oidp || p->oid_arg1 == NULL) continue; - *(long *)p->oid_arg1 = 0; + counter = (uintptr_t)p->oid_arg1; + for (i = 0; i <= mp_maxid; i++) { + if (CPU_ABSENT(i)) + continue; + *(long *)(dpcpu_off[i] + counter) = 0; + } } return (0); } Modified: head/sys/sys/sched.h ============================================================================== --- head/sys/sys/sched.h Thu Jun 25 01:31:59 2009 (r194935) +++ head/sys/sys/sched.h Thu Jun 25 01:33:51 2009 (r194936) @@ -162,14 +162,27 @@ sched_unpin(void) /* Scheduler stats. */ #ifdef SCHED_STATS -extern long sched_switch_stats[SWT_COUNT]; +DPCPU_DECLARE(long, sched_switch_stats[SWT_COUNT]); #define SCHED_STAT_DEFINE_VAR(name, ptr, descr) \ - SYSCTL_LONG(_kern_sched_stats, OID_AUTO, name, CTLFLAG_RD, ptr, 0, descr) +static void name ## _add_proc(void *dummy __unused) \ +{ \ + \ + SYSCTL_ADD_PROC(NULL, \ + SYSCTL_STATIC_CHILDREN(_kern_sched_stats), OID_AUTO, \ + #name, CTLTYPE_LONG|CTLFLAG_RD|CTLFLAG_MPSAFE, \ + ptr, 0, sysctl_dpcpu_long, "LU", descr); \ +} \ +SYSINIT(name, SI_SUB_RUN_SCHEDULER, SI_ORDER_ANY, name ## _add_proc, NULL); + #define SCHED_STAT_DEFINE(name, descr) \ - unsigned long name; \ - SCHED_STAT_DEFINE_VAR(name, &name, descr) -#define SCHED_STAT_INC(var) atomic_add_long(&(var), 1) + DPCPU_DEFINE(unsigned long, name); \ + SCHED_STAT_DEFINE_VAR(name, &DPCPU_NAME(name), descr) +/* + * Sched stats are always incremented in critical sections so no atomic + * is necesssary to increment them. + */ +#define SCHED_STAT_INC(var) DPCPU_GET(var)++; #else #define SCHED_STAT_DEFINE_VAR(name, descr, ptr) #define SCHED_STAT_DEFINE(name, descr) From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 01:43:16 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F232106564A; Thu, 25 Jun 2009 01:43:16 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by mx1.freebsd.org (Postfix) with ESMTP id 626D28FC0A; Thu, 25 Jun 2009 01:43:16 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from [172.31.193.10] (cpe-075-177-134-250.nc.res.rr.com [75.177.134.250]) (authenticated bits=0) by duke.cs.duke.edu (8.14.2/8.14.2) with ESMTP id n5P1hDdK018302 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 24 Jun 2009 21:43:15 -0400 (EDT) Message-ID: <4A42D629.8060806@cs.duke.edu> Date: Wed, 24 Jun 2009 21:43:05 -0400 From: Andrew Gallatin User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Sam Leffler References: <200906242109.n5OL9uVb029380@svn.freebsd.org> <4A42983C.6050307@freebsd.org> In-Reply-To: <4A42983C.6050307@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r194909 - head/sys/dev/mxge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 01:43:17 -0000 Sam Leffler wrote: > There's something else wrong. This is just covering up the real bug. I'm pretty sure the "real bug" is in bpf, but I'm not sure its a bug, and I suspect there are probably other, similar, bugs lurking when you try to tear down a busy interface. What I was doing was: - point a packet generator offering 1.5Mpps at the NIC - in a tight shell loop, do while (1) tcpdump -ni mxge0 host 172.31.0.1 end - in another shell loop: while (1) ifconfig mxge0 192.168.1.22 up sleep 1 kldunload if_mxge end Before the commit, with the old order: lock() close() unlock() ether_ifdetach() I'd see either an exhaustion of mbufs because tcpdump snuck in after I'd closed the device and re-opened it on me (so I never closed it again, resulting in leaked mbufs), or a panic. I then moved the ether_ifdetach() to the new position: ether_ifdetach() lock() close() unlock() This worked great until I started the packet generator, then it crashed. The stack I saw (which I don't have saved, so this is from memory) when I had ether_ifdetach() first was: panic: mtx_lock() (don't remember exact text) bpf_mtap() ether_input() mxge_rx_done_small() mxge_clean_rx_done() mxge_intr() <...> When I looked at the ifp in kgdb, I noticed that all the operations (if_input(), if_output(), etc) pointed to ifdead_* The machine I'm using for this is a MacPro, and I can't get ddb to work on the USB based console, so I'm working purely from dumps. I don't know how to get a stack of another process in kgdb on amd64, so that's all the information I have. My assumption is that my interrupt thread was running when ether_ifdetach() called bpfdetach(), and was starting bpf_mtap() while bpfdetach() was destroying the bpf_if. There doesn't seem to be anything to prevent bpfdetach() from racing with bpf_mtap(). By calling my close() routine (with a dying flag so nothing can sneak in before detach), I'm assured that my NIC is quiescent, and cannot be calling into the stack while the interface is being torn down. I'd prefer to leave my commit as-is because: 1) it works, and fixes a bug 2) it can be MFC'ed as is 3) it just feels wrong to be blasting packets up into the stack while detaching. With this NIC, the best way to make it quiescent is to call close(). There's an interrupt handshake done with the NIC to ensure its is quiescent, so doing something like disabling its interrupt could leave the things in a weird state. Drew From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 01:49:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 495D91065670; Thu, 25 Jun 2009 01:49:16 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.237]) by mx1.freebsd.org (Postfix) with ESMTP id 01A5B8FC21; Thu, 25 Jun 2009 01:49:15 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: by rv-out-0506.google.com with SMTP id f9so224965rvb.43 for ; Wed, 24 Jun 2009 18:49:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:from:date:to:cc :subject:message-id:reply-to:references:mime-version:content-type :content-disposition:in-reply-to:user-agent; bh=z12R/VNjVAlrNiY8fSiR4VQO3MmLssycvhxoMhR6c50=; b=jLMn4o8GRYCdgGNpG29OfccCUXzmP97KG/8bNwayG7ZBvgDmGEVr1561xh9WkfzoqQ p1nqpjcWJImGlFLGNIHHu/GG9uxJ6XphxrP9nl54ZnwrLrnkqYuuQH4LMD7On+aH67/u paWb6yiyek2D7iWmwplqaCp/99VtPyuQcGduk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=SCdkXQNoGlJbl881km0Ox+1tHAqci1fRnxETai/ZbMIo5jvV1nFHKqZEj/qc5vLSTE Jpec02en0wC8Uf1bGXVlnXJ0btyVAvNYBwtRwVqIny8DVKlxB4hNBhhC5Sy7WfTT1Lkz yWFAGLtroZ02/K4n/UGWuBqBpbY42RAuIGeU8= Received: by 10.140.157.5 with SMTP id f5mr1775620rve.165.1245894555734; Wed, 24 Jun 2009 18:49:15 -0700 (PDT) Received: from michelle.cdnetworks.co.kr ([114.111.62.249]) by mx.google.com with ESMTPS id g22sm3726953rvb.45.2009.06.24.18.49.13 (version=SSLv3 cipher=RC4-MD5); Wed, 24 Jun 2009 18:49:15 -0700 (PDT) Received: by michelle.cdnetworks.co.kr (sSMTP sendmail emulation); Thu, 25 Jun 2009 10:54:44 +0900 From: Pyun YongHyeon Date: Thu, 25 Jun 2009 10:54:43 +0900 To: Marius Strobl Message-ID: <20090625015443.GH10712@michelle.cdnetworks.co.kr> References: <200906242056.n5OKu7Ql028836@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200906242056.n5OKu7Ql028836@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: r194904 - head/sys/dev/cas X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 01:49:16 -0000 On Wed, Jun 24, 2009 at 08:56:07PM +0000, Marius Strobl wrote: > Author: marius > Date: Wed Jun 24 20:56:06 2009 > New Revision: 194904 > URL: http://svn.freebsd.org/changeset/base/194904 > > Log: > - Change this driver to do taskqueue(9) based TX and interrupt > handling in order to reduce interrupt overhead which results in > better performance. > - Call ether_ifdetach(9) before stopping the controller and the > callouts detach in order to prevent active BPF listeners to clear > promiscuous mode which may lead to the tick callout being restarted > which will trigger a panic once it's actually gone. > - Add explicit IFF_DRV_RUNNING checking in order to prevent extra > link up/down events when using dhclient(8). > - Use the correct macro for deciding whether 2/3 of the available TX > descriptors are used. > - Wrap the RX fault printing in #ifdef CAS_DEBUG in order to not > unnecessarily frighten users and as debugging was the actual > intention. Real errors caused by these faults still will be > accumulated as input errors. It might be a good idea to later on > add driver specific counters for the faults though. > > Submitted by: yongari (original patch) > Thanks a lot! From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 02:14:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E05641065674; Thu, 25 Jun 2009 02:14:47 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CE5148FC20; Thu, 25 Jun 2009 02:14:47 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5P2ElZ0037228; Thu, 25 Jun 2009 02:14:47 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5P2ElhE037226; Thu, 25 Jun 2009 02:14:47 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <200906250214.n5P2ElhE037226@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 25 Jun 2009 02:14: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: r194937 - head/sys/dev/usb/wlan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 02:14:48 -0000 Author: weongyo Date: Thu Jun 25 02:14:47 2009 New Revision: 194937 URL: http://svn.freebsd.org/changeset/base/194937 Log: uses ZYD_NOTIF_RETRYSTATUS info to count the number of retries. 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 Thu Jun 25 01:33:51 2009 (r194936) +++ head/sys/dev/usb/wlan/if_zyd.c Thu Jun 25 02:14:47 2009 (r194937) @@ -667,7 +667,8 @@ zyd_intr_read_callback(struct usb_xfer * ni = ieee80211_find_txnode(vap, retry->macaddr); if (ni != NULL) { ieee80211_amrr_tx_complete(&ZYD_NODE(ni)->amn, - IEEE80211_AMRR_FAILURE, 1); + IEEE80211_AMRR_FAILURE, + (int)(le16toh(retry->count) & 0xff)); ieee80211_free_node(ni); } if (le16toh(retry->count) & 0x100) From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 02:28:12 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 923A8106564A; Thu, 25 Jun 2009 02:28:12 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7FEB18FC14; Thu, 25 Jun 2009 02:28:12 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5P2SCIK037547; Thu, 25 Jun 2009 02:28:12 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5P2SCN5037545; Thu, 25 Jun 2009 02:28:12 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <200906250228.n5P2SCN5037545@svn.freebsd.org> From: Weongyo Jeong Date: Thu, 25 Jun 2009 02:28:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194939 - head/sys/dev/usb/wlan X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 02:28:13 -0000 Author: weongyo Date: Thu Jun 25 02:28:12 2009 New Revision: 194939 URL: http://svn.freebsd.org/changeset/base/194939 Log: updates AMRR statistics with tx complete status that if not the tx rate always would be reduced. 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 Thu Jun 25 02:15:04 2009 (r194938) +++ head/sys/dev/usb/wlan/if_zyd.c Thu Jun 25 02:28:12 2009 (r194939) @@ -517,6 +517,9 @@ zyd_tx_free(struct zyd_tx_data *data, in m_freem(data->m); data->m = NULL; + if (txerr == 0) + ieee80211_amrr_tx_complete(&ZYD_NODE(data->ni)->amn, + IEEE80211_AMRR_SUCCESS, 0); ieee80211_free_node(data->ni); data->ni = NULL; } From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 02:45:34 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11D4D106564A; Thu, 25 Jun 2009 02:45:34 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr [150.140.141.169]) by mx1.freebsd.org (Postfix) with ESMTP id AD9F68FC0A; Thu, 25 Jun 2009 02:45:33 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from mail.ceid.upatras.gr (unknown [10.1.0.143]) by poseidon.ceid.upatras.gr (Postfix) with ESMTP id 2C7FFEB62A2; Thu, 25 Jun 2009 05:26:22 +0300 (EEST) Received: from localhost (europa.ceid.upatras.gr [127.0.0.1]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 20B36450C6; Thu, 25 Jun 2009 05:26:22 +0300 (EEST) X-Virus-Scanned: amavisd-new at ceid.upatras.gr Received: from mail.ceid.upatras.gr ([127.0.0.1]) by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Kf6RkqWHdcdr; Thu, 25 Jun 2009 05:26:22 +0300 (EEST) Received: from kobe.laptop (adsl105-76.kln.forthnet.gr [77.49.224.76]) by mail.ceid.upatras.gr (Postfix) with ESMTP id E064845088; Thu, 25 Jun 2009 05:26:21 +0300 (EEST) Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id n5P2QLo6066060; Thu, 25 Jun 2009 05:26:21 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id n5P2QLp1066056; Thu, 25 Jun 2009 05:26:21 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: John Baldwin References: <200906242110.n5OLAq6c029444@svn.freebsd.org> Date: Thu, 25 Jun 2009 05:26:20 +0300 Message-ID: <87eit9hwvn.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r194910 - in head: lib/libc/gen lib/libc/include lib/libc/sys sys/compat/freebsd32 sys/compat/linux sys/compat/svr4 sys/i386/ibcs2 sys/kern sys/sys usr.bin/ipcs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 02:45:34 -0000 On Wed, 24 Jun 2009 21:10:52 +0000 (UTC), John Baldwin wrote: > Author: jhb > Date: Wed Jun 24 21:10:52 2009 > New Revision: 194910 > URL: http://svn.freebsd.org/changeset/base/194910 > > Log: > Change the ABI of some of the structures used by the SYSV IPC API: > - The existing __semctl(), msgctl(), and shmctl() system call entries are > now marked COMPAT7 and new versions of those system calls which support > the new ABI are now present. Now that oshmctl is declared as static, it needs a visible prototype. Perhaps something like this? %%% diff -r d79a5c0d6b89 sys/kern/sysv_shm.c --- a/sys/kern/sysv_shm.c Thu Jun 25 02:44:23 2009 +0300 +++ b/sys/kern/sysv_shm.c Thu Jun 25 05:23:52 2009 +0300 @@ -129,6 +129,9 @@ static void shmfork_myhook(struct proc *p1, struct proc *p2); static int sysctl_shmsegs(SYSCTL_HANDLER_ARGS); +struct oshmctl_args; +static int oshmctl(struct thread *td, struct oshmctl_args *uap); + /* * Tuneable values. */ %%% From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 02:52:28 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70EBC106564A; Thu, 25 Jun 2009 02:52:28 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr [150.140.141.169]) by mx1.freebsd.org (Postfix) with ESMTP id D73A78FC12; Thu, 25 Jun 2009 02:52:27 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from mail.ceid.upatras.gr (unknown [10.1.0.143]) by poseidon.ceid.upatras.gr (Postfix) with ESMTP id DB42FEB6C7C; Thu, 25 Jun 2009 05:52:26 +0300 (EEST) Received: from localhost (europa.ceid.upatras.gr [127.0.0.1]) by mail.ceid.upatras.gr (Postfix) with ESMTP id CDBC84509B; Thu, 25 Jun 2009 05:52:26 +0300 (EEST) X-Virus-Scanned: amavisd-new at ceid.upatras.gr Received: from mail.ceid.upatras.gr ([127.0.0.1]) by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bjXuYkpiCmwO; Thu, 25 Jun 2009 05:52:26 +0300 (EEST) Received: from kobe.laptop (adsl105-76.kln.forthnet.gr [77.49.224.76]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 92EFF45088; Thu, 25 Jun 2009 05:52:26 +0300 (EEST) Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id n5P2qPQd078347; Thu, 25 Jun 2009 05:52:26 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id n5P2qPtD078346; Thu, 25 Jun 2009 05:52:25 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: John Baldwin References: <200906242110.n5OLAq6c029444@svn.freebsd.org> <87eit9hwvn.fsf@kobe.laptop> Date: Thu, 25 Jun 2009 05:52:25 +0300 In-Reply-To: <87eit9hwvn.fsf@kobe.laptop> (Giorgos Keramidas's message of "Thu, 25 Jun 2009 05:26:20 +0300") Message-ID: <877hz1auty.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r194910 - in head: lib/libc/gen lib/libc/include lib/libc/sys sys/compat/freebsd32 sys/compat/linux sys/compat/svr4 sys/i386/ibcs2 sys/kern sys/sys usr.bin/ipcs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 02:52:28 -0000 On Thu, 25 Jun 2009 05:26:20 +0300, Giorgos Keramidas wrote: > Now that oshmctl is declared as static, it needs a visible prototype. > Perhaps something like this? I accidentally diffed only part of the kernel. Another tiny change is also needed to ibcs2, for SHRT_MAX: %%% diff -r d79a5c0d6b89 sys/i386/ibcs2/ibcs2_ipc.c --- a/sys/i386/ibcs2/ibcs2_ipc.c Thu Jun 25 02:44:23 2009 +0300 +++ b/sys/i386/ibcs2/ibcs2_ipc.c Thu Jun 25 05:50:51 2009 +0300 @@ -28,6 +28,7 @@ #include #include +#include #include #include #include diff -r d79a5c0d6b89 sys/kern/sysv_shm.c --- a/sys/kern/sysv_shm.c Thu Jun 25 02:44:23 2009 +0300 +++ b/sys/kern/sysv_shm.c Thu Jun 25 05:50:51 2009 +0300 @@ -129,6 +129,9 @@ static void shmfork_myhook(struct proc *p1, struct proc *p2); static int sysctl_shmsegs(SYSCTL_HANDLER_ARGS); +struct oshmctl_args; +static int oshmctl(struct thread *td, struct oshmctl_args *uap); + /* * Tuneable values. */ %%% From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 04:25:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 89031106567A; Thu, 25 Jun 2009 04:25:26 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5CCAE8FC12; Thu, 25 Jun 2009 04:25:26 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5P4PQmT040163; Thu, 25 Jun 2009 04:25:26 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5P4PQPb040161; Thu, 25 Jun 2009 04:25:26 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <200906250425.n5P4PQPb040161@svn.freebsd.org> From: Marcel Moolenaar Date: Thu, 25 Jun 2009 04:25: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: r194940 - head/release X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 04:25:27 -0000 Author: marcel Date: Thu Jun 25 04:25:26 2009 New Revision: 194940 URL: http://svn.freebsd.org/changeset/base/194940 Log: Make a DVD for ia64. Modified: head/release/Makefile Modified: head/release/Makefile ============================================================================== --- head/release/Makefile Thu Jun 25 02:28:12 2009 (r194939) +++ head/release/Makefile Thu Jun 25 04:25:26 2009 (r194940) @@ -218,6 +218,7 @@ MFSLABEL= auto MINIROOT= .elif ${TARGET_ARCH} == "ia64" DISKLABEL= "" +MAKE_DVD= MFSSIZE= 8192 MFSINODE= 8192 MFSLABEL= auto From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 05:39:51 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6BC231065679; Thu, 25 Jun 2009 05:39:51 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 013948FC19; Thu, 25 Jun 2009 05:39:50 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-107-126-113.carlnfd1.nsw.optusnet.com.au (c122-107-126-113.carlnfd1.nsw.optusnet.com.au [122.107.126.113]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n5P5djBZ028844 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 25 Jun 2009 15:39:47 +1000 Date: Thu, 25 Jun 2009 15:39:46 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: David Schultz In-Reply-To: <20090623234549.GA6076@zim.MIT.EDU> Message-ID: <20090625151849.W33864@delplex.bde.org> References: <200906201639.n5KGdPhO081114@svn.freebsd.org> <20090620174158.GG2884@deviant.kiev.zoral.com.ua> <20090623221248.GA5445@zim.MIT.EDU> <20090623221053.GT2884@deviant.kiev.zoral.com.ua> <20090623234549.GA6076@zim.MIT.EDU> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Kostik Belousov , svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Ed Schouten Subject: Re: svn commit: r194538 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 05:39:51 -0000 On Tue, 23 Jun 2009, David Schultz wrote: > On Wed, Jun 24, 2009, Kostik Belousov wrote: >> On Tue, Jun 23, 2009 at 06:12:48PM -0400, David Schultz wrote: >>> [... excessive quoting deleted] >>> Applications are not supposed to use such symbols, but we use them >>> pervasively in system headers specifically to avoid conflicting >>> with symbols an application might define. (Effectively, we >>> consider system headers to be part of the language implementation.) >> >> My interpretation is that we use freestanding environment for the kernel, >> and appropriate requirements shall be fullfilled by kernel code. Freestanding reserves fewer symbols for the implementation. Perhaps this mainly affects library symbols, so we can use printf(9) without having pure namespace conflicts with printf(3). > If that's the case, then how do you propose we cope with the > boilerplate preface to virtually every header file, i.e., like the > following? > > #ifndef _SYS_PRIV_H_ > #define _SYS_PRIV_H_ Use he reserved namespace where needed only. This doesn't include the names of system's own macros and variables, at least at the top level (lower level declarations need some protection, and ones used in application headers like __size_t need to be in the implementation namespace). Normal spelling for spare struct members is s_sparefoo where 's' is short for the struct name. struct siginfo in sys/signal.h uses __spare__ (without even the si prefix :-(). Even this shouldn't be an exception. Names beginning with si_ are reserved if is included, and such a name should be used for the spare field too. Bruce From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 05:45:18 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5F3291065672; Thu, 25 Jun 2009 05:45:18 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au [211.29.132.188]) by mx1.freebsd.org (Postfix) with ESMTP id D317B8FC17; Thu, 25 Jun 2009 05:45:17 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-107-126-113.carlnfd1.nsw.optusnet.com.au (c122-107-126-113.carlnfd1.nsw.optusnet.com.au [122.107.126.113]) by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n5P5j7uW005990 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 25 Jun 2009 15:45:09 +1000 Date: Thu, 25 Jun 2009 15:45:07 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Xin LI In-Reply-To: <200906232316.n5NNG1iT094289@svn.freebsd.org> Message-ID: <20090625154007.H33864@delplex.bde.org> References: <200906232316.n5NNG1iT094289@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: r194789 - head/usr.bin/usbhidctl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 05:45:18 -0000 On Tue, 23 Jun 2009, Xin LI wrote: > Log: > Use getprogname() instead of referencing __progname. Neither is permitted in FreeBSD in usage(). > Modified: > head/usr.bin/usbhidctl/usbhid.c This was obtained from NetBSD, which requires using getprogname() in usage(). Bruce From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 07:16:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 278A3106564A; Thu, 25 Jun 2009 07:16:11 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 163728FC1E; Thu, 25 Jun 2009 07:16:11 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5P7GAe1043359; Thu, 25 Jun 2009 07:16:10 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5P7GAAT043357; Thu, 25 Jun 2009 07:16:10 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906250716.n5P7GAAT043357@svn.freebsd.org> From: Robert Watson Date: Thu, 25 Jun 2009 07:16: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: r194941 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 07:16:11 -0000 Author: rwatson Date: Thu Jun 25 07:16:10 2009 New Revision: 194941 URL: http://svn.freebsd.org/changeset/base/194941 Log: oshmctl() now requires a sysv_shm.c-local function prototype. Modified: head/sys/kern/sysv_shm.c Modified: head/sys/kern/sysv_shm.c ============================================================================== --- head/sys/kern/sysv_shm.c Thu Jun 25 04:25:26 2009 (r194940) +++ head/sys/kern/sysv_shm.c Thu Jun 25 07:16:10 2009 (r194941) @@ -116,6 +116,10 @@ struct shmmap_state { int shmid; }; +#if defined(__i386__) && (defined(COMPAT_FREEBSD4) || defined(COMPAT_43)) +struct oshmctl_args; +static int oshmctl(struct thread *td, struct oshmctl_args *uap); +#endif static void shm_deallocate_segment(struct shmid_kernel *); static int shm_find_segment_by_key(key_t); static struct shmid_kernel *shm_find_segment_by_shmid(int); From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 07:18:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBE8F106564A; Thu, 25 Jun 2009 07:18:20 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id 2CFB58FC19; Thu, 25 Jun 2009 07:18:19 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from inchoate.gsoft.com.au (inchoate.gsoft.com.au [203.31.81.30]) (authenticated bits=0) by cain.gsoft.com.au (8.13.8/8.13.8) with ESMTP id n5P6pO2d026340 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 25 Jun 2009 16:21:24 +0930 (CST) (envelope-from doconnor@gsoft.com.au) From: "Daniel O'Connor" To: cvs-all@freebsd.org Date: Thu, 25 Jun 2009 16:21:20 +0930 User-Agent: KMail/1.9.10 References: <200906242221.n5OMLVxb032003@svn.freebsd.org> In-Reply-To: <200906242221.n5OMLVxb032003@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart3369454.TC6AOn5Kx7"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200906251621.22421.doconnor@gsoft.com.au> X-Spam-Score: -3.559 () ALL_TRUSTED,AWL,BAYES_00 X-Scanned-By: MIMEDefang 2.63 on 203.31.81.10 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, "Bjoern A. Zeeb" , src-committers@freebsd.org Subject: Re: svn commit: r194927 - in head: share/man/man4 sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 07:18:21 -0000 --nextPart3369454.TC6AOn5Kx7 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Thu, 25 Jun 2009, Bjoern A. Zeeb wrote: > Author: bz > Date: Wed Jun 24 22:21:30 2009 > New Revision: 194927 > URL: http://svn.freebsd.org/changeset/base/194927 > > Log: > Merge from p4: CH154790,154793,154874 > > Import if_epair(4), a virtual cross-over Ethernet-like interface > pair. Can't you already do this pretty easily with netgraph? ie connect 2 ng_eiface's together. Although that said, the ng docs leave a bit to be desired if you want to=20 actually do it ;) =2D-=20 Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C --nextPart3369454.TC6AOn5Kx7 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iD8DBQBKQx5q5ZPcIHs/zowRAn7gAKCn1qc7ModflE2LOIs+yzSVhnimBwCbBfQ0 ODefL5o5JaHi90ps1HfO3DY= =PetZ -----END PGP SIGNATURE----- --nextPart3369454.TC6AOn5Kx7-- From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 07:25:39 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFD1C1065674; Thu, 25 Jun 2009 07:25:39 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE6C88FC1D; Thu, 25 Jun 2009 07:25:39 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5P7PdhV043590; Thu, 25 Jun 2009 07:25:39 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5P7Pd3f043588; Thu, 25 Jun 2009 07:25:39 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906250725.n5P7Pd3f043588@svn.freebsd.org> From: Robert Watson Date: Thu, 25 Jun 2009 07:25: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: r194942 - head/sys/i386/ibcs2 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 07:25:40 -0000 Author: rwatson Date: Thu Jun 25 07:25:39 2009 New Revision: 194942 URL: http://svn.freebsd.org/changeset/base/194942 Log: Fix ibcs2_ipc.c build by adding missing limits.h include. Submitted by: keramida Modified: head/sys/i386/ibcs2/ibcs2_ipc.c Modified: head/sys/i386/ibcs2/ibcs2_ipc.c ============================================================================== --- head/sys/i386/ibcs2/ibcs2_ipc.c Thu Jun 25 07:16:10 2009 (r194941) +++ head/sys/i386/ibcs2/ibcs2_ipc.c Thu Jun 25 07:25:39 2009 (r194942) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 07:30:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2CC21065691; Thu, 25 Jun 2009 07:30:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.cksoft.de (mail.cksoft.de [195.88.108.3]) by mx1.freebsd.org (Postfix) with ESMTP id A683A8FC13; Thu, 25 Jun 2009 07:30:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from localhost (amavis.fra.cksoft.de [192.168.74.71]) by mail.cksoft.de (Postfix) with ESMTP id 5E6D041C89A; Thu, 25 Jun 2009 09:30:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at cksoft.de Received: from mail.cksoft.de ([195.88.108.3]) by localhost (amavis.fra.cksoft.de [192.168.74.71]) (amavisd-new, port 10024) with ESMTP id iwk433ivTejQ; Thu, 25 Jun 2009 09:30:06 +0200 (CEST) Received: by mail.cksoft.de (Postfix, from userid 66) id F1EB841C899; Thu, 25 Jun 2009 09:30:05 +0200 (CEST) Received: from maildrop.int.zabbadoz.net (maildrop.int.zabbadoz.net [10.111.66.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.int.zabbadoz.net (Postfix) with ESMTP id E14904448E6; Thu, 25 Jun 2009 07:25:49 +0000 (UTC) Date: Thu, 25 Jun 2009 07:25:49 +0000 (UTC) From: "Bjoern A. Zeeb" X-X-Sender: bz@maildrop.int.zabbadoz.net To: Daniel O'Connor In-Reply-To: <200906251621.22421.doconnor@gsoft.com.au> Message-ID: <20090625072353.H22887@maildrop.int.zabbadoz.net> References: <200906242221.n5OMLVxb032003@svn.freebsd.org> <200906251621.22421.doconnor@gsoft.com.au> X-OpenPGP-Key: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 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, cvs-all@freebsd.org Subject: Re: svn commit: r194927 - in head: share/man/man4 sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 07:30:08 -0000 On Thu, 25 Jun 2009, Daniel O'Connor wrote: > On Thu, 25 Jun 2009, Bjoern A. Zeeb wrote: >> Author: bz >> Date: Wed Jun 24 22:21:30 2009 >> New Revision: 194927 >> URL: http://svn.freebsd.org/changeset/base/194927 >> >> Log: >> Merge from p4: CH154790,154793,154874 >> >> Import if_epair(4), a virtual cross-over Ethernet-like interface >> pair. > > Can't you already do this pretty easily with netgraph? > > ie connect 2 ng_eiface's together. > > Although that said, the ng docs leave a bit to be desired if you want to > actually do it ;) Yes, but this explicitly there to avoid the mandaotry dependency of netgraph for vnets once you are out of physical interfaces. The much I like netgraph for some things the much people like to be able to avoid it, also for simplicitly, if they do neither need nor know it. /bz -- Bjoern A. Zeeb The greatest risk is not taking one. From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 08:37:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80685106564A; Thu, 25 Jun 2009 08:37:38 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E8C08FC1E; Thu, 25 Jun 2009 08:37:38 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5P8bc2v044943; Thu, 25 Jun 2009 08:37:38 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5P8bcjB044941; Thu, 25 Jun 2009 08:37:38 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906250837.n5P8bcjB044941@svn.freebsd.org> From: Robert Watson Date: Thu, 25 Jun 2009 08:37: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: r194943 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 08:37:38 -0000 Author: rwatson Date: Thu Jun 25 08:37:38 2009 New Revision: 194943 URL: http://svn.freebsd.org/changeset/base/194943 Log: Clean up reference management in in6_update_ifa and in6_unlink_ifa, and in particular, add a reference for in6_ifaddrhead since we do remove a reference for it when an IPv6 address is removed. This fixes ifconfig delete of an IPv6 alias. Reported by: tegge MFC after: 6 weeks Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Thu Jun 25 07:25:39 2009 (r194942) +++ head/sys/netinet6/in6.c Thu Jun 25 08:37:38 2009 (r194943) @@ -831,6 +831,7 @@ in6_update_ifa(struct ifnet *ifp, struct TAILQ_INSERT_TAIL(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_UNLOCK(ifp); + ifa_ref(&ia->ia_ifa); /* in6_if_addrhead */ TAILQ_INSERT_TAIL(&V_in6_ifaddrhead, ia, ia_link); } @@ -1147,8 +1148,8 @@ in6_update_ifa(struct ifnet *ifp, struct * anyway. */ if (hostIsNew) { - ifa_free(&ia->ia_ifa); in6_unlink_ifa(ia, ifp); + ifa_free(&ia->ia_ifa); } return (error); @@ -1376,6 +1377,7 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st ifa_free(&ia->ia_ifa); /* if_addrhead */ TAILQ_REMOVE(&V_in6_ifaddrhead, ia, ia_link); + ifa_free(&ia->ia_ifa); /* in6_ifaddrhead */ /* * Release the reference to the base prefix. There should be a @@ -1399,12 +1401,6 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st pfxlist_onlink_check(); } - /* - * release another refcnt for the link from in6_ifaddr. - * Note that we should decrement the refcnt at least once for all *BSD. - */ - ifa_free(&ia->ia_ifa); - splx(s); } From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 08:52:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EAC7106564A; Thu, 25 Jun 2009 08:52:20 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C3628FC1A; Thu, 25 Jun 2009 08:52:20 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5P8qKip045325; Thu, 25 Jun 2009 08:52:20 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5P8qKSb045319; Thu, 25 Jun 2009 08:52:20 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200906250852.n5P8qKSb045319@svn.freebsd.org> From: Roman Divacky Date: Thu, 25 Jun 2009 08:52: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: r194944 - in head/sys/gnu/fs/xfs: . FreeBSD X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 08:52:20 -0000 Author: rdivacky Date: Thu Jun 25 08:52:20 2009 New Revision: 194944 URL: http://svn.freebsd.org/changeset/base/194944 Log: Switch cmd argument of ioctl to u_long as elsewhere in the kernel. Propagate this change down the callchain. Approved by: kan (maintainer) Approved by: ed (mentor) Modified: head/sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c head/sys/gnu/fs/xfs/FreeBSD/xfs_iops.h head/sys/gnu/fs/xfs/FreeBSD/xfs_vnode.h head/sys/gnu/fs/xfs/xfs_rw.h head/sys/gnu/fs/xfs/xfs_vnodeops.c Modified: head/sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c ============================================================================== --- head/sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c Thu Jun 25 08:37:38 2009 (r194943) +++ head/sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c Thu Jun 25 08:52:20 2009 (r194944) @@ -703,7 +703,7 @@ xfs_ioc_space( xfs_vnode_t *vp, struct file *filp, int flags, - unsigned int cmd, + u_long cmd, void __user *arg); STATIC int @@ -749,7 +749,7 @@ xfs_ioctl( struct inode *inode, struct file *filp, int ioflags, - unsigned int cmd, + u_long cmd, void *arg) { int error; @@ -1021,7 +1021,7 @@ xfs_ioc_space( xfs_vnode_t *vp, struct file *filp, int ioflags, - unsigned int cmd, + u_long cmd, void __user *arg) { xfs_flock64_t bf; @@ -1455,7 +1455,7 @@ xfs_ioctl( struct inode *inode, struct file *filp, int ioflags, - unsigned int cmd, + u_long cmd, unsigned long arg) { return EINVAL; Modified: head/sys/gnu/fs/xfs/FreeBSD/xfs_iops.h ============================================================================== --- head/sys/gnu/fs/xfs/FreeBSD/xfs_iops.h Thu Jun 25 08:37:38 2009 (r194943) +++ head/sys/gnu/fs/xfs/FreeBSD/xfs_iops.h Thu Jun 25 08:52:20 2009 (r194944) @@ -56,6 +56,6 @@ typedef struct xattr_namespace { extern struct xattr_namespace *xfs_namespaces; extern int xfs_ioctl(struct bhv_desc *, struct inode *, struct file *, - int, unsigned int, void *); + int, u_long, void *); #endif /* __XFS_IOPS_H__ */ Modified: head/sys/gnu/fs/xfs/FreeBSD/xfs_vnode.h ============================================================================== --- head/sys/gnu/fs/xfs/FreeBSD/xfs_vnode.h Thu Jun 25 08:37:38 2009 (r194943) +++ head/sys/gnu/fs/xfs/FreeBSD/xfs_vnode.h Thu Jun 25 08:52:20 2009 (r194944) @@ -182,7 +182,7 @@ typedef int (*xfs_vop_open_t)(bhv_desc_t typedef ssize_t (*xfs_vop_read_t)(bhv_desc_t *, uio_t *, int, struct cred *); typedef ssize_t (*xfs_vop_write_t)(bhv_desc_t *, uio_t *, int, struct cred *); typedef int (*xfs_vop_ioctl_t)(bhv_desc_t *, struct inode *, struct file *, - int, unsigned int, void *); + int, u_long, void *); typedef int (*xfs_vop_getattr_t)(bhv_desc_t *, struct xfs_vattr *, int, struct cred *); typedef int (*xfs_vop_setattr_t)(bhv_desc_t *, struct xfs_vattr *, int, Modified: head/sys/gnu/fs/xfs/xfs_rw.h ============================================================================== --- head/sys/gnu/fs/xfs/xfs_rw.h Thu Jun 25 08:37:38 2009 (r194943) +++ head/sys/gnu/fs/xfs/xfs_rw.h Thu Jun 25 08:52:20 2009 (r194944) @@ -90,7 +90,7 @@ extern void xfs_ioerror_alert(char *func extern int xfs_rwlock(bhv_desc_t *bdp, vrwlock_t write_lock); extern void xfs_rwunlock(bhv_desc_t *bdp, vrwlock_t write_lock); extern int xfs_setattr(bhv_desc_t *bdp, xfs_vattr_t *vap, int flags, cred_t *credp); -extern int xfs_change_file_space(bhv_desc_t *bdp, int cmd, xfs_flock64_t *bf, +extern int xfs_change_file_space(bhv_desc_t *bdp, u_long cmd, xfs_flock64_t *bf, xfs_off_t offset, cred_t *credp, int flags); extern int xfs_set_dmattrs(bhv_desc_t *bdp, u_int evmask, u_int16_t state, cred_t *credp); Modified: head/sys/gnu/fs/xfs/xfs_vnodeops.c ============================================================================== --- head/sys/gnu/fs/xfs/xfs_vnodeops.c Thu Jun 25 08:37:38 2009 (r194943) +++ head/sys/gnu/fs/xfs/xfs_vnodeops.c Thu Jun 25 08:52:20 2009 (r194944) @@ -4506,7 +4506,7 @@ xfs_free_file_space( int xfs_change_file_space( bhv_desc_t *bdp, - int cmd, + u_long cmd, xfs_flock64_t *bf, xfs_off_t offset, cred_t *credp, From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 09:28:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 390E6106564A; Thu, 25 Jun 2009 09:28:05 +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 1BDDB8FC13; Thu, 25 Jun 2009 09:28:05 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5P9S5b7046272; Thu, 25 Jun 2009 09:28:05 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5P9S4Ve046270; Thu, 25 Jun 2009 09:28:04 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200906250928.n5P9S4Ve046270@svn.freebsd.org> From: Luigi Rizzo Date: Thu, 25 Jun 2009 09:28: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: r194947 - head/share/man/man8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 09:28:05 -0000 Author: luigi Date: Thu Jun 25 09:28:04 2009 New Revision: 194947 URL: http://svn.freebsd.org/changeset/base/194947 Log: update the manpage to track existing options (including --iso), and alphabetize them. MFC after: 3 days Modified: head/share/man/man8/picobsd.8 Modified: head/share/man/man8/picobsd.8 ============================================================================== --- head/share/man/man8/picobsd.8 Thu Jun 25 09:17:50 2009 (r194946) +++ head/share/man/man8/picobsd.8 Thu Jun 25 09:28:04 2009 (r194947) @@ -1,6 +1,6 @@ .\" -*- nroff-fill -*- .\" $FreeBSD$ -.Dd January 31, 2006 +.Dd June 25, 2009 .Os .Dt PICOBSD 8 .Sh NAME @@ -49,9 +49,83 @@ After the boot phase, the system runs en .Pp The following options are available (but also check the .Nm -script for more details): +script for more details). +The most important options for common operations are +.Fl src , +.Fl init , +.Fl n and +.Fl v. .Pp .Bl -tag -width indent +.\" +.It Fl -all_in_mfs +Put the entire contents of the file system in the +memory file system image which is contained in the +kernel. +This is the default behaviour, and is +extremely useful as the kernel itself can be loaded, +using +.Xr etherboot +or +.Xr pxeboot 8 , +.\" +.It Fl c , Fl clean +Clean the product of previous builds. +.\" +.It Fl -cfg Ar file +Specify a file that contains additional config commands. +.\" +.It Fl -floppy_size Ar size +Set the size of the disk image. +Typical values for a floppy disk are 1440 or 2880, +but other values can be used for other media (flash memories, +CDROM, network booted kernels). +Note that this option is overridden by the content of the +config files (config in the image tree, or the one +specified with +.Fl Fl cfg ) +.\" +.It Fl -init +When used together with the +.Fl -src +option, this initializes the +.Ao Ar SRC_PATH Ac Ns Pa /../usr +subtree as necessary to subsequently build +.Nm +images. +.\" +.It Fl -iso +Generate an ISO image, picobsd.iso, in addition to the disk image picobsd.bin +.\" +.It Fl -modules +Also build kernel modules. +These are not stored on the +.Nm +image but are left available in the build directory. +.\" +.It Fl n +Make the script non-interactive, skipping the initial menu +and proceeding with the build process without requiring user input. +.\" +.It Fl -no_all_in_mfs +Leaves files contained in the +.Pa floppy.tree +on the +.Nm +image, so they can be loaded separately +from the kernel (and updated individually to +customize the image). +.\" +.It Fl -no_loader +Omit /boot/loader, just rely on boot2 to load the kernel. +This saves some space but may have problems with kernels > 4MB. +.\" +.It Fl -objdir Ar directory +Specify a directory with the result of a previous buildworld. +This saves the need for an +.Fl Fl init +call before creating an image. +.\" .It Fl -src Ar SRC_PATH Use the source tree at .Ar SRC_PATH @@ -66,7 +140,7 @@ with the correct header files, libraries .Xr config 8 program) that are necessary for the cross-build (see the .Fl -init -option below). +option). The source files are unmodified by the .Nm script. @@ -78,53 +152,13 @@ its subdirectories, and also the process .Pa usr subtree touches some parts of the source tree (this is a bug in the release build scripts which might go away with time). -.It Fl -init -When used together with the -.Fl -src -option, this initializes the -.Ao Ar SRC_PATH Ac Ns Pa /../usr -subtree as necessary to subsequently build -.Nm -images. -.It Fl -modules -Also build kernel modules. -These are not stored on the -.Nm -image but are left available in the build directory. -.It Fl n -Make the script non-interactive, skipping the initial menu -and proceeding with the build process without requiring user input. +.\" .It Fl v Make the script verbose, showing commands to be executed and waiting for user input before executing each of them. Useful for debugging. -.It Fl -all_in_mfs -Put the entire contents of the file system in the -memory file system image which is contained in the -kernel. -This is the default behaviour, and is -extremely useful as the kernel itself can be loaded, -using -.Xr etherboot -or -.Xr pxeboot 8 , as a fully functional system. -.It Fl -no_all_in_mfs -Leaves files contained in the -.Pa floppy.tree -on the -.Nm -image, so they can be loaded separately -from the kernel (and updated individually to -customize the image). -.It Fl -floppy_size Ar size -Set the size of the disk image. -Typical values for a floppy disk are 1440 or 2880, -but other values can be used for other media (flash memories, -CDROM, network booted kernels). -.It Fl c , clean -Clean the product of previous builds. .El .Sh ENVIRONMENT As a result of extreme size limitations, the @@ -414,24 +448,12 @@ Note that the image size can be smaller (indicated as partition .Dq Li c: ) . .Ss CDROM Install -Another option is to put the image on a CDROM. -Assuming your image -for disk type -.Pa foo -is in the directory -.Pa build_dir-foo -then you can produce a bootable +.Nm +can produce an ISO image named picobsd.iso, +which does not use .Dq "El Torito" -image (and burn it) with the -following command: -.Bd -literal -offset indent -mkisofs -b picobsd.bin -c boot.catalog -d -N -D -R -T \\ - -o cd.img build_dir-foo -burncd -f /dev/acd0c -s 4 data cd.img fixate -.Ed -.Pp -Note that the image size is restricted to 1.44MB or 2.88MB, other sizes -most likely will not work. +emulation, so it has no size restrictions. +Installing means just burning a media with the file. .Ss Booting From The Network Yet another way to use .Nm @@ -638,8 +660,4 @@ Man page and created by .An Greg Lehey Aq grog@lemis.com . .Sh BUGS -Building -.Nm -is still a black art. -The biggest problem is determining what will fit on the -floppies, and the only practical method is trial and error. +Documentation is still incomplete. From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 10:03:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FA45106567E; Thu, 25 Jun 2009 10:03:53 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 62DE58FC1E; Thu, 25 Jun 2009 10:03:53 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PA3p9L047147; Thu, 25 Jun 2009 10:03:52 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PA3pH3047142; Thu, 25 Jun 2009 10:03:51 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200906251003.n5PA3pH3047142@svn.freebsd.org> From: Rafal Jaworowski Date: Thu, 25 Jun 2009 10:03: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: r194949 - in head/sys/arm/mv: . discovery kirkwood orion X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 10:03:54 -0000 Author: raj Date: Thu Jun 25 10:03:51 2009 New Revision: 194949 URL: http://svn.freebsd.org/changeset/base/194949 Log: Enable all populated TWSI (I2C) controllers on Marvell SOCs. Obtained from: Semihalf Modified: head/sys/arm/mv/discovery/discovery.c head/sys/arm/mv/kirkwood/kirkwood.c head/sys/arm/mv/mvwin.h head/sys/arm/mv/orion/orion.c Modified: head/sys/arm/mv/discovery/discovery.c ============================================================================== --- head/sys/arm/mv/discovery/discovery.c Thu Jun 25 09:28:44 2009 (r194948) +++ head/sys/arm/mv/discovery/discovery.c Thu Jun 25 10:03:51 2009 (r194949) @@ -126,7 +126,11 @@ struct obio_device obio_devices[] = { { -1 }, CPU_PM_CTRL_GE1 }, - { "twsi", MV_TWSI_BASE, MV_TWSI_SIZE, + { "twsi", MV_TWSI0_BASE, MV_TWSI_SIZE, + { -1 }, { -1 }, + CPU_PM_CTRL_NONE + }, + { "twsi", MV_TWSI1_BASE, MV_TWSI_SIZE, { -1 }, { -1 }, CPU_PM_CTRL_NONE }, Modified: head/sys/arm/mv/kirkwood/kirkwood.c ============================================================================== --- head/sys/arm/mv/kirkwood/kirkwood.c Thu Jun 25 09:28:44 2009 (r194948) +++ head/sys/arm/mv/kirkwood/kirkwood.c Thu Jun 25 10:03:51 2009 (r194949) @@ -95,7 +95,7 @@ struct obio_device obio_devices[] = { { -1 }, CPU_PM_CTRL_GE0 }, - { "twsi", MV_TWSI_BASE, MV_TWSI_SIZE, + { "twsi", MV_TWSI0_BASE, MV_TWSI_SIZE, { -1 }, { -1 }, CPU_PM_CTRL_NONE }, Modified: head/sys/arm/mv/mvwin.h ============================================================================== --- head/sys/arm/mv/mvwin.h Thu Jun 25 09:28:44 2009 (r194948) +++ head/sys/arm/mv/mvwin.h Thu Jun 25 10:03:51 2009 (r194949) @@ -91,7 +91,8 @@ #define MV_GPIO_SIZE 0x20 #define MV_RTC_BASE (MV_BASE + 0x10300) #define MV_RTC_SIZE 0x08 -#define MV_TWSI_BASE (MV_BASE + 0x11000) +#define MV_TWSI0_BASE (MV_BASE + 0x11000) +#define MV_TWSI1_BASE (MV_BASE + 0x11100) #define MV_TWSI_SIZE 0x20 #define MV_UART0_BASE (MV_BASE + 0x12000) #define MV_UART1_BASE (MV_BASE + 0x12100) Modified: head/sys/arm/mv/orion/orion.c ============================================================================== --- head/sys/arm/mv/orion/orion.c Thu Jun 25 09:28:44 2009 (r194948) +++ head/sys/arm/mv/orion/orion.c Thu Jun 25 10:03:51 2009 (r194949) @@ -88,7 +88,7 @@ struct obio_device obio_devices[] = { { -1 }, CPU_PM_CTRL_NONE }, - { "twsi", MV_TWSI_BASE, MV_TWSI_SIZE, + { "twsi", MV_TWSI0_BASE, MV_TWSI_SIZE, { -1 }, { -1 }, CPU_PM_CTRL_NONE }, From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 10:07:22 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3925B106564A; Thu, 25 Jun 2009 10:07:22 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D40E8FC1A; Thu, 25 Jun 2009 10:07:22 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PA7L6F047272; Thu, 25 Jun 2009 10:07:21 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PA7LCa047270; Thu, 25 Jun 2009 10:07:21 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200906251007.n5PA7LCa047270@svn.freebsd.org> From: Rafal Jaworowski Date: Thu, 25 Jun 2009 10:07: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: r194950 - head/sys/powerpc/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 10:07:22 -0000 Author: raj Date: Thu Jun 25 10:07:21 2009 New Revision: 194950 URL: http://svn.freebsd.org/changeset/base/194950 Log: Include SMP support in the MPC85XX kernel by default. Modified: head/sys/powerpc/conf/MPC85XX Modified: head/sys/powerpc/conf/MPC85XX ============================================================================== --- head/sys/powerpc/conf/MPC85XX Thu Jun 25 10:03:51 2009 (r194949) +++ head/sys/powerpc/conf/MPC85XX Thu Jun 25 10:07:21 2009 (r194950) @@ -43,6 +43,7 @@ options NFSLOCKD options PROCFS options PSEUDOFS options SCHED_4BSD +options SMP options SYSVMSG options SYSVSEM options SYSVSHM From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 10:19:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19A19106564A; Thu, 25 Jun 2009 10:19:35 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id 24B578FC1E; Thu, 25 Jun 2009 10:19:33 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from [212.86.226.226] (account mav@alkar.net HELO mavbook.mavhome.dp.ua) by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9) with ESMTPSA id 246787238; Thu, 25 Jun 2009 13:19:30 +0300 Message-ID: <4A434F2C.1020005@FreeBSD.org> Date: Thu, 25 Jun 2009 13:19:24 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.21 (X11/20090405) MIME-Version: 1.0 To: Rafal Jaworowski References: <200906241538.n5OFcHwp018860@svn.freebsd.org> In-Reply-To: <200906241538.n5OFcHwp018860@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194844 - in head/sys: conf dev/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 10:19:35 -0000 Rafal Jaworowski wrote: > Author: raj > Date: Wed Jun 24 15:38:17 2009 > New Revision: 194844 > URL: http://svn.freebsd.org/changeset/base/194844 > > Log: > Move non-PCI prototypes from ata-pci.h -> ata-all.h. > > This removes unnecessary PCI #includes dependency for systems with ATA > controllers living at non-PCI buses. > > Submitted by: Piotr Ziecik > Obtained from: Semihalf > > Modified: head/sys/conf/files > ============================================================================== > --- head/sys/conf/files Wed Jun 24 15:33:33 2009 (r194843) > +++ head/sys/conf/files Wed Jun 24 15:38:17 2009 (r194844) > @@ -491,12 +491,12 @@ dev/ata/ata_if.m optional ata | atacore > dev/ata/ata-all.c optional ata | atacore > dev/ata/ata-lowlevel.c optional ata | atacore > dev/ata/ata-queue.c optional ata | atacore > +dev/ata/ata-dma.c optional ata | atadma > +dev/ata/ata-sata.c optional ata | atasata What is atadma and atasata here, kernel options? What for are they needed? You will not be able to build most of drivers without them, while enabling them for others will not give you any benefit, just bigger code size. I think dependency must be reviewed there. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 10:42:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FC5B106566C; Thu, 25 Jun 2009 10:42:54 +0000 (UTC) (envelope-from raj@semihalf.com) Received: from smtp.semihalf.com (smtp.semihalf.com [213.17.239.109]) by mx1.freebsd.org (Postfix) with ESMTP id F311A8FC22; Thu, 25 Jun 2009 10:42:53 +0000 (UTC) (envelope-from raj@semihalf.com) Received: from [10.0.0.34] (cardhu.semihalf.com [213.17.239.108]) by smtp.semihalf.com (Postfix) with ESMTPSA id 97514C3BB6; Thu, 25 Jun 2009 12:41:27 +0200 (CEST) Message-Id: From: Rafal Jaworowski To: Alexander Motin In-Reply-To: <4A434F2C.1020005@FreeBSD.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Date: Thu, 25 Jun 2009 12:42:52 +0200 References: <200906241538.n5OFcHwp018860@svn.freebsd.org> <4A434F2C.1020005@FreeBSD.org> X-Mailer: Apple Mail (2.935.3) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, =?ISO-8859-2?Q?Piotr_Zi=EAcik?= Subject: Re: svn commit: r194844 - in head/sys: conf dev/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 10:42:55 -0000 On 2009-06-25, at 12:19, Alexander Motin wrote: > Rafal Jaworowski wrote: >> Modified: head/sys/conf/files >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- head/sys/conf/files Wed Jun 24 15:33:33 2009 (r194843) >> +++ head/sys/conf/files Wed Jun 24 15:38:17 2009 (r194844) >> @@ -491,12 +491,12 @@ dev/ata/ata_if.m optional ata | atacore >> dev/ata/ata-all.c optional ata | atacore >> dev/ata/ata-lowlevel.c optional ata | atacore >> dev/ata/ata-queue.c optional ata | atacore >> +dev/ata/ata-dma.c optional ata | atadma >> +dev/ata/ata-sata.c optional ata | atasata > > What is atadma and atasata here, kernel options? What for are they > needed? You will not be able to build most of drivers without them, > while enabling them for others will not give you any benefit, just > bigger code size. I think dependency must be reviewed there. This was supposed to follow the fine grained kernel options route for various ata subsystems. Both ata-dma.c and ata-sata.c seem orthogonal to the rest of the ata framework (think ata controller without DMA, which is often seen in embedded). They could also be made mandatory under atacore, I have no problem with this approach too. Rafal From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 11:03:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90E2B1065675; Thu, 25 Jun 2009 11:03:45 +0000 (UTC) (envelope-from oleg@lath.rinet.ru) Received: from lath.rinet.ru (lath.rinet.ru [195.54.192.90]) by mx1.freebsd.org (Postfix) with ESMTP id 483B38FC2D; Thu, 25 Jun 2009 11:03:45 +0000 (UTC) (envelope-from oleg@lath.rinet.ru) Received: by lath.rinet.ru (Postfix, from userid 222) id F29317007; Thu, 25 Jun 2009 14:44:51 +0400 (MSD) Date: Thu, 25 Jun 2009 14:44:51 +0400 From: Oleg Bulyzhin To: Ben Kaduk Message-ID: <20090625104451.GA273@lath.rinet.ru> References: <200906242257.n5OMv71d032996@svn.freebsd.org> <47d0403c0906241644v70f35ba5r7c6440a45c95c369@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <47d0403c0906241644v70f35ba5r7c6440a45c95c369@mail.gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, freebsd-doc@freebsd.org Subject: Re: svn commit: r194930 - in head: sbin/ipfw sys/netinet sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 11:03:46 -0000 On Wed, Jun 24, 2009 at 07:44:04PM -0400, Ben Kaduk wrote: > There's a grammar error and a style error, here. I'm actually not > entirely sure what > the intended meaning is, so it's a bit hard to fix the grammar error. It's no wonder - my english writing skill is poor. > Looking at the code, it seems that in burst mode, extra data will be > allowed to be sent, though > it is capped to not exceed the pipe bandwidth. > Perhaps "... bytes of data is allowed to bypass the dummynet scheduler > (...), though > the transmission rate will still be capped so as to not exceed the > pipe's bandwidth."? Let me explain. For example, we have pipe with bw 1Mbit/s and burst size is 5GByte. If we try to download 10Gbyte through this pipe following will happen: 1) 1st 5Gbyte of data will go with 'wire speed'. 2) last 5Gbyte will be shaped to 1Mbit/s Could you please mail me whole 'burst' part (as it should be), and i will fix it. > > The style error is that the new sentence ("Effective burst size ...") > should start > on a new line. > > I would also prefer to see the new sentence be an actual complete sentence > (i.e., "The effective burst size is calculated as follows"), though > there appears > to be at least one other bug of this form in the file already (see, > for example, the > quoted text at the beginning of this hunk: "Default value is no delay.", which > would benefit from a "the".) > > > Unrelated to this commit, there is a grammar error early in the file: > > 312 Once > 313 .Fl p > 314 has been specified, any additional arguments as passed on to the preproc > essor > 315 for interpretation. > > The 'as' in line 314 should be 'are'. > (This is from CVS r1.220, so the line numbers may not be current.) > > > Thanks, > > Ben Kaduk > > > > +MAX( > > +.Ar size > > +, > > +.Nm bw > > +* pipe_idle_time). > > +.Pp > > š.It Cm profile Ar filename > > šA file specifying the additional overhead incurred in the transmission > > šof a packet on the link. > > -- Oleg. ================================================================ === Oleg Bulyzhin -- OBUL-RIPN -- OBUL-RIPE -- oleg@rinet.ru === ================================================================ From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 11:52:34 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FABB106568B; Thu, 25 Jun 2009 11:52:34 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4A0C88FC19; Thu, 25 Jun 2009 11:52:34 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PBqYSK050291; Thu, 25 Jun 2009 11:52:34 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PBqXCK050275; Thu, 25 Jun 2009 11:52:33 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906251152.n5PBqXCK050275@svn.freebsd.org> From: Robert Watson Date: Thu, 25 Jun 2009 11:52:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194951 - in head/sys: fs/nfsclient net netinet netipsec nfsclient X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 11:52:35 -0000 Author: rwatson Date: Thu Jun 25 11:52:33 2009 New Revision: 194951 URL: http://svn.freebsd.org/changeset/base/194951 Log: Add a new global rwlock, in_ifaddr_lock, which will synchronize use of the in_ifaddrhead and INADDR_HASH address lists. Previously, these lists were used unsynchronized as they were effectively never changed in steady state, but we've seen increasing reports of writer-writer races on very busy VPN servers as core count has gone up (and similar configurations where address lists change frequently and concurrently). For the time being, use rwlocks rather than rmlocks in order to take advantage of their better lock debugging support. As a result, we don't enable ip_input()'s read-locking of INADDR_HASH until an rmlock conversion is complete and a performance analysis has been done. This means that one class of reader-writer races still exists. MFC after: 6 weeks Reviewed by: bz Modified: head/sys/fs/nfsclient/nfs_clvnops.c head/sys/net/if_spppsubr.c head/sys/net/if_stf.c head/sys/netinet/if_ether.c head/sys/netinet/in.c head/sys/netinet/in_gif.c head/sys/netinet/in_mcast.c head/sys/netinet/in_pcb.c head/sys/netinet/in_var.h head/sys/netinet/ip_carp.c head/sys/netinet/ip_icmp.c head/sys/netinet/ip_input.c head/sys/netinet/raw_ip.c head/sys/netipsec/key.c head/sys/nfsclient/nfs_vnops.c Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Thu Jun 25 10:07:21 2009 (r194950) +++ head/sys/fs/nfsclient/nfs_clvnops.c Thu Jun 25 11:52:33 2009 (r194951) @@ -1400,11 +1400,15 @@ again: CURVNET_SET(P_TO_VNET(&proc0)); #ifdef INET INIT_VNET_INET(curvnet); + IN_IFADDR_RLOCK(); if (!TAILQ_EMPTY(&V_in_ifaddrhead)) cverf.lval[0] = IA_SIN(TAILQ_FIRST(&V_in_ifaddrhead))->sin_addr.s_addr; else #endif cverf.lval[0] = create_verf; +#ifdef INET + IN_IFADDR_RUNLOCK(); +#endif cverf.lval[1] = ++create_verf; CURVNET_RESTORE(); error = nfsrpc_create(dvp, cnp->cn_nameptr, cnp->cn_namelen, Modified: head/sys/net/if_spppsubr.c ============================================================================== --- head/sys/net/if_spppsubr.c Thu Jun 25 10:07:21 2009 (r194950) +++ head/sys/net/if_spppsubr.c Thu Jun 25 11:52:33 2009 (r194951) @@ -4973,8 +4973,10 @@ sppp_set_ip_addr(struct sppp *sp, u_long /* set new address */ si->sin_addr.s_addr = htonl(src); ia = ifatoia(ifa); + IN_IFADDR_WLOCK(); LIST_REMOVE(ia, ia_hash); LIST_INSERT_HEAD(INADDR_HASH(si->sin_addr.s_addr), ia, ia_hash); + IN_IFADDR_WUNLOCK(); /* add new route */ error = rtinit(ifa, (int)RTM_ADD, RTF_HOST); Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Thu Jun 25 10:07:21 2009 (r194950) +++ head/sys/net/if_stf.c Thu Jun 25 11:52:33 2009 (r194951) @@ -620,15 +620,19 @@ stf_checkaddr4(sc, in, inifp) /* * reject packets with broadcast */ + IN_IFADDR_RLOCK(); for (ia4 = TAILQ_FIRST(&V_in_ifaddrhead); ia4; ia4 = TAILQ_NEXT(ia4, ia_link)) { if ((ia4->ia_ifa.ifa_ifp->if_flags & IFF_BROADCAST) == 0) continue; - if (in->s_addr == ia4->ia_broadaddr.sin_addr.s_addr) + if (in->s_addr == ia4->ia_broadaddr.sin_addr.s_addr) { + IN_IFADDR_RUNLOCK(); return -1; + } } + IN_IFADDR_RUNLOCK(); /* * perform ingress filter Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Thu Jun 25 10:07:21 2009 (r194950) +++ head/sys/netinet/if_ether.c Thu Jun 25 11:52:33 2009 (r194951) @@ -509,11 +509,13 @@ in_arpinput(struct mbuf *m) * request for the virtual host ip. * XXX: This is really ugly! */ + IN_IFADDR_RLOCK(); LIST_FOREACH(ia, INADDR_HASH(itaddr.s_addr), ia_hash) { if (((bridged && ia->ia_ifp->if_bridge != NULL) || ia->ia_ifp == ifp) && itaddr.s_addr == ia->ia_addr.sin_addr.s_addr) { ifa_ref(&ia->ia_ifa); + IN_IFADDR_RUNLOCK(); goto match; } #ifdef DEV_CARP @@ -522,6 +524,7 @@ in_arpinput(struct mbuf *m) itaddr.s_addr == ia->ia_addr.sin_addr.s_addr) { carp_match = 1; ifa_ref(&ia->ia_ifa); + IN_IFADDR_RUNLOCK(); goto match; } #endif @@ -531,6 +534,7 @@ in_arpinput(struct mbuf *m) ia->ia_ifp == ifp) && isaddr.s_addr == ia->ia_addr.sin_addr.s_addr) { ifa_ref(&ia->ia_ifa); + IN_IFADDR_RUNLOCK(); goto match; } @@ -549,11 +553,13 @@ in_arpinput(struct mbuf *m) if (BDG_MEMBER_MATCHES_ARP(itaddr.s_addr, ifp, ia)) { ifa_ref(&ia->ia_ifa); ifp = ia->ia_ifp; + IN_IFADDR_RUNLOCK(); goto match; } } } #undef BDG_MEMBER_MATCHES_ARP + IN_IFADDR_RUNLOCK(); /* * No match, use the first inet address on the receive interface @@ -572,9 +578,13 @@ in_arpinput(struct mbuf *m) /* * If bridging, fall back to using any inet address. */ - if (!bridged || (ia = TAILQ_FIRST(&V_in_ifaddrhead)) == NULL) + IN_IFADDR_RLOCK(); + if (!bridged || (ia = TAILQ_FIRST(&V_in_ifaddrhead)) == NULL) { + IN_IFADDR_RUNLOCK(); goto drop; + } ifa_ref(&ia->ia_ifa); + IN_IFADDR_RUNLOCK(); match: if (!enaddr) enaddr = (u_int8_t *)IF_LLADDR(ifp); Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Thu Jun 25 10:07:21 2009 (r194950) +++ head/sys/netinet/in.c Thu Jun 25 11:52:33 2009 (r194951) @@ -100,15 +100,23 @@ in_localaddr(struct in_addr in) register u_long i = ntohl(in.s_addr); register struct in_ifaddr *ia; + IN_IFADDR_RLOCK(); if (V_subnetsarelocal) { - TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) - if ((i & ia->ia_netmask) == ia->ia_net) + TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { + if ((i & ia->ia_netmask) == ia->ia_net) { + IN_IFADDR_RUNLOCK(); return (1); + } + } } else { - TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) - if ((i & ia->ia_subnetmask) == ia->ia_subnet) + TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { + if ((i & ia->ia_subnetmask) == ia->ia_subnet) { + IN_IFADDR_RUNLOCK(); return (1); + } + } } + IN_IFADDR_RUNLOCK(); return (0); } @@ -122,10 +130,14 @@ in_localip(struct in_addr in) INIT_VNET_INET(curvnet); struct in_ifaddr *ia; + IN_IFADDR_RLOCK(); LIST_FOREACH(ia, INADDR_HASH(in.s_addr), ia_hash) { - if (IA_SIN(ia)->sin_addr.s_addr == in.s_addr) + if (IA_SIN(ia)->sin_addr.s_addr == in.s_addr) { + IN_IFADDR_RUNLOCK(); return (1); + } } + IN_IFADDR_RUNLOCK(); return (0); } @@ -222,7 +234,7 @@ in_control(struct socket *so, u_long cmd struct in_ifinfo *ii; struct in_aliasreq *ifra = (struct in_aliasreq *)data; struct sockaddr_in oldaddr; - int error, hostIsNew, iaIsNew, maskIsNew, s; + int error, hostIsNew, iaIsNew, maskIsNew; int iaIsFirst; ia = NULL; @@ -313,6 +325,7 @@ in_control(struct socket *so, u_long cmd * first one on the interface, if possible. */ dst = ((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr; + IN_IFADDR_RLOCK(); LIST_FOREACH(iap, INADDR_HASH(dst.s_addr), ia_hash) { if (iap->ia_ifp == ifp && iap->ia_addr.sin_addr.s_addr == dst.s_addr) { @@ -324,6 +337,7 @@ in_control(struct socket *so, u_long cmd } if (ia != NULL) ifa_ref(&ia->ia_ifa); + IN_IFADDR_RUNLOCK(); if (ia == NULL) { IF_ADDR_LOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { @@ -351,6 +365,7 @@ in_control(struct socket *so, u_long cmd if (ifra->ifra_addr.sin_family == AF_INET) { struct in_ifaddr *oia; + IN_IFADDR_RLOCK(); for (oia = ia; ia; ia = TAILQ_NEXT(ia, ia_link)) { if (ia->ia_ifp == ifp && ia->ia_addr.sin_addr.s_addr == @@ -361,6 +376,7 @@ in_control(struct socket *so, u_long cmd ifa_ref(&ia->ia_ifa); if (oia != NULL && ia != oia) ifa_free(&oia->ia_ifa); + IN_IFADDR_RUNLOCK(); if ((ifp->if_flags & IFF_POINTOPOINT) && (cmd == SIOCAIFADDR) && (ifra->ifra_dstaddr.sin_addr.s_addr @@ -405,9 +421,9 @@ in_control(struct socket *so, u_long cmd TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); IF_ADDR_UNLOCK(ifp); ifa_ref(ifa); /* in_ifaddrhead */ - s = splnet(); + IN_IFADDR_WLOCK(); TAILQ_INSERT_TAIL(&V_in_ifaddrhead, ia, ia_link); - splx(s); + IN_IFADDR_WUNLOCK(); iaIsNew = 1; } break; @@ -578,13 +594,14 @@ in_control(struct socket *so, u_long cmd TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_UNLOCK(ifp); ifa_free(&ia->ia_ifa); /* if_addrhead */ - s = splnet(); + + IN_IFADDR_WLOCK(); TAILQ_REMOVE(&V_in_ifaddrhead, ia, ia_link); - ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ if (ia->ia_addr.sin_family == AF_INET) { struct in_ifaddr *if_ia; LIST_REMOVE(ia, ia_hash); + IN_IFADDR_WUNLOCK(); /* * If this is the last IPv4 address configured on this * interface, leave the all-hosts group. @@ -603,8 +620,9 @@ in_control(struct socket *so, u_long cmd IN_MULTI_UNLOCK(); } else ifa_free(&if_ia->ia_ifa); - } - splx(s); + } else + IN_IFADDR_WUNLOCK(); + ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ out: if (ia != NULL) ifa_free(&ia->ia_ifa); @@ -811,9 +829,12 @@ in_ifinit(struct ifnet *ifp, struct in_i if (oldaddr.sin_family == AF_INET) LIST_REMOVE(ia, ia_hash); ia->ia_addr = *sin; - if (ia->ia_addr.sin_family == AF_INET) + if (ia->ia_addr.sin_family == AF_INET) { + IN_IFADDR_WLOCK(); LIST_INSERT_HEAD(INADDR_HASH(ia->ia_addr.sin_addr.s_addr), ia, ia_hash); + IN_IFADDR_WUNLOCK(); + } /* * Give the interface a chance to initialize * if this is its first address, @@ -825,6 +846,7 @@ in_ifinit(struct ifnet *ifp, struct in_i splx(s); /* LIST_REMOVE(ia, ia_hash) is done in in_control */ ia->ia_addr = oldaddr; + IN_IFADDR_WLOCK(); if (ia->ia_addr.sin_family == AF_INET) LIST_INSERT_HEAD(INADDR_HASH( ia->ia_addr.sin_addr.s_addr), ia, ia_hash); @@ -836,6 +858,7 @@ in_ifinit(struct ifnet *ifp, struct in_i * with bogus ia entries in hash */ LIST_REMOVE(ia, ia_hash); + IN_IFADDR_WUNLOCK(); return (error); } } @@ -943,6 +966,7 @@ in_addprefix(struct in_ifaddr *target, i prefix.s_addr &= mask.s_addr; } + IN_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if (rtinitflags(ia)) { p = ia->ia_addr.sin_addr; @@ -966,12 +990,16 @@ in_addprefix(struct in_ifaddr *target, i if (ia->ia_flags & IFA_ROUTE) { if (V_sameprefixcarponly && target->ia_ifp->if_type != IFT_CARP && - ia->ia_ifp->if_type != IFT_CARP) + ia->ia_ifp->if_type != IFT_CARP) { + IN_IFADDR_RUNLOCK(); return (EEXIST); - else + } else { + IN_IFADDR_RUNLOCK(); return (0); + } } } + IN_IFADDR_RUNLOCK(); /* * No-one seem to have this prefix route, so we try to insert it. @@ -1031,6 +1059,7 @@ in_scrubprefix(struct in_ifaddr *target) arp_ifscrub(target->ia_ifp, IA_SIN(target)->sin_addr.s_addr); } + IN_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if (rtinitflags(ia)) p = ia->ia_dstaddr.sin_addr; @@ -1054,6 +1083,7 @@ in_scrubprefix(struct in_ifaddr *target) && (ia->ia_ifp->if_type != IFT_CARP) #endif ) { + IN_IFADDR_RUNLOCK(); rtinit(&(target->ia_ifa), (int)RTM_DELETE, rtinitflags(target)); target->ia_flags &= ~IFA_ROUTE; @@ -1065,6 +1095,7 @@ in_scrubprefix(struct in_ifaddr *target) return (error); } } + IN_IFADDR_RUNLOCK(); /* * remove all L2 entries on the given prefix Modified: head/sys/netinet/in_gif.c ============================================================================== --- head/sys/netinet/in_gif.c Thu Jun 25 10:07:21 2009 (r194950) +++ head/sys/netinet/in_gif.c Thu Jun 25 11:52:33 2009 (r194951) @@ -387,13 +387,19 @@ gif_validate4(const struct ip *ip, struc case 0: case 127: case 255: return 0; } + /* reject packets with broadcast on source */ + /* XXXRW: should use hash lists? */ + IN_IFADDR_RLOCK(); TAILQ_FOREACH(ia4, &V_in_ifaddrhead, ia_link) { if ((ia4->ia_ifa.ifa_ifp->if_flags & IFF_BROADCAST) == 0) continue; - if (ip->ip_src.s_addr == ia4->ia_broadaddr.sin_addr.s_addr) + if (ip->ip_src.s_addr == ia4->ia_broadaddr.sin_addr.s_addr) { + IN_IFADDR_RUNLOCK(); return 0; + } } + IN_IFADDR_RUNLOCK(); /* ingress filters on outer source */ if ((GIF2IFP(sc)->if_flags & IFF_LINK2) == 0 && ifp) { Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Thu Jun 25 10:07:21 2009 (r194950) +++ head/sys/netinet/in_mcast.c Thu Jun 25 11:52:33 2009 (r194951) @@ -1834,6 +1834,7 @@ inp_lookup_mcast_ifp(const struct inpcb struct ifnet *mifp; mifp = NULL; + IN_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { mifp = ia->ia_ifp; if (!(mifp->if_flags & IFF_LOOPBACK) && @@ -1842,6 +1843,7 @@ inp_lookup_mcast_ifp(const struct inpcb break; } } + IN_IFADDR_RUNLOCK(); } } Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Thu Jun 25 10:07:21 2009 (r194950) +++ head/sys/netinet/in_pcb.c Thu Jun 25 11:52:33 2009 (r194951) @@ -813,16 +813,21 @@ in_pcbconnect_setup(struct inpcb *inp, s * choose the broadcast address for that interface. */ if (faddr.s_addr == INADDR_ANY) { + IN_IFADDR_RLOCK(); faddr = IA_SIN(TAILQ_FIRST(&V_in_ifaddrhead))->sin_addr; + IN_IFADDR_RUNLOCK(); if (cred != NULL && (error = prison_get_ip4(cred, &faddr)) != 0) return (error); - } else if (faddr.s_addr == (u_long)INADDR_BROADCAST && - (TAILQ_FIRST(&V_in_ifaddrhead)->ia_ifp->if_flags & - IFF_BROADCAST)) - faddr = satosin(&TAILQ_FIRST( - &V_in_ifaddrhead)->ia_broadaddr)->sin_addr; + } else if (faddr.s_addr == (u_long)INADDR_BROADCAST) { + IN_IFADDR_RLOCK(); + if (TAILQ_FIRST(&V_in_ifaddrhead)->ia_ifp->if_flags & + IFF_BROADCAST) + faddr = satosin(&TAILQ_FIRST( + &V_in_ifaddrhead)->ia_broadaddr)->sin_addr; + IN_IFADDR_RUNLOCK(); + } } if (laddr.s_addr == INADDR_ANY) { error = in_pcbladdr(inp, &faddr, &laddr, cred); @@ -842,12 +847,16 @@ in_pcbconnect_setup(struct inpcb *inp, s imo = inp->inp_moptions; if (imo->imo_multicast_ifp != NULL) { ifp = imo->imo_multicast_ifp; + IN_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) if (ia->ia_ifp == ifp) break; - if (ia == NULL) + if (ia == NULL) { + IN_IFADDR_RUNLOCK(); return (EADDRNOTAVAIL); + } laddr = ia->ia_addr.sin_addr; + IN_IFADDR_RUNLOCK(); } } } Modified: head/sys/netinet/in_var.h ============================================================================== --- head/sys/netinet/in_var.h Thu Jun 25 10:07:21 2009 (r194950) +++ head/sys/netinet/in_var.h Thu Jun 25 11:52:33 2009 (r194951) @@ -114,6 +114,17 @@ extern u_long in_ifaddrhmask; /* mask #define INADDR_HASH(x) \ (&V_in_ifaddrhashtbl[INADDR_HASHVAL(x) & V_in_ifaddrhmask]) +extern struct rwlock in_ifaddr_lock; + +#define IN_IFADDR_LOCK_INIT() rw_init(&in_ifaddr_lock, "in_ifaddr_lock") +#define IN_IFADDR_LOCK_ASSERT() rw_assert(&in_ifaddr_lock, RA_LOCKED) +#define IN_IFADDR_RLOCK() rw_rlock(&in_ifaddr_lock) +#define IN_IFADDR_RLOCK_ASSERT() rw_assert(&in_ifaddr_lock, RA_RLOCKED) +#define IN_IFADDR_RUNLOCK() rw_runlock(&in_ifaddr_lock) +#define IN_IFADDR_WLOCK() rw_wlock(&in_ifaddr_lock) +#define IN_IFADDR_WLOCK_ASSERT() rw_assert(&in_ifaddr_lock, RA_WLOCKED) +#define IN_IFADDR_WUNLOCK() rw_wunlock(&in_ifaddr_lock) + /* * Macro for finding the internet address structure (in_ifaddr) * corresponding to one of our IP addresses (in_addr). Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Thu Jun 25 10:07:21 2009 (r194950) +++ head/sys/netinet/ip_carp.c Thu Jun 25 11:52:33 2009 (r194951) @@ -1500,6 +1500,7 @@ carp_set_addr(struct carp_softc *sc, str /* we have to do it by hands to check we won't match on us */ ia_if = NULL; own = 0; + IN_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { /* and, yeah, we need a multicast-capable iface too */ if (ia->ia_ifp != SC2IFP(sc) && @@ -1513,20 +1514,30 @@ carp_set_addr(struct carp_softc *sc, str } } - if (!ia_if) + if (!ia_if) { + IN_IFADDR_RUNLOCK(); return (EADDRNOTAVAIL); + } ia = ia_if; + ifa_ref(&ia->ia_ifa); + IN_IFADDR_RUNLOCK(); + ifp = ia->ia_ifp; if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0 || - (imo->imo_multicast_ifp && imo->imo_multicast_ifp != ifp)) + (imo->imo_multicast_ifp && imo->imo_multicast_ifp != ifp)) { + ifa_free(&ia->ia_ifa); return (EADDRNOTAVAIL); + } if (imo->imo_num_memberships == 0) { addr.s_addr = htonl(INADDR_CARP_GROUP); - if ((imo->imo_membership[0] = in_addmulti(&addr, ifp)) == NULL) + if ((imo->imo_membership[0] = in_addmulti(&addr, ifp)) == + NULL) { + ifa_free(&ia->ia_ifa); return (ENOBUFS); + } imo->imo_num_memberships++; imo->imo_multicast_ifp = ifp; imo->imo_multicast_ttl = CARP_DFLTTL; @@ -1601,11 +1612,13 @@ carp_set_addr(struct carp_softc *sc, str carp_setrun(sc, 0); CARP_UNLOCK(cif); + ifa_free(&ia->ia_ifa); /* XXXRW: should hold reference for softc. */ return (0); cleanup: in_delmulti(imo->imo_membership[--imo->imo_num_memberships]); + ifa_free(&ia->ia_ifa); return (error); } Modified: head/sys/netinet/ip_icmp.c ============================================================================== --- head/sys/netinet/ip_icmp.c Thu Jun 25 10:07:21 2009 (r194950) +++ head/sys/netinet/ip_icmp.c Thu Jun 25 11:52:33 2009 (r194951) @@ -675,12 +675,16 @@ icmp_reflect(struct mbuf *m) * If the incoming packet was addressed directly to one of our * own addresses, use dst as the src for the reply. */ + IN_IFADDR_RLOCK(); LIST_FOREACH(ia, INADDR_HASH(t.s_addr), ia_hash) { if (t.s_addr == IA_SIN(ia)->sin_addr.s_addr) { t = IA_SIN(ia)->sin_addr; + IN_IFADDR_RUNLOCK(); goto match; } } + IN_IFADDR_RUNLOCK(); + /* * If the incoming packet was addressed to one of our broadcast * addresses, use the first non-broadcast address which corresponds Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Thu Jun 25 10:07:21 2009 (r194950) +++ head/sys/netinet/ip_input.c Thu Jun 25 11:52:33 2009 (r194951) @@ -117,6 +117,7 @@ static int maxfragsperpacket; int ipstealth; static int nipq; /* Total # of reass queues */ #endif +struct rwlock in_ifaddr_lock; SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, IPCTL_FORWARDING, forwarding, CTLFLAG_RW, ipforwarding, 0, @@ -325,6 +326,7 @@ ip_init(void) TAILQ_INIT(&V_in_ifaddrhead); V_in_ifaddrhashtbl = hashinit(INADDR_NHASH, M_IFADDR, &V_in_ifaddrhmask); + IN_IFADDR_LOCK_INIT(); /* Initialize IP reassembly queue. */ for (i = 0; i < IPREASS_NHASH; i++) @@ -615,6 +617,7 @@ passin: /* * Check for exact addresses in the hash bucket. */ + /* IN_IFADDR_RLOCK(); */ LIST_FOREACH(ia, INADDR_HASH(ip->ip_dst.s_addr), ia_hash) { /* * If the address matches, verify that the packet @@ -624,9 +627,12 @@ passin: if (IA_SIN(ia)->sin_addr.s_addr == ip->ip_dst.s_addr && (!checkif || ia->ia_ifp == ifp)) { ifa_ref(&ia->ia_ifa); + /* IN_IFADDR_RUNLOCK(); */ goto ours; } } + /* IN_IFADDR_RUNLOCK(); */ + /* * Check for broadcast addresses. * Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Thu Jun 25 10:07:21 2009 (r194950) +++ head/sys/netinet/raw_ip.c Thu Jun 25 11:52:33 2009 (r194951) @@ -678,9 +678,12 @@ rip_ctlinput(int cmd, struct sockaddr *s switch (cmd) { case PRC_IFDOWN: + IN_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if (ia->ia_ifa.ifa_addr == sa && (ia->ia_flags & IFA_ROUTE)) { + ifa_ref(&ia->ia_ifa); + IN_IFADDR_RUNLOCK(); /* * in_ifscrub kills the interface route. */ @@ -692,18 +695,26 @@ rip_ctlinput(int cmd, struct sockaddr *s * routing process they will come back. */ in_ifadown(&ia->ia_ifa, 0); + ifa_free(&ia->ia_ifa); break; } } + if (ia == NULL) /* If ia matched, already unlocked. */ + IN_IFADDR_RUNLOCK(); break; case PRC_IFUP: + IN_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if (ia->ia_ifa.ifa_addr == sa) break; } - if (ia == 0 || (ia->ia_flags & IFA_ROUTE)) + if (ia == NULL || (ia->ia_flags & IFA_ROUTE)) { + IN_IFADDR_RUNLOCK(); return; + } + ifa_ref(&ia->ia_ifa); + IN_IFADDR_RUNLOCK(); flags = RTF_UP; ifp = ia->ia_ifa.ifa_ifp; @@ -714,6 +725,7 @@ rip_ctlinput(int cmd, struct sockaddr *s err = rtinit(&ia->ia_ifa, RTM_ADD, flags); if (err == 0) ia->ia_flags |= IFA_ROUTE; + ifa_free(&ia->ia_ifa); break; } } Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Thu Jun 25 10:07:21 2009 (r194950) +++ head/sys/netipsec/key.c Thu Jun 25 11:52:33 2009 (r194951) @@ -3939,6 +3939,7 @@ key_ismyaddr(sa) #ifdef INET case AF_INET: sin = (struct sockaddr_in *)sa; + IN_IFADDR_RLOCK(); for (ia = V_in_ifaddrhead.tqh_first; ia; ia = ia->ia_link.tqe_next) { @@ -3946,9 +3947,11 @@ key_ismyaddr(sa) sin->sin_len == ia->ia_addr.sin_len && sin->sin_addr.s_addr == ia->ia_addr.sin_addr.s_addr) { + IN_IFADDR_RUNLOCK(); return 1; } } + IN_IFADDR_RUNLOCK(); break; #endif #ifdef INET6 Modified: head/sys/nfsclient/nfs_vnops.c ============================================================================== --- head/sys/nfsclient/nfs_vnops.c Thu Jun 25 10:07:21 2009 (r194950) +++ head/sys/nfsclient/nfs_vnops.c Thu Jun 25 11:52:33 2009 (r194951) @@ -1553,11 +1553,15 @@ again: tl = nfsm_build(u_int32_t *, NFSX_V3CREATEVERF); #ifdef INET INIT_VNET_INET(curvnet); + IN_IFADDR_RLOCK(); if (!TAILQ_EMPTY(&V_in_ifaddrhead)) *tl++ = IA_SIN(TAILQ_FIRST(&V_in_ifaddrhead))->sin_addr.s_addr; else #endif *tl++ = create_verf; +#ifdef INET + IN_IFADDR_RUNLOCK(); +#endif *tl = ++create_verf; } else { *tl = txdr_unsigned(NFSV3CREATE_UNCHECKED); From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 12:34:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39F711065675; Thu, 25 Jun 2009 12:34:06 +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 2783A8FC1D; Thu, 25 Jun 2009 12:34:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PCY6ps051139; Thu, 25 Jun 2009 12:34:06 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PCY6wb051137; Thu, 25 Jun 2009 12:34:06 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906251234.n5PCY6wb051137@svn.freebsd.org> From: John Baldwin Date: Thu, 25 Jun 2009 12:34: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: r194953 - head/usr.sbin/sysinstall X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 12:34:07 -0000 Author: jhb Date: Thu Jun 25 12:34:05 2009 New Revision: 194953 URL: http://svn.freebsd.org/changeset/base/194953 Log: Raise the default size of the EFI partition on ia64 from 100MB to 400MB. A fresh install of a current 8.0 snapshot uses 156MB with a single kernel and having the filesystem too small prevented the system from booting. Reviewed by: marcel MFC after: 1 week Modified: head/usr.sbin/sysinstall/label.c Modified: head/usr.sbin/sysinstall/label.c ============================================================================== --- head/usr.sbin/sysinstall/label.c Thu Jun 25 12:21:49 2009 (r194952) +++ head/usr.sbin/sysinstall/label.c Thu Jun 25 12:34:05 2009 (r194953) @@ -1389,7 +1389,7 @@ try_auto_label(Device **devs, Device *de #ifdef __ia64__ AutoEfi = NULL; if (EfiChunk == NULL) { - sz = 100 * ONE_MEG; + sz = 400 * ONE_MEG; AutoEfi = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c, sz, efi, 0, 0); if (AutoEfi == NULL) { From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 12:47:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C0AC106564A; Thu, 25 Jun 2009 12:47:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2733F8FC14; Thu, 25 Jun 2009 12:47:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PCl0FC051513; Thu, 25 Jun 2009 12:47:00 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PCl0v7051505; Thu, 25 Jun 2009 12:47:00 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200906251247.n5PCl0v7051505@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 25 Jun 2009 12:47: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: r194955 - in head: lib/libc/posix1e lib/libc/sys sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 12:47:00 -0000 Author: trasz Date: Thu Jun 25 12:46:59 2009 New Revision: 194955 URL: http://svn.freebsd.org/changeset/base/194955 Log: Add NFSv4 ACL support to libc. This adds the following functions to the acl(3) API: acl_add_flag_np, acl_clear_flags_np, acl_create_entry_np, acl_delete_entry_np, acl_delete_flag_np, acl_get_extended_np, acl_get_flag_np, acl_get_flagset_np, acl_set_extended_np, acl_set_flagset_np, acl_to_text_np, acl_is_trivial_np, acl_strip_np, acl_get_brand_np. Most of them are similar to what Darwin does. There are no backward-incompatible changes. Approved by: rwatson@ Added: head/lib/libc/posix1e/acl_add_flag_np.3 (contents, props changed) head/lib/libc/posix1e/acl_branding.c (contents, props changed) head/lib/libc/posix1e/acl_clear_flags_np.3 (contents, props changed) head/lib/libc/posix1e/acl_delete_flag_np.3 (contents, props changed) head/lib/libc/posix1e/acl_flag.c (contents, props changed) head/lib/libc/posix1e/acl_from_text_nfs4.c (contents, props changed) head/lib/libc/posix1e/acl_get_brand_np.3 (contents, props changed) head/lib/libc/posix1e/acl_get_entry_type_np.3 (contents, props changed) head/lib/libc/posix1e/acl_get_flag_np.3 (contents, props changed) head/lib/libc/posix1e/acl_get_flagset_np.3 (contents, props changed) head/lib/libc/posix1e/acl_is_trivial_np.3 (contents, props changed) head/lib/libc/posix1e/acl_set_entry_type_np.3 (contents, props changed) head/lib/libc/posix1e/acl_set_flagset_np.3 (contents, props changed) head/lib/libc/posix1e/acl_strip.c (contents, props changed) head/lib/libc/posix1e/acl_strip_np.3 (contents, props changed) head/lib/libc/posix1e/acl_support_nfs4.c (contents, props changed) head/lib/libc/posix1e/acl_to_text_nfs4.c (contents, props changed) Modified: head/lib/libc/posix1e/Makefile.inc head/lib/libc/posix1e/Symbol.map head/lib/libc/posix1e/acl.3 head/lib/libc/posix1e/acl_add_perm.3 head/lib/libc/posix1e/acl_calc_mask.c head/lib/libc/posix1e/acl_copy.c head/lib/libc/posix1e/acl_create_entry.3 head/lib/libc/posix1e/acl_delete_entry.3 head/lib/libc/posix1e/acl_delete_entry.c head/lib/libc/posix1e/acl_entry.c head/lib/libc/posix1e/acl_from_text.c head/lib/libc/posix1e/acl_get.3 head/lib/libc/posix1e/acl_get.c head/lib/libc/posix1e/acl_init.c head/lib/libc/posix1e/acl_set.3 head/lib/libc/posix1e/acl_set.c head/lib/libc/posix1e/acl_set_tag_type.3 head/lib/libc/posix1e/acl_support.c head/lib/libc/posix1e/acl_support.h head/lib/libc/posix1e/acl_to_text.3 head/lib/libc/posix1e/acl_to_text.c head/lib/libc/posix1e/acl_valid.c head/lib/libc/sys/pathconf.2 head/sys/sys/acl.h head/sys/sys/unistd.h Modified: head/lib/libc/posix1e/Makefile.inc ============================================================================== --- head/lib/libc/posix1e/Makefile.inc Thu Jun 25 12:34:44 2009 (r194954) +++ head/lib/libc/posix1e/Makefile.inc Thu Jun 25 12:46:59 2009 (r194955) @@ -4,52 +4,74 @@ CFLAGS+=-D_ACL_PRIVATE -SRCS+= acl_calc_mask.c \ +# Copy kern/subr_acl_nfs4.c to the libc object directory. +subr_acl_nfs4.c: ${.CURDIR}/../../sys/kern/subr_acl_nfs4.c + cat ${.ALLSRC} > ${.TARGET} + +SRCS+= acl_branding.c \ + acl_calc_mask.c \ acl_copy.c \ acl_compat.c \ acl_delete.c \ acl_delete_entry.c \ acl_entry.c \ + acl_flag.c \ acl_free.c \ acl_from_text.c \ + acl_from_text_nfs4.c \ acl_get.c \ acl_init.c \ acl_perm.c \ acl_set.c \ + acl_strip.c \ acl_support.c \ + acl_support_nfs4.c \ acl_to_text.c \ + acl_to_text_nfs4.c \ acl_valid.c \ extattr.c \ mac.c \ mac_exec.c \ mac_get.c \ - mac_set.c + mac_set.c \ + subr_acl_nfs4.c SYM_MAPS+=${.CURDIR}/posix1e/Symbol.map MAN+= acl.3 \ + acl_add_flag_np.3 \ acl_add_perm.3 \ acl_calc_mask.3 \ + acl_clear_flags_np.3 \ acl_clear_perms.3 \ acl_copy_entry.3 \ acl_create_entry.3 \ acl_delete.3 \ acl_delete_entry.3 \ + acl_delete_flag_np.3 \ acl_delete_perm.3 \ acl_dup.3 \ acl_free.3 \ acl_from_text.3 \ acl_get.3 \ + acl_get_brand_np.3 \ acl_get_entry.3 \ + acl_get_entry_type_np.3 \ + acl_get_flagset_np.3 \ + acl_get_flag_np.3 \ acl_get_permset.3 \ acl_get_perm_np.3 \ acl_get_qualifier.3 \ acl_get_tag_type.3 \ acl_init.3 \ + acl_is_trivial_np.3 \ acl_set.3 \ + acl_set_entry_type_np.3 \ + acl_set_flagset_np.3 \ acl_set_permset.3 \ acl_set_qualifier.3 \ acl_set_tag_type.3 \ + acl_strip_np.3 \ acl_to_text.3 \ acl_valid.3 \ extattr.3 \ @@ -63,15 +85,18 @@ MAN+= acl.3 \ mac_text.3 \ posix1e.3 -MLINKS+=acl_delete.3 acl_delete_def_file.3 \ +MLINKS+=acl_create_entry.3 acl_create_entry_np.3\ + acl_delete.3 acl_delete_def_file.3 \ acl_delete.3 acl_delete_file_np.3 \ acl_delete.3 acl_delete_fd_np.3 \ + acl_delete_entry.3 acl_delete_entry_np.3\ acl_get.3 acl_get_file.3 \ acl_get.3 acl_get_fd.3 \ acl_get.3 acl_get_fd_np.3 \ acl_set.3 acl_set_file.3 \ acl_set.3 acl_set_fd.3 \ acl_set.3 acl_set_fd_np.3 \ + acl_to_text.3 acl_to_text_np.3 \ acl_valid.3 acl_valid_file_np.3 \ acl_valid.3 acl_valid_fd_np.3 \ extattr.3 extattr_namespace_to_string.3 \ Modified: head/lib/libc/posix1e/Symbol.map ============================================================================== --- head/lib/libc/posix1e/Symbol.map Thu Jun 25 12:34:44 2009 (r194954) +++ head/lib/libc/posix1e/Symbol.map Thu Jun 25 12:46:59 2009 (r194955) @@ -66,7 +66,21 @@ FBSD_1.0 { }; FBSD_1.1 { + acl_add_flag_np; acl_add_perm; + acl_clear_flags_np; + acl_create_entry_np; + acl_delete_entry_np; + acl_delete_flag_np; acl_delete_perm; + acl_get_brand_np; + acl_get_entry_type_np; + acl_get_flag_np; + acl_get_flagset_np; acl_get_perm_np; + acl_is_trivial_np; + acl_set_entry_type_np; + acl_set_flagset_np; + acl_strip_np; + acl_to_text_np; }; Modified: head/lib/libc/posix1e/acl.3 ============================================================================== --- head/lib/libc/posix1e/acl.3 Thu Jun 25 12:34:44 2009 (r194954) +++ head/lib/libc/posix1e/acl.3 Thu Jun 25 12:46:59 2009 (r194955) @@ -59,6 +59,10 @@ all of these support routines are implem .Pp Available functions, sorted by behavior, include: .Bl -tag -width indent +.It Fn acl_add_flag_np +This function is described in +.Xr acl_add_flag_np 3 , +and may be used to add flags to a flagset. .It Fn acl_add_perm This function is described in .Xr acl_add_perm 3 , @@ -70,6 +74,10 @@ and may be used to calculate and set the the .Dv ACL_MASK entry. +.It Fn acl_clear_flags_np +This function is described in +.Xr acl_clear_flags_np 3 , +and may be used to clear all flags from a flagset. .It Fn acl_clear_perms This function is described in .Xr acl_clear_perms 3 , @@ -78,8 +86,11 @@ and may be used to clear all permissions This function is described in .Xr acl_copy_entry 3 , and may be used to copy the contents of an ACL entry. -.It Fn acl_create_entry -This function is described in +.It Xo +.Fn acl_create_entry , +.Fn acl_create_entry_np +.Xc +These functions are described in .Xr acl_create_entry 3 , and may be used to create an empty entry in an ACL. .It Xo @@ -92,10 +103,17 @@ and may be used to create an empty entry These functions are described in .Xr acl_delete 3 , and may be used to delete ACLs from file system objects. -.It Fn acl_delete_entry -This function is described in +.It Xo +.Fn acl_delete_entry , +.Fn acl_delete_entry_np , +.Xc +This functions are described in .Xr acl_delete_entry 3 , and may be used to delete an entry from an ACL. +.It Fn acl_delete_flag_np +This function is described in +.Xr acl_delete_flag_np 3 , +and may be used to delete flags from a flagset. .It Fn acl_delete_perm This function is described in .Xr acl_delete_perm 3 , @@ -126,6 +144,14 @@ and may be used to retrieve a designated These functions are described in .Xr acl_get 3 , and may be used to retrieve ACLs from file system objects. +.It Fn acl_get_entry_type_np +This function is described in +.Xr acl_get_entry_type_np 3 , +and may be used to retrieve an ACL type from an ACL entry. +.It Fn acl_get_flagset_np +This function is described in +.Xr acl_get_flagset_np 3 , +and may be used to retrieve a flagset from an ACL entry. .It Fn acl_get_permset This function is described in .Xr acl_get_permset 3 , @@ -142,6 +168,10 @@ and may be used to retrieve the tag type This function is described in .Xr acl_init 3 , and may be used to allocate a fresh (empty) ACL structure. +.It Fn acl_is_trivial_np +This function is described in +.Xr acl_is_trivial_np 3 , +and may be used to find out whether ACL is trivial. .It Xo .Fn acl_set_fd , .Fn acl_set_fd_np , @@ -151,6 +181,14 @@ and may be used to allocate a fresh (emp These functions are described in .Xr acl_set 3 , and may be used to assign an ACL to a file system object. +.It Fn acl_set_entry_type_np +This function is described in +.Xr acl_set_entry_type_np 3 , +and may be used to set the ACL type of an ACL entry. +.It Fn acl_set_flagset_np +This function is described in +.Xr acl_set_flagset_np 3 , +and may be used to set the flags of an ACL entry from a flagset. .It Fn acl_set_permset This function is described in .Xr acl_set_permset 3 , @@ -163,8 +201,15 @@ and may be used to set the qualifier of This function is described in .Xr acl_set_tag_type 3 , and may be used to set the tag type of an ACL. -.It Fn acl_to_text -This function is described in +.It Fn acl_strip_np +This function is describe din +.Xr acl-strip_np 3 , +and may be used to remove extended entries from an ACL. +.It Xo +.Fn acl_to_text , +.Fn acl_to_text_np +.Xc +These functions are described in .Xr acl_to_text 3 , and may be used to generate a text-form of a POSIX.1e semantics ACL. .It Xo @@ -189,25 +234,34 @@ library. .Sh SEE ALSO .Xr getfacl 1 , .Xr setfacl 1 , +.Xr acl_add_flag_np 3 , .Xr acl_add_perm 3 , .Xr acl_calc_mask 3 , +.Xr acl_clear_flags_np 3 , .Xr acl_clear_perms 3 , .Xr acl_copy_entry 3 , .Xr acl_create_entry 3 , .Xr acl_delete_entry 3 , +.Xr acl_delete_flag_np 3 , .Xr acl_delete_perm 3 , .Xr acl_dup 3 , .Xr acl_free 3 , .Xr acl_from_text 3 , .Xr acl_get 3 , +.Xr acl_get_entry_type_np 3 , +.Xr acl_get_flagset_np 3 , .Xr acl_get_permset 3 , .Xr acl_get_qualifier 3 , .Xr acl_get_tag_type 3 , .Xr acl_init 3 , +.Xr acl_is_trivial_np 3 , .Xr acl_set 3 , +.Xr acl_set_entry_type_np 3 , +.Xr acl_set_flagset_np 3 , .Xr acl_set_permset 3 , .Xr acl_set_qualifier 3 , .Xr acl_set_tag_type 3 , +.Xr acl_strip_np 3 , .Xr acl_to_text 3 , .Xr acl_valid 3 , .Xr posix1e 3 , Added: head/lib/libc/posix1e/acl_add_flag_np.3 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/posix1e/acl_add_flag_np.3 Thu Jun 25 12:46:59 2009 (r194955) @@ -0,0 +1,294 @@ +.\"- +.\" Copyright (c) 2008, 2009 Edward Tomasz Napierala +.\" 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 THE VOICES IN HIS HEAD BE +.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd March 10, 2001 +.Dt ACL_ADD_FLAG_NP 3 +.Os +.Sh NAME +.Nm acl_add_flag_np +.Nd add flags to a flagset +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/acl.h +.Ft int +.Fn acl_add_flag_np "acl_flagset_t flagset_d" "acl_flag_t flag" +.Sh DESCRIPTION +The +.Fn acl_add_flag_np +function +is a non-portable call that adds the flags contained in +.Fa flags +to the flagset +.Fa flagset_d . +.Pp +Note: it is not considered an error to attempt to add flags +that already exist in the flagset. +.Pp +Valid values are: +.Pp +.Bl -column -offset 3n "ACL_ENTRY_NO_PROPAGATE_INHERIT" +.It ACL_ENTRY_FILE_INHERIT Will be inherited by files. +.It ACL_ENTRY_DIRECTORY_INHERIT Will be inherited by directories. +.It ACL_ENTRY_NO_PROPAGATE_INHERIT Will not propagate. +.It ACL_ENTRY_INHERIT_ONLY Inherit-only. +.El +.Sh RETURN VALUES +.Rv -std acl_add_flag_np +.Sh ERRORS +The +.Fn acl_add_flag_np +function fails if: +.Bl -tag -width Er +.It Bq Er EINVAL +Argument +.Fa flagset_d +is not a valid descriptor for a flagset within an ACL entry. +Argument +.Fa flag +does not contain a valid +.Vt acl_flag_t +value. +.El +.Sh SEE ALSO +.Xr acl 3 , +.Xr acl_clear_flags_np 3 , +.Xr acl_delete_flag_np 3 , +.Xr acl_get_flagset_np 3 , +.Xr acl_set_flagset_np 3 , +.Xr posix1e 3 +.Sh STANDARDS +POSIX.1e is described in IEEE POSIX.1e draft 17. +.Sh HISTORY +POSIX.1e support was introduced in +.Fx 4.0 . +The +.Fn acl_add_flag_np +function was added in +.Fx 8.0 . +.Sh AUTHORS +The +.Fn acl_add_flag_np +function was written by +.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . +.\"- +.\" Copyright (c) 2008, 2009 Edward Tomasz Napierala +.\" 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 THE VOICES IN HIS HEAD BE +.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd March 10, 2001 +.Dt ACL_ADD_FLAG_NP 3 +.Os +.Sh NAME +.Nm acl_add_flag_np +.Nd add flags to a flagset +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/acl.h +.Ft int +.Fn acl_add_flag_np "acl_flagset_t flagset_d" "acl_flag_t flag" +.Sh DESCRIPTION +The +.Fn acl_add_flag_np +function +is a non-portable call that adds the flags contained in +.Fa flags +to the flagset +.Fa flagset_d . +.Pp +Note: it is not considered an error to attempt to add flags +that already exist in the flagset. +.Pp +Valid values are: +.Pp +.Bl -column -offset 3n "ACL_ENTRY_NO_PROPAGATE_INHERIT" +.It ACL_ENTRY_FILE_INHERIT Will be inherited by files. +.It ACL_ENTRY_DIRECTORY_INHERIT Will be inherited by directories. +.It ACL_ENTRY_NO_PROPAGATE_INHERIT Will not propagate. +.It ACL_ENTRY_INHERIT_ONLY Inherit-only. +.El +.Sh RETURN VALUES +.Rv -std acl_add_flag_np +.Sh ERRORS +The +.Fn acl_add_flag_np +function fails if: +.Bl -tag -width Er +.It Bq Er EINVAL +Argument +.Fa flagset_d +is not a valid descriptor for a flagset within an ACL entry. +Argument +.Fa flag +does not contain a valid +.Vt acl_flag_t +value. +.El +.Sh SEE ALSO +.Xr acl 3 , +.Xr acl_clear_flags_np 3 , +.Xr acl_delete_flag_np 3 , +.Xr acl_get_flagset_np 3 , +.Xr acl_set_flagset_np 3 , +.Xr posix1e 3 +.Sh STANDARDS +POSIX.1e is described in IEEE POSIX.1e draft 17. +.Sh HISTORY +POSIX.1e support was introduced in +.Fx 4.0 . +The +.Fn acl_add_flag_np +function was added in +.Fx 8.0 . +.Sh AUTHORS +The +.Fn acl_add_flag_np +function was written by +.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . +.\"- +.\" Copyright (c) 2008, 2009 Edward Tomasz Napierala +.\" 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 THE VOICES IN HIS HEAD BE +.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd March 10, 2001 +.Dt ACL_ADD_FLAG_NP 3 +.Os +.Sh NAME +.Nm acl_add_flag_np +.Nd add flags to a flagset +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/types.h +.In sys/acl.h +.Ft int +.Fn acl_add_flag_np "acl_flagset_t flagset_d" "acl_flag_t flag" +.Sh DESCRIPTION +The +.Fn acl_add_flag_np +function +is a non-portable call that adds the flags contained in +.Fa flags +to the flagset +.Fa flagset_d . +.Pp +Note: it is not considered an error to attempt to add flags +that already exist in the flagset. +.Pp +Valid values are: +.Pp +.Bl -column -offset 3n "ACL_ENTRY_NO_PROPAGATE_INHERIT" +.It ACL_ENTRY_FILE_INHERIT Will be inherited by files. +.It ACL_ENTRY_DIRECTORY_INHERIT Will be inherited by directories. +.It ACL_ENTRY_NO_PROPAGATE_INHERIT Will not propagate. +.It ACL_ENTRY_INHERIT_ONLY Inherit-only. +.El +.Sh RETURN VALUES +.Rv -std acl_add_flag_np +.Sh ERRORS +The +.Fn acl_add_flag_np +function fails if: +.Bl -tag -width Er +.It Bq Er EINVAL +Argument +.Fa flagset_d +is not a valid descriptor for a flagset within an ACL entry. +Argument +.Fa flag +does not contain a valid +.Vt acl_flag_t +value. +.El +.Sh SEE ALSO +.Xr acl 3 , +.Xr acl_clear_flags_np 3 , +.Xr acl_delete_flag_np 3 , +.Xr acl_get_flagset_np 3 , +.Xr acl_set_flagset_np 3 , +.Xr posix1e 3 +.Sh STANDARDS +POSIX.1e is described in IEEE POSIX.1e draft 17. +.Sh HISTORY +POSIX.1e support was introduced in +.Fx 4.0 . +The +.Fn acl_add_flag_np +function was added in +.Fx 8.0 . +.Sh AUTHORS +The +.Fn acl_add_flag_np +function was written by +.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . Modified: head/lib/libc/posix1e/acl_add_perm.3 ============================================================================== --- head/lib/libc/posix1e/acl_add_perm.3 Thu Jun 25 12:34:44 2009 (r194954) +++ head/lib/libc/posix1e/acl_add_perm.3 Thu Jun 25 12:46:59 2009 (r194955) @@ -52,11 +52,43 @@ that already exist in the permission set .Pp For POSIX.1e ACLs, valid values are: .Pp -.Bl -column -offset 3n "ACL_EXECUTE" +.Bl -column -offset 3n "ACL_WRITE_NAMED_ATTRS" .It ACL_EXECUTE Execute permission .It ACL_WRITE Write permission .It ACL_READ Read permission .El +.Pp +For NFSv4 ACLs, valid values are: +.Pp +.Bl -column -offset 3n "ACL_WRITE_NAMED_ATTRS" +.It ACL_READ_DATA Read permission +.It ACL_LIST_DIRECTORY Same as ACL_READ_DATA +.It ACL_WRITE_DATA Write permission, or permission to create files +.It ACL_ADD_FILE Same as ACL_READ_DATA +.It ACL_APPEND_DATA Permission to create directories. Ignored for files +.It ACL_ADD_SUBDIRECTORY Same as ACL_APPEND_DATA +.It ACL_READ_NAMED_ATTRS Ignored +.It ACL_WRITE_NAMED_ATTRS Ignored +.It ACL_EXECUTE Execute permission +.It ACL_DELETE_CHILD Permission to delete files and subdirectories +.It ACL_READ_ATTRIBUTES Permission to read basic attributes +.It ACL_WRITE_ATTRIBUTES Permission to change basic attributes +.It ACL_DELETE Permission to delete the object this ACL is placed on +.It ACL_READ_ACL Permission to read ACL +.It ACL_WRITE_ACL Permission to change the ACL and file mode +.It ACL_SYNCHRONIZE Ignored +.El +.Pp +Calling +.Fn acl_add_perm +with +.Fa perm +equal to ACL_WRITE or ACL_READ brands the ACL as POSIX. +Calling it with ACL_READ_DATA, ACL_LIST_DIRECTORY, ACL_WRITE_DATA, +ACL_ADD_FILE, ACL_APPEND_DATA, ACL_ADD_SUBDIRECTORY, ACL_READ_NAMED_ATTRS, +ACL_WRITE_NAMED_ATTRS, ACL_DELETE_CHILD, ACL_READ_ATTRIBUTES, +ACL_WRITE_ATTRIBUTES, ACL_DELETE, ACL_READ_ACL, ACL_WRITE_ACL +or ACL_SYNCHRONIZE brands the ACL as NFSv4. .Sh RETURN VALUES .Rv -std acl_add_perm .Sh ERRORS @@ -73,11 +105,13 @@ Argument does not contain a valid .Vt acl_perm_t value. +ACL is already branded differently. .El .Sh SEE ALSO .Xr acl 3 , .Xr acl_clear_perms 3 , .Xr acl_delete_perm 3 , +.Xr acl_get_brand_np 3 , .Xr acl_get_permset 3 , .Xr acl_set_permset 3 , .Xr posix1e 3 Added: head/lib/libc/posix1e/acl_branding.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/posix1e/acl_branding.c Thu Jun 25 12:46:59 2009 (r194955) @@ -0,0 +1,498 @@ +/*- + * Copyright (c) 2008, 2009 Edward Tomasz NapieraÅ‚a + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include "acl_support.h" + +/* + * An ugly detail of the implementation - fortunately not visible + * to the API users - is the "branding": libc needs to keep track + * of what "brand" ACL is: NFSv4, POSIX.1e or unknown. It happens + * automatically - for example, during acl_get_file(3) ACL gets + * branded according to the "type" argument; during acl_set_permset + * ACL, if its brand is unknown it gets branded as NFSv4 if any of the + * NFSv4 permissions that are not valid for POSIX.1e ACL are set etc. + * Branding information is used for printing out the ACL (acl_to_text(3)), + * veryfying acl_set_whatever arguments (checking against setting + * bits that are valid only for NFSv4 in ACL branded as POSIX.1e) etc. + */ + +static acl_t +entry2acl(acl_entry_t entry) +{ + acl_t aclp; + + aclp = (acl_t)(((long)entry >> _ACL_T_ALIGNMENT_BITS) << _ACL_T_ALIGNMENT_BITS); + + return (aclp); +} + +/* + * Return brand of an ACL. + */ +int +_acl_brand(const acl_t acl) +{ + + return (acl->ats_brand); +} + +int +_entry_brand(const acl_entry_t entry) +{ + + return (_acl_brand(entry2acl(entry))); +} + +/* + * Return 1, iff branding ACL as "brand" is ok. + */ +int +_acl_brand_may_be(const acl_t acl, int brand) +{ + + if (_acl_brand(acl) == ACL_BRAND_UNKNOWN) + return (1); + + if (_acl_brand(acl) == brand) + return (1); + + return (0); +} + +int +_entry_brand_may_be(const acl_entry_t entry, int brand) +{ + + return (_acl_brand_may_be(entry2acl(entry), brand)); +} + +/* + * Brand ACL as "brand". + */ +void +_acl_brand_as(acl_t acl, int brand) +{ + + assert(_acl_brand_may_be(acl, brand)); + + acl->ats_brand = brand; +} + +void +_entry_brand_as(const acl_entry_t entry, int brand) +{ + + _acl_brand_as(entry2acl(entry), brand); +} + +int +_acl_type_not_valid_for_acl(const acl_t acl, acl_type_t type) +{ + + switch (_acl_brand(acl)) { + case ACL_BRAND_NFS4: + if (type == ACL_TYPE_NFS4) + return (0); + break; + + case ACL_BRAND_POSIX: + if (type == ACL_TYPE_ACCESS || type == ACL_TYPE_DEFAULT) + return (0); + break; + } + + return (-1); +} + +void +_acl_brand_from_type(acl_t acl, acl_type_t type) +{ + + switch (type) { + case ACL_TYPE_NFS4: + _acl_brand_as(acl, ACL_BRAND_NFS4); + break; + case ACL_TYPE_ACCESS: + case ACL_TYPE_DEFAULT: + _acl_brand_as(acl, ACL_BRAND_POSIX); + break; + default: + /* XXX: What to do here? */ + break; + } +} + +int +acl_get_brand_np(acl_t acl, int *brand_p) +{ + + if (acl == NULL || brand_p == NULL) { + errno = EINVAL; + return (-1); + } + *brand_p = _acl_brand(acl); + + return (0); +} +/*- + * Copyright (c) 2008, 2009 Edward Tomasz NapieraÅ‚a + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include "acl_support.h" + +/* + * An ugly detail of the implementation - fortunately not visible + * to the API users - is the "branding": libc needs to keep track + * of what "brand" ACL is: NFSv4, POSIX.1e or unknown. It happens + * automatically - for example, during acl_get_file(3) ACL gets + * branded according to the "type" argument; during acl_set_permset + * ACL, if its brand is unknown it gets branded as NFSv4 if any of the + * NFSv4 permissions that are not valid for POSIX.1e ACL are set etc. + * Branding information is used for printing out the ACL (acl_to_text(3)), + * veryfying acl_set_whatever arguments (checking against setting + * bits that are valid only for NFSv4 in ACL branded as POSIX.1e) etc. + */ + +static acl_t +entry2acl(acl_entry_t entry) +{ + acl_t aclp; + + aclp = (acl_t)(((long)entry >> _ACL_T_ALIGNMENT_BITS) << _ACL_T_ALIGNMENT_BITS); + + return (aclp); +} + +/* + * Return brand of an ACL. + */ +int +_acl_brand(const acl_t acl) +{ + + return (acl->ats_brand); +} + +int +_entry_brand(const acl_entry_t entry) +{ + + return (_acl_brand(entry2acl(entry))); +} + +/* + * Return 1, iff branding ACL as "brand" is ok. + */ +int +_acl_brand_may_be(const acl_t acl, int brand) +{ + + if (_acl_brand(acl) == ACL_BRAND_UNKNOWN) + return (1); + + if (_acl_brand(acl) == brand) + return (1); + + return (0); +} + +int +_entry_brand_may_be(const acl_entry_t entry, int brand) +{ + + return (_acl_brand_may_be(entry2acl(entry), brand)); +} + +/* + * Brand ACL as "brand". + */ +void +_acl_brand_as(acl_t acl, int brand) +{ + + assert(_acl_brand_may_be(acl, brand)); + + acl->ats_brand = brand; +} + +void +_entry_brand_as(const acl_entry_t entry, int brand) +{ + + _acl_brand_as(entry2acl(entry), brand); +} + +int +_acl_type_not_valid_for_acl(const acl_t acl, acl_type_t type) +{ + + switch (_acl_brand(acl)) { + case ACL_BRAND_NFS4: + if (type == ACL_TYPE_NFS4) + return (0); + break; + + case ACL_BRAND_POSIX: + if (type == ACL_TYPE_ACCESS || type == ACL_TYPE_DEFAULT) + return (0); + break; + } + + return (-1); +} + +void +_acl_brand_from_type(acl_t acl, acl_type_t type) +{ + + switch (type) { + case ACL_TYPE_NFS4: + _acl_brand_as(acl, ACL_BRAND_NFS4); + break; + case ACL_TYPE_ACCESS: + case ACL_TYPE_DEFAULT: + _acl_brand_as(acl, ACL_BRAND_POSIX); + break; + default: + /* XXX: What to do here? */ + break; + } +} + +int +acl_get_brand_np(acl_t acl, int *brand_p) +{ + + if (acl == NULL || brand_p == NULL) { + errno = EINVAL; + return (-1); + } + *brand_p = _acl_brand(acl); + + return (0); +} +/*- + * Copyright (c) 2008, 2009 Edward Tomasz NapieraÅ‚a + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 12:53:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61136106564A; Thu, 25 Jun 2009 12:53:51 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D6F88FC16; Thu, 25 Jun 2009 12:53:51 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PCrpO5051668; Thu, 25 Jun 2009 12:53:51 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PCrpJN051648; Thu, 25 Jun 2009 12:53:51 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200906251253.n5PCrpJN051648@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 25 Jun 2009 12:53: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: r194956 - in head/lib/libc: posix1e sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 12:53:51 -0000 Author: trasz Date: Thu Jun 25 12:53:50 2009 New Revision: 194956 URL: http://svn.freebsd.org/changeset/base/194956 Log: Bump manual page timestamps. Modified: head/lib/libc/posix1e/acl.3 head/lib/libc/posix1e/acl_add_flag_np.3 head/lib/libc/posix1e/acl_add_perm.3 head/lib/libc/posix1e/acl_clear_flags_np.3 head/lib/libc/posix1e/acl_create_entry.3 head/lib/libc/posix1e/acl_delete_entry.3 head/lib/libc/posix1e/acl_get.3 head/lib/libc/posix1e/acl_get_brand_np.3 head/lib/libc/posix1e/acl_get_entry_type_np.3 head/lib/libc/posix1e/acl_get_flag_np.3 head/lib/libc/posix1e/acl_get_flagset_np.3 head/lib/libc/posix1e/acl_is_trivial_np.3 head/lib/libc/posix1e/acl_set.3 head/lib/libc/posix1e/acl_set_entry_type_np.3 head/lib/libc/posix1e/acl_set_flagset_np.3 head/lib/libc/posix1e/acl_set_tag_type.3 head/lib/libc/posix1e/acl_strip_np.3 head/lib/libc/posix1e/acl_to_text.3 head/lib/libc/sys/pathconf.2 Modified: head/lib/libc/posix1e/acl.3 ============================================================================== --- head/lib/libc/posix1e/acl.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 18, 2002 +.Dd June 25, 2009 .Dt ACL 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_add_flag_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_add_flag_np.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_add_flag_np.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 10, 2001 +.Dd June 25, 2009 .Dt ACL_ADD_FLAG_NP 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_add_perm.3 ============================================================================== --- head/lib/libc/posix1e/acl_add_perm.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_add_perm.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 10, 2001 +.Dd June 25, 2009 .Dt ACL_ADD_PERM 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_clear_flags_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_clear_flags_np.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_clear_flags_np.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 10, 2001 +.Dd June 25, 2009 .Dt ACL_CLEAR_FLAGS_NP 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_create_entry.3 ============================================================================== --- head/lib/libc/posix1e/acl_create_entry.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_create_entry.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 16, 2001 +.Dd June 25, 2009 .Dt ACL_CREATE_ENTRY 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_delete_entry.3 ============================================================================== --- head/lib/libc/posix1e/acl_delete_entry.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_delete_entry.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 10, 2001 +.Dd June 25, 2009 .Dt ACL_DELETE_ENTRY 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_get.3 ============================================================================== --- head/lib/libc/posix1e/acl_get.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_get.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 29, 2002 +.Dd June 25, 2009 .Dt ACL_GET 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_get_brand_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_get_brand_np.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_get_brand_np.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 10, 2001 +.Dd June 25, 2009 .Dt ACL_GET_BRAND_NP 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_get_entry_type_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_get_entry_type_np.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_get_entry_type_np.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 10, 2001 +.Dd June 25, 2009 .Dt ACL_GET_ENTRY_TYPE_NP 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_get_flag_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_get_flag_np.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_get_flag_np.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 10, 2001 +.Dd June 25, 2009 .Dt ACL_GET_FLAG_NP 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_get_flagset_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_get_flagset_np.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_get_flagset_np.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 10, 2001 +.Dd June 25, 2009 .Dt ACL_GET_FLAGSET_NP 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_is_trivial_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_is_trivial_np.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_is_trivial_np.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 28, 2000 +.Dd June 25, 2009 .Dt ACL_STRIP_NP 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_set.3 ============================================================================== --- head/lib/libc/posix1e/acl_set.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_set.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 29, 2002 +.Dd June 25, 2009 .Dt ACL_SET 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_set_entry_type_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_set_entry_type_np.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_set_entry_type_np.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 10, 2001 +.Dd June 25, 2009 .Dt ACL_SET_ENTRY_TYPE_NP 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_set_flagset_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_set_flagset_np.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_set_flagset_np.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 10, 2001 +.Dd June 25, 2009 .Dt ACL_SET_FLAGSET_NP 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_set_tag_type.3 ============================================================================== --- head/lib/libc/posix1e/acl_set_tag_type.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_set_tag_type.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 10, 2001 +.Dd June 25, 2009 .Dt ACL_SET_TAG_TYPE 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_strip_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_strip_np.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_strip_np.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 28, 2000 +.Dd June 25, 2009 .Dt ACL_STRIP_NP 3 .Os .Sh NAME Modified: head/lib/libc/posix1e/acl_to_text.3 ============================================================================== --- head/lib/libc/posix1e/acl_to_text.3 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/posix1e/acl_to_text.3 Thu Jun 25 12:53:50 2009 (r194956) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 28, 2000 +.Dd June 25, 2009 .Dt ACL_TO_TEXT 3 .Os .Sh NAME Modified: head/lib/libc/sys/pathconf.2 ============================================================================== --- head/lib/libc/sys/pathconf.2 Thu Jun 25 12:46:59 2009 (r194955) +++ head/lib/libc/sys/pathconf.2 Thu Jun 25 12:53:50 2009 (r194956) @@ -28,7 +28,7 @@ .\" @(#)pathconf.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 5, 2007 +.Dd June 25, 2009 .Dt PATHCONF 2 .Os .Sh NAME From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 13:08:03 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3DA68106564A; Thu, 25 Jun 2009 13:08:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 293878FC13; Thu, 25 Jun 2009 13:08:03 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PD83kP052104; Thu, 25 Jun 2009 13:08:03 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PD83ur052097; Thu, 25 Jun 2009 13:08:03 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200906251308.n5PD83ur052097@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 25 Jun 2009 13:08: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: r194957 - head/lib/libc/posix1e X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 13:08:03 -0000 Author: trasz Date: Thu Jun 25 13:08:02 2009 New Revision: 194957 URL: http://svn.freebsd.org/changeset/base/194957 Log: Fix c194955 - somehow I managed all the new files, tripling their contents. Modified: head/lib/libc/posix1e/acl_add_flag_np.3 head/lib/libc/posix1e/acl_branding.c head/lib/libc/posix1e/acl_clear_flags_np.3 head/lib/libc/posix1e/acl_delete_flag_np.3 head/lib/libc/posix1e/acl_flag.c head/lib/libc/posix1e/acl_from_text_nfs4.c head/lib/libc/posix1e/acl_get_brand_np.3 head/lib/libc/posix1e/acl_get_entry_type_np.3 head/lib/libc/posix1e/acl_get_flag_np.3 head/lib/libc/posix1e/acl_get_flagset_np.3 head/lib/libc/posix1e/acl_is_trivial_np.3 head/lib/libc/posix1e/acl_set_entry_type_np.3 head/lib/libc/posix1e/acl_set_flagset_np.3 head/lib/libc/posix1e/acl_strip.c head/lib/libc/posix1e/acl_strip_np.3 head/lib/libc/posix1e/acl_support_nfs4.c head/lib/libc/posix1e/acl_to_text_nfs4.c Modified: head/lib/libc/posix1e/acl_add_flag_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_add_flag_np.3 Thu Jun 25 12:53:50 2009 (r194956) +++ head/lib/libc/posix1e/acl_add_flag_np.3 Thu Jun 25 13:08:02 2009 (r194957) @@ -96,199 +96,3 @@ The .Fn acl_add_flag_np function was written by .An Edward Tomasz Napierala Aq trasz@FreeBSD.org . -.\"- -.\" Copyright (c) 2008, 2009 Edward Tomasz Napierala -.\" 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 THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_ADD_FLAG_NP 3 -.Os -.Sh NAME -.Nm acl_add_flag_np -.Nd add flags to a flagset -.Sh LIBRARY -.Lb libc -.Sh SYNOPSIS -.In sys/types.h -.In sys/acl.h -.Ft int -.Fn acl_add_flag_np "acl_flagset_t flagset_d" "acl_flag_t flag" -.Sh DESCRIPTION -The -.Fn acl_add_flag_np -function -is a non-portable call that adds the flags contained in -.Fa flags -to the flagset -.Fa flagset_d . -.Pp -Note: it is not considered an error to attempt to add flags -that already exist in the flagset. -.Pp -Valid values are: -.Pp -.Bl -column -offset 3n "ACL_ENTRY_NO_PROPAGATE_INHERIT" -.It ACL_ENTRY_FILE_INHERIT Will be inherited by files. -.It ACL_ENTRY_DIRECTORY_INHERIT Will be inherited by directories. -.It ACL_ENTRY_NO_PROPAGATE_INHERIT Will not propagate. -.It ACL_ENTRY_INHERIT_ONLY Inherit-only. -.El -.Sh RETURN VALUES -.Rv -std acl_add_flag_np -.Sh ERRORS -The -.Fn acl_add_flag_np -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa flagset_d -is not a valid descriptor for a flagset within an ACL entry. -Argument -.Fa flag -does not contain a valid -.Vt acl_flag_t -value. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_clear_flags_np 3 , -.Xr acl_delete_flag_np 3 , -.Xr acl_get_flagset_np 3 , -.Xr acl_set_flagset_np 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_add_flag_np -function was added in -.Fx 8.0 . -.Sh AUTHORS -The -.Fn acl_add_flag_np -function was written by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . -.\"- -.\" Copyright (c) 2008, 2009 Edward Tomasz Napierala -.\" 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 THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_ADD_FLAG_NP 3 -.Os -.Sh NAME -.Nm acl_add_flag_np -.Nd add flags to a flagset -.Sh LIBRARY -.Lb libc -.Sh SYNOPSIS -.In sys/types.h -.In sys/acl.h -.Ft int -.Fn acl_add_flag_np "acl_flagset_t flagset_d" "acl_flag_t flag" -.Sh DESCRIPTION -The -.Fn acl_add_flag_np -function -is a non-portable call that adds the flags contained in -.Fa flags -to the flagset -.Fa flagset_d . -.Pp -Note: it is not considered an error to attempt to add flags -that already exist in the flagset. -.Pp -Valid values are: -.Pp -.Bl -column -offset 3n "ACL_ENTRY_NO_PROPAGATE_INHERIT" -.It ACL_ENTRY_FILE_INHERIT Will be inherited by files. -.It ACL_ENTRY_DIRECTORY_INHERIT Will be inherited by directories. -.It ACL_ENTRY_NO_PROPAGATE_INHERIT Will not propagate. -.It ACL_ENTRY_INHERIT_ONLY Inherit-only. -.El -.Sh RETURN VALUES -.Rv -std acl_add_flag_np -.Sh ERRORS -The -.Fn acl_add_flag_np -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa flagset_d -is not a valid descriptor for a flagset within an ACL entry. -Argument -.Fa flag -does not contain a valid -.Vt acl_flag_t -value. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_clear_flags_np 3 , -.Xr acl_delete_flag_np 3 , -.Xr acl_get_flagset_np 3 , -.Xr acl_set_flagset_np 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_add_flag_np -function was added in -.Fx 8.0 . -.Sh AUTHORS -The -.Fn acl_add_flag_np -function was written by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . Modified: head/lib/libc/posix1e/acl_branding.c ============================================================================== --- head/lib/libc/posix1e/acl_branding.c Thu Jun 25 12:53:50 2009 (r194956) +++ head/lib/libc/posix1e/acl_branding.c Thu Jun 25 13:08:02 2009 (r194957) @@ -164,335 +164,3 @@ acl_get_brand_np(acl_t acl, int *brand_p return (0); } -/*- - * Copyright (c) 2008, 2009 Edward Tomasz NapieraÅ‚a - * 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. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include "acl_support.h" - -/* - * An ugly detail of the implementation - fortunately not visible - * to the API users - is the "branding": libc needs to keep track - * of what "brand" ACL is: NFSv4, POSIX.1e or unknown. It happens - * automatically - for example, during acl_get_file(3) ACL gets - * branded according to the "type" argument; during acl_set_permset - * ACL, if its brand is unknown it gets branded as NFSv4 if any of the - * NFSv4 permissions that are not valid for POSIX.1e ACL are set etc. - * Branding information is used for printing out the ACL (acl_to_text(3)), - * veryfying acl_set_whatever arguments (checking against setting - * bits that are valid only for NFSv4 in ACL branded as POSIX.1e) etc. - */ - -static acl_t -entry2acl(acl_entry_t entry) -{ - acl_t aclp; - - aclp = (acl_t)(((long)entry >> _ACL_T_ALIGNMENT_BITS) << _ACL_T_ALIGNMENT_BITS); - - return (aclp); -} - -/* - * Return brand of an ACL. - */ -int -_acl_brand(const acl_t acl) -{ - - return (acl->ats_brand); -} - -int -_entry_brand(const acl_entry_t entry) -{ - - return (_acl_brand(entry2acl(entry))); -} - -/* - * Return 1, iff branding ACL as "brand" is ok. - */ -int -_acl_brand_may_be(const acl_t acl, int brand) -{ - - if (_acl_brand(acl) == ACL_BRAND_UNKNOWN) - return (1); - - if (_acl_brand(acl) == brand) - return (1); - - return (0); -} - -int -_entry_brand_may_be(const acl_entry_t entry, int brand) -{ - - return (_acl_brand_may_be(entry2acl(entry), brand)); -} - -/* - * Brand ACL as "brand". - */ -void -_acl_brand_as(acl_t acl, int brand) -{ - - assert(_acl_brand_may_be(acl, brand)); - - acl->ats_brand = brand; -} - -void -_entry_brand_as(const acl_entry_t entry, int brand) -{ - - _acl_brand_as(entry2acl(entry), brand); -} - -int -_acl_type_not_valid_for_acl(const acl_t acl, acl_type_t type) -{ - - switch (_acl_brand(acl)) { - case ACL_BRAND_NFS4: - if (type == ACL_TYPE_NFS4) - return (0); - break; - - case ACL_BRAND_POSIX: - if (type == ACL_TYPE_ACCESS || type == ACL_TYPE_DEFAULT) - return (0); - break; - } - - return (-1); -} - -void -_acl_brand_from_type(acl_t acl, acl_type_t type) -{ - - switch (type) { - case ACL_TYPE_NFS4: - _acl_brand_as(acl, ACL_BRAND_NFS4); - break; - case ACL_TYPE_ACCESS: - case ACL_TYPE_DEFAULT: - _acl_brand_as(acl, ACL_BRAND_POSIX); - break; - default: - /* XXX: What to do here? */ - break; - } -} - -int -acl_get_brand_np(acl_t acl, int *brand_p) -{ - - if (acl == NULL || brand_p == NULL) { - errno = EINVAL; - return (-1); - } - *brand_p = _acl_brand(acl); - - return (0); -} -/*- - * Copyright (c) 2008, 2009 Edward Tomasz NapieraÅ‚a - * 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. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include "acl_support.h" - -/* - * An ugly detail of the implementation - fortunately not visible - * to the API users - is the "branding": libc needs to keep track - * of what "brand" ACL is: NFSv4, POSIX.1e or unknown. It happens - * automatically - for example, during acl_get_file(3) ACL gets - * branded according to the "type" argument; during acl_set_permset - * ACL, if its brand is unknown it gets branded as NFSv4 if any of the - * NFSv4 permissions that are not valid for POSIX.1e ACL are set etc. - * Branding information is used for printing out the ACL (acl_to_text(3)), - * veryfying acl_set_whatever arguments (checking against setting - * bits that are valid only for NFSv4 in ACL branded as POSIX.1e) etc. - */ - -static acl_t -entry2acl(acl_entry_t entry) -{ - acl_t aclp; - - aclp = (acl_t)(((long)entry >> _ACL_T_ALIGNMENT_BITS) << _ACL_T_ALIGNMENT_BITS); - - return (aclp); -} - -/* - * Return brand of an ACL. - */ -int -_acl_brand(const acl_t acl) -{ - - return (acl->ats_brand); -} - -int -_entry_brand(const acl_entry_t entry) -{ - - return (_acl_brand(entry2acl(entry))); -} - -/* - * Return 1, iff branding ACL as "brand" is ok. - */ -int -_acl_brand_may_be(const acl_t acl, int brand) -{ - - if (_acl_brand(acl) == ACL_BRAND_UNKNOWN) - return (1); - - if (_acl_brand(acl) == brand) - return (1); - - return (0); -} - -int -_entry_brand_may_be(const acl_entry_t entry, int brand) -{ - - return (_acl_brand_may_be(entry2acl(entry), brand)); -} - -/* - * Brand ACL as "brand". - */ -void -_acl_brand_as(acl_t acl, int brand) -{ - - assert(_acl_brand_may_be(acl, brand)); - - acl->ats_brand = brand; -} - -void -_entry_brand_as(const acl_entry_t entry, int brand) -{ - - _acl_brand_as(entry2acl(entry), brand); -} - -int -_acl_type_not_valid_for_acl(const acl_t acl, acl_type_t type) -{ - - switch (_acl_brand(acl)) { - case ACL_BRAND_NFS4: - if (type == ACL_TYPE_NFS4) - return (0); - break; - - case ACL_BRAND_POSIX: - if (type == ACL_TYPE_ACCESS || type == ACL_TYPE_DEFAULT) - return (0); - break; - } - - return (-1); -} - -void -_acl_brand_from_type(acl_t acl, acl_type_t type) -{ - - switch (type) { - case ACL_TYPE_NFS4: - _acl_brand_as(acl, ACL_BRAND_NFS4); - break; - case ACL_TYPE_ACCESS: - case ACL_TYPE_DEFAULT: - _acl_brand_as(acl, ACL_BRAND_POSIX); - break; - default: - /* XXX: What to do here? */ - break; - } -} - -int -acl_get_brand_np(acl_t acl, int *brand_p) -{ - - if (acl == NULL || brand_p == NULL) { - errno = EINVAL; - return (-1); - } - *brand_p = _acl_brand(acl); - - return (0); -} Modified: head/lib/libc/posix1e/acl_clear_flags_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_clear_flags_np.3 Thu Jun 25 12:53:50 2009 (r194956) +++ head/lib/libc/posix1e/acl_clear_flags_np.3 Thu Jun 25 13:08:02 2009 (r194957) @@ -77,161 +77,3 @@ The .Fn acl_clear_flags_np function was written by .An Edward Tomasz Napierala Aq trasz@FreeBSD.org . -.\"- -.\" Copyright (c) 2008, 2009 Edward Tomasz Napierala -.\" 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 THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_CLEAR_FLAGS_NP 3 -.Os -.Sh NAME -.Nm acl_clear_flags_np -.Nd clear flags from a flagset -.Sh LIBRARY -.Lb libc -.Sh SYNOPSIS -.In sys/types.h -.In sys/acl.h -.Ft int -.Fn acl_clear_flags_np "acl_flagset_t flagset_d" -.Sh DESCRIPTION -The -.Fn acl_clear_flags_np -function -is a non-portable call that clears all flags from flagset -.Fa flagset_d . -.Sh RETURN VALUES -.Rv -std acl_clear_flags_np -.Sh ERRORS -The -.Fn acl_clear_flags_np -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa flagset_d -is not a valid descriptor for a flagset. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_add_flag_np 3 , -.Xr acl_delete_flag_np 3 , -.Xr acl_get_flagset_np 3 , -.Xr acl_set_flagset_np 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_clear_flags_np -function was added in -.Fx 5.0 . -.Sh AUTHORS -The -.Fn acl_clear_flags_np -function was written by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . -.\"- -.\" Copyright (c) 2008, 2009 Edward Tomasz Napierala -.\" 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 THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_CLEAR_FLAGS_NP 3 -.Os -.Sh NAME -.Nm acl_clear_flags_np -.Nd clear flags from a flagset -.Sh LIBRARY -.Lb libc -.Sh SYNOPSIS -.In sys/types.h -.In sys/acl.h -.Ft int -.Fn acl_clear_flags_np "acl_flagset_t flagset_d" -.Sh DESCRIPTION -The -.Fn acl_clear_flags_np -function -is a non-portable call that clears all flags from flagset -.Fa flagset_d . -.Sh RETURN VALUES -.Rv -std acl_clear_flags_np -.Sh ERRORS -The -.Fn acl_clear_flags_np -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa flagset_d -is not a valid descriptor for a flagset. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_add_flag_np 3 , -.Xr acl_delete_flag_np 3 , -.Xr acl_get_flagset_np 3 , -.Xr acl_set_flagset_np 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_clear_flags_np -function was added in -.Fx 5.0 . -.Sh AUTHORS -The -.Fn acl_clear_flags_np -function was written by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . Modified: head/lib/libc/posix1e/acl_delete_flag_np.3 ============================================================================== --- head/lib/libc/posix1e/acl_delete_flag_np.3 Thu Jun 25 12:53:50 2009 (r194956) +++ head/lib/libc/posix1e/acl_delete_flag_np.3 Thu Jun 25 13:08:02 2009 (r194957) @@ -82,171 +82,3 @@ The .Fn acl_delete_flag_np function was written by .An Edward Tomasz Napierala Aq trasz@FreeBSD.org . -.\"- -.\" Copyright (c) 2008, 2009 Edward Tomasz Napierala -.\" 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 THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_DELETE_FLAG_NP 3 -.Os -.Sh NAME -.Nm acl_delete_flag_np -.Nd delete flags from a flagset -.Sh LIBRARY -.Lb libc -.Sh SYNOPSIS -.In sys/types.h -.In sys/acl.h -.Ft int -.Fn acl_delete_flag_np "acl_flagset_t flagset_d" "acl_flag_t flag" -.Sh DESCRIPTION -The -.Fn acl_delete_flag_np -function -is a non-portable call that removes specific flags from flagset -.Fa flags . -.Sh RETURN VALUES -.Rv -std acl_delete_flag_np -.Sh ERRORS -The -.Fn acl_delete_flag_np -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa flagset_d -is not a valid descriptor for a flagset. -Argument -.Fa flag -does not contain a valid -.Vt acl_flag_t -value. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_add_flag_np 3 , -.Xr acl_clear_flag_nps 3 , -.Xr acl_get_flagset_np 3 , -.Xr acl_set_flagset_np 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_delete_flag_np -function was added in -.Fx 8.0 . -.Sh AUTHORS -The -.Fn acl_delete_flag_np -function was written by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . -.\"- -.\" Copyright (c) 2008, 2009 Edward Tomasz Napierala -.\" 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 THE VOICES IN HIS HEAD BE -.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd March 10, 2001 -.Dt ACL_DELETE_FLAG_NP 3 -.Os -.Sh NAME -.Nm acl_delete_flag_np -.Nd delete flags from a flagset -.Sh LIBRARY -.Lb libc -.Sh SYNOPSIS -.In sys/types.h -.In sys/acl.h -.Ft int -.Fn acl_delete_flag_np "acl_flagset_t flagset_d" "acl_flag_t flag" -.Sh DESCRIPTION -The -.Fn acl_delete_flag_np -function -is a non-portable call that removes specific flags from flagset -.Fa flags . -.Sh RETURN VALUES -.Rv -std acl_delete_flag_np -.Sh ERRORS -The -.Fn acl_delete_flag_np -function fails if: -.Bl -tag -width Er -.It Bq Er EINVAL -Argument -.Fa flagset_d -is not a valid descriptor for a flagset. -Argument -.Fa flag -does not contain a valid -.Vt acl_flag_t -value. -.El -.Sh SEE ALSO -.Xr acl 3 , -.Xr acl_add_flag_np 3 , -.Xr acl_clear_flag_nps 3 , -.Xr acl_get_flagset_np 3 , -.Xr acl_set_flagset_np 3 , -.Xr posix1e 3 -.Sh STANDARDS -POSIX.1e is described in IEEE POSIX.1e draft 17. -.Sh HISTORY -POSIX.1e support was introduced in -.Fx 4.0 . -The -.Fn acl_delete_flag_np -function was added in -.Fx 8.0 . -.Sh AUTHORS -The -.Fn acl_delete_flag_np -function was written by -.An Edward Tomasz Napierala Aq trasz@FreeBSD.org . Modified: head/lib/libc/posix1e/acl_flag.c ============================================================================== --- head/lib/libc/posix1e/acl_flag.c Thu Jun 25 12:53:50 2009 (r194956) +++ head/lib/libc/posix1e/acl_flag.c Thu Jun 25 13:08:02 2009 (r194957) @@ -153,313 +153,3 @@ acl_set_flagset_np(acl_entry_t entry_d, return (0); } -/*- - * Copyright (c) 2008, 2009 Edward Tomasz NapieraÅ‚a - * 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. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include "acl_support.h" - -static int -_flag_is_invalid(acl_flag_t flag) -{ - - if ((flag & ACL_FLAGS_BITS) == flag) - return (0); - - errno = EINVAL; - - return (1); -} - -int -acl_add_flag_np(acl_flagset_t flagset_d, acl_flag_t flag) -{ - - if (flagset_d == NULL) { - errno = EINVAL; - return (-1); - } - - if (_flag_is_invalid(flag)) - return (-1); - - *flagset_d |= flag; - - return (0); -} - -int -acl_clear_flags_np(acl_flagset_t flagset_d) -{ - - if (flagset_d == NULL) { - errno = EINVAL; - return (-1); - } - - *flagset_d |= 0; - - return (0); -} - -int -acl_delete_flag_np(acl_flagset_t flagset_d, acl_flag_t flag) -{ - - if (flagset_d == NULL) { - errno = EINVAL; - return (-1); - } - - if (_flag_is_invalid(flag)) - return (-1); - - *flagset_d &= ~flag; - - return (0); -} - -int -acl_get_flag_np(acl_flagset_t flagset_d, acl_flag_t flag) -{ - - if (flagset_d == NULL) { - errno = EINVAL; - return (-1); - } - - if (_flag_is_invalid(flag)) - return (-1); - - if (*flagset_d & flag) - return (1); - - return (0); -} - -int -acl_get_flagset_np(acl_entry_t entry_d, acl_flagset_t *flagset_p) -{ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 13:15:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CC2B1065670; Thu, 25 Jun 2009 13:15:21 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15EDF8FC08; Thu, 25 Jun 2009 13:15:21 +0000 (UTC) (envelope-from n_hibma@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PDFKgg052292; Thu, 25 Jun 2009 13:15:20 GMT (envelope-from n_hibma@svn.freebsd.org) Received: (from n_hibma@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PDFK71052290; Thu, 25 Jun 2009 13:15:20 GMT (envelope-from n_hibma@svn.freebsd.org) Message-Id: <200906251315.n5PDFK71052290@svn.freebsd.org> From: Nick Hibma Date: Thu, 25 Jun 2009 13:15: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: r194958 - head/tools/tools/nanobsd X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 13:15:27 -0000 Author: n_hibma Date: Thu Jun 25 13:15:20 2009 New Revision: 194958 URL: http://svn.freebsd.org/changeset/base/194958 Log: - Make pprint print through fd 3, so it can be used in customisation functions to print something to the screen. - Prefix each line with the running time (bikeshed). Submitted by: Rick van der Zwet (Wireless Leiden) Modified: head/tools/tools/nanobsd/nanobsd.sh Modified: head/tools/tools/nanobsd/nanobsd.sh ============================================================================== --- head/tools/tools/nanobsd/nanobsd.sh Thu Jun 25 13:08:02 2009 (r194957) +++ head/tools/tools/nanobsd/nanobsd.sh Thu Jun 25 13:15:20 2009 (r194958) @@ -664,7 +664,8 @@ late_customize_cmd () { # Print $2 at level $1. pprint() { if [ "$1" -le $PPLEVEL ]; then - printf "%.${1}s %s\n" "#####" "$2" + runtime=$(( `date +%s` - $NANO_STARTTIME )) + printf "%s %.${1}s %s\n" "`date -u -r $runtime +%H:%M:%S`" "#####" "$2" 1>&3 fi } @@ -806,6 +807,10 @@ export NANO_BOOTLOADER ####################################################################### # And then it is as simple as that... +# File descriptor 3 is used for logging output, see pprint +exec 3>&1 + +NANO_STARTTIME=`date +%s` pprint 1 "NanoBSD image ${NANO_NAME} build starting" if $do_world ; then From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 13:36:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F31E106564A; Thu, 25 Jun 2009 13:36:58 +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 3D7708FC1A; Thu, 25 Jun 2009 13:36:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PDawU0052803; Thu, 25 Jun 2009 13:36:58 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PDawU8052801; Thu, 25 Jun 2009 13:36:58 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906251336.n5PDawU8052801@svn.freebsd.org> From: John Baldwin Date: Thu, 25 Jun 2009 13:36: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: r194959 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 13:36:58 -0000 Author: jhb Date: Thu Jun 25 13:36:57 2009 New Revision: 194959 URL: http://svn.freebsd.org/changeset/base/194959 Log: Tweak the oshmctl() compile fix: convert the K&R definition to ANSI. Modified: head/sys/kern/sysv_shm.c Modified: head/sys/kern/sysv_shm.c ============================================================================== --- head/sys/kern/sysv_shm.c Thu Jun 25 13:15:20 2009 (r194958) +++ head/sys/kern/sysv_shm.c Thu Jun 25 13:36:57 2009 (r194959) @@ -116,10 +116,6 @@ struct shmmap_state { int shmid; }; -#if defined(__i386__) && (defined(COMPAT_FREEBSD4) || defined(COMPAT_43)) -struct oshmctl_args; -static int oshmctl(struct thread *td, struct oshmctl_args *uap); -#endif static void shm_deallocate_segment(struct shmid_kernel *); static int shm_find_segment_by_key(key_t); static struct shmid_kernel *shm_find_segment_by_shmid(int); @@ -901,9 +897,7 @@ struct oshmctl_args { }; static int -oshmctl(td, uap) - struct thread *td; - struct oshmctl_args *uap; +oshmctl(struct thread *td, struct oshmctl_args *uap) { #ifdef COMPAT_43 int error = 0; From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 13:43:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 100C9106568F; Thu, 25 Jun 2009 13:43:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id 13C768FC19; Thu, 25 Jun 2009 13:43:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from [212.86.226.226] (account mav@alkar.net HELO mavbook.mavhome.dp.ua) by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9) with ESMTPSA id 246816997; Thu, 25 Jun 2009 16:43:50 +0300 Message-ID: <4A437F11.6000708@FreeBSD.org> Date: Thu, 25 Jun 2009 16:43:45 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.21 (X11/20090405) MIME-Version: 1.0 To: Rafal Jaworowski References: <200906241538.n5OFcHwp018860@svn.freebsd.org> <4A434F2C.1020005@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, =?windows-1252?Q?Piotr_Zie=3Bcik?= Subject: Re: svn commit: r194844 - in head/sys: conf dev/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 13:43:56 -0000 Rafal Jaworowski wrote: > On 2009-06-25, at 12:19, Alexander Motin wrote: >> Rafal Jaworowski wrote: >>> ===================================================================== >>> --- head/sys/conf/files Wed Jun 24 15:33:33 2009 (r194843) >>> +++ head/sys/conf/files Wed Jun 24 15:38:17 2009 (r194844) >>> @@ -491,12 +491,12 @@ dev/ata/ata_if.m optional ata | atacore >>> dev/ata/ata-all.c optional ata | atacore >>> dev/ata/ata-lowlevel.c optional ata | atacore >>> dev/ata/ata-queue.c optional ata | atacore >>> +dev/ata/ata-dma.c optional ata | atadma >>> +dev/ata/ata-sata.c optional ata | atasata >> >> What is atadma and atasata here, kernel options? What for are they >> needed? You will not be able to build most of drivers without them, >> while enabling them for others will not give you any benefit, just >> bigger code size. I think dependency must be reviewed there. > > This was supposed to follow the fine grained kernel options route for > various ata subsystems. Both ata-dma.c and ata-sata.c seem orthogonal to > the rest of the ata framework (think ata controller without DMA, which > is often seen in embedded). They could also be made mandatory under > atacore, I have no problem with this approach too. There is move for fine-grained PCI drivers modularization. But ata-dma.c and ata-sata.c are not a drivers and are not a kernel modules. They are not orthogonal, but mandatory requisites of some drivers (all PCI, plus may be some others). All kernel build dependencies must be tracked without user influence. So please, or, as you said, add them both to the atacore, or, as I would prefer, ata-dma.c to atapci and any other requiring drivers, and ata-sata.c to atacore. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 13:56:25 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BAEEA106566C; Thu, 25 Jun 2009 13:56:25 +0000 (UTC) (envelope-from gnn@neville-neil.com) Received: from proxy.meer.net (proxy.meer.net [64.13.141.13]) by mx1.freebsd.org (Postfix) with ESMTP id 954C78FC12; Thu, 25 Jun 2009 13:56:25 +0000 (UTC) (envelope-from gnn@neville-neil.com) Received: from mail.meer.net (mail.meer.net [64.13.141.3]) by proxy.meer.net (8.14.3/8.14.3) with ESMTP id n5PDSQQK040488; Thu, 25 Jun 2009 06:29:19 -0700 (PDT) (envelope-from gnn@neville-neil.com) Received: from mail2.meer.net (mail2.meer.net [64.13.141.16]) by mail.meer.net (8.13.3/8.13.3/meer) with ESMTP id n5PDInD0045489; Thu, 25 Jun 2009 06:18:49 -0700 (PDT) (envelope-from gnn@neville-neil.com) Received: from gnnmac.hudson-trading.com (209.249.190.8.available.above.net [209.249.190.8] (may be forged)) (authenticated bits=0) by mail2.meer.net (8.14.1/8.14.3) with ESMTP id n5PDIlN3013139 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Thu, 25 Jun 2009 06:18:48 -0700 (PDT) (envelope-from gnn@neville-neil.com) Message-Id: <29388187-3617-40D4-ACDA-DECD97F8274F@neville-neil.com> From: George Neville-Neil To: Navdeep Parhar In-Reply-To: <200906242153.n5OLrPEV030916@svn.freebsd.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Date: Thu, 25 Jun 2009 09:18:47 -0400 References: <200906242153.n5OLrPEV030916@svn.freebsd.org> X-Mailer: Apple Mail (2.935.3) X-Spam-Score: undef - spam scanning disabled X-CanIt-Geo: ip=64.13.141.3; country=US; region=CA; city=Mountain View; latitude=37.3974; longitude=-122.0732; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.3974,-122.0732&z=6 X-CanItPRO-Stream: default X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 64.13.141.13 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r194918 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 13:56:26 -0000 On Jun 24, 2009, at 17:53 , Navdeep Parhar wrote: > Author: np > Date: Wed Jun 24 21:53:25 2009 > New Revision: 194918 > URL: http://svn.freebsd.org/changeset/base/194918 > > Log: > Add 10Gbase-T to known ethernet media types. > > Approved by: gnn (mentor) > MFC after: 1 week. > > Modified: > head/sys/net/if_media.h > > Modified: head/sys/net/if_media.h > = > = > = > = > = > = > = > = > ====================================================================== > --- head/sys/net/if_media.h Wed Jun 24 21:51:42 2009 (r194917) > +++ head/sys/net/if_media.h Wed Jun 24 21:53:25 2009 (r194918) > @@ -149,6 +149,7 @@ uint64_t ifmedia_baudrate(int); > #define IFM_10G_TWINAX_LONG 23 /* 10GBase Twinax Long copper */ > #define IFM_10G_LRM 24 /* 10GBase-LRM 850nm Multi-mode */ > #define IFM_UNKNOWN 25 /* media types not defined yet */ > +#define IFM_10G_T 26 /* 10GBase-T - RJ45 */ > > > /* note 31 is the max! */ > @@ -358,6 +359,7 @@ struct ifmedia_description { > { IFM_10G_TWINAX, "10Gbase-Twinax" }, \ > { IFM_10G_TWINAX_LONG, "10Gbase-Twinax-Long" }, \ > { IFM_UNKNOWN, "Unknown" }, \ > + { IFM_10G_T, "10Gbase-T" }, \ > { 0, NULL }, \ > } > > @@ -615,6 +617,7 @@ struct ifmedia_baudrate { > { IFM_ETHER | IFM_10G_TWINAX, IF_Gbps(10ULL) }, \ > { IFM_ETHER | IFM_10G_TWINAX_LONG, IF_Gbps(10ULL) }, \ > { IFM_ETHER | IFM_10G_LRM, IF_Gbps(10ULL) }, \ > + { IFM_ETHER | IFM_10G_T, IF_Gbps(10ULL) }, \ > \ > { IFM_TOKEN | IFM_TOK_STP4, IF_Mbps(4) }, \ > { IFM_TOKEN | IFM_TOK_STP16, IF_Mbps(16) }, \ Howdy, John Baldwin pointed out to me that UNKNOWN really should have been pushed up to the end. Can you make a small patch and send it to me? Increase the number and move its string to the end of the array? Best, George From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 14:15:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 761E61065676; Thu, 25 Jun 2009 14:15:46 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6495D8FC1B; Thu, 25 Jun 2009 14:15:46 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PEFkIk053647; Thu, 25 Jun 2009 14:15:46 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PEFkTu053645; Thu, 25 Jun 2009 14:15:46 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200906251415.n5PEFkTu053645@svn.freebsd.org> From: Robert Noland Date: Thu, 25 Jun 2009 14:15: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: r194960 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 14:15:46 -0000 Author: rnoland Date: Thu Jun 25 14:15:45 2009 New Revision: 194960 URL: http://svn.freebsd.org/changeset/base/194960 Log: Ensure that we always hold the lock when calling vblank_disable_fn() MFC after: 3 days Modified: head/sys/dev/drm/drm_irq.c Modified: head/sys/dev/drm/drm_irq.c ============================================================================== --- head/sys/dev/drm/drm_irq.c Thu Jun 25 13:36:57 2009 (r194959) +++ head/sys/dev/drm/drm_irq.c Thu Jun 25 14:15:45 2009 (r194960) @@ -70,6 +70,9 @@ static void vblank_disable_fn(void *arg) struct drm_device *dev = (struct drm_device *)arg; int i; + /* Make sure that we are called with the lock held */ + mtx_assert(&dev->vbl_lock, MA_OWNED); + if (callout_pending(&dev->vblank_disable_timer)) { /* callout was reset */ return; @@ -109,7 +112,9 @@ void drm_vblank_cleanup(struct drm_devic callout_drain(&dev->vblank_disable_timer); + DRM_SPINLOCK(&dev->vbl_lock); vblank_disable_fn((void *)dev); + DRM_SPINUNLOCK(&dev->vbl_lock); free(dev->vblank, DRM_MEM_DRIVER); From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 14:44:01 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 047DD1065689; Thu, 25 Jun 2009 14:44:01 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E0DC18FC12; Thu, 25 Jun 2009 14:44:00 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PEi0OB054383; Thu, 25 Jun 2009 14:44:00 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PEi0F5054380; Thu, 25 Jun 2009 14:44:00 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906251444.n5PEi0F5054380@svn.freebsd.org> From: Robert Watson Date: Thu, 25 Jun 2009 14:44: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: r194962 - head/sys/netinet X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 14:44:03 -0000 Author: rwatson Date: Thu Jun 25 14:44:00 2009 New Revision: 194962 URL: http://svn.freebsd.org/changeset/base/194962 Log: Initialize in_ifaddr_lock using RW_SYSINIT() instead of in ip_init(), so that it doesn't run multiple times if VIMAGE is being used. Discussed with: bz MFC after: 6 weeks Modified: head/sys/netinet/in_var.h head/sys/netinet/ip_input.c Modified: head/sys/netinet/in_var.h ============================================================================== --- head/sys/netinet/in_var.h Thu Jun 25 14:41:42 2009 (r194961) +++ head/sys/netinet/in_var.h Thu Jun 25 14:44:00 2009 (r194962) @@ -116,7 +116,6 @@ extern u_long in_ifaddrhmask; /* mask extern struct rwlock in_ifaddr_lock; -#define IN_IFADDR_LOCK_INIT() rw_init(&in_ifaddr_lock, "in_ifaddr_lock") #define IN_IFADDR_LOCK_ASSERT() rw_assert(&in_ifaddr_lock, RA_LOCKED) #define IN_IFADDR_RLOCK() rw_rlock(&in_ifaddr_lock) #define IN_IFADDR_RLOCK_ASSERT() rw_assert(&in_ifaddr_lock, RA_RLOCKED) Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Thu Jun 25 14:41:42 2009 (r194961) +++ head/sys/netinet/ip_input.c Thu Jun 25 14:44:00 2009 (r194962) @@ -117,7 +117,9 @@ static int maxfragsperpacket; int ipstealth; static int nipq; /* Total # of reass queues */ #endif + struct rwlock in_ifaddr_lock; +RW_SYSINIT(in_ifaddr_lock, &in_ifaddr_lock, "in_ifaddr_lock"); SYSCTL_V_INT(V_NET, vnet_inet, _net_inet_ip, IPCTL_FORWARDING, forwarding, CTLFLAG_RW, ipforwarding, 0, @@ -326,7 +328,6 @@ ip_init(void) TAILQ_INIT(&V_in_ifaddrhead); V_in_ifaddrhashtbl = hashinit(INADDR_NHASH, M_IFADDR, &V_in_ifaddrhmask); - IN_IFADDR_LOCK_INIT(); /* Initialize IP reassembly queue. */ for (i = 0; i < IPREASS_NHASH; i++) From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 15:30:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8AEDC1065670; Thu, 25 Jun 2009 15:30:26 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6DBD88FC1B; Thu, 25 Jun 2009 15:30:26 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PFUPvm055293; Thu, 25 Jun 2009 15:30:25 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PFUP0v055291; Thu, 25 Jun 2009 15:30:25 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200906251530.n5PFUP0v055291@svn.freebsd.org> From: Robert Noland Date: Thu, 25 Jun 2009 15:30: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: r194963 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 15:30:27 -0000 Author: rnoland Date: Thu Jun 25 15:30:25 2009 New Revision: 194963 URL: http://svn.freebsd.org/changeset/base/194963 Log: Additional vblank cleanups. Use the vbl_lock when maniputlating the refcount. Eventually I want to convert this to use our internal refcount code. Continue to use atomic ops for manipulating vblank count since we access it often just for reading. MFC after: 3 days Modified: head/sys/dev/drm/drm_irq.c Modified: head/sys/dev/drm/drm_irq.c ============================================================================== --- head/sys/dev/drm/drm_irq.c Thu Jun 25 14:44:00 2009 (r194962) +++ head/sys/dev/drm/drm_irq.c Thu Jun 25 15:30:25 2009 (r194963) @@ -136,13 +136,14 @@ int drm_vblank_init(struct drm_device *d DRM_DEBUG("\n"); /* Zero per-crtc vblank stuff */ + DRM_SPINLOCK(&dev->vbl_lock); for (i = 0; i < num_crtcs; i++) { DRM_INIT_WAITQUEUE(&dev->vblank[i].queue); - atomic_set(&dev->vblank[i].count, 0); - atomic_set(&dev->vblank[i].refcount, 0); + dev->vblank[i].refcount = 0; + atomic_set_rel_32(&dev->vblank[i].count, 0); } - dev->vblank_disable_allowed = 0; + DRM_SPINUNLOCK(&dev->vbl_lock); return 0; @@ -275,7 +276,7 @@ int drm_control(struct drm_device *dev, u32 drm_vblank_count(struct drm_device *dev, int crtc) { - return atomic_read(&dev->vblank[crtc].count); + return atomic_load_acq_32(&dev->vblank[crtc].count); } static void drm_update_vblank_count(struct drm_device *dev, int crtc) @@ -301,45 +302,44 @@ static void drm_update_vblank_count(stru DRM_DEBUG("enabling vblank interrupts on crtc %d, missed %d\n", crtc, diff); - atomic_add(diff, &dev->vblank[crtc].count); + atomic_add_rel_32(&dev->vblank[crtc].count, diff); } int drm_vblank_get(struct drm_device *dev, int crtc) { int ret = 0; - DRM_SPINLOCK(&dev->vbl_lock); + /* Make sure that we are called with the lock held */ + mtx_assert(&dev->vbl_lock, MA_OWNED); + /* Going from 0->1 means we have to enable interrupts again */ - atomic_add_acq_int(&dev->vblank[crtc].refcount, 1); - if (dev->vblank[crtc].refcount == 1 && + if (++dev->vblank[crtc].refcount == 1 && !dev->vblank[crtc].enabled) { ret = dev->driver->enable_vblank(dev, crtc); DRM_DEBUG("enabling vblank on crtc %d, ret: %d\n", crtc, ret); if (ret) - atomic_dec(&dev->vblank[crtc].refcount); + --dev->vblank[crtc].refcount; else { dev->vblank[crtc].enabled = 1; drm_update_vblank_count(dev, crtc); } } - DRM_SPINUNLOCK(&dev->vbl_lock); return ret; } void drm_vblank_put(struct drm_device *dev, int crtc) { - KASSERT(atomic_read(&dev->vblank[crtc].refcount) > 0, + /* Make sure that we are called with the lock held */ + mtx_assert(&dev->vbl_lock, MA_OWNED); + + KASSERT(dev->vblank[crtc].refcount > 0, ("invalid refcount")); /* Last user schedules interrupt disable */ - atomic_subtract_acq_int(&dev->vblank[crtc].refcount, 1); - - DRM_SPINLOCK(&dev->vbl_lock); - if (dev->vblank[crtc].refcount == 0) + if (--dev->vblank[crtc].refcount == 0) callout_reset(&dev->vblank_disable_timer, 5 * DRM_HZ, (timeout_t *)vblank_disable_fn, (void *)dev); - DRM_SPINUNLOCK(&dev->vbl_lock); } int drm_modeset_ctl(struct drm_device *dev, void *data, @@ -348,13 +348,11 @@ int drm_modeset_ctl(struct drm_device *d struct drm_modeset_ctl *modeset = data; int crtc, ret = 0; - DRM_DEBUG("num_crtcs=%d\n", dev->num_crtcs); /* If drm_vblank_init() hasn't been called yet, just no-op */ if (!dev->num_crtcs) goto out; crtc = modeset->crtc; - DRM_DEBUG("crtc=%d\n", crtc); if (crtc >= dev->num_crtcs) { ret = EINVAL; goto out; @@ -369,25 +367,25 @@ int drm_modeset_ctl(struct drm_device *d */ switch (modeset->cmd) { case _DRM_PRE_MODESET: - DRM_DEBUG("pre-modeset\n"); + DRM_DEBUG("pre-modeset, crtc %d\n", crtc); + DRM_SPINLOCK(&dev->vbl_lock); if (!dev->vblank[crtc].inmodeset) { dev->vblank[crtc].inmodeset = 0x1; if (drm_vblank_get(dev, crtc) == 0) dev->vblank[crtc].inmodeset |= 0x2; } + DRM_SPINUNLOCK(&dev->vbl_lock); break; case _DRM_POST_MODESET: - DRM_DEBUG("post-modeset\n"); + DRM_DEBUG("post-modeset, crtc %d\n", crtc); + DRM_SPINLOCK(&dev->vbl_lock); if (dev->vblank[crtc].inmodeset) { - DRM_SPINLOCK(&dev->vbl_lock); - dev->vblank_disable_allowed = 1; - DRM_SPINUNLOCK(&dev->vbl_lock); - if (dev->vblank[crtc].inmodeset & 0x2) drm_vblank_put(dev, crtc); - dev->vblank[crtc].inmodeset = 0; } + dev->vblank_disable_allowed = 1; + DRM_SPINUNLOCK(&dev->vbl_lock); break; default: ret = EINVAL; @@ -421,7 +419,9 @@ int drm_wait_vblank(struct drm_device *d if (crtc >= dev->num_crtcs) return EINVAL; + DRM_SPINLOCK(&dev->vbl_lock); ret = drm_vblank_get(dev, crtc); + DRM_SPINUNLOCK(&dev->vbl_lock); if (ret) { DRM_ERROR("failed to acquire vblank counter, %d\n", ret); return ret; @@ -478,13 +478,16 @@ int drm_wait_vblank(struct drm_device *d } done: + DRM_SPINLOCK(&dev->vbl_lock); drm_vblank_put(dev, crtc); + DRM_SPINUNLOCK(&dev->vbl_lock); + return ret; } void drm_handle_vblank(struct drm_device *dev, int crtc) { - atomic_inc(&dev->vblank[crtc].count); + atomic_add_rel_32(&dev->vblank[crtc].count, 1); DRM_WAKEUP(&dev->vblank[crtc].queue); } From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 15:36:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BBDB71065675; Thu, 25 Jun 2009 15:36:11 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A9CF68FC16; Thu, 25 Jun 2009 15:36:11 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PFaBxC055506; Thu, 25 Jun 2009 15:36:11 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PFaBbk055504; Thu, 25 Jun 2009 15:36:11 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200906251536.n5PFaBbk055504@svn.freebsd.org> From: Robert Noland Date: Thu, 25 Jun 2009 15:36: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: r194965 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 15:36:12 -0000 Author: rnoland Date: Thu Jun 25 15:36:11 2009 New Revision: 194965 URL: http://svn.freebsd.org/changeset/base/194965 Log: Fix one use of atomic for refcount missed in last commit. MFC after: 3 days Modified: head/sys/dev/drm/drm_irq.c Modified: head/sys/dev/drm/drm_irq.c ============================================================================== --- head/sys/dev/drm/drm_irq.c Thu Jun 25 15:34:17 2009 (r194964) +++ head/sys/dev/drm/drm_irq.c Thu Jun 25 15:36:11 2009 (r194965) @@ -89,7 +89,7 @@ static void vblank_disable_fn(void *arg) return; for (i = 0; i < dev->num_crtcs; i++) { - if (atomic_read(&dev->vblank[i].refcount) == 0 && + if (dev->vblank[i].refcount == 0 && dev->vblank[i].enabled && !dev->vblank[i].inmodeset) { DRM_DEBUG("disabling vblank on crtc %d\n", i); dev->vblank[i].last = From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 15:47:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43D87106564A; Thu, 25 Jun 2009 15:47:33 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 31B098FC08; Thu, 25 Jun 2009 15:47:33 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PFlWHK055772; Thu, 25 Jun 2009 15:47:32 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PFlWmn055770; Thu, 25 Jun 2009 15:47:32 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200906251547.n5PFlWmn055770@svn.freebsd.org> From: Robert Noland Date: Thu, 25 Jun 2009 15:47: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: r194966 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 15:47:33 -0000 Author: rnoland Date: Thu Jun 25 15:47:32 2009 New Revision: 194966 URL: http://svn.freebsd.org/changeset/base/194966 Log: Keep track of the hardware counter more aggressively while interrupts are enabled. This should help to reduce cases where the hardware counter reference jumps by large amounts. MFC after: 3 days Modified: head/sys/dev/drm/drm_irq.c Modified: head/sys/dev/drm/drm_irq.c ============================================================================== --- head/sys/dev/drm/drm_irq.c Thu Jun 25 15:36:11 2009 (r194965) +++ head/sys/dev/drm/drm_irq.c Thu Jun 25 15:47:32 2009 (r194966) @@ -325,6 +325,10 @@ int drm_vblank_get(struct drm_device *de } } + if (dev->vblank[crtc].enabled) + dev->vblank[crtc].last = + dev->driver->get_vblank_counter(dev, crtc); + return ret; } From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 15:50:06 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02A3F10656CF; Thu, 25 Jun 2009 15:50:05 +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 968D88FC14; Thu, 25 Jun 2009 15:50:02 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 3A9AD46B09; Thu, 25 Jun 2009 11:50:02 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id D4B148A085; Thu, 25 Jun 2009 11:50:00 -0400 (EDT) From: John Baldwin To: Jack F Vogel Date: Thu, 25 Jun 2009 08:21:43 -0400 User-Agent: KMail/1.9.7 References: <200906242216.n5OMG2qY031803@svn.freebsd.org> In-Reply-To: <200906242216.n5OMG2qY031803@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906250821.44010.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 25 Jun 2009 11:50:00 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00, DATE_IN_PAST_03_06,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194925 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 15:50:08 -0000 On Wednesday 24 June 2009 6:16:02 pm Jack F Vogel wrote: > Author: jfv > Date: Wed Jun 24 22:16:02 2009 > New Revision: 194925 > URL: http://svn.freebsd.org/changeset/base/194925 > > Log: > need to make intr_bind call architecture specific for > global builds (failing sun4v lint build) You should be able to use BUS_BIND_INTR() instead which is not machine-dependent. It accepts the IRQ resource directly as well which is a bit cleaner. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 16:15:40 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D0E81065672; Thu, 25 Jun 2009 16:15:40 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC5118FC16; Thu, 25 Jun 2009 16:15:39 +0000 (UTC) (envelope-from brian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PGFd0v056490; Thu, 25 Jun 2009 16:15:39 GMT (envelope-from brian@svn.freebsd.org) Received: (from brian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PGFdw3056482; Thu, 25 Jun 2009 16:15:39 GMT (envelope-from brian@svn.freebsd.org) Message-Id: <200906251615.n5PGFdw3056482@svn.freebsd.org> From: Brian Somers Date: Thu, 25 Jun 2009 16:15: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: r194968 - in head: share/man/man8 usr.bin/ypcat usr.bin/ypmatch usr.bin/ypwhich usr.sbin/ypserv X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 16:15:40 -0000 Author: brian Date: Thu Jun 25 16:15:39 2009 New Revision: 194968 URL: http://svn.freebsd.org/changeset/base/194968 Log: Support shadow.byname and shadow.byuid maps, protecting them by insisting on privileged port access. Include /var/yp/Makefile.local if it exists and suggest using it to override /var/yp/Makefile behaviour. Approved by: re (kib) MFC after: 3 weeks Modified: head/share/man/man8/yp.8 head/usr.bin/ypcat/ypcat.c head/usr.bin/ypmatch/ypmatch.c head/usr.bin/ypwhich/ypwhich.c head/usr.sbin/ypserv/Makefile.yp head/usr.sbin/ypserv/yp_access.c head/usr.sbin/ypserv/ypserv.8 Modified: head/share/man/man8/yp.8 ============================================================================== --- head/share/man/man8/yp.8 Thu Jun 25 16:10:04 2009 (r194967) +++ head/share/man/man8/yp.8 Thu Jun 25 16:15:39 2009 (r194968) @@ -28,7 +28,7 @@ .\" from: @(#)yp.8 1.0 (deraadt) 4/26/93 .\" $FreeBSD$ .\" -.Dd April 5, 1993 +.Dd June 25, 2009 .Dt YP 8 .Os .Sh NAME @@ -310,9 +310,15 @@ The .Tn NIS .Pa Makefile .Pq Pa /var/yp/Makefile -will do this automatically if the administrator comments out the -line which says -.Dq Li NOPUSH=true +will do this automatically if the administrator creates +.Pa /var/yp/Makefile.local +and empties the +.Va NOPUSH +variable: +.Bd -literal -offset four +.Li NOPUSH= +.Ed +.Pp .Va ( NOPUSH is set to true by default because the default configuration is for a small network with only one @@ -394,9 +400,11 @@ To help prevent this, .Fx Ns 's .Tn NIS server handles the shadow password maps -.Pa ( master.passwd.byname +.Pa ( master.passwd.byname , +.Pa master.passwd.byuid , +.Pa shadow.byname and -.Pa master.passwd.byuid ) +.Pa shadow.byuid ) in a special way: the server will only provide access to these maps in response to requests that originate on privileged ports. Since only the super-user is allowed to bind to a privileged port, Modified: head/usr.bin/ypcat/ypcat.c ============================================================================== --- head/usr.bin/ypcat/ypcat.c Thu Jun 25 16:10:04 2009 (r194967) +++ head/usr.bin/ypcat/ypcat.c Thu Jun 25 16:15:39 2009 (r194968) @@ -52,6 +52,7 @@ struct ypalias { } ypaliases[] = { { "passwd", "passwd.byname" }, { "master.passwd", "master.passwd.byname" }, + { "shadow", "shadow.byname" }, { "group", "group.byname" }, { "networks", "networks.byaddr" }, { "hosts", "hosts.byaddr" }, Modified: head/usr.bin/ypmatch/ypmatch.c ============================================================================== --- head/usr.bin/ypmatch/ypmatch.c Thu Jun 25 16:10:04 2009 (r194967) +++ head/usr.bin/ypmatch/ypmatch.c Thu Jun 25 16:15:39 2009 (r194968) @@ -52,6 +52,7 @@ struct ypalias { } ypaliases[] = { { "passwd", "passwd.byname" }, { "master.passwd", "master.passwd.byname" }, + { "shadow", "shadow.byname" }, { "group", "group.byname" }, { "networks", "networks.byaddr" }, { "hosts", "hosts.byname" }, Modified: head/usr.bin/ypwhich/ypwhich.c ============================================================================== --- head/usr.bin/ypwhich/ypwhich.c Thu Jun 25 16:10:04 2009 (r194967) +++ head/usr.bin/ypwhich/ypwhich.c Thu Jun 25 16:15:39 2009 (r194968) @@ -64,6 +64,7 @@ struct ypalias { } ypaliases[] = { { "passwd", "passwd.byname" }, { "master.passwd", "master.passwd.byname" }, + { "shadow", "shadow.byname" }, { "group", "group.byname" }, { "networks", "networks.byaddr" }, { "hosts", "hosts.byaddr" }, Modified: head/usr.sbin/ypserv/Makefile.yp ============================================================================== --- head/usr.sbin/ypserv/Makefile.yp Thu Jun 25 16:10:04 2009 (r194967) +++ head/usr.sbin/ypserv/Makefile.yp Thu Jun 25 16:15:39 2009 (r194968) @@ -11,33 +11,40 @@ # This Makefile can be modified to support more NIS maps if desired. # -# If this machine is an NIS master, comment out this next line so -# that changes to the NIS maps can be propagated to the slave servers. -# (By default we assume that we are only serving a small domain with -# only one server.) +# If this machine is an NIS master, reset this variable (NOPUSH=) +# in Makefile.local so that changes to the NIS maps can be propagated to +# the slave servers. (By default we assume that we are only serving a +# small domain with only one server.) # NOPUSH = "True" +# If this machine does not wish to generate a linux-style shadow map +# from the master.passwd file, reset this variable (SHADOW=) in +# Makefile.local. +SHADOW = "True" + # If you want to use a FreeBSD NIS server to serve non-FreeBSD clients # (i.e. clients who expect the password field in the passwd maps to be -# valid) then uncomment this line. This will cause $YPDIR/passwd to -# be generated with valid password fields. This is insecure: FreeBSD -# normally only serves the master.passwd maps (which have real encrypted -# passwords in them) to the superuser on other FreeBSD machines, but -# non-FreeBSD clients (e.g. SunOS, Solaris (without NIS+), IRIX, HP-UX, -# etc...) will only work properly in 'unsecure' mode. +# valid) then set this variable (UNSECURE="True") in Makefile.local. +# This will cause $YPDIR/passwd to be generated with valid password +# fields. This is insecure: FreeBSD normally only serves the +# master.passwd and shadow maps (which have real encrypted passwords +# in them) to the superuser on other FreeBSD machines, but non-FreeBSD +# clients (e.g. SunOS, Solaris (without NIS+), IRIX, HP-UX, etc...) +# will only work properly in 'unsecure' mode. # #UNSECURE = "True" # The following line encodes the YP_INTERDOMAIN key into the hosts.byname # and hosts.byaddr maps so that ypserv(8) will do DNS lookups to resolve -# hosts not in the current domain. Commenting this line out will disable -# the DNS lookups. +# hosts not in the current domain. Resetting this variable in +# Makefile.local (B=) will disable the DNS lookups. B=-b -# Normally, the master.passwd.* maps are guarded against access from -# non-privileged users. By commenting out the following line, the YP_SECURE -# key will be removed from these maps, allowing anyone to access them. +# Normally, the master.passwd.* and shadow.* maps are guarded against access +# from non-privileged users. By resetting S in Makefile.local (S=), the +# YP_SECURE key will be removed from these maps, allowing anyone to access +# them. S=-s # These are commands which this Makefile needs to properly rebuild the @@ -118,6 +125,17 @@ PUBLICKEY = $(YPSRCDIR)/publickey NETID = $(YPSRCDIR)/netid AMDHOST = $(YPSRCDIR)/amd.map +target: + @if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \ + cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \ + make -f ../Makefile all; echo "NIS Map update completed." + +# Read overrides. Note, the current directory will be /var/yp/ +# when 'all' is built. +.if exists(${YPDIR}/Makefile.local) +.include "${YPDIR}/Makefile.local" +.endif + # List of maps that are always built. # If you want to omit some of them, feel free to comment # them out from this list. @@ -148,6 +166,9 @@ NETGROUP= /dev/null .if exists($(MASTER)) TARGETS+= passwd master.passwd netid +.if ${SHADOW} == "\"True\"" +TARGETS+= shadow +.endif .else MASTER= /dev/null TARGETS+= nopass @@ -171,11 +192,6 @@ TARGETS+= ipnodes IPNODES= /dev/null .endif -target: - @if [ ! -d $(DOMAIN) ]; then mkdir $(DOMAIN); fi; \ - cd $(DOMAIN) ; echo "NIS Map update started on `date` for domain $(DOMAIN)" ; \ - make -f ../Makefile all; echo "NIS Map update completed." - all: $(TARGETS) ethers: ethers.byname ethers.byaddr @@ -187,6 +203,7 @@ protocols: protocols.bynumber protocols. rpc: rpc.byname rpc.bynumber services: services.byname passwd: passwd.byname passwd.byuid +shadow: shadow.byname shadow.byuid group: group.byname group.bygid netgrp: netgroup netid: netid.byname @@ -207,6 +224,10 @@ pushpw: @$(DBLOAD) -c @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byname ; fi @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) master.passwd.byuid ; fi +.if ${SHADOW} == "\"True\"" + @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) shadow.byname ; fi + @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) shadow.byuid ; fi +.endif @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byname ; fi @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) passwd.byuid ; fi @@ -586,6 +607,36 @@ master.passwd.byuid: $(MASTER) .endif +shadow.byname: $(MASTER) + @echo "Updating $@..." +.if ${MASTER} == "/dev/null" + @echo "Master.passwd source file not found -- skipping" +.else + @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ + print $$1"\t"$$1":"$$2":12000:0:99999:7:::" }' $(MASTER) \ + | sed 's/\( [^:]*:\)\*:/\1!:/' \ + | $(DBLOAD) ${S} -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ + $(RMV) $(TMP) $@ + @$(DBLOAD) -c + @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi + @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi +.endif + +shadow.byuid: $(MASTER) + @echo "Updating $@..." +.if ${MASTER} == "/dev/null" + @echo "Master.passwd source file not found -- skipping" +.else + @$(AWK) -F: '{ if ($$1 != "" && $$1 !~ "^#.*" && $$1 != "+") \ + print $$3"\t"$$1":"$$2":12000:0:99999:7:::" }' $(MASTER) \ + | sed 's/\( [^:]*:\)\*:/\1!:/' \ + | $(DBLOAD) ${S} -f -i $(PASSWD) -o $(YPMAPDIR)/$@ - $(TMP); \ + $(RMV) $(TMP) $@ + @$(DBLOAD) -c + @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi + @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi +.endif + amd.map: $(AMDHOST) @echo "Updating $@..." @$(AWK) '$$1 !~ "^#.*" { \ @@ -604,4 +655,3 @@ amd.map: $(AMDHOST) @$(DBLOAD) -c @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi - Modified: head/usr.sbin/ypserv/yp_access.c ============================================================================== --- head/usr.sbin/ypserv/yp_access.c Thu Jun 25 16:10:04 2009 (r194967) +++ head/usr.sbin/ypserv/yp_access.c Thu Jun 25 16:15:39 2009 (r194968) @@ -178,9 +178,9 @@ load_securenets(void) * yp_access() checks the mapname and client host address and watches for * the following things: * - * - If the client is referencing one of the master.passwd.* maps, it must - * be using a privileged port to make its RPC to us. If it is, then we can - * assume that the caller is root and allow the RPC to succeed. If it + * - If the client is referencing one of the master.passwd.* or shadow.* maps, + * it must be using a privileged port to make its RPC to us. If it is, then + * we can assume that the caller is root and allow the RPC to succeed. If it * isn't access is denied. * * - The client's IP address is checked against the securenets rules. @@ -254,7 +254,7 @@ possible spoof attempt from %s:%d", #ifdef DB_CACHE if ((yp_testflag((char *)map, (char *)domain, YP_SECURE) || #else - if ((strstr(map, "master.passwd.") || + if ((strstr(map, "master.passwd.") || strstr(map, "shadow.") || #endif (rqstp->rq_prog == YPPROG && rqstp->rq_proc == YPPROC_XFR) || Modified: head/usr.sbin/ypserv/ypserv.8 ============================================================================== --- head/usr.sbin/ypserv/ypserv.8 Thu Jun 25 16:10:04 2009 (r194967) +++ head/usr.sbin/ypserv/ypserv.8 Thu Jun 25 16:15:39 2009 (r194968) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 3, 2008 +.Dd June 25, 2009 .Dt YPSERV 8 .Os .Sh NAME @@ -142,7 +142,11 @@ and .Pa master.passwd.byuid maps in a special way. When the server receives a request to access -either of these two maps, it will check the TCP port from which the +either of these two maps (or in fact either of the +.Pa shadow.byname +or +.Pa shadow.byuid +maps), it will check the TCP port from which the request originated and return an error if the port number is greater than 1023. Since only the superuser is allowed to bind to TCP ports From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 16:17:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB7A71065673; Thu, 25 Jun 2009 16:17:08 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1109F8FC28; Thu, 25 Jun 2009 16:17:07 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PGH7QD056564; Thu, 25 Jun 2009 16:17:07 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PGH7R2056561; Thu, 25 Jun 2009 16:17:07 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200906251617.n5PGH7R2056561@svn.freebsd.org> From: Robert Noland Date: Thu, 25 Jun 2009 16:17: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: r194969 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 16:17:09 -0000 Author: rnoland Date: Thu Jun 25 16:17:07 2009 New Revision: 194969 URL: http://svn.freebsd.org/changeset/base/194969 Log: Initialize max_vblank_count earlier. Small cleanup of the error paths while I'm here. MFC after: 3 days Modified: head/sys/dev/drm/radeon_cp.c head/sys/dev/drm/radeon_irq.c Modified: head/sys/dev/drm/radeon_cp.c ============================================================================== --- head/sys/dev/drm/radeon_cp.c Thu Jun 25 16:15:39 2009 (r194968) +++ head/sys/dev/drm/radeon_cp.c Thu Jun 25 16:17:07 2009 (r194969) @@ -2064,16 +2064,22 @@ int radeon_driver_load(struct drm_device drm_get_resource_len(dev, 2), _DRM_REGISTERS, _DRM_READ_ONLY | _DRM_DRIVER, &dev_priv->mmio); if (ret != 0) - return ret; + goto error; ret = drm_vblank_init(dev, 2); - if (ret) { - radeon_driver_unload(dev); - return ret; - } + if (ret != 0) + goto error; + + dev->max_vblank_count = 0x001fffff; DRM_DEBUG("%s card detected\n", - ((dev_priv->flags & RADEON_IS_AGP) ? "AGP" : (((dev_priv->flags & RADEON_IS_PCIE) ? "PCIE" : "PCI")))); + ((dev_priv->flags & RADEON_IS_AGP) ? "AGP" : + (((dev_priv->flags & RADEON_IS_PCIE) ? "PCIE" : "PCI")))); + + return ret; + +error: + radeon_driver_unload(dev); return ret; } Modified: head/sys/dev/drm/radeon_irq.c ============================================================================== --- head/sys/dev/drm/radeon_irq.c Thu Jun 25 16:15:39 2009 (r194968) +++ head/sys/dev/drm/radeon_irq.c Thu Jun 25 16:17:07 2009 (r194969) @@ -380,8 +380,6 @@ int radeon_driver_irq_postinstall(struct atomic_set(&dev_priv->swi_emitted, 0); DRM_INIT_WAITQUEUE(&dev_priv->swi_queue); - dev->max_vblank_count = 0x001fffff; - radeon_irq_set_state(dev, RADEON_SW_INT_ENABLE, 1); return 0; From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 16:21:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82E431065672; Thu, 25 Jun 2009 16:21:56 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: from wf-out-1314.google.com (wf-out-1314.google.com [209.85.200.169]) by mx1.freebsd.org (Postfix) with ESMTP id 3F0C58FC08; Thu, 25 Jun 2009 16:21:55 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: by wf-out-1314.google.com with SMTP id 24so508948wfg.7 for ; Thu, 25 Jun 2009 09:21:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=gXtqApX94A3/PBrTo6pCb+g/8pM1KM9QjeOuZw4xsic=; b=cAdApNRjm8w4D9kwiT/p8K/q5s4pgeNnhQilewrHRwkpWSuMh0akDujxJEppU0Ccw5 7usIHpzEkl+ihEcPgZP51yfDjORQsKqemaF/7RM5if9r7d0MiDwWIFBWi3FGIXuQcEx2 FOjUD6wtsGkXqmRSW9GAR7fYEC8/QurV2zZYI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=iFsV0GEgPTxBcaV7qPu264MmmzKZABpS11il4+S7qSlLzN6ycaPxcyz21zYECeKNYq U6Xxwx/vSYTx1Ssg/snKcJ7fW0Y00ul7/swGb95hyYMAgyN6V/QnPMhdRi5QOOUyBCDJ NyBILA9sokhgDHYLKq3oSF82Ya7ej5ISClxtI= MIME-Version: 1.0 Received: by 10.143.156.12 with SMTP id i12mr913565wfo.55.1245945224397; Thu, 25 Jun 2009 08:53:44 -0700 (PDT) In-Reply-To: <200906250821.44010.jhb@freebsd.org> References: <200906242216.n5OMG2qY031803@svn.freebsd.org> <200906250821.44010.jhb@freebsd.org> Date: Thu, 25 Jun 2009 08:53:44 -0700 Message-ID: <2a41acea0906250853r4d130d14u19aad00ee02c38e6@mail.gmail.com> From: Jack Vogel To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Jack F Vogel , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194925 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 16:21:57 -0000 Oh, hmmm, wasn't aware of that, I'll take a look at it today. Thanks John, Jack On Thu, Jun 25, 2009 at 5:21 AM, John Baldwin wrote: > On Wednesday 24 June 2009 6:16:02 pm Jack F Vogel wrote: > > Author: jfv > > Date: Wed Jun 24 22:16:02 2009 > > New Revision: 194925 > > URL: http://svn.freebsd.org/changeset/base/194925 > > > > Log: > > need to make intr_bind call architecture specific for > > global builds (failing sun4v lint build) > > You should be able to use BUS_BIND_INTR() instead which is not > machine-dependent. It accepts the IRQ resource directly as well which is a > bit cleaner. > > -- > John Baldwin > From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 16:34:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4BF1F106564A; Thu, 25 Jun 2009 16:34:30 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 39E9E8FC08; Thu, 25 Jun 2009 16:34:30 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PGYUdV056993; Thu, 25 Jun 2009 16:34:30 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PGYUY9056991; Thu, 25 Jun 2009 16:34:30 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200906251634.n5PGYUY9056991@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 25 Jun 2009 16:34:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194970 - head/lib/libc/posix1e X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 16:34:30 -0000 Author: trasz Date: Thu Jun 25 16:34:29 2009 New Revision: 194970 URL: http://svn.freebsd.org/changeset/base/194970 Log: Manual page tweaks. Modified: head/lib/libc/posix1e/acl.3 Modified: head/lib/libc/posix1e/acl.3 ============================================================================== --- head/lib/libc/posix1e/acl.3 Thu Jun 25 16:17:07 2009 (r194969) +++ head/lib/libc/posix1e/acl.3 Thu Jun 25 16:34:29 2009 (r194970) @@ -130,7 +130,7 @@ and may be used to free userland working This function is described in .Xr acl_from_text 3 , and may be used to convert a text-form ACL into working ACL state, if -the ACL has POSIX.1e semantics. +the ACL has POSIX.1e or NFSv4 semantics. .It Fn acl_get_entry This function is described in .Xr acl_get_entry 3 , @@ -211,7 +211,7 @@ and may be used to remove extended entri .Xc These functions are described in .Xr acl_to_text 3 , -and may be used to generate a text-form of a POSIX.1e semantics ACL. +and may be used to generate a text-form of a POSIX.1e or NFSv4 semantics ACL. .It Xo .Fn acl_valid , .Fn acl_valid_fd_np , From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 16:35:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE523106566C; Thu, 25 Jun 2009 16:35:28 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B996B8FC14; Thu, 25 Jun 2009 16:35:28 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PGZSQp057060; Thu, 25 Jun 2009 16:35:28 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PGZSQM057050; Thu, 25 Jun 2009 16:35:28 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906251635.n5PGZSQM057050@svn.freebsd.org> From: Robert Watson Date: Thu, 25 Jun 2009 16:35: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: r194971 - in head/sys: netinet netinet6 netipsec X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 16:35:29 -0000 Author: rwatson Date: Thu Jun 25 16:35:28 2009 New Revision: 194971 URL: http://svn.freebsd.org/changeset/base/194971 Log: Add address list locking for in6_ifaddrhead/ia_link: as with locking for in_ifaddrhead, we stick with an rwlock for the time being, which we will revisit in the future with a possible move to rmlocks. Some pieces of code require significant further reworking to be safe from all classes of writer-writer races. Reviewed by: bz MFC after: 6 weeks Modified: head/sys/netinet/ip_carp.c head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_src.c head/sys/netinet6/in6_var.h head/sys/netinet6/ip6_input.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6_rtr.c head/sys/netipsec/key.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Thu Jun 25 16:34:29 2009 (r194970) +++ head/sys/netinet/ip_carp.c Thu Jun 25 16:35:28 2009 (r194971) @@ -1680,6 +1680,7 @@ carp_set_addr6(struct carp_softc *sc, st /* we have to do it by hands to check we won't match on us */ ia_if = NULL; own = 0; + IN6_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { int i; @@ -1702,14 +1703,20 @@ carp_set_addr6(struct carp_softc *sc, st } } - if (!ia_if) + if (!ia_if) { + IN6_IFADDR_RUNLOCK(); return (EADDRNOTAVAIL); + } ia = ia_if; + ifa_ref(&ia->ia_ifa); + IN6_IFADDR_RUNLOCK(); ifp = ia->ia_ifp; if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0 || - (im6o->im6o_multicast_ifp && im6o->im6o_multicast_ifp != ifp)) + (im6o->im6o_multicast_ifp && im6o->im6o_multicast_ifp != ifp)) { + ifa_free(&ia->ia_ifa); return (EADDRNOTAVAIL); + } if (!sc->sc_naddrs6) { struct in6_multi *in6m; @@ -1811,12 +1818,14 @@ carp_set_addr6(struct carp_softc *sc, st carp_setrun(sc, 0); CARP_UNLOCK(cif); + ifa_free(&ia->ia_ifa); /* XXXRW: should hold reference for softc. */ return (0); cleanup: if (!sc->sc_naddrs6) carp_multicast6_cleanup(sc); + ifa_free(&ia->ia_ifa); return (error); } Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Thu Jun 25 16:34:29 2009 (r194970) +++ head/sys/netinet6/in6.c Thu Jun 25 16:35:28 2009 (r194971) @@ -831,8 +831,10 @@ in6_update_ifa(struct ifnet *ifp, struct TAILQ_INSERT_TAIL(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_UNLOCK(ifp); - ifa_ref(&ia->ia_ifa); /* in6_if_addrhead */ + ifa_ref(&ia->ia_ifa); /* in6_ifaddrhead */ + IN6_IFADDR_WLOCK(); TAILQ_INSERT_TAIL(&V_in6_ifaddrhead, ia, ia_link); + IN6_IFADDR_WUNLOCK(); } /* update timestamp */ @@ -1376,7 +1378,9 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st IF_ADDR_UNLOCK(ifp); ifa_free(&ia->ia_ifa); /* if_addrhead */ + IN6_IFADDR_WLOCK(); TAILQ_REMOVE(&V_in6_ifaddrhead, ia, ia_link); + IN6_IFADDR_WUNLOCK(); ifa_free(&ia->ia_ifa); /* in6_ifaddrhead */ /* @@ -1917,12 +1921,15 @@ in6_localaddr(struct in6_addr *in6) if (IN6_IS_ADDR_LOOPBACK(in6) || IN6_IS_ADDR_LINKLOCAL(in6)) return 1; + IN6_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { if (IN6_ARE_MASKED_ADDR_EQUAL(in6, &ia->ia_addr.sin6_addr, &ia->ia_prefixmask.sin6_addr)) { + IN6_IFADDR_RUNLOCK(); return 1; } } + IN6_IFADDR_RUNLOCK(); return (0); } @@ -1933,14 +1940,18 @@ in6_is_addr_deprecated(struct sockaddr_i INIT_VNET_INET6(curvnet); struct in6_ifaddr *ia; + IN6_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { if (IN6_ARE_ADDR_EQUAL(&ia->ia_addr.sin6_addr, &sa6->sin6_addr) && - (ia->ia6_flags & IN6_IFF_DEPRECATED) != 0) + (ia->ia6_flags & IN6_IFF_DEPRECATED) != 0) { + IN6_IFADDR_RUNLOCK(); return (1); /* true */ + } /* XXX: do we still have to go thru the rest of the list? */ } + IN6_IFADDR_RUNLOCK(); return (0); /* false */ } @@ -2074,7 +2085,9 @@ in6_ifawithifp(struct ifnet *ifp, struct IF_ADDR_UNLOCK(ifp); return (besta); } + IF_ADDR_UNLOCK(ifp); + IN6_IFADDR_RLOCK(); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; @@ -2092,10 +2105,10 @@ in6_ifawithifp(struct ifnet *ifp, struct if (ifa != NULL) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IN6_IFADDR_RUNLOCK(); return (struct in6_ifaddr *)ifa; } - IF_ADDR_UNLOCK(ifp); + IN6_IFADDR_RUNLOCK(); /* use the last-resort values, that are, deprecated addresses */ if (dep[0]) Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Thu Jun 25 16:34:29 2009 (r194970) +++ head/sys/netinet6/in6_ifattach.c Thu Jun 25 16:35:28 2009 (r194971) @@ -836,7 +836,9 @@ in6_ifdetach(struct ifnet *ifp) IF_ADDR_UNLOCK(ifp); ifa_free(ifa); /* if_addrhead */ + IN6_IFADDR_WLOCK(); TAILQ_REMOVE(&V_in6_ifaddrhead, ia, ia_link); + IN6_IFADDR_WUNLOCK(); ifa_free(ifa); } Modified: head/sys/netinet6/in6_src.c ============================================================================== --- head/sys/netinet6/in6_src.c Thu Jun 25 16:34:29 2009 (r194970) +++ head/sys/netinet6/in6_src.c Thu Jun 25 16:35:28 2009 (r194971) @@ -289,6 +289,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso if (error) return (error); + IN6_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { int new_scope = -1, new_matchlen = -1; struct in6_addrpolicy *new_policy = NULL; @@ -466,13 +467,16 @@ in6_selectsrc(struct sockaddr_in6 *dstso break; } - if ((ia = ia_best) == NULL) + if ((ia = ia_best) == NULL) { + IN6_IFADDR_RUNLOCK(); return (EADDRNOTAVAIL); + } if (ifpp) *ifpp = ifp; bcopy(&ia->ia_addr.sin6_addr, srcp, sizeof(*srcp)); + IN6_IFADDR_RUNLOCK(); return (0); } Modified: head/sys/netinet6/in6_var.h ============================================================================== --- head/sys/netinet6/in6_var.h Thu Jun 25 16:34:29 2009 (r194970) +++ head/sys/netinet6/in6_var.h Thu Jun 25 16:35:28 2009 (r194971) @@ -493,6 +493,16 @@ extern struct icmp6stat icmp6stat; extern unsigned long in6_maxmtu; #endif /* VIMAGE_GLOBALS */ + +extern struct rwlock in6_ifaddr_lock; +#define IN6_IFADDR_LOCK_ASSERT( ) rw_assert(&in6_ifaddr_lock, RA_LOCKED) +#define IN6_IFADDR_RLOCK() rw_rlock(&in6_ifaddr_lock) +#define IN6_IFADDR_RLOCK_ASSERT() rw_assert(&in6_ifaddr_lock, RA_RLOCKED) +#define IN6_IFADDR_RUNLOCK() rw_runlock(&in6_ifaddr_lock) +#define IN6_IFADDR_WLOCK() rw_wlock(&in6_ifaddr_lock) +#define IN6_IFADDR_WLOCK_ASSERT() rw_assert(&in6_ifaddr_lock, RA_WLOCKED) +#define IN6_IFADDR_WUNLOCK() rw_wunlock(&in6_ifaddr_lock) + #define in6_ifstat_inc(ifp, tag) \ do { \ if (ifp) \ Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Thu Jun 25 16:34:29 2009 (r194970) +++ head/sys/netinet6/ip6_input.c Thu Jun 25 16:35:28 2009 (r194971) @@ -150,6 +150,9 @@ extern int udp6_sendspace; extern int udp6_recvspace; #endif +struct rwlock in6_ifaddr_lock; +RW_SYSINIT(in6_ifaddr_lock, &in6_ifaddr_lock, "in6_ifaddr_lock"); + struct pfil_head inet6_pfil_hook; static void ip6_init2(void *); Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Thu Jun 25 16:34:29 2009 (r194970) +++ head/sys/netinet6/nd6.c Thu Jun 25 16:35:28 2009 (r194971) @@ -624,6 +624,8 @@ nd6_timer(void *arg) * in the past the loop was inside prefix expiry processing. * However, from a stricter speci-confrmance standpoint, we should * rather separate address lifetimes and prefix lifetimes. + * + * XXXRW: in6_ifaddrhead locking. */ addrloop: TAILQ_FOREACH_SAFE(ia6, &V_in6_ifaddrhead, ia_link, nia6) { @@ -1328,6 +1330,7 @@ nd6_ioctl(u_long cmd, caddr_t data, stru continue; /* XXX */ /* do we really have to remove addresses as well? */ + /* XXXRW: in6_ifaddrhead locking. */ TAILQ_FOREACH_SAFE(ia, &V_in6_ifaddrhead, ia_link, ia_next) { if ((ia->ia6_flags & IN6_IFF_AUTOCONF) == 0) Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Thu Jun 25 16:34:29 2009 (r194970) +++ head/sys/netinet6/nd6_rtr.c Thu Jun 25 16:35:28 2009 (r194971) @@ -1500,6 +1500,8 @@ pfxlist_onlink_check() * detached. Note, however, that a manually configured address should * always be attached. * The precise detection logic is same as the one for prefixes. + * + * XXXRW: in6_ifaddrhead locking. */ TAILQ_FOREACH(ifa, &V_in6_ifaddrhead, ia_link) { if (!(ifa->ia6_flags & IN6_IFF_AUTOCONF)) @@ -1949,10 +1951,12 @@ in6_tmpifadd(const struct in6_ifaddr *ia * there may be a time lag between generation of the ID and generation * of the address. So, we'll do one more sanity check. */ + IN6_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { if (IN6_ARE_ADDR_EQUAL(&ia->ia_addr.sin6_addr, &ifra.ifra_addr.sin6_addr)) { if (trylimit-- == 0) { + IN6_IFADDR_RUNLOCK(); /* * Give up. Something strange should have * happened. @@ -1961,10 +1965,12 @@ in6_tmpifadd(const struct in6_ifaddr *ia "find a unique random IFID\n")); return (EEXIST); } + IN6_IFADDR_RUNLOCK(); forcegen = 1; goto again; } } + IN6_IFADDR_RUNLOCK(); /* * The Valid Lifetime is the lower of the Valid Lifetime of the Modified: head/sys/netipsec/key.c ============================================================================== --- head/sys/netipsec/key.c Thu Jun 25 16:34:29 2009 (r194970) +++ head/sys/netipsec/key.c Thu Jun 25 16:35:28 2009 (r194971) @@ -3982,10 +3982,13 @@ key_ismyaddr6(sin6) struct in6_multi *in6m; #endif + IN6_IFADDR_RLOCK(); TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { if (key_sockaddrcmp((struct sockaddr *)&sin6, - (struct sockaddr *)&ia->ia_addr, 0) == 0) + (struct sockaddr *)&ia->ia_addr, 0) == 0) { + IN6_IFADDR_RUNLOCK(); return 1; + } #if 0 /* @@ -3996,10 +3999,13 @@ key_ismyaddr6(sin6) */ in6m = NULL; IN6_LOOKUP_MULTI(sin6->sin6_addr, ia->ia_ifp, in6m); - if (in6m) + if (in6m) { + IN6_IFADDR_RUNLOCK(); return 1; + } #endif } + IN6_IFADDR_RUNLOCK(); /* loopback, just for safety */ if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr)) From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 16:36:58 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5488A1065670; Thu, 25 Jun 2009 16:36:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 425898FC20; Thu, 25 Jun 2009 16:36:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PGaw9i057125; Thu, 25 Jun 2009 16:36:58 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PGawxK057123; Thu, 25 Jun 2009 16:36:58 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200906251636.n5PGawxK057123@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 25 Jun 2009 16:36: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: r194972 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 16:36:58 -0000 Author: trasz Date: Thu Jun 25 16:36:57 2009 New Revision: 194972 URL: http://svn.freebsd.org/changeset/base/194972 Log: Tweak comment. Modified: head/sys/sys/vnode.h Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Thu Jun 25 16:35:28 2009 (r194971) +++ head/sys/sys/vnode.h Thu Jun 25 16:36:57 2009 (r194972) @@ -316,8 +316,8 @@ struct vattr { #define VADMIN 000000010000 /* being the file owner */ #define VAPPEND 000000040000 /* permission to write/append */ /* - * VEXPLICIT_DENY makes VOP_ACCESS(9) return EPERM or EACCES only - * if permission was denied explicitly, by a "deny" rule in NFS4 ACL, + * VEXPLICIT_DENY makes VOP_ACCESSX(9) return EPERM or EACCES only + * if permission was denied explicitly, by a "deny" rule in NFSv4 ACL, * and 0 otherwise. This never happens with ordinary unix access rights * or POSIX.1e ACLs. Obviously, VEXPLICIT_DENY must be OR-ed with * some other V* constant. From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 16:38:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C79D11065672; Thu, 25 Jun 2009 16:38:16 +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 9AA298FC15; Thu, 25 Jun 2009 16:38:16 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PGcGSK057182; Thu, 25 Jun 2009 16:38:16 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PGcGlm057180; Thu, 25 Jun 2009 16:38:16 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <200906251638.n5PGcGlm057180@svn.freebsd.org> From: Marius Strobl Date: Thu, 25 Jun 2009 16:38:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194973 - head/sys/dev/cas X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 16:38:17 -0000 Author: marius Date: Thu Jun 25 16:38:16 2009 New Revision: 194973 URL: http://svn.freebsd.org/changeset/base/194973 Log: Don't use the preprocessor while inside function-like macro invocations as doing so violates the C specification. This fixes the build with Clang. Submitted by: ed Modified: head/sys/dev/cas/if_cas.c Modified: head/sys/dev/cas/if_cas.c ============================================================================== --- head/sys/dev/cas/if_cas.c Thu Jun 25 16:36:57 2009 (r194972) +++ head/sys/dev/cas/if_cas.c Thu Jun 25 16:38:16 2009 (r194973) @@ -1697,14 +1697,16 @@ cas_rint(struct cas_softc *sc) refcount_acquire(&rxds->rxds_refcount); bus_dmamap_sync(sc->sc_rdmatag, rxds->rxds_dmamap, BUS_DMASYNC_POSTREAD); +#if __FreeBSD_version < 800016 MEXTADD(m, (caddr_t)rxds->rxds_buf + off * 256 + ETHER_ALIGN, len, cas_free, -#if __FreeBSD_version < 800016 - rxds, + rxds, M_RDONLY, EXT_NET_DRV); #else + MEXTADD(m, (caddr_t)rxds->rxds_buf + + off * 256 + ETHER_ALIGN, len, cas_free, sc, (void *)(uintptr_t)idx, -#endif M_RDONLY, EXT_NET_DRV); +#endif if ((m->m_flags & M_EXT) == 0) { m_freem(m); m = NULL; @@ -1740,14 +1742,16 @@ cas_rint(struct cas_softc *sc) m->m_len = min(CAS_PAGE_SIZE - off, len); bus_dmamap_sync(sc->sc_rdmatag, rxds->rxds_dmamap, BUS_DMASYNC_POSTREAD); - MEXTADD(m, (caddr_t)rxds->rxds_buf + off, - m->m_len, cas_free, #if __FreeBSD_version < 800016 - rxds, + MEXTADD(m, (caddr_t)rxds->rxds_buf + off, + m->m_len, cas_free, rxds, M_RDONLY, + EXT_NET_DRV); #else - sc, (void *)(uintptr_t)idx, + MEXTADD(m, (caddr_t)rxds->rxds_buf + off, + m->m_len, cas_free, sc, + (void *)(uintptr_t)idx, M_RDONLY, + EXT_NET_DRV); #endif - M_RDONLY, EXT_NET_DRV); if ((m->m_flags & M_EXT) == 0) { m_freem(m); m = NULL; @@ -1774,14 +1778,16 @@ cas_rint(struct cas_softc *sc) bus_dmamap_sync(sc->sc_rdmatag, rxds2->rxds_dmamap, BUS_DMASYNC_POSTREAD); - MEXTADD(m2, (caddr_t)rxds2->rxds_buf, - m2->m_len, cas_free, #if __FreeBSD_version < 800016 - rxds2, + MEXTADD(m2, (caddr_t)rxds2->rxds_buf, + m2->m_len, cas_free, rxds2, + M_RDONLY, EXT_NET_DRV); #else + MEXTADD(m2, (caddr_t)rxds2->rxds_buf, + m2->m_len, cas_free, sc, (void *)(uintptr_t)idx2, -#endif M_RDONLY, EXT_NET_DRV); +#endif if ((m2->m_flags & M_EXT) == 0) { m_freem(m2); m2 = NULL; From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 16:48:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 205E41065673; Thu, 25 Jun 2009 16:48:15 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 093F08FC13; Thu, 25 Jun 2009 16:48:15 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PGmDBg057405; Thu, 25 Jun 2009 16:48:13 GMT (envelope-from rdivacky@svn.freebsd.org) Received: (from rdivacky@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PGmDE5057403; Thu, 25 Jun 2009 16:48:13 GMT (envelope-from rdivacky@svn.freebsd.org) Message-Id: <200906251648.n5PGmDE5057403@svn.freebsd.org> From: Roman Divacky Date: Thu, 25 Jun 2009 16:48: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: r194974 - head/sys/gnu/fs/xfs/FreeBSD X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 16:48:15 -0000 Author: rdivacky Date: Thu Jun 25 16:48:13 2009 New Revision: 194974 URL: http://svn.freebsd.org/changeset/base/194974 Log: Fix the build by using proper format. Pointy hat: me Approved by: kib Modified: head/sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c Modified: head/sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c ============================================================================== --- head/sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c Thu Jun 25 16:38:16 2009 (r194973) +++ head/sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c Thu Jun 25 16:48:13 2009 (r194974) @@ -760,7 +760,7 @@ xfs_ioctl( // vp = vn_from_inode(inode); vp = BHV_TO_VNODE(bdp); - printf("xfs_ioctl: bdp %p flags 0x%x cmd 0x%x basecmd 0x%x arg %p\n", + printf("xfs_ioctl: bdp %p flags 0x%x cmd 0x%lx basecmd 0x%lx arg %p\n", bdp, ioflags, cmd, IOCBASECMD(cmd), arg); From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 17:10:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74927106568B; Thu, 25 Jun 2009 17:10:51 +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 578C78FC26; Thu, 25 Jun 2009 17:10:51 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PHApBF057885; Thu, 25 Jun 2009 17:10:51 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PHApJ4057883; Thu, 25 Jun 2009 17:10:51 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200906251710.n5PHApJ4057883@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 25 Jun 2009 17:10: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: r194975 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 17:10:52 -0000 Author: jilles Date: Thu Jun 25 17:10:51 2009 New Revision: 194975 URL: http://svn.freebsd.org/changeset/base/194975 Log: Improve IFS expansion using code from NetBSD. We now pass the ifs.sh testsuite. PR: standards/79067 Approved by: ed (mentor) (implicit) Obtained from: NetBSD Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Thu Jun 25 16:48:13 2009 (r194974) +++ head/bin/sh/expand.c Thu Jun 25 17:10:51 2009 (r194975) @@ -82,7 +82,7 @@ struct ifsregion { struct ifsregion *next; /* next region in list */ int begoff; /* offset of start of region */ int endoff; /* offset of end of region */ - int nulonly; /* search for nul bytes only */ + int inquotes; /* search for nul bytes only */ }; @@ -936,13 +936,19 @@ numvar: */ STATIC void -recordregion(int start, int end, int nulonly) +recordregion(int start, int end, int inquotes) { struct ifsregion *ifsp; if (ifslastp == NULL) { ifsp = &ifsfirst; } else { + if (ifslastp->endoff == start + && ifslastp->inquotes == inquotes) { + /* extend previous area */ + ifslastp->endoff = end; + return; + } ifsp = (struct ifsregion *)ckmalloc(sizeof (struct ifsregion)); ifslastp->next = ifsp; } @@ -950,7 +956,7 @@ recordregion(int start, int end, int nul ifslastp->next = NULL; ifslastp->begoff = start; ifslastp->endoff = end; - ifslastp->nulonly = nulonly; + ifslastp->inquotes = inquotes; } @@ -969,75 +975,88 @@ ifsbreakup(char *string, struct arglist char *p; char *q; char *ifs; - int ifsspc; - int nulonly; - + const char *ifsspc; + int had_param_ch = 0; start = string; - ifsspc = 0; - nulonly = 0; - if (ifslastp != NULL) { - ifsp = &ifsfirst; - do { - p = string + ifsp->begoff; - nulonly = ifsp->nulonly; - ifs = nulonly ? nullstr : - ( ifsset() ? ifsval() : " \t\n" ); - ifsspc = 0; - while (p < string + ifsp->endoff) { - q = p; - if (*p == CTLESC) + + if (ifslastp == NULL) { + /* Return entire argument, IFS doesn't apply to any of it */ + sp = (struct strlist *)stalloc(sizeof *sp); + sp->text = start; + *arglist->lastp = sp; + arglist->lastp = &sp->next; + return; + } + + ifs = ifsset() ? ifsval() : " \t\n"; + + for (ifsp = &ifsfirst; ifsp != NULL; ifsp = ifsp->next) { + p = string + ifsp->begoff; + while (p < string + ifsp->endoff) { + had_param_ch = 1; + q = p; + if (*p == CTLESC) + p++; + if (ifsp->inquotes) { + /* Only NULs (should be from "$@") end args */ + if (*p != 0) { p++; - if (strchr(ifs, *p)) { - if (!nulonly) - ifsspc = (strchr(" \t\n", *p) != NULL); - /* Ignore IFS whitespace at start */ - if (q == start && ifsspc) { - p++; - start = p; - continue; - } - *q = '\0'; - sp = (struct strlist *)stalloc(sizeof *sp); - sp->text = start; - *arglist->lastp = sp; - arglist->lastp = &sp->next; + continue; + } + ifsspc = NULL; + } else { + if (!strchr(ifs, *p)) { p++; - if (!nulonly) { - for (;;) { - if (p >= string + ifsp->endoff) { - break; - } - q = p; - if (*p == CTLESC) - p++; - if (strchr(ifs, *p) == NULL ) { - p = q; - break; - } else if (strchr(" \t\n",*p) == NULL) { - if (ifsspc) { - p++; - ifsspc = 0; - } else { - p = q; - break; - } - } else - p++; - } - } - start = p; - } else + continue; + } + had_param_ch = 0; + ifsspc = strchr(" \t\n", *p); + + /* Ignore IFS whitespace at start */ + if (q == start && ifsspc != NULL) { p++; + start = p; + continue; + } } - } while ((ifsp = ifsp->next) != NULL); - if (*start || (!ifsspc && start > string)) { + + /* Save this argument... */ + *q = '\0'; sp = (struct strlist *)stalloc(sizeof *sp); sp->text = start; *arglist->lastp = sp; arglist->lastp = &sp->next; + p++; + + if (ifsspc != NULL) { + /* Ignore further trailing IFS whitespace */ + for (; p < string + ifsp->endoff; p++) { + q = p; + if (*p == CTLESC) + p++; + if (strchr(ifs, *p) == NULL) { + p = q; + break; + } + if (strchr(" \t\n", *p) == NULL) { + p++; + break; + } + } + } + start = p; } - } else { + } + + /* + * Save anything left as an argument. + * Traditionally we have treated 'IFS=':'; set -- x$IFS' as + * generating 2 arguments, the second of which is empty. + * Some recent clarification of the Posix spec say that it + * should only generate one.... + */ + if (had_param_ch || *start != 0) { sp = (struct strlist *)stalloc(sizeof *sp); sp->text = start; *arglist->lastp = sp; From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 17:11:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7C2B1065672; Thu, 25 Jun 2009 17:11:27 +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 D5F668FC1D; Thu, 25 Jun 2009 17:11:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PHBR85057953; Thu, 25 Jun 2009 17:11:27 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PHBR2n057951; Thu, 25 Jun 2009 17:11:27 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906251711.n5PHBR2n057951@svn.freebsd.org> From: John Baldwin Date: Thu, 25 Jun 2009 17:11:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194976 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 17:11:28 -0000 Author: jhb Date: Thu Jun 25 17:11:27 2009 New Revision: 194976 URL: http://svn.freebsd.org/changeset/base/194976 Log: Use the correct cast for the arguments passed to freebsd_shmctl() in oshmctl(). Submitted by: kib Modified: head/sys/kern/sysv_shm.c Modified: head/sys/kern/sysv_shm.c ============================================================================== --- head/sys/kern/sysv_shm.c Thu Jun 25 17:10:51 2009 (r194975) +++ head/sys/kern/sysv_shm.c Thu Jun 25 17:11:27 2009 (r194976) @@ -936,7 +936,7 @@ oshmctl(struct thread *td, struct oshmct goto done2; break; default: - error = freebsd7_shmctl(td, (struct shmctl_args *)uap); + error = freebsd7_shmctl(td, (struct freebsd7_shmctl_args *)uap); break; } done2: From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 17:11:42 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: by hub.freebsd.org (Postfix, from userid 1205) id 628EF1065721; Thu, 25 Jun 2009 17:11:42 +0000 (UTC) Date: Thu, 25 Jun 2009 17:11:42 +0000 From: Navdeep Parhar To: George Neville-Neil Message-ID: <20090625171142.GA98791@hub.freebsd.org> Mail-Followup-To: George Neville-Neil , src-committers@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, svn-src-head@FreeBSD.ORG References: <200906242153.n5OLrPEV030916@svn.freebsd.org> <29388187-3617-40D4-ACDA-DECD97F8274F@neville-neil.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <29388187-3617-40D4-ACDA-DECD97F8274F@neville-neil.com> User-Agent: Mutt/1.4.2.1i Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG Subject: Re: svn commit: r194918 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 17:11:43 -0000 On Thu, Jun 25, 2009 at 09:18:47AM -0400, George Neville-Neil wrote: > > On Jun 24, 2009, at 17:53 , Navdeep Parhar wrote: > .... > >====================================================================== > >--- head/sys/net/if_media.h Wed Jun 24 21:51:42 2009 (r194917) > >+++ head/sys/net/if_media.h Wed Jun 24 21:53:25 2009 (r194918) > >@@ -149,6 +149,7 @@ uint64_t ifmedia_baudrate(int); > >#define IFM_10G_TWINAX_LONG 23 /* 10GBase Twinax Long copper */ > >#define IFM_10G_LRM 24 /* 10GBase-LRM 850nm Multi-mode */ > >#define IFM_UNKNOWN 25 /* media types not defined yet */ > >+#define IFM_10G_T 26 /* 10GBase-T - RJ45 */ > > > > > >/* note 31 is the max! */ > >@@ -358,6 +359,7 @@ struct ifmedia_description { > > { IFM_10G_TWINAX, "10Gbase-Twinax" }, \ > > { IFM_10G_TWINAX_LONG, "10Gbase-Twinax-Long" }, \ > > { IFM_UNKNOWN, "Unknown" }, \ > >+ { IFM_10G_T, "10Gbase-T" }, \ > > { 0, NULL }, \ > >} > > > >@@ -615,6 +617,7 @@ struct ifmedia_baudrate { > > { IFM_ETHER | IFM_10G_TWINAX, IF_Gbps(10ULL) }, \ > > { IFM_ETHER | IFM_10G_TWINAX_LONG, IF_Gbps(10ULL) }, \ > > { IFM_ETHER | IFM_10G_LRM, IF_Gbps(10ULL) }, \ > >+ { IFM_ETHER | IFM_10G_T, IF_Gbps(10ULL) }, \ > > \ > > { IFM_TOKEN | IFM_TOK_STP4, IF_Mbps(4) }, \ > > { IFM_TOKEN | IFM_TOK_STP16, IF_Mbps(16) }, \ > > > Howdy, > > John Baldwin pointed out to me that UNKNOWN really should have been > pushed up to the end. Mostly for cosmetic reasons, correct? I'm not sure if pushing it to the end has any functional impact. I'd deliberately left it where it was, simply to avoid gratuitous differences between 7 and 8 #define's. [I don't think we can reorder the #define's on 7 without having to rebuild its ifconfig too]. > > Can you make a small patch and send it to me? Increase the number and > move its string to the end of the array? If you'd still like them reordered - should we simply swap IFM_UNKNOWN/25 and IFM_10G_T/26 or should we #define IFM_UNKNOWN to be 31, the max allowed? That way we can add more types and not have to bother with IFM_UNKNOWN again. Regards, Navdeep From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 17:14:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4630A1065670; Thu, 25 Jun 2009 17:14:08 +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 340B88FC12; Thu, 25 Jun 2009 17:14:08 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PHE6mn058035; Thu, 25 Jun 2009 17:14:06 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PHE6Dr058033; Thu, 25 Jun 2009 17:14:06 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200906251714.n5PHE6Dr058033@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 25 Jun 2009 17:14: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: r194977 - head/bin/sh X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 17:14:08 -0000 Author: jilles Date: Thu Jun 25 17:14:06 2009 New Revision: 194977 URL: http://svn.freebsd.org/changeset/base/194977 Log: Fix some weirdnesses in the NetBSD IFS code, in particular "$@"$ifschar if the final positional parameter is empty. With the NetBSD code, adding the $ifschar removes a parameter. PR: standards/79067 Approved by: ed (mentor) (implicit) Modified: head/bin/sh/expand.c Modified: head/bin/sh/expand.c ============================================================================== --- head/bin/sh/expand.c Thu Jun 25 17:11:27 2009 (r194976) +++ head/bin/sh/expand.c Thu Jun 25 17:14:06 2009 (r194977) @@ -994,12 +994,12 @@ ifsbreakup(char *string, struct arglist for (ifsp = &ifsfirst; ifsp != NULL; ifsp = ifsp->next) { p = string + ifsp->begoff; while (p < string + ifsp->endoff) { - had_param_ch = 1; q = p; if (*p == CTLESC) p++; if (ifsp->inquotes) { /* Only NULs (should be from "$@") end args */ + had_param_ch = 1; if (*p != 0) { p++; continue; @@ -1007,10 +1007,10 @@ ifsbreakup(char *string, struct arglist ifsspc = NULL; } else { if (!strchr(ifs, *p)) { + had_param_ch = 1; p++; continue; } - had_param_ch = 0; ifsspc = strchr(" \t\n", *p); /* Ignore IFS whitespace at start */ @@ -1019,6 +1019,7 @@ ifsbreakup(char *string, struct arglist start = p; continue; } + had_param_ch = 0; } /* Save this argument... */ From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 17:16:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F8351065672; Thu, 25 Jun 2009 17:16:27 +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 2E0A08FC27; Thu, 25 Jun 2009 17:16:27 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PHGRLC058123; Thu, 25 Jun 2009 17:16:27 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PHGRir058121; Thu, 25 Jun 2009 17:16:27 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200906251716.n5PHGRir058121@svn.freebsd.org> From: Jack F Vogel Date: Thu, 25 Jun 2009 17:16:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194978 - head/sys/dev/ixgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 17:16:27 -0000 Author: jfv Date: Thu Jun 25 17:16:26 2009 New Revision: 194978 URL: http://svn.freebsd.org/changeset/base/194978 Log: Change intr_bind to bus_bind_intr, thanks to John Baldwin for pointing out this simplification. Modified: head/sys/dev/ixgbe/ixgbe.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Thu Jun 25 17:14:06 2009 (r194977) +++ head/sys/dev/ixgbe/ixgbe.c Thu Jun 25 17:16:26 2009 (r194978) @@ -2152,13 +2152,12 @@ ixgbe_allocate_msix(struct adapter *adap return (error); } txr->msix = vector; -#if defined(__i386__) || defined(__amd64__) /* ** Bind the msix vector, and thus the ** ring to the corresponding cpu. */ - intr_bind(rman_get_start(txr->res), i); -#endif + bus_bind_intr(dev, txr->res, i); + TASK_INIT(&txr->tx_task, 0, ixgbe_handle_tx, txr); txr->tq = taskqueue_create_fast("ixgbe_txq", M_NOWAIT, taskqueue_thread_enqueue, &txr->tq); @@ -2189,13 +2188,12 @@ ixgbe_allocate_msix(struct adapter *adap rxr->msix = vector; /* used in local timer */ adapter->rx_mask |= (u64)(1 << vector); -#if defined(__i386__) || defined(__amd64__) /* ** Bind the msix vector, and thus the ** ring to the corresponding cpu. */ - intr_bind(rman_get_start(rxr->res), i); -#endif + bus_bind_intr(dev, rxr->res, i); + TASK_INIT(&rxr->rx_task, 0, ixgbe_handle_rx, rxr); rxr->tq = taskqueue_create_fast("ixgbe_rxq", M_NOWAIT, taskqueue_thread_enqueue, &rxr->tq); From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 17:21:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 000B9106566C; Thu, 25 Jun 2009 17:21:12 +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 E2B938FC16; Thu, 25 Jun 2009 17:21:12 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PHLCHQ058287; Thu, 25 Jun 2009 17:21:12 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PHLC3d058285; Thu, 25 Jun 2009 17:21:12 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200906251721.n5PHLC3d058285@svn.freebsd.org> From: Jack F Vogel Date: Thu, 25 Jun 2009 17:21:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194979 - head/sys/dev/e1000 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 17:21:13 -0000 Author: jfv Date: Thu Jun 25 17:21:12 2009 New Revision: 194979 URL: http://svn.freebsd.org/changeset/base/194979 Log: Change intr_bind to bus_bind_intr, also limit this to multiqueue setup which is not the shipping default for igb (its set to 1). Modified: head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Thu Jun 25 17:16:26 2009 (r194978) +++ head/sys/dev/e1000/if_igb.c Thu Jun 25 17:21:12 2009 (r194979) @@ -2189,13 +2189,12 @@ igb_allocate_msix(struct adapter *adapte txr->eims = E1000_EICR_TX_QUEUE0 << i; else txr->eims = 1 << vector; -#if defined(__i386__) || defined(__amd64__) /* ** Bind the msix vector, and thus the ** ring to the corresponding cpu. */ - intr_bind(rman_get_start(txr->res), i); -#endif + if (adapter->num_queues > 1) + bus_bind_intr(dev, txr->res, i); } /* RX Setup */ @@ -2226,7 +2225,6 @@ igb_allocate_msix(struct adapter *adapte rxr->eims = 1 << vector; /* Get a mask for local timer */ adapter->rx_mask |= rxr->eims; -#if defined(__i386__) || defined(__amd64__) /* ** Bind the msix vector, and thus the ** ring to the corresponding cpu. @@ -2234,8 +2232,8 @@ igb_allocate_msix(struct adapter *adapte ** bound to each CPU, limited by the MSIX ** vectors. */ - intr_bind(rman_get_start(rxr->res), i); -#endif + if (adapter->num_queues > 1) + bus_bind_intr(dev, rxr->res, i); } /* And Link */ From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 17:24:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED50E1065677; Thu, 25 Jun 2009 17:24:36 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D94558FC12; Thu, 25 Jun 2009 17:24:36 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PHOat5058418; Thu, 25 Jun 2009 17:24:36 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PHOa2Q058415; Thu, 25 Jun 2009 17:24:36 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200906251724.n5PHOa2Q058415@svn.freebsd.org> From: Andrew Thompson Date: Thu, 25 Jun 2009 17:24:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194980 - head/share/man/man4 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 17:24:37 -0000 Author: thompsa Date: Thu Jun 25 17:24:36 2009 New Revision: 194980 URL: http://svn.freebsd.org/changeset/base/194980 Log: Rename man4/if_bridge.4 to man4/bridge.4 in order to be consistent with other peueso interfaces. The .Nm name hasnt been changed and all xrefs are still valid. Added: head/share/man/man4/bridge.4 - copied unchanged from r194929, head/share/man/man4/if_bridge.4 Deleted: head/share/man/man4/if_bridge.4 Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Thu Jun 25 17:21:12 2009 (r194979) +++ head/share/man/man4/Makefile Thu Jun 25 17:24:36 2009 (r194980) @@ -53,6 +53,7 @@ MAN= aac.4 \ bktr.4 \ blackhole.4 \ bpf.4 \ + bridge.4 \ bt.4 \ bwi.4 \ cardbus.4 \ @@ -130,7 +131,6 @@ MAN= aac.4 \ ida.4 \ idt.4 \ ieee80211.4 \ - if_bridge.4 \ ifmib.4 \ igb.4 \ igmp.4 \ @@ -474,6 +474,7 @@ MLINKS+=bce.4 if_bce.4 MLINKS+=bfe.4 if_bfe.4 MLINKS+=bge.4 if_bge.4 MLINKS+=bktr.4 brooktree.4 +MLINKS+=bridge.4 if_bridge.4 MLINKS+=bwi.4 if_bwi.4 MLINKS+=cas.4 if_cas.4 MLINKS+=crypto.4 cryptodev.4 @@ -506,7 +507,6 @@ MLINKS+=hatm.4 if_hatm.4 MLINKS+=hme.4 if_hme.4 MLINKS+=${_hptrr.4} ${_rr232x.4} MLINKS+=idt.4 if_idt.4 -MLINKS+=if_bridge.4 bridge.4 MLINKS+=igb.4 if_igb.4 MLINKS+=ip.4 rawip.4 MLINKS+=ipfirewall.4 ipaccounting.4 \ Copied: head/share/man/man4/bridge.4 (from r194929, head/share/man/man4/if_bridge.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/bridge.4 Thu Jun 25 17:24:36 2009 (r194980, copy of r194929, head/share/man/man4/if_bridge.4) @@ -0,0 +1,449 @@ +.\" $NetBSD: bridge.4,v 1.5 2004/01/31 20:14:11 jdc Exp $ +.\" +.\" Copyright 2001 Wasabi Systems, Inc. +.\" All rights reserved. +.\" +.\" Written by Jason R. Thorpe for Wasabi Systems, Inc. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed for the NetBSD Project by +.\" Wasabi Systems, Inc. +.\" 4. The name of Wasabi Systems, Inc. may not be used to endorse +.\" or promote products derived from this software without specific prior +.\" written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC +.\" 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 June 8, 2009 +.Dt IF_BRIDGE 4 +.Os +.Sh NAME +.Nm if_bridge +.Nd network bridge device +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device if_bridge" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following lines in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_bridge_load="YES" +bridgestp_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver creates a logical link between two or more IEEE 802 networks +that use the same (or +.Dq "similar enough" ) +framing format. +For example, it is possible to bridge Ethernet and 802.11 networks together, +but it is not possible to bridge Ethernet and Token Ring together. +.Pp +Each +.Nm +interface is created at runtime using interface cloning. +This is +most easily done with the +.Xr ifconfig 8 +.Cm create +command or using the +.Va cloned_interfaces +variable in +.Xr rc.conf 5 . +.Pp +The +.Nm +interface randomly chooses a link (MAC) address in the range reserved for +locally administered addresses when it is created. +This address is guaranteed to be unique +.Em only +across all +.Nm +interfaces on the local machine. +Thus you can theoretically have two bridges on the different machines with +the same link addresses. +The address can be changed by assigning the desired link address using +.Xr ifconfig 8 . +.Pp +If +.Xr sysctl 8 +node +.Va net.link.bridge.inherit_mac +has non-zero value, newly created bridge will inherit MAC address +from its first member instead of choosing random link-level address. +This will provide more predictable bridge MAC without any +additional configuration, but currently this feature is known +to break some L2 protocols, for example PPPoE that is provided +by +.Xr ng_pppoe 4 +and +.Xr ppp 8 . +Now this feature is considered as experimental and is turned off +by-default. +.Pp +A bridge can be used to provide several services, such as a simple +802.11-to-Ethernet bridge for wireless hosts, and traffic isolation. +.Pp +A bridge works like a hub, forwarding traffic from one interface +to another. +Multicast and broadcast packets are always forwarded to all +interfaces that are part of the bridge. +For unicast traffic, the bridge learns which MAC addresses are associated +with which interfaces and will forward the traffic selectively. +.Pp +All the bridged member interfaces need to be up in order to pass network traffic. +These can be enabled using +.Xr ifconfig 8 +or +.Va ifconfig_ Ns Ao Ar interface Ac Ns Li ="up" +in +.Xr rc.conf 5 . +.Pp +The MTU of the first member interface to be added is used as the bridge MTU. +All additional members are required to have exactly the same value. +.Pp +The TXCSUM capability is disabled for any interface added to the bridge, and it +is restored when the interface is removed again. +.Pp +The bridge supports +.Dq monitor mode , +where the packets are discarded after +.Xr bpf 4 +processing, and are not processed or forwarded further. +This can be used to multiplex the input of two or more interfaces into a single +.Xr bpf 4 +stream. +This is useful for reconstructing the traffic for network taps +that transmit the RX/TX signals out through two separate interfaces. +.Sh SPANNING TREE +The +.Nm +driver implements the Rapid Spanning Tree Protocol (RSTP or 802.1w) with +backwards compatibility with the legacy Spanning Tree Protocol (STP). +Spanning Tree is used to detect and remove loops in a network topology. +.Pp +RSTP provides faster spanning tree convergence than legacy STP, the protocol +will exchange information with neighbouring switches to quickly transition to +forwarding without creating loops. +.Pp +The code will default to RSTP mode but will downgrade any port connected to a +legacy STP network so is fully backward compatible. +A bridge can be forced to operate in STP mode without rapid state transitions +via the +.Va proto +command in +.Xr ifconfig 8 . +.Pp +The bridge can log STP port changes to +.Xr syslog 3 +by enabling the +.Va net.link.bridge.log_stp +variable using +.Xr sysctl 8 . +.Pp +.Sh PACKET FILTERING +Packet filtering can be used with any firewall package that hooks in via the +.Xr pfil 9 +framework. +When filtering is enabled, bridged packets will pass through the filter +inbound on the originating interface, on the bridge interface and outbound on +the appropriate interfaces. +Either stage can be disabled. +The filtering behaviour can be controlled using +.Xr sysctl 8 : +.Bl -tag -width ".Va net.link.bridge.pfil_onlyip" +.It Va net.link.bridge.pfil_onlyip +Controls the handling of non-IP packets which are not passed to +.Xr pfil 9 . +Set to +.Li 1 +to only allow IP packets to pass (subject to firewall rules), set to +.Li 0 +to unconditionally pass all non-IP Ethernet frames. +.It Va net.link.bridge.pfil_member +Set to +.Li 1 +to enable filtering on the incoming and outgoing member interfaces, set +to +.Li 0 +to disable it. +.It Va net.link.bridge.pfil_bridge +Set to +.Li 1 +to enable filtering on the bridge interface, set +to +.Li 0 +to disable it. +.It Va net.link.bridge.pfil_local_phys +Set to +.Li 1 +to additionally filter on the physical interface for locally destined packets. +Set to +.Li 0 +to disable this feature. +.It Va net.link.bridge.ipfw +Set to +.Li 1 +to enable layer2 filtering with +.Xr ipfirewall 4 , +set to +.Li 0 +to disable it. +This needs to be enabled for +.Xr dummynet 4 +support. +When +.Va ipfw +is enabled, +.Va pfil_bridge +and +.Va pfil_member +will be disabled so that IPFW +is not run twice; these can be re-enabled if desired. +.It Va net.link.bridge.ipfw_arp +Set to +.Li 1 +to enable layer2 ARP filtering with +.Xr ipfirewall 4 , +set to +.Li 0 +to disable it. +Requires +.Va ipfw +to be enabled. +.El +.Pp +ARP and REVARP packets are forwarded without being filtered and others +that are not IP nor IPv6 packets are not forwarded when +.Va pfil_onlyip +is enabled. +IPFW can filter Ethernet types using +.Cm mac-type +so all packets are passed to +the filter for processing. +.Pp +The packets originating from the bridging host will be seen by +the filter on the interface that is looked up in the routing +table. +.Pp +The packets destined to the bridging host will be seen by the filter +on the interface with the MAC address equal to the packet's destination +MAC. +There are situations when some of the bridge members are sharing +the same MAC address (for example the +.Xr vlan 4 +interfaces: they are currenly sharing the +MAC address of the parent physical interface). +It is not possible to distinguish between these interfaces using +their MAC address, excluding the case when the packet's destination +MAC address is equal to the MAC address of the interface on which +the packet was entered to the system. +In this case the filter will see the incoming packet on this +interface. +In all other cases the interface seen by the packet filter is chosen +from the list of bridge members with the same MAC address and the +result strongly depends on the member addition sequence and the +actual implementation of +.Nm . +It is not recommended to rely on the order chosen by the current +.Nm +implementation: it can be changed in the future. +.Pp +The previous paragraph is best illustrated with the following +pictures. +Let +.Bl -bullet +.It +the MAC address of the incoming packet's destination is +.Nm nn:nn:nn:nn:nn:nn , +.It +the interface on which packet entered the system is +.Nm ifX , +.It +.Nm ifX +MAC address is +.Nm xx:xx:xx:xx:xx:xx , +.It +there are possibly other bridge members with the same MAC address +.Nm xx:xx:xx:xx:xx:xx , +.It +the bridge has more than one interface that are sharing the +same MAC address +.Nm yy:yy:yy:yy:yy:yy ; +we will call them +.Nm vlanY1 , +.Nm vlanY2 , +etc. +.El +.Pp +Then if the MAC address +.Nm nn:nn:nn:nn:nn:nn +is equal to the +.Nm xx:xx:xx:xx:xx:xx +then the filter will see the packet on the interface +.Nm ifX +no matter if there are any other bridge members carrying the same +MAC address. +But if the MAC address +.Nm nn:nn:nn:nn:nn:nn +is equal to the +.Nm yy:yy:yy:yy:yy:yy +then the interface that will be seen by the filter is one of the +.Nm vlanYn . +It is not possible to predict the name of the actual interface +without the knowledge of the system state and the +.Nm +implementation details. +.Pp +This problem arises for any bridge members that are sharing the same +MAC address, not only to the +.Xr vlan 4 +ones: they we taken just as the example of such situation. +So if one wants the filter the locally destined packets based on +their interface name, one should be aware of this implication. +The described situation will appear at least on the filtering bridges +that are doing IP-forwarding; in some of such cases it is better +to assign the IP address only to the +.Nm +interface and not to the bridge members. +Enabling +.Va net.link.bridge.pfil_local_phys +will let you do the additional filtering on the physical interface. +.Sh EXAMPLES +The following when placed in the file +.Pa /etc/rc.conf +will cause a bridge called +.Dq Li bridge0 +to be created, and will add the interfaces +.Dq Li wlan0 +and +.Dq Li fxp0 +to the bridge, and then enable packet forwarding. +Such a configuration could be used to implement a simple +802.11-to-Ethernet bridge (assuming the 802.11 interface is +in ad-hoc mode). +.Bd -literal -offset indent +cloned_interfaces="bridge0" +ifconfig_bridge0="addm wlan0 addm fxp0 up" +.Ed +.Pp +For the bridge to forward packets all member interfaces and the bridge need +to be up. +The above example would also require: +.Bd -literal -offset indent +create_args_wlan0="wlanmode hostap" +ifconfig_wlan0="up ssid my_ap mode 11g" +ifconfig_fxp0="up" +.Ed +.Pp +Consider a system with two 4-port Ethernet boards. +The following will cause a bridge consisting of all 8 ports with Rapid Spanning +Tree enabled to be created: +.Bd -literal -offset indent +ifconfig bridge0 create +ifconfig bridge0 \e + addm fxp0 stp fxp0 \e + addm fxp1 stp fxp1 \e + addm fxp2 stp fxp2 \e + addm fxp3 stp fxp3 \e + addm fxp4 stp fxp4 \e + addm fxp5 stp fxp5 \e + addm fxp6 stp fxp6 \e + addm fxp7 stp fxp7 \e + up +.Ed +.Pp +The bridge can be used as a regular host interface at the same time as bridging +between its member ports. +In this example, the bridge connects em0 and em1, and will receive its IP +address through DHCP: +.Bd -literal -offset indent +cloned_interfaces="bridge0" +ifconfig_bridge0="addm em0 addm em1 DHCP" +ifconfig_em0="up" +ifconfig_em1="up" +.Ed +.Pp +The bridge can tunnel Ethernet across an IP internet using the EtherIP +protocol. +This can be combined with +.Xr ipsec 4 +to provide an encrypted connection. +Create a +.Xr gif 4 +interface and set the local and remote IP addresses for the +tunnel, these are reversed on the remote bridge. +.Bd -literal -offset indent +ifconfig gif0 create +ifconfig gif0 tunnel 1.2.3.4 5.6.7.8 up +ifconfig bridge0 create +ifconfig bridge0 addm fxp0 addm gif0 up +.Ed +.Pp +Note that +.Fx +6.1, 6.2, 6.3, 7.0, 7.1, and 7.2 have a bug in the EtherIP protocol. +For more details and workaround, see +.Xr gif 4 manual page. +.Sh SEE ALSO +.Xr gif 4 , +.Xr ipf 4 , +.Xr ipfw 4 , +.Xr pf 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 6.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm bridge +driver was originally written by +.An Jason L. Wright +.Aq jason@thought.net +as part of an undergraduate independent study at the University of +North Carolina at Greensboro. +.Pp +This version of the +.Nm +driver has been heavily modified from the original version by +.An Jason R. Thorpe +.Aq thorpej@wasabisystems.com . +.Pp +Rapid Spanning Tree Protocol (RSTP) support was added by +.An Andrew Thompson +.Aq thompsa@FreeBSD.org . +.Sh BUGS +The +.Nm +driver currently supports only Ethernet and Ethernet-like (e.g., 802.11) +network devices, with exactly the same interface MTU size as the bridge device. From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 17:36:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55A05106564A; Thu, 25 Jun 2009 17:36:09 +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 436EE8FC0C; Thu, 25 Jun 2009 17:36:09 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PHa8ZN058845; Thu, 25 Jun 2009 17:36:08 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PHa8QM058844; Thu, 25 Jun 2009 17:36:08 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <200906251736.n5PHa8QM058844@svn.freebsd.org> From: Jilles Tjoelker Date: Thu, 25 Jun 2009 17:36: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: r194981 - head/tools/regression/bin/sh/expansion X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 17:36:09 -0000 Author: jilles Date: Thu Jun 25 17:36:08 2009 New Revision: 194981 URL: http://svn.freebsd.org/changeset/base/194981 Log: Add some tests for r194975 and r194977. Approved by: ed (mentor) (implicit) Added: head/tools/regression/bin/sh/expansion/ head/tools/regression/bin/sh/expansion/ifs1.0 (contents, props changed) Added: head/tools/regression/bin/sh/expansion/ifs1.0 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/regression/bin/sh/expansion/ifs1.0 Thu Jun 25 17:36:08 2009 (r194981) @@ -0,0 +1,35 @@ +# $FreeBSD$ + +c=: e= s=' ' +failures='' +ok='' + +check_result() { + if [ "x$2" = "x$3" ]; then + ok=x$ok + else + failures=x$failures + echo "For $1, expected $3 actual $2" + fi +} + +IFS=' +' +set -- a '' +set -- "$@" +check_result 'set -- "$@"' "($#)($1)($2)" "(2)(a)()" + +set -- a '' +set -- "$@"$e +check_result 'set -- "$@"$e' "($#)($1)($2)" "(2)(a)()" + +set -- a '' +set -- "$@"$s +check_result 'set -- "$@"$s' "($#)($1)($2)" "(2)(a)()" + +IFS="$c" +set -- a '' +set -- "$@"$c +check_result 'set -- "$@"$c' "($#)($1)($2)" "(2)(a)()" + +test "x$failures" = x From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 17:44:23 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FA3F1065675; Thu, 25 Jun 2009 17:44:23 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.delphij.net (delphij-pt.tunnel.tserv2.fmt.ipv6.he.net [IPv6:2001:470:1f03:2c9::2]) by mx1.freebsd.org (Postfix) with ESMTP id 0144A8FC19; Thu, 25 Jun 2009 17:44:23 +0000 (UTC) (envelope-from delphij@delphij.net) Received: from tarsier.geekcn.org (tarsier.geekcn.org [211.166.10.233]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tarsier.delphij.net (Postfix) with ESMTPS id E9BE15C025; Fri, 26 Jun 2009 01:44:21 +0800 (CST) Received: from localhost (tarsier.geekcn.org [211.166.10.233]) by tarsier.geekcn.org (Postfix) with ESMTP id AFE1955CD5B3; Fri, 26 Jun 2009 01:44:21 +0800 (CST) X-Virus-Scanned: amavisd-new at geekcn.org Received: from tarsier.geekcn.org ([211.166.10.233]) by localhost (mail.geekcn.org [211.166.10.233]) (amavisd-new, port 10024) with ESMTP id jvBNNkKG8guk; Fri, 26 Jun 2009 01:43:28 +0800 (CST) Received: from charlie.delphij.net (adsl-76-237-33-62.dsl.pltn13.sbcglobal.net [76.237.33.62]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tarsier.geekcn.org (Postfix) with ESMTPSA id 6C3A055CD5AC; Fri, 26 Jun 2009 01:43:21 +0800 (CST) DomainKey-Signature: a=rsa-sha1; s=default; d=delphij.net; c=nofws; q=dns; h=message-id:date:from:reply-to:organization:user-agent: mime-version:to:cc:subject:references:in-reply-to: x-enigmail-version:openpgp:content-type:content-transfer-encoding; b=lw7aMBWCj/96+Hl2/p0ZP9OKIGV6ta/e4JDhPwB2NEIPyG5eb1AvqL+CNUKnrDfUk QGEYSgVhD8NFSIzBKPGOQ== Message-ID: <4A43B727.7010204@delphij.net> Date: Thu, 25 Jun 2009 10:43:03 -0700 From: Xin LI Organization: The FreeBSD Project User-Agent: Thunderbird 2.0.0.21 (X11/20090408) MIME-Version: 1.0 To: Bruce Evans References: <200906232316.n5NNG1iT094289@svn.freebsd.org> <20090625154007.H33864@delplex.bde.org> In-Reply-To: <20090625154007.H33864@delplex.bde.org> X-Enigmail-Version: 0.95.7 OpenPGP: id=18EDEBA0; url=http://www.delphij.net/delphij.asc Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@FreeBSD.ORG, svn-src-all@FreeBSD.ORG, src-committers@FreeBSD.ORG, Xin LI Subject: Re: svn commit: r194789 - head/usr.bin/usbhidctl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: d@delphij.net List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 17:44:23 -0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, Bruce, Bruce Evans wrote: > On Tue, 23 Jun 2009, Xin LI wrote: > >> Log: >> Use getprogname() instead of referencing __progname. > > Neither is permitted in FreeBSD in usage(). I didn't see references about this? If this is discouraged, perhaps we should mention it in style(9) or somewhere. It looks like that a lot of programs are using (not necessarily from NetBSD), but also others. Do we have some discussion in the past regarding this? >> Modified: >> head/usr.bin/usbhidctl/usbhid.c > > This was obtained from NetBSD, which requires using getprogname() in > usage(). This is purely coincidence... I didn't even looked at NetBSD code in this case, otherwise I would have brought the TNF copyright changes, etc. altogether. Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEARECAAYFAkpDtycACgkQi+vbBBjt66A8awCggrT1H1PcbRXdTuKGs9S2Bgd+ v1YAn3XibpzEdWruW7voxhZtd+5qBRmC =uf+j -----END PGP SIGNATURE----- From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 17:46:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8F701065674; Thu, 25 Jun 2009 17:46:52 +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 D713D8FC20; Thu, 25 Jun 2009 17:46:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PHkqVc059129; Thu, 25 Jun 2009 17:46:52 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PHkqko059127; Thu, 25 Jun 2009 17:46:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906251746.n5PHkqko059127@svn.freebsd.org> From: John Baldwin Date: Thu, 25 Jun 2009 17:46: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: r194982 - head/sys/sun4v/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 17:46:53 -0000 Author: jhb Date: Thu Jun 25 17:46:52 2009 New Revision: 194982 URL: http://svn.freebsd.org/changeset/base/194982 Log: Remove COMPAT_FREEBSD5 from sun4v. There are no FreeBSD/sun4v 5.x binaries to be compatible with. Modified: head/sys/sun4v/conf/GENERIC Modified: head/sys/sun4v/conf/GENERIC ============================================================================== --- head/sys/sun4v/conf/GENERIC Thu Jun 25 17:36:08 2009 (r194981) +++ head/sys/sun4v/conf/GENERIC Thu Jun 25 17:46:52 2009 (r194982) @@ -53,7 +53,6 @@ options GEOM_PART_GPT # GUID Partition options GEOM_LABEL # Provides labelization options COMPAT_43 # Compatible with BSD 4.3 (sgtty) options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty) -options COMPAT_FREEBSD5 # Compatible with FreeBSD5 options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support options STACK # stack(9) support From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 18:07:19 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5669C106564A; Thu, 25 Jun 2009 18:07:19 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 452698FC14; Thu, 25 Jun 2009 18:07:19 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PI7Jid059799; Thu, 25 Jun 2009 18:07:19 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PI7JiO059797; Thu, 25 Jun 2009 18:07:19 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906251807.n5PI7JiO059797@svn.freebsd.org> From: Sam Leffler Date: Thu, 25 Jun 2009 18:07: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: r194983 - head/sys/arm/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 18:07:19 -0000 Author: sam Date: Thu Jun 25 18:07:19 2009 New Revision: 194983 URL: http://svn.freebsd.org/changeset/base/194983 Log: temporarily disable optional uarts; apparently we hang when probing them (and they are not present) Modified: head/sys/arm/conf/CAMBRIA.hints Modified: head/sys/arm/conf/CAMBRIA.hints ============================================================================== --- head/sys/arm/conf/CAMBRIA.hints Thu Jun 25 17:46:52 2009 (r194982) +++ head/sys/arm/conf/CAMBRIA.hints Thu Jun 25 18:07:19 2009 (r194983) @@ -14,16 +14,16 @@ hint.uart.0.ier_rxbits=0x5d # NB: need U # NB: no UART1 on ixp435 # optional GPS serial port -hint.uart.1.at="ixp0" -hint.uart.1.addr=0x53fc0000 -hint.uart.1.irq=20 -hint.uart.1.ier_rxbits=0x1 -hint.uart.1.rclk=1843200 +#hint.uart.1.at="ixp0" +#hint.uart.1.addr=0x53fc0000 +#hint.uart.1.irq=20 +#hint.uart.1.ier_rxbits=0x1 +#hint.uart.1.rclk=1843200 # optional RS485 serial port -hint.uart.2.at="ixp0" -hint.uart.2.addr=0x53f80000 -hint.uart.2.irq=21 -hint.uart.2.rclk=1843200 +#hint.uart.2.at="ixp0" +#hint.uart.2.addr=0x53f80000 +#hint.uart.2.irq=21 +#hint.uart.2.rclk=1843200 # NPE Hardware Queue Manager hint.ixpqmgr.0.at="ixp0" From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 18:09:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B461106564A; Thu, 25 Jun 2009 18:09:23 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 54DF28FC08; Thu, 25 Jun 2009 18:09:23 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PI9NRH059872; Thu, 25 Jun 2009 18:09:23 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PI9N3X059870; Thu, 25 Jun 2009 18:09:23 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200906251809.n5PI9N3X059870@svn.freebsd.org> From: Rafal Jaworowski Date: Thu, 25 Jun 2009 18:09:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194984 - head/sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 18:09:24 -0000 Author: raj Date: Thu Jun 25 18:09:23 2009 New Revision: 194984 URL: http://svn.freebsd.org/changeset/base/194984 Log: Make ata-{dma,sata}.c dependent on atacore build option. Discussed with: mav Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Jun 25 18:07:19 2009 (r194983) +++ head/sys/conf/files Thu Jun 25 18:09:23 2009 (r194984) @@ -489,10 +489,10 @@ dev/asr/asr.c optional asr pci # dev/ata/ata_if.m optional ata | atacore dev/ata/ata-all.c optional ata | atacore +dev/ata/ata-dma.c optional ata | atacore dev/ata/ata-lowlevel.c optional ata | atacore dev/ata/ata-queue.c optional ata | atacore -dev/ata/ata-dma.c optional ata | atadma -dev/ata/ata-sata.c optional ata | atasata +dev/ata/ata-sata.c optional ata | atacore dev/ata/ata-card.c optional ata pccard | atapccard dev/ata/ata-cbus.c optional ata pc98 | atapc98 dev/ata/ata-isa.c optional ata isa | ataisa From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 18:13:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B0EE51065672; Thu, 25 Jun 2009 18:13:46 +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 9D7178FC14; Thu, 25 Jun 2009 18:13:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PIDk3S060013; Thu, 25 Jun 2009 18:13:46 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PIDkfl060004; Thu, 25 Jun 2009 18:13:46 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906251813.n5PIDkfl060004@svn.freebsd.org> From: John Baldwin Date: Thu, 25 Jun 2009 18:13: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: r194985 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 18:13:47 -0000 Author: jhb Date: Thu Jun 25 18:13:46 2009 New Revision: 194985 URL: http://svn.freebsd.org/changeset/base/194985 Log: - Restore the behavior of pre-allocating IDT vectors for MSI interrupts. This is mostly important for the multiple MSI message case where the IDT vectors for the entire group need to be allocated together. This also restores the assumptions made by the PCI bus code that it could invoke PCIB_MAP_MSI() once MSI vectors were allocated. - To avoid whiplash with CPU assignments, change the way that CPUs are assigned to interrupt sources on activation. Instead of assigning the CPU via pic_assign_cpu() before calling enable_intr(), allow the different interrupt source drivers to ask the MD interrupt code which CPU to use when they allocate an IDT vector. I/O APIC interrupt pins do this in their pic_enable_intr() routines giving the same behavior as before. MSI sources do it when the IDT vectors are allocated during msi_alloc() and msix_alloc(). - Change the intr_table_lock from an sx lock to a mutex. Tested by: rnoland Modified: head/sys/amd64/amd64/intr_machdep.c head/sys/amd64/amd64/io_apic.c head/sys/amd64/amd64/msi.c head/sys/amd64/include/intr_machdep.h head/sys/i386/i386/intr_machdep.c head/sys/i386/i386/io_apic.c head/sys/i386/i386/msi.c head/sys/i386/include/intr_machdep.h Modified: head/sys/amd64/amd64/intr_machdep.c ============================================================================== --- head/sys/amd64/amd64/intr_machdep.c Thu Jun 25 18:09:23 2009 (r194984) +++ head/sys/amd64/amd64/intr_machdep.c Thu Jun 25 18:13:46 2009 (r194985) @@ -51,7 +51,6 @@ #include #include #include -#include #include #include #include @@ -73,14 +72,12 @@ typedef void (*mask_fn)(void *); static int intrcnt_index; static struct intsrc *interrupt_sources[NUM_IO_INTS]; -static struct sx intr_table_lock; +static struct mtx intr_table_lock; static struct mtx intrcnt_lock; static STAILQ_HEAD(, pic) pics; #ifdef SMP static int assign_cpu; - -static void intr_assign_next_cpu(struct intsrc *isrc); #endif static int intr_assign_cpu(void *arg, u_char cpu); @@ -114,14 +111,14 @@ intr_register_pic(struct pic *pic) { int error; - sx_xlock(&intr_table_lock); + mtx_lock(&intr_table_lock); if (intr_pic_registered(pic)) error = EBUSY; else { STAILQ_INSERT_TAIL(&pics, pic, pics); error = 0; } - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); return (error); } @@ -145,16 +142,16 @@ intr_register_source(struct intsrc *isrc vector); if (error) return (error); - sx_xlock(&intr_table_lock); + mtx_lock(&intr_table_lock); if (interrupt_sources[vector] != NULL) { - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); intr_event_destroy(isrc->is_event); return (EEXIST); } intrcnt_register(isrc); interrupt_sources[vector] = isrc; isrc->is_handlers = 0; - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); return (0); } @@ -178,18 +175,14 @@ intr_add_handler(const char *name, int v error = intr_event_add_handler(isrc->is_event, name, filter, handler, arg, intr_priority(flags), flags, cookiep); if (error == 0) { - sx_xlock(&intr_table_lock); + mtx_lock(&intr_table_lock); intrcnt_updatename(isrc); isrc->is_handlers++; if (isrc->is_handlers == 1) { -#ifdef SMP - if (assign_cpu) - intr_assign_next_cpu(isrc); -#endif isrc->is_pic->pic_enable_intr(isrc); isrc->is_pic->pic_enable_source(isrc); } - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); } return (error); } @@ -203,14 +196,14 @@ intr_remove_handler(void *cookie) isrc = intr_handler_source(cookie); error = intr_event_remove_handler(cookie); if (error == 0) { - sx_xlock(&intr_table_lock); + mtx_lock(&intr_table_lock); isrc->is_handlers--; if (isrc->is_handlers == 0) { isrc->is_pic->pic_disable_source(isrc, PIC_NO_EOI); isrc->is_pic->pic_disable_intr(isrc); } intrcnt_updatename(isrc); - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); } return (error); } @@ -284,12 +277,12 @@ intr_resume(void) #ifndef DEV_ATPIC atpic_reset(); #endif - sx_xlock(&intr_table_lock); + mtx_lock(&intr_table_lock); STAILQ_FOREACH(pic, &pics, pics) { if (pic->pic_resume != NULL) pic->pic_resume(pic); } - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); } void @@ -297,12 +290,12 @@ intr_suspend(void) { struct pic *pic; - sx_xlock(&intr_table_lock); + mtx_lock(&intr_table_lock); STAILQ_FOREACH(pic, &pics, pics) { if (pic->pic_suspend != NULL) pic->pic_suspend(pic); } - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); } static int @@ -317,9 +310,9 @@ intr_assign_cpu(void *arg, u_char cpu) */ if (assign_cpu && cpu != NOCPU) { isrc = arg; - sx_xlock(&intr_table_lock); + mtx_lock(&intr_table_lock); isrc->is_pic->pic_assign_cpu(isrc, cpu_apic_ids[cpu]); - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); } return (0); #else @@ -378,7 +371,7 @@ intr_init(void *dummy __unused) intrcnt_setname("???", 0); intrcnt_index = 1; STAILQ_INIT(&pics); - sx_init(&intr_table_lock, "intr sources"); + mtx_init(&intr_table_lock, "intr sources", NULL, MTX_DEF | MTX_RECURSE); mtx_init(&intrcnt_lock, "intrcnt", NULL, MTX_SPIN); } SYSINIT(intr_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_init, NULL); @@ -435,19 +428,28 @@ DB_SHOW_COMMAND(irqs, db_show_irqs) static cpumask_t intr_cpus = (1 << 0); static int current_cpu; -static void -intr_assign_next_cpu(struct intsrc *isrc) +/* + * Return the CPU that the next interrupt source should use. For now + * this just returns the next local APIC according to round-robin. + */ +u_int +intr_next_cpu(void) { + u_int apic_id; - /* - * Assign this source to a local APIC in a round-robin fashion. - */ - isrc->is_pic->pic_assign_cpu(isrc, cpu_apic_ids[current_cpu]); + /* Leave all interrupts on the BSP during boot. */ + if (!assign_cpu) + return (cpu_apic_ids[0]); + + mtx_lock(&intr_table_lock); + apic_id = cpu_apic_ids[current_cpu]; do { current_cpu++; if (current_cpu > mp_maxid) current_cpu = 0; } while (!(intr_cpus & (1 << current_cpu))); + mtx_unlock(&intr_table_lock); + return (apic_id); } /* Attempt to bind the specified IRQ to the specified CPU. */ @@ -487,6 +489,7 @@ static void intr_shuffle_irqs(void *arg __unused) { struct intsrc *isrc; + u_int apic_id; int i; /* Don't bother on UP. */ @@ -494,7 +497,7 @@ intr_shuffle_irqs(void *arg __unused) return; /* Round-robin assign a CPU to each enabled source. */ - sx_xlock(&intr_table_lock); + mtx_lock(&intr_table_lock); assign_cpu = 1; for (i = 0; i < NUM_IO_INTS; i++) { isrc = interrupt_sources[i]; @@ -505,13 +508,13 @@ intr_shuffle_irqs(void *arg __unused) * of picking one via round-robin. */ if (isrc->is_event->ie_cpu != NOCPU) - isrc->is_pic->pic_assign_cpu(isrc, - cpu_apic_ids[isrc->is_event->ie_cpu]); + apic_id = isrc->is_event->ie_cpu; else - intr_assign_next_cpu(isrc); + apic_id = intr_next_cpu(); + isrc->is_pic->pic_assign_cpu(isrc, apic_id); } } - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); } SYSINIT(intr_shuffle_irqs, SI_SUB_SMP, SI_ORDER_SECOND, intr_shuffle_irqs, NULL); Modified: head/sys/amd64/amd64/io_apic.c ============================================================================== --- head/sys/amd64/amd64/io_apic.c Thu Jun 25 18:09:23 2009 (r194984) +++ head/sys/amd64/amd64/io_apic.c Thu Jun 25 18:13:46 2009 (r194985) @@ -372,7 +372,7 @@ ioapic_enable_intr(struct intsrc *isrc) struct ioapic_intsrc *intpin = (struct ioapic_intsrc *)isrc; if (intpin->io_vector == 0) - ioapic_assign_cpu(isrc, pcpu_find(0)->pc_apic_id); + ioapic_assign_cpu(isrc, intr_next_cpu()); apic_enable_vector(intpin->io_cpu, intpin->io_vector); } Modified: head/sys/amd64/amd64/msi.c ============================================================================== --- head/sys/amd64/amd64/msi.c Thu Jun 25 18:09:23 2009 (r194984) +++ head/sys/amd64/amd64/msi.c Thu Jun 25 18:13:46 2009 (r194985) @@ -161,8 +161,6 @@ msi_enable_intr(struct intsrc *isrc) { struct msi_intsrc *msi = (struct msi_intsrc *)isrc; - if (msi->msi_vector == 0) - msi_assign_cpu(isrc, 0); apic_enable_vector(msi->msi_cpu, msi->msi_vector); } @@ -208,10 +206,11 @@ msi_assign_cpu(struct intsrc *isrc, u_in /* Store information to free existing irq. */ old_vector = msi->msi_vector; old_id = msi->msi_cpu; - if (old_vector && old_id == apic_id) + if (old_id == apic_id) return; - if (old_vector && !msi->msi_msix && msi->msi_first->msi_count > 1) + if (!msi->msi_msix && msi->msi_first->msi_count > 1) return; + /* Allocate IDT vector on this cpu. */ vector = apic_alloc_vector(apic_id, msi->msi_irq); if (vector == 0) @@ -223,15 +222,14 @@ msi_assign_cpu(struct intsrc *isrc, u_in msi->msi_msix ? "MSI-X" : "MSI", msi->msi_irq, msi->msi_cpu, msi->msi_vector); pci_remap_msi_irq(msi->msi_dev, msi->msi_irq); + /* * Free the old vector after the new one is established. This is done * to prevent races where we could miss an interrupt. */ - if (old_vector) - apic_free_vector(old_id, old_vector, msi->msi_irq); + apic_free_vector(old_id, old_vector, msi->msi_irq); } - void msi_init(void) { @@ -287,7 +285,8 @@ int msi_alloc(device_t dev, int count, int maxcount, int *irqs) { struct msi_intsrc *msi, *fsrc; - int cnt, i; + u_int cpu; + int cnt, i, vector; if (!msi_enabled) return (ENXIO); @@ -333,12 +332,25 @@ again: /* Ok, we now have the IRQs allocated. */ KASSERT(cnt == count, ("count mismatch")); + /* Allocate 'count' IDT vectors. */ + cpu = intr_next_cpu(); + vector = apic_alloc_vectors(cpu, irqs, count, maxcount); + if (vector == 0) { + mtx_unlock(&msi_lock); + return (ENOSPC); + } + /* Assign IDT vectors and make these messages owned by 'dev'. */ fsrc = (struct msi_intsrc *)intr_lookup_source(irqs[0]); for (i = 0; i < count; i++) { msi = (struct msi_intsrc *)intr_lookup_source(irqs[i]); + msi->msi_cpu = cpu; msi->msi_dev = dev; - msi->msi_vector = 0; + msi->msi_vector = vector + i; + if (bootverbose) + printf( + "msi: routing MSI IRQ %d to local APIC %u vector %u\n", + msi->msi_irq, msi->msi_cpu, msi->msi_vector); msi->msi_first = fsrc; KASSERT(msi->msi_intsrc.is_handlers == 0, ("dead MSI has handlers")); @@ -391,18 +403,14 @@ msi_release(int *irqs, int count) KASSERT(msi->msi_dev == first->msi_dev, ("owner mismatch")); msi->msi_first = NULL; msi->msi_dev = NULL; - if (msi->msi_vector) - apic_free_vector(msi->msi_cpu, msi->msi_vector, - msi->msi_irq); + apic_free_vector(msi->msi_cpu, msi->msi_vector, msi->msi_irq); msi->msi_vector = 0; } /* Clear out the first message. */ first->msi_first = NULL; first->msi_dev = NULL; - if (first->msi_vector) - apic_free_vector(first->msi_cpu, first->msi_vector, - first->msi_irq); + apic_free_vector(first->msi_cpu, first->msi_vector, first->msi_irq); first->msi_vector = 0; first->msi_count = 0; @@ -451,7 +459,8 @@ int msix_alloc(device_t dev, int *irq) { struct msi_intsrc *msi; - int i; + u_int cpu; + int i, vector; if (!msi_enabled) return (ENXIO); @@ -486,9 +495,17 @@ again: goto again; } + /* Allocate an IDT vector. */ + cpu = intr_next_cpu(); + vector = apic_alloc_vector(cpu, i); + if (bootverbose) + printf("msi: routing MSI-X IRQ %d to local APIC %u vector %u\n", + msi->msi_irq, cpu, vector); + /* Setup source. */ + msi->msi_cpu = cpu; msi->msi_dev = dev; - msi->msi_vector = 0; + msi->msi_vector = vector; msi->msi_msix = 1; KASSERT(msi->msi_intsrc.is_handlers == 0, ("dead MSI-X has handlers")); @@ -520,8 +537,7 @@ msix_release(int irq) /* Clear out the message. */ msi->msi_dev = NULL; - if (msi->msi_vector) - apic_free_vector(msi->msi_cpu, msi->msi_vector, msi->msi_irq); + apic_free_vector(msi->msi_cpu, msi->msi_vector, msi->msi_irq); msi->msi_vector = 0; msi->msi_msix = 0; Modified: head/sys/amd64/include/intr_machdep.h ============================================================================== --- head/sys/amd64/include/intr_machdep.h Thu Jun 25 18:09:23 2009 (r194984) +++ head/sys/amd64/include/intr_machdep.h Thu Jun 25 18:13:46 2009 (r194985) @@ -152,6 +152,9 @@ int intr_bind(u_int vector, u_char cpu); int intr_config_intr(int vector, enum intr_trigger trig, enum intr_polarity pol); void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame); +#ifdef SMP +u_int intr_next_cpu(void); +#endif struct intsrc *intr_lookup_source(int vector); int intr_register_pic(struct pic *pic); int intr_register_source(struct intsrc *isrc); Modified: head/sys/i386/i386/intr_machdep.c ============================================================================== --- head/sys/i386/i386/intr_machdep.c Thu Jun 25 18:09:23 2009 (r194984) +++ head/sys/i386/i386/intr_machdep.c Thu Jun 25 18:13:46 2009 (r194985) @@ -50,7 +50,6 @@ #include #include #include -#include #include #include #include @@ -64,14 +63,12 @@ typedef void (*mask_fn)(void *); static int intrcnt_index; static struct intsrc *interrupt_sources[NUM_IO_INTS]; -static struct sx intr_table_lock; +static struct mtx intr_table_lock; static struct mtx intrcnt_lock; static STAILQ_HEAD(, pic) pics; #ifdef SMP static int assign_cpu; - -static void intr_assign_next_cpu(struct intsrc *isrc); #endif static int intr_assign_cpu(void *arg, u_char cpu); @@ -105,14 +102,14 @@ intr_register_pic(struct pic *pic) { int error; - sx_xlock(&intr_table_lock); + mtx_lock(&intr_table_lock); if (intr_pic_registered(pic)) error = EBUSY; else { STAILQ_INSERT_TAIL(&pics, pic, pics); error = 0; } - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); return (error); } @@ -136,16 +133,16 @@ intr_register_source(struct intsrc *isrc vector); if (error) return (error); - sx_xlock(&intr_table_lock); + mtx_lock(&intr_table_lock); if (interrupt_sources[vector] != NULL) { - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); intr_event_destroy(isrc->is_event); return (EEXIST); } intrcnt_register(isrc); interrupt_sources[vector] = isrc; isrc->is_handlers = 0; - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); return (0); } @@ -169,18 +166,14 @@ intr_add_handler(const char *name, int v error = intr_event_add_handler(isrc->is_event, name, filter, handler, arg, intr_priority(flags), flags, cookiep); if (error == 0) { - sx_xlock(&intr_table_lock); + mtx_lock(&intr_table_lock); intrcnt_updatename(isrc); isrc->is_handlers++; if (isrc->is_handlers == 1) { -#ifdef SMP - if (assign_cpu) - intr_assign_next_cpu(isrc); -#endif isrc->is_pic->pic_enable_intr(isrc); isrc->is_pic->pic_enable_source(isrc); } - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); } return (error); } @@ -194,14 +187,14 @@ intr_remove_handler(void *cookie) isrc = intr_handler_source(cookie); error = intr_event_remove_handler(cookie); if (error == 0) { - sx_xlock(&intr_table_lock); + mtx_lock(&intr_table_lock); isrc->is_handlers--; if (isrc->is_handlers == 0) { isrc->is_pic->pic_disable_source(isrc, PIC_NO_EOI); isrc->is_pic->pic_disable_intr(isrc); } intrcnt_updatename(isrc); - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); } return (error); } @@ -272,12 +265,12 @@ intr_resume(void) { struct pic *pic; - sx_xlock(&intr_table_lock); + mtx_lock(&intr_table_lock); STAILQ_FOREACH(pic, &pics, pics) { if (pic->pic_resume != NULL) pic->pic_resume(pic); } - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); } void @@ -285,12 +278,12 @@ intr_suspend(void) { struct pic *pic; - sx_xlock(&intr_table_lock); + mtx_lock(&intr_table_lock); STAILQ_FOREACH(pic, &pics, pics) { if (pic->pic_suspend != NULL) pic->pic_suspend(pic); } - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); } static int @@ -305,9 +298,9 @@ intr_assign_cpu(void *arg, u_char cpu) */ if (assign_cpu && cpu != NOCPU) { isrc = arg; - sx_xlock(&intr_table_lock); + mtx_lock(&intr_table_lock); isrc->is_pic->pic_assign_cpu(isrc, cpu_apic_ids[cpu]); - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); } return (0); #else @@ -366,7 +359,7 @@ intr_init(void *dummy __unused) intrcnt_setname("???", 0); intrcnt_index = 1; STAILQ_INIT(&pics); - sx_init(&intr_table_lock, "intr sources"); + mtx_init(&intr_table_lock, "intr sources", NULL, MTX_DEF | MTX_RECURSE); mtx_init(&intrcnt_lock, "intrcnt", NULL, MTX_SPIN); } SYSINIT(intr_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_init, NULL); @@ -401,19 +394,28 @@ DB_SHOW_COMMAND(irqs, db_show_irqs) static cpumask_t intr_cpus = (1 << 0); static int current_cpu; -static void -intr_assign_next_cpu(struct intsrc *isrc) +/* + * Return the CPU that the next interrupt source should use. For now + * this just returns the next local APIC according to round-robin. + */ +u_int +intr_next_cpu(void) { + u_int apic_id; - /* - * Assign this source to a local APIC in a round-robin fashion. - */ - isrc->is_pic->pic_assign_cpu(isrc, cpu_apic_ids[current_cpu]); + /* Leave all interrupts on the BSP during boot. */ + if (!assign_cpu) + return (cpu_apic_ids[0]); + + mtx_lock(&intr_table_lock); + apic_id = cpu_apic_ids[current_cpu]; do { current_cpu++; if (current_cpu > mp_maxid) current_cpu = 0; } while (!(intr_cpus & (1 << current_cpu))); + mtx_unlock(&intr_table_lock); + return (apic_id); } /* Attempt to bind the specified IRQ to the specified CPU. */ @@ -453,6 +455,7 @@ static void intr_shuffle_irqs(void *arg __unused) { struct intsrc *isrc; + u_int apic_id; int i; #ifdef XEN @@ -467,7 +470,7 @@ intr_shuffle_irqs(void *arg __unused) return; /* Round-robin assign a CPU to each enabled source. */ - sx_xlock(&intr_table_lock); + mtx_lock(&intr_table_lock); assign_cpu = 1; for (i = 0; i < NUM_IO_INTS; i++) { isrc = interrupt_sources[i]; @@ -478,13 +481,13 @@ intr_shuffle_irqs(void *arg __unused) * of picking one via round-robin. */ if (isrc->is_event->ie_cpu != NOCPU) - isrc->is_pic->pic_assign_cpu(isrc, - cpu_apic_ids[isrc->is_event->ie_cpu]); + apic_id = isrc->is_event->ie_cpu; else - intr_assign_next_cpu(isrc); + apic_id = intr_next_cpu(); + isrc->is_pic->pic_assign_cpu(isrc, apic_id); } } - sx_xunlock(&intr_table_lock); + mtx_unlock(&intr_table_lock); } SYSINIT(intr_shuffle_irqs, SI_SUB_SMP, SI_ORDER_SECOND, intr_shuffle_irqs, NULL); Modified: head/sys/i386/i386/io_apic.c ============================================================================== --- head/sys/i386/i386/io_apic.c Thu Jun 25 18:09:23 2009 (r194984) +++ head/sys/i386/i386/io_apic.c Thu Jun 25 18:13:46 2009 (r194985) @@ -372,7 +372,7 @@ ioapic_enable_intr(struct intsrc *isrc) struct ioapic_intsrc *intpin = (struct ioapic_intsrc *)isrc; if (intpin->io_vector == 0) - ioapic_assign_cpu(isrc, pcpu_find(0)->pc_apic_id); + ioapic_assign_cpu(isrc, intr_next_cpu()); apic_enable_vector(intpin->io_cpu, intpin->io_vector); } Modified: head/sys/i386/i386/msi.c ============================================================================== --- head/sys/i386/i386/msi.c Thu Jun 25 18:09:23 2009 (r194984) +++ head/sys/i386/i386/msi.c Thu Jun 25 18:13:46 2009 (r194985) @@ -161,8 +161,6 @@ msi_enable_intr(struct intsrc *isrc) { struct msi_intsrc *msi = (struct msi_intsrc *)isrc; - if (msi->msi_vector == 0) - msi_assign_cpu(isrc, 0); apic_enable_vector(msi->msi_cpu, msi->msi_vector); } @@ -208,10 +206,11 @@ msi_assign_cpu(struct intsrc *isrc, u_in /* Store information to free existing irq. */ old_vector = msi->msi_vector; old_id = msi->msi_cpu; - if (old_vector && old_id == apic_id) + if (old_id == apic_id) return; - if (old_vector && !msi->msi_msix && msi->msi_first->msi_count > 1) + if (!msi->msi_msix && msi->msi_first->msi_count > 1) return; + /* Allocate IDT vector on this cpu. */ vector = apic_alloc_vector(apic_id, msi->msi_irq); if (vector == 0) @@ -223,15 +222,14 @@ msi_assign_cpu(struct intsrc *isrc, u_in msi->msi_msix ? "MSI-X" : "MSI", msi->msi_irq, msi->msi_cpu, msi->msi_vector); pci_remap_msi_irq(msi->msi_dev, msi->msi_irq); + /* * Free the old vector after the new one is established. This is done * to prevent races where we could miss an interrupt. */ - if (old_vector) - apic_free_vector(old_id, old_vector, msi->msi_irq); + apic_free_vector(old_id, old_vector, msi->msi_irq); } - void msi_init(void) { @@ -287,7 +285,8 @@ int msi_alloc(device_t dev, int count, int maxcount, int *irqs) { struct msi_intsrc *msi, *fsrc; - int cnt, i; + u_int cpu; + int cnt, i, vector; if (!msi_enabled) return (ENXIO); @@ -333,12 +332,25 @@ again: /* Ok, we now have the IRQs allocated. */ KASSERT(cnt == count, ("count mismatch")); + /* Allocate 'count' IDT vectors. */ + cpu = intr_next_cpu(); + vector = apic_alloc_vectors(cpu, irqs, count, maxcount); + if (vector == 0) { + mtx_unlock(&msi_lock); + return (ENOSPC); + } + /* Assign IDT vectors and make these messages owned by 'dev'. */ fsrc = (struct msi_intsrc *)intr_lookup_source(irqs[0]); for (i = 0; i < count; i++) { msi = (struct msi_intsrc *)intr_lookup_source(irqs[i]); + msi->msi_cpu = cpu; msi->msi_dev = dev; - msi->msi_vector = 0; + msi->msi_vector = vector + i; + if (bootverbose) + printf( + "msi: routing MSI IRQ %d to local APIC %u vector %u\n", + msi->msi_irq, msi->msi_cpu, msi->msi_vector); msi->msi_first = fsrc; KASSERT(msi->msi_intsrc.is_handlers == 0, ("dead MSI has handlers")); @@ -391,18 +403,14 @@ msi_release(int *irqs, int count) KASSERT(msi->msi_dev == first->msi_dev, ("owner mismatch")); msi->msi_first = NULL; msi->msi_dev = NULL; - if (msi->msi_vector) - apic_free_vector(msi->msi_cpu, msi->msi_vector, - msi->msi_irq); + apic_free_vector(msi->msi_cpu, msi->msi_vector, msi->msi_irq); msi->msi_vector = 0; } /* Clear out the first message. */ first->msi_first = NULL; first->msi_dev = NULL; - if (first->msi_vector) - apic_free_vector(first->msi_cpu, first->msi_vector, - first->msi_irq); + apic_free_vector(first->msi_cpu, first->msi_vector, first->msi_irq); first->msi_vector = 0; first->msi_count = 0; @@ -451,7 +459,8 @@ int msix_alloc(device_t dev, int *irq) { struct msi_intsrc *msi; - int i; + u_int cpu; + int i, vector; if (!msi_enabled) return (ENXIO); @@ -486,9 +495,17 @@ again: goto again; } + /* Allocate an IDT vector. */ + cpu = intr_next_cpu(); + vector = apic_alloc_vector(cpu, i); + if (bootverbose) + printf("msi: routing MSI-X IRQ %d to local APIC %u vector %u\n", + msi->msi_irq, cpu, vector); + /* Setup source. */ + msi->msi_cpu = cpu; msi->msi_dev = dev; - msi->msi_vector = 0; + msi->msi_vector = vector; msi->msi_msix = 1; KASSERT(msi->msi_intsrc.is_handlers == 0, ("dead MSI-X has handlers")); @@ -520,8 +537,7 @@ msix_release(int irq) /* Clear out the message. */ msi->msi_dev = NULL; - if (msi->msi_vector) - apic_free_vector(msi->msi_cpu, msi->msi_vector, msi->msi_irq); + apic_free_vector(msi->msi_cpu, msi->msi_vector, msi->msi_irq); msi->msi_vector = 0; msi->msi_msix = 0; Modified: head/sys/i386/include/intr_machdep.h ============================================================================== --- head/sys/i386/include/intr_machdep.h Thu Jun 25 18:09:23 2009 (r194984) +++ head/sys/i386/include/intr_machdep.h Thu Jun 25 18:13:46 2009 (r194985) @@ -139,6 +139,9 @@ int intr_bind(u_int vector, u_char cpu); int intr_config_intr(int vector, enum intr_trigger trig, enum intr_polarity pol); void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame); +#ifdef SMP +u_int intr_next_cpu(void); +#endif struct intsrc *intr_lookup_source(int vector); int intr_register_pic(struct pic *pic); int intr_register_source(struct intsrc *isrc); From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 18:27:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5B2A1065670; Thu, 25 Jun 2009 18:27:08 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A3A428FC08; Thu, 25 Jun 2009 18:27:08 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PIR8ji060378; Thu, 25 Jun 2009 18:27:08 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PIR8ZH060375; Thu, 25 Jun 2009 18:27:08 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200906251827.n5PIR8ZH060375@svn.freebsd.org> From: Robert Noland Date: Thu, 25 Jun 2009 18:27:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194986 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 18:27:09 -0000 Author: rnoland Date: Thu Jun 25 18:27:08 2009 New Revision: 194986 URL: http://svn.freebsd.org/changeset/base/194986 Log: Some more cleanups for vblank code on Intel. The Intel 2d driver calls modeset before reinstalling the handler on a vt switch. This means that vblank status ends up getting cleared after it has been setup. Restore saved values for the pipestat registers rather than just wiping them out. MFC after: 3 days Modified: head/sys/dev/drm/i915_drv.h head/sys/dev/drm/i915_irq.c Modified: head/sys/dev/drm/i915_drv.h ============================================================================== --- head/sys/dev/drm/i915_drv.h Thu Jun 25 18:13:46 2009 (r194985) +++ head/sys/dev/drm/i915_drv.h Thu Jun 25 18:27:08 2009 (r194986) @@ -129,7 +129,6 @@ typedef struct drm_i915_private { int page_flipping; wait_queue_head_t irq_queue; - atomic_t irq_received; /** Protects user_irq_refcount and irq_mask_reg */ DRM_SPINTYPE user_irq_lock; /** Refcount for i915_user_irq_get() versus i915_user_irq_put(). */ Modified: head/sys/dev/drm/i915_irq.c ============================================================================== --- head/sys/dev/drm/i915_irq.c Thu Jun 25 18:13:46 2009 (r194985) +++ head/sys/dev/drm/i915_irq.c Thu Jun 25 18:27:08 2009 (r194986) @@ -53,12 +53,6 @@ __FBSDID("$FreeBSD$"); #define I915_INTERRUPT_ENABLE_MASK (I915_INTERRUPT_ENABLE_FIX | \ I915_INTERRUPT_ENABLE_VAR) -#define I915_PIPE_VBLANK_STATUS (PIPE_START_VBLANK_INTERRUPT_STATUS |\ - PIPE_VBLANK_INTERRUPT_STATUS) - -#define I915_PIPE_VBLANK_ENABLE (PIPE_START_VBLANK_INTERRUPT_ENABLE |\ - PIPE_VBLANK_INTERRUPT_ENABLE) - #define DRM_I915_VBLANK_PIPE_ALL (DRM_I915_VBLANK_PIPE_A | \ DRM_I915_VBLANK_PIPE_B) @@ -154,7 +148,7 @@ u32 i915_get_vblank_counter(struct drm_d low_frame = pipe ? PIPEBFRAMEPIXEL : PIPEAFRAMEPIXEL; if (!i915_pipe_enabled(dev, pipe)) { - DRM_ERROR("trying to get vblank count for disabled pipe %d\n", pipe); + DRM_DEBUG("trying to get vblank count for disabled pipe %d\n", pipe); return 0; } @@ -183,7 +177,7 @@ u32 g45_get_vblank_counter(struct drm_de int reg = pipe ? PIPEB_FRMCOUNT_GM45 : PIPEA_FRMCOUNT_GM45; if (!i915_pipe_enabled(dev, pipe)) { - DRM_ERROR("trying to get vblank count for disabled pipe %d\n", pipe); + DRM_DEBUG("trying to get vblank count for disabled pipe %d\n", pipe); return 0; } @@ -200,12 +194,10 @@ irqreturn_t i915_driver_irq_handler(DRM_ u32 vblank_enable; int irq_received; - atomic_inc(&dev_priv->irq_received); - iir = I915_READ(IIR); if (IS_I965G(dev)) { - vblank_status = I915_START_VBLANK_INTERRUPT_STATUS; + vblank_status = PIPE_START_VBLANK_INTERRUPT_STATUS; vblank_enable = PIPE_START_VBLANK_INTERRUPT_ENABLE; } else { vblank_status = I915_VBLANK_INTERRUPT_STATUS; @@ -305,9 +297,12 @@ void i915_user_irq_get(struct drm_device { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; + if (dev->irq_enabled == 0) + return; + DRM_DEBUG("\n"); DRM_SPINLOCK(&dev_priv->user_irq_lock); - if (dev->irq_enabled && (++dev_priv->user_irq_refcount == 1)) + if (++dev_priv->user_irq_refcount == 1) i915_enable_irq(dev_priv, I915_USER_INTERRUPT); DRM_SPINUNLOCK(&dev_priv->user_irq_lock); } @@ -316,12 +311,13 @@ void i915_user_irq_put(struct drm_device { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; + if (dev->irq_enabled == 0) + return; + DRM_SPINLOCK(&dev_priv->user_irq_lock); - if (dev->irq_enabled) { - KASSERT(dev_priv->user_irq_refcount > 0, ("invalid refcount")); - if (--dev_priv->user_irq_refcount == 0) - i915_disable_irq(dev_priv, I915_USER_INTERRUPT); - } + KASSERT(dev_priv->user_irq_refcount > 0, ("invalid refcount")); + if (--dev_priv->user_irq_refcount == 0) + i915_disable_irq(dev_priv, I915_USER_INTERRUPT); DRM_SPINUNLOCK(&dev_priv->user_irq_lock); } @@ -408,11 +404,8 @@ int i915_irq_wait(struct drm_device *dev int i915_enable_vblank(struct drm_device *dev, int pipe) { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; - int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF; - u32 pipeconf; - pipeconf = I915_READ(pipeconf_reg); - if (!(pipeconf & PIPEACONF_ENABLE)) + if (!i915_pipe_enabled(dev, pipe)) return -EINVAL; DRM_SPINLOCK(&dev_priv->user_irq_lock); @@ -500,8 +493,6 @@ void i915_driver_irq_preinstall(struct d { drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; - atomic_set_int(&dev_priv->irq_received, 0); - I915_WRITE(HWSTAM, 0xeffe); I915_WRITE(PIPEASTAT, 0); I915_WRITE(PIPEBSTAT, 0); @@ -519,9 +510,6 @@ int i915_driver_irq_postinstall(struct d /* Unmask the interrupts that we always want on. */ dev_priv->irq_mask_reg = ~I915_INTERRUPT_ENABLE_FIX; - dev_priv->pipestat[0] = 0; - dev_priv->pipestat[1] = 0; - /* Disable pipe interrupt enables, clear pending pipe status */ I915_WRITE(PIPEASTAT, I915_READ(PIPEASTAT) & 0x8000ffff); I915_WRITE(PIPEBSTAT, I915_READ(PIPEBSTAT) & 0x8000ffff); @@ -531,6 +519,10 @@ int i915_driver_irq_postinstall(struct d I915_WRITE(IER, I915_INTERRUPT_ENABLE_MASK); I915_WRITE(IMR, dev_priv->irq_mask_reg); + I915_WRITE(PIPEASTAT, dev_priv->pipestat[0] | + (dev_priv->pipestat[0] >> 16)); + I915_WRITE(PIPEBSTAT, dev_priv->pipestat[1] | + (dev_priv->pipestat[1] >> 16)); (void) I915_READ(IER); return 0; From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 18:35:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A362106568B; Thu, 25 Jun 2009 18:35:20 +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 ECDB28FC21; Thu, 25 Jun 2009 18:35:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PIZJbF060601; Thu, 25 Jun 2009 18:35:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PIZJVo060599; Thu, 25 Jun 2009 18:35:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906251835.n5PIZJVo060599@svn.freebsd.org> From: John Baldwin Date: Thu, 25 Jun 2009 18:35:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194987 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 18:35:20 -0000 Author: jhb Date: Thu Jun 25 18:35:19 2009 New Revision: 194987 URL: http://svn.freebsd.org/changeset/base/194987 Log: Return errors from intr_event_bind() to the caller of intr_set_affinity(). Specifically, if a non-root user attempts to bind an interrupt the request will now report failure with EPERM rather than silently failing with a successful return code. MFC after: 1 week Modified: head/sys/kern/kern_intr.c Modified: head/sys/kern/kern_intr.c ============================================================================== --- head/sys/kern/kern_intr.c Thu Jun 25 18:27:08 2009 (r194986) +++ head/sys/kern/kern_intr.c Thu Jun 25 18:35:19 2009 (r194987) @@ -373,8 +373,7 @@ intr_setaffinity(int irq, void *m) ie = intr_lookup(irq); if (ie == NULL) return (ESRCH); - intr_event_bind(ie, cpu); - return (0); + return (intr_event_bind(ie, cpu)); } int From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 18:40:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07AE61065675; Thu, 25 Jun 2009 18:40:28 +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 EA8C98FC19; Thu, 25 Jun 2009 18:40:27 +0000 (UTC) (envelope-from jfv@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PIeRnr060748; Thu, 25 Jun 2009 18:40:27 GMT (envelope-from jfv@svn.freebsd.org) Received: (from jfv@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PIeRFH060746; Thu, 25 Jun 2009 18:40:27 GMT (envelope-from jfv@svn.freebsd.org) Message-Id: <200906251840.n5PIeRFH060746@svn.freebsd.org> From: Jack F Vogel Date: Thu, 25 Jun 2009 18:40:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194988 - head/sys/dev/ixgbe X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 18:40:28 -0000 Author: jfv Date: Thu Jun 25 18:40:27 2009 New Revision: 194988 URL: http://svn.freebsd.org/changeset/base/194988 Log: Decided to limit the interrupt bind to multiqueue config as done in igb. Modified: head/sys/dev/ixgbe/ixgbe.c Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Thu Jun 25 18:35:19 2009 (r194987) +++ head/sys/dev/ixgbe/ixgbe.c Thu Jun 25 18:40:27 2009 (r194988) @@ -2156,7 +2156,8 @@ ixgbe_allocate_msix(struct adapter *adap ** Bind the msix vector, and thus the ** ring to the corresponding cpu. */ - bus_bind_intr(dev, txr->res, i); + if (adapter->num_queues > 1) + bus_bind_intr(dev, txr->res, i); TASK_INIT(&txr->tx_task, 0, ixgbe_handle_tx, txr); txr->tq = taskqueue_create_fast("ixgbe_txq", M_NOWAIT, @@ -2192,7 +2193,8 @@ ixgbe_allocate_msix(struct adapter *adap ** Bind the msix vector, and thus the ** ring to the corresponding cpu. */ - bus_bind_intr(dev, rxr->res, i); + if (adapter->num_queues > 1) + bus_bind_intr(dev, rxr->res, i); TASK_INIT(&rxr->rx_task, 0, ixgbe_handle_rx, rxr); rxr->tq = taskqueue_create_fast("ixgbe_rxq", M_NOWAIT, From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 18:44:05 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 839ED1065673; Thu, 25 Jun 2009 18:44:05 +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 726438FC14; Thu, 25 Jun 2009 18:44:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PIi5SQ060860; Thu, 25 Jun 2009 18:44:05 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PIi5cg060858; Thu, 25 Jun 2009 18:44:05 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906251844.n5PIi5cg060858@svn.freebsd.org> From: John Baldwin Date: Thu, 25 Jun 2009 18:44: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: r194989 - head/sys/sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 18:44:06 -0000 Author: jhb Date: Thu Jun 25 18:44:05 2009 New Revision: 194989 URL: http://svn.freebsd.org/changeset/base/194989 Log: Remove the d_spare2_t typedef. The d_spare2 field was replaced by d_mmap_single(). I considered adding a new round of padding for 8.0. However, since cdevsw already maintains a version field, new versions can be handled without requiring the need for explicit padding fields. Modified: head/sys/sys/conf.h Modified: head/sys/sys/conf.h ============================================================================== --- head/sys/sys/conf.h Thu Jun 25 18:40:27 2009 (r194988) +++ head/sys/sys/conf.h Thu Jun 25 18:44:05 2009 (r194989) @@ -141,8 +141,6 @@ typedef int d_mmap_single_t(struct cdev vm_size_t size, struct vm_object **object, int nprot); typedef void d_purge_t(struct cdev *dev); -typedef int d_spare2_t(struct cdev *dev); - typedef int dumper_t( void *_priv, /* Private to the driver. */ void *_virtual, /* Virtual (mapped) address. */ From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 18:46:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3138106566C; Thu, 25 Jun 2009 18:46:30 +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 8E5C78FC0A; Thu, 25 Jun 2009 18:46:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PIkUr7060977; Thu, 25 Jun 2009 18:46:30 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PIkUnK060964; Thu, 25 Jun 2009 18:46:30 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200906251846.n5PIkUnK060964@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 25 Jun 2009 18:46:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194990 - in head/sys: cam/scsi dev/iscsi/initiator dev/sound/midi dev/speaker fs/coda fs/pseudofs net sys vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 18:46:31 -0000 Author: kib Date: Thu Jun 25 18:46:30 2009 New Revision: 194990 URL: http://svn.freebsd.org/changeset/base/194990 Log: Change the type of uio_resid member of struct uio from int to ssize_t. Note that this does not actually enable full-range i/o requests for 64 architectures, and is done now to update KBI only. Tested by: pho Reviewed by: jhb, bde (as part of the review of the bigger patch) Modified: head/sys/cam/scsi/scsi_target.c head/sys/dev/iscsi/initiator/isc_soc.c head/sys/dev/sound/midi/midi.c head/sys/dev/sound/midi/sequencer.c head/sys/dev/speaker/spkr.c head/sys/fs/coda/coda_psdev.c head/sys/fs/coda/coda_vnops.c head/sys/fs/pseudofs/pseudofs_vnops.c head/sys/net/if_tap.c head/sys/net/if_tun.c head/sys/sys/uio.h head/sys/vm/vnode_pager.c Modified: head/sys/cam/scsi/scsi_target.c ============================================================================== --- head/sys/cam/scsi/scsi_target.c Thu Jun 25 18:44:05 2009 (r194989) +++ head/sys/cam/scsi/scsi_target.c Thu Jun 25 18:46:30 2009 (r194990) @@ -552,7 +552,7 @@ targwrite(struct cdev *dev, struct uio * softc = (struct targ_softc *)dev->si_drv1; write_len = error = 0; CAM_DEBUG(softc->path, CAM_DEBUG_PERIPH, - ("write - uio_resid %d\n", uio->uio_resid)); + ("write - uio_resid %zd\n", uio->uio_resid)); while (uio->uio_resid >= sizeof(user_ccb) && error == 0) { union ccb *ccb; Modified: head/sys/dev/iscsi/initiator/isc_soc.c ============================================================================== --- head/sys/dev/iscsi/initiator/isc_soc.c Thu Jun 25 18:44:05 2009 (r194989) +++ head/sys/dev/iscsi/initiator/isc_soc.c Thu Jun 25 18:46:30 2009 (r194990) @@ -322,12 +322,12 @@ so_getbhs(isc_session_t *sp) error = soreceive(sp->soc, NULL, uio, 0, 0, &flags); if(error) - debug(2, "error=%d so_error=%d uio->uio_resid=%d iov.iov_len=%zd", + debug(2, "error=%d so_error=%d uio->uio_resid=%zd iov.iov_len=%zd", error, sp->soc->so_error, uio->uio_resid, iov->iov_len); if(!error && (uio->uio_resid > 0)) { error = EPIPE; // was EAGAIN - debug(2, "error=%d so_error=%d uio->uio_resid=%d iov.iov_len=%zd so_state=%x", + debug(2, "error=%d so_error=%d uio->uio_resid=%zd iov.iov_len=%zd so_state=%x", error, sp->soc->so_error, uio->uio_resid, iov->iov_len, sp->soc->so_state); } @@ -442,7 +442,7 @@ so_recv(isc_session_t *sp, pduq_t *pq) } mp = NULL; - sdebug(4, "uio_resid=0x%x itt=0x%x bp=%p bo=%x len=%x/%x", + sdebug(4, "uio_resid=0x%zx itt=0x%x bp=%p bo=%x len=%x/%x", uio->uio_resid, ntohl(pq->pdu.ipdu.bhs.itt), csio->data_ptr, ntohl(rcmd->bo), ntohl(cmd->edtlen), pq->pdu.ds_len); Modified: head/sys/dev/sound/midi/midi.c ============================================================================== --- head/sys/dev/sound/midi/midi.c Thu Jun 25 18:44:05 2009 (r194989) +++ head/sys/dev/sound/midi/midi.c Thu Jun 25 18:46:30 2009 (r194990) @@ -852,7 +852,7 @@ midi_write(struct cdev *i_dev, struct ui used = MIN(MIDIQ_AVAIL(m->outq), uio->uio_resid); used = MIN(used, MIDI_WSIZE); - MIDI_DEBUG(5, printf("midiout: resid %d len %jd avail %jd\n", + MIDI_DEBUG(5, printf("midiout: resid %zd len %jd avail %jd\n", uio->uio_resid, (intmax_t)MIDIQ_LEN(m->outq), (intmax_t)MIDIQ_AVAIL(m->outq))); Modified: head/sys/dev/sound/midi/sequencer.c ============================================================================== --- head/sys/dev/sound/midi/sequencer.c Thu Jun 25 18:44:05 2009 (r194989) +++ head/sys/dev/sound/midi/sequencer.c Thu Jun 25 18:46:30 2009 (r194990) @@ -878,7 +878,7 @@ seq_read(struct cdev *i_dev, struct uio if (scp == NULL) return ENXIO; - SEQ_DEBUG(7, printf("seq_read: unit %d, resid %d.\n", + SEQ_DEBUG(7, printf("seq_read: unit %d, resid %zd.\n", scp->unit, uio->uio_resid)); mtx_lock(&scp->seq_lock); @@ -936,7 +936,7 @@ seq_read(struct cdev *i_dev, struct uio retval = 0; err1: mtx_unlock(&scp->seq_lock); - SEQ_DEBUG(6, printf("seq_read: ret %d, resid %d.\n", + SEQ_DEBUG(6, printf("seq_read: ret %d, resid %zd.\n", retval, uio->uio_resid)); return retval; @@ -950,7 +950,7 @@ seq_write(struct cdev *i_dev, struct uio int retval; int used; - SEQ_DEBUG(7, printf("seq_write: unit %d, resid %d.\n", + SEQ_DEBUG(7, printf("seq_write: unit %d, resid %zd.\n", scp->unit, uio->uio_resid)); if (scp == NULL) @@ -995,7 +995,7 @@ seq_write(struct cdev *i_dev, struct uio used = MIN(uio->uio_resid, 4); - SEQ_DEBUG(8, printf("seqout: resid %d len %jd avail %jd\n", + SEQ_DEBUG(8, printf("seqout: resid %zd len %jd avail %jd\n", uio->uio_resid, (intmax_t)MIDIQ_LEN(scp->out_q), (intmax_t)MIDIQ_AVAIL(scp->out_q))); @@ -1115,7 +1115,7 @@ seq_write(struct cdev *i_dev, struct uio err0: SEQ_DEBUG(6, - printf("seq_write done: leftover buffer length %d retval %d\n", + printf("seq_write done: leftover buffer length %zd retval %d\n", uio->uio_resid, retval)); mtx_unlock(&scp->seq_lock); return retval; Modified: head/sys/dev/speaker/spkr.c ============================================================================== --- head/sys/dev/speaker/spkr.c Thu Jun 25 18:44:05 2009 (r194989) +++ head/sys/dev/speaker/spkr.c Thu Jun 25 18:46:30 2009 (r194990) @@ -439,7 +439,7 @@ spkrwrite(dev, uio, ioflag) int ioflag; { #ifdef DEBUG - printf("spkrwrite: entering with dev = %s, count = %d\n", + printf("spkrwrite: entering with dev = %s, count = %zd\n", devtoname(dev), uio->uio_resid); #endif /* DEBUG */ Modified: head/sys/fs/coda/coda_psdev.c ============================================================================== --- head/sys/fs/coda/coda_psdev.c Thu Jun 25 18:44:05 2009 (r194989) +++ head/sys/fs/coda/coda_psdev.c Thu Jun 25 18:46:30 2009 (r194990) @@ -331,7 +331,7 @@ vc_write(struct cdev *dev, struct uio *u * Get the rest of the data. */ if (vmp->vm_outSize < uiop->uio_resid) { - myprintf(("vcwrite: more data than asked for (%d < %d)\n", + myprintf(("vcwrite: more data than asked for (%d < %zd)\n", vmp->vm_outSize, uiop->uio_resid)); /* Modified: head/sys/fs/coda/coda_vnops.c ============================================================================== --- head/sys/fs/coda/coda_vnops.c Thu Jun 25 18:44:05 2009 (r194989) +++ head/sys/fs/coda/coda_vnops.c Thu Jun 25 18:46:30 2009 (r194990) @@ -331,7 +331,7 @@ coda_rdwr(struct vnode *vp, struct uio * int error = 0; MARK_ENTRY(CODA_RDWR_STATS); - CODADEBUG(CODA_RDWR, myprintf(("coda_rdwr(%d, %p, %d, %lld, %d)\n", + CODADEBUG(CODA_RDWR, myprintf(("coda_rdwr(%d, %p, %zd, %lld, %d)\n", rw, (void *)uiop->uio_iov->iov_base, uiop->uio_resid, (long long)uiop->uio_offset, uiop->uio_segflg));); @@ -1470,7 +1470,7 @@ coda_readdir(struct vop_readdir_args *ap int opened_internally = 0; MARK_ENTRY(CODA_READDIR_STATS); - CODADEBUG(CODA_READDIR, myprintf(("coda_readdir(%p, %d, %lld, %d)\n", + CODADEBUG(CODA_READDIR, myprintf(("coda_readdir(%p, %zd, %lld, %d)\n", (void *)uiop->uio_iov->iov_base, uiop->uio_resid, (long long)uiop->uio_offset, uiop->uio_segflg));); Modified: head/sys/fs/pseudofs/pseudofs_vnops.c ============================================================================== --- head/sys/fs/pseudofs/pseudofs_vnops.c Thu Jun 25 18:44:05 2009 (r194989) +++ head/sys/fs/pseudofs/pseudofs_vnops.c Thu Jun 25 18:46:30 2009 (r194990) @@ -622,9 +622,9 @@ pfs_read(struct vop_read_args *va) VOP_UNLOCK(vn, 0); if (pn->pn_flags & PFS_RAWRD) { - PFS_TRACE(("%lu resid", (unsigned long)uio->uio_resid)); + PFS_TRACE(("%zd resid", uio->uio_resid)); error = pn_fill(curthread, proc, pn, NULL, uio); - PFS_TRACE(("%lu resid", (unsigned long)uio->uio_resid)); + PFS_TRACE(("%zd resid", uio->uio_resid)); goto ret; } Modified: head/sys/net/if_tap.c ============================================================================== --- head/sys/net/if_tap.c Thu Jun 25 18:44:05 2009 (r194989) +++ head/sys/net/if_tap.c Thu Jun 25 18:46:30 2009 (r194990) @@ -934,7 +934,7 @@ tapwrite(struct cdev *dev, struct uio *u return (0); if ((uio->uio_resid < 0) || (uio->uio_resid > TAPMRU)) { - TAPDEBUG("%s invalid packet len = %d, minor = %#x\n", + TAPDEBUG("%s invalid packet len = %zd, minor = %#x\n", ifp->if_xname, uio->uio_resid, dev2unit(dev)); return (EIO); Modified: head/sys/net/if_tun.c ============================================================================== --- head/sys/net/if_tun.c Thu Jun 25 18:44:05 2009 (r194989) +++ head/sys/net/if_tun.c Thu Jun 25 18:46:30 2009 (r194990) @@ -888,7 +888,7 @@ tunwrite(struct cdev *dev, struct uio *u return (0); if (uio->uio_resid < 0 || uio->uio_resid > TUNMRU) { - TUNDEBUG(ifp, "len=%d!\n", uio->uio_resid); + TUNDEBUG(ifp, "len=%zd!\n", uio->uio_resid); return (EIO); } Modified: head/sys/sys/uio.h ============================================================================== --- head/sys/sys/uio.h Thu Jun 25 18:44:05 2009 (r194989) +++ head/sys/sys/uio.h Thu Jun 25 18:46:30 2009 (r194990) @@ -64,7 +64,7 @@ struct uio { struct iovec *uio_iov; /* scatter/gather list */ int uio_iovcnt; /* length of scatter/gather list */ off_t uio_offset; /* offset in target object */ - int uio_resid; /* remaining bytes to process */ + ssize_t uio_resid; /* remaining bytes to process */ enum uio_seg uio_segflg; /* address space */ enum uio_rw uio_rw; /* operation */ struct thread *uio_td; /* owner */ Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Thu Jun 25 18:44:05 2009 (r194989) +++ head/sys/vm/vnode_pager.c Thu Jun 25 18:46:30 2009 (r194990) @@ -1161,7 +1161,7 @@ vnode_pager_generic_putpages(vp, m, byte } if (auio.uio_resid) { if (ppscheck || ppsratecheck(&lastfail, &curfail, 1)) - printf("vnode_pager_putpages: residual I/O %d at %lu\n", + printf("vnode_pager_putpages: residual I/O %zd at %lu\n", auio.uio_resid, (u_long)m[0]->pindex); } for (i = 0; i < ncount; i++) { From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 18:52:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFE431065680; Thu, 25 Jun 2009 18:52: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 A28B18FC19; Thu, 25 Jun 2009 18:52:17 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 5986F46B17; Thu, 25 Jun 2009 14:52:17 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 37DBF8A083; Thu, 25 Jun 2009 14:52:16 -0400 (EDT) From: John Baldwin To: src-committers@freebsd.org Date: Thu, 25 Jun 2009 14:46:13 -0400 User-Agent: KMail/1.9.7 References: <200906251813.n5PIDkfl060004@svn.freebsd.org> In-Reply-To: <200906251813.n5PIDkfl060004@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906251446.14106.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 25 Jun 2009 14:52:16 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r194985 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 18:52:18 -0000 On Thursday 25 June 2009 2:13:46 pm John Baldwin wrote: > Author: jhb > Date: Thu Jun 25 18:13:46 2009 > New Revision: 194985 > URL: http://svn.freebsd.org/changeset/base/194985 > > Log: > - Restore the behavior of pre-allocating IDT vectors for MSI interrupts. > This is mostly important for the multiple MSI message case where the > IDT vectors for the entire group need to be allocated together. This > also restores the assumptions made by the PCI bus code that it could > invoke PCIB_MAP_MSI() once MSI vectors were allocated. > - To avoid whiplash with CPU assignments, change the way that CPUs are > assigned to interrupt sources on activation. Instead of assigning the > CPU via pic_assign_cpu() before calling enable_intr(), allow the > different interrupt source drivers to ask the MD interrupt code which > CPU to use when they allocate an IDT vector. I/O APIC interrupt pins > do this in their pic_enable_intr() routines giving the same behavior as > before. MSI sources do it when the IDT vectors are allocated during > msi_alloc() and msix_alloc(). > - Change the intr_table_lock from an sx lock to a mutex. Incidentally, this fixes the remaining issues Robert was having with VT switch with Intel DRM drivers. It is still not possible to migrate multiple MSI interrupts, but I intend to work on that next. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 18:54:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECDE11065673; Thu, 25 Jun 2009 18:54:56 +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 DB7028FC0C; Thu, 25 Jun 2009 18:54:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PIsuHI061364; Thu, 25 Jun 2009 18:54:56 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PIsuRx061362; Thu, 25 Jun 2009 18:54:56 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200906251854.n5PIsuRx061362@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 25 Jun 2009 18:54: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: r194993 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 18:54:57 -0000 Author: kib Date: Thu Jun 25 18:54:56 2009 New Revision: 194993 URL: http://svn.freebsd.org/changeset/base/194993 Log: In lf_iteratelocks_vnode, increment state->ls_threads around iterating of the vnode advisory lock list. This prevents deallocation of state while inside the loop. Reported and tested by: pho MFC after: 2 weeks Modified: head/sys/kern/kern_lockf.c Modified: head/sys/kern/kern_lockf.c ============================================================================== --- head/sys/kern/kern_lockf.c Thu Jun 25 18:51:35 2009 (r194992) +++ head/sys/kern/kern_lockf.c Thu Jun 25 18:54:56 2009 (r194993) @@ -1937,9 +1937,14 @@ lf_iteratelocks_vnode(struct vnode *vp, * make sure it doesn't go away before we are finished. */ STAILQ_INIT(&locks); + VI_LOCK(vp); ls = vp->v_lockf; - if (!ls) + if (!ls) { + VI_UNLOCK(vp); return (0); + } + ls->ls_threads++; + VI_UNLOCK(vp); sx_xlock(&ls->ls_lock); LIST_FOREACH(lf, &ls->ls_active, lf_link) { @@ -1960,6 +1965,10 @@ lf_iteratelocks_vnode(struct vnode *vp, STAILQ_INSERT_TAIL(&locks, ldesc, link); } sx_xunlock(&ls->ls_lock); + VI_LOCK(vp); + ls->ls_threads--; + wakeup(ls); + VI_UNLOCK(vp); /* * Call the iterator function for each lock in turn. If the From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 19:16:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3422B1065670; Thu, 25 Jun 2009 19:16:30 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1EE6F8FC18; Thu, 25 Jun 2009 19:16:30 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PJGTua062074; Thu, 25 Jun 2009 19:16:29 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PJGTD7062062; Thu, 25 Jun 2009 19:16:29 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200906251916.n5PJGTD7062062@svn.freebsd.org> From: Doug Barton Date: Thu, 25 Jun 2009 19:16:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194995 - in head/contrib/bind9: . bin/check bin/dnssec doc/arm lib/bind9 lib/dns lib/dns/include/dns X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 19:16:30 -0000 Author: dougb Date: Thu Jun 25 19:16:29 2009 New Revision: 194995 URL: http://svn.freebsd.org/changeset/base/194995 Log: Update to the final release version of BIND 9.6.1. It has the following changes from the 9.6.1rc1 version. The first 2 only affect DNSSEC. named could incorrectly delete NSEC3 records for empty nodes when processing a update request. Accept DS responses from delegation only zones. "delegation-only" was not being accepted in delegation-only type zones. Added: head/contrib/bind9/KNOWN-DEFECTS - copied unchanged from r194992, vendor/bind9/dist/KNOWN-DEFECTS Modified: head/contrib/bind9/ (props changed) head/contrib/bind9/CHANGES head/contrib/bind9/bin/check/named-checkzone.c head/contrib/bind9/bin/dnssec/dnssec-signzone.8 head/contrib/bind9/bin/dnssec/dnssec-signzone.c head/contrib/bind9/bin/dnssec/dnssec-signzone.docbook head/contrib/bind9/bin/dnssec/dnssec-signzone.html head/contrib/bind9/bin/dnssec/dnssectool.c head/contrib/bind9/doc/arm/Bv9ARM-book.xml head/contrib/bind9/doc/arm/Bv9ARM.ch06.html head/contrib/bind9/doc/arm/Bv9ARM.ch07.html head/contrib/bind9/doc/arm/Bv9ARM.ch08.html head/contrib/bind9/doc/arm/Bv9ARM.ch09.html head/contrib/bind9/doc/arm/Bv9ARM.html head/contrib/bind9/doc/arm/man.dig.html head/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html head/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html head/contrib/bind9/doc/arm/man.dnssec-keygen.html head/contrib/bind9/doc/arm/man.dnssec-signzone.html head/contrib/bind9/doc/arm/man.host.html head/contrib/bind9/doc/arm/man.named-checkconf.html head/contrib/bind9/doc/arm/man.named-checkzone.html head/contrib/bind9/doc/arm/man.named.html head/contrib/bind9/doc/arm/man.nsupdate.html head/contrib/bind9/doc/arm/man.rndc-confgen.html head/contrib/bind9/doc/arm/man.rndc.conf.html head/contrib/bind9/doc/arm/man.rndc.html head/contrib/bind9/lib/bind9/api head/contrib/bind9/lib/bind9/check.c head/contrib/bind9/lib/dns/api head/contrib/bind9/lib/dns/dnssec.c head/contrib/bind9/lib/dns/include/dns/dnssec.h head/contrib/bind9/lib/dns/include/dns/keyvalues.h head/contrib/bind9/lib/dns/nsec3.c head/contrib/bind9/lib/dns/resolver.c head/contrib/bind9/version Modified: head/contrib/bind9/CHANGES ============================================================================== --- head/contrib/bind9/CHANGES Thu Jun 25 19:06:08 2009 (r194994) +++ head/contrib/bind9/CHANGES Thu Jun 25 19:16:29 2009 (r194995) @@ -1,4 +1,23 @@ + --- 9.6.1 released --- + +2607. [bug] named could incorrectly delete NSEC3 records for + empty nodes when processing a update request. + [RT #19749] + +2606. [bug] "delegation-only" was not being accepted in + delegation-only type zones. [RT #19717] + +2605. [bug] Accept DS responses from delegation only zones. + [RT # 19296] + +2603. [port] win32: handle .exe extension of named-checkzone and + named-comilezone argv[0] names under windows. + [RT #19767] + +2602. [port] win32: fix debugging command line build of libisccfg. + [RT #19767] + --- 9.6.1rc1 released --- 2599. [bug] Address rapid memory growth when validation fails. Copied: head/contrib/bind9/KNOWN-DEFECTS (from r194992, vendor/bind9/dist/KNOWN-DEFECTS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/bind9/KNOWN-DEFECTS Thu Jun 25 19:16:29 2009 (r194995, copy of r194992, vendor/bind9/dist/KNOWN-DEFECTS) @@ -0,0 +1,15 @@ +dnssec-signzone was designed so that it could sign a zone partially, using +only a subset of the DNSSEC keys needed to produce a fully-signed zone. +This permits a zone administrator, for example, to sign a zone with one +key on one machine, move the resulting partially-signed zone to a second +machine, and sign it again with a second key. + +An unfortunate side-effect of this flexibility is that dnssec-signzone +does not check to make sure it's signing a zone with any valid keys at +all. An attempt to sign a zone without any keys will appear to succeed, +producing a "signed" zone with no signatures. There is no warning issued +when a zone is not signed. + +This will be corrected in a future release. In the meantime, ISC +recommends examining the output of dnssec-signzone to confirm that +the zone is properly signed by all keys before using it. Modified: head/contrib/bind9/bin/check/named-checkzone.c ============================================================================== --- head/contrib/bind9/bin/check/named-checkzone.c Thu Jun 25 19:06:08 2009 (r194994) +++ head/contrib/bind9/bin/check/named-checkzone.c Thu Jun 25 19:16:29 2009 (r194995) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: named-checkzone.c,v 1.51.34.2 2009/02/16 23:47:15 tbox Exp $ */ +/* $Id: named-checkzone.c,v 1.51.34.3 2009/05/29 02:17:43 marka Exp $ */ /*! \file */ @@ -123,9 +123,13 @@ main(int argc, char **argv) { */ if (strncmp(prog_name, "lt-", 3) == 0) prog_name += 3; - if (strcmp(prog_name, "named-checkzone") == 0) + +#define PROGCMP(X) \ + (strcasecmp(prog_name, X) == 0 || strcasecmp(prog_name, X ".exe") == 0) + + if (PROGCMP("named-checkzone")) progmode = progmode_check; - else if (strcmp(prog_name, "named-compilezone") == 0) + else if (PROGCMP("named-compilezone")) progmode = progmode_compile; else INSIST(0); Modified: head/contrib/bind9/bin/dnssec/dnssec-signzone.8 ============================================================================== --- head/contrib/bind9/bin/dnssec/dnssec-signzone.8 Thu Jun 25 19:06:08 2009 (r194994) +++ head/contrib/bind9/bin/dnssec/dnssec-signzone.8 Thu Jun 25 19:16:29 2009 (r194995) @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004-2008 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000-2003 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and distribute this software for any @@ -13,275 +13,163 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id: dnssec-signzone.8,v 1.47 2008/10/15 01:11:35 tbox Exp $ +.\" $Id: dnssec-signzone.8,v 1.47.44.4 2009/06/09 01:47:19 each Exp $ .\" .hy 0 .ad l -.\" Title: dnssec\-signzone -.\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 -.\" Date: June 30, 2000 -.\" Manual: BIND9 -.\" Source: BIND9 -.\" -.TH "DNSSEC\-SIGNZONE" "8" "June 30, 2000" "BIND9" "BIND9" -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH "NAME" -dnssec\-signzone \- DNSSEC zone signing tool +.\"Generated by db2man.xsl. Don't modify this, modify the source. +.de Sh \" Subsection +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Ip \" List item +.br +.ie \\n(.$>=3 .ne \\$3 +.el .ne 3 +.IP "\\$1" \\$2 +.. +.TH "DNSSEC-SIGNZONE" 8 "June 08, 2009" "" "" +.SH NAME +dnssec-signzone \- DNSSEC zone signing tool .SH "SYNOPSIS" .HP 16 -\fBdnssec\-signzone\fR [\fB\-a\fR] [\fB\-c\ \fR\fB\fIclass\fR\fR] [\fB\-d\ \fR\fB\fIdirectory\fR\fR] [\fB\-e\ \fR\fB\fIend\-time\fR\fR] [\fB\-f\ \fR\fB\fIoutput\-file\fR\fR] [\fB\-g\fR] [\fB\-h\fR] [\fB\-k\ \fR\fB\fIkey\fR\fR] [\fB\-l\ \fR\fB\fIdomain\fR\fR] [\fB\-i\ \fR\fB\fIinterval\fR\fR] [\fB\-I\ \fR\fB\fIinput\-format\fR\fR] [\fB\-j\ \fR\fB\fIjitter\fR\fR] [\fB\-N\ \fR\fB\fIsoa\-serial\-format\fR\fR] [\fB\-o\ \fR\fB\fIorigin\fR\fR] [\fB\-O\ \fR\fB\fIoutput\-format\fR\fR] [\fB\-p\fR] [\fB\-r\ \fR\fB\fIrandomdev\fR\fR] [\fB\-s\ \fR\fB\fIstart\-time\fR\fR] [\fB\-t\fR] [\fB\-v\ \fR\fB\fIlevel\fR\fR] [\fB\-z\fR] [\fB\-3\ \fR\fB\fIsalt\fR\fR] [\fB\-H\ \fR\fB\fIiterations\fR\fR] [\fB\-A\fR] {zonefile} [key...] +\fBdnssec\-signzone\fR [\fB\-a\fR] [\fB\-c\ \fIclass\fR\fR] [\fB\-d\ \fIdirectory\fR\fR] [\fB\-e\ \fIend\-time\fR\fR] [\fB\-f\ \fIoutput\-file\fR\fR] [\fB\-g\fR] [\fB\-h\fR] [\fB\-k\ \fIkey\fR\fR] [\fB\-l\ \fIdomain\fR\fR] [\fB\-i\ \fIinterval\fR\fR] [\fB\-I\ \fIinput\-format\fR\fR] [\fB\-j\ \fIjitter\fR\fR] [\fB\-N\ \fIsoa\-serial\-format\fR\fR] [\fB\-o\ \fIorigin\fR\fR] [\fB\-O\ \fIoutput\-format\fR\fR] [\fB\-p\fR] [\fB\-r\ \fIrandomdev\fR\fR] [\fB\-s\ \fIstart\-time\fR\fR] [\fB\-t\fR] [\fB\-v\ \fIlevel\fR\fR] [\fB\-z\fR] [\fB\-3\ \fIsalt\fR\fR] [\fB\-H\ \fIiterations\fR\fR] [\fB\-A\fR] {zonefile} [key...] .SH "DESCRIPTION" .PP -\fBdnssec\-signzone\fR -signs a zone. It generates NSEC and RRSIG records and produces a signed version of the zone. The security status of delegations from the signed zone (that is, whether the child zones are secure or not) is determined by the presence or absence of a -\fIkeyset\fR -file for each child zone. +\fBdnssec\-signzone\fR signs a zone\&. It generates NSEC and RRSIG records and produces a signed version of the zone\&. The security status of delegations from the signed zone (that is, whether the child zones are secure or not) is determined by the presence or absence of a \fIkeyset\fR file for each child zone\&. .SH "OPTIONS" -.PP +.TP \-a -.RS 4 -Verify all generated signatures. -.RE -.PP +Verify all generated signatures\&. +.TP \-c \fIclass\fR -.RS 4 -Specifies the DNS class of the zone. -.RE -.PP +Specifies the DNS class of the zone\&. +.TP \-k \fIkey\fR -.RS 4 -Treat specified key as a key signing key ignoring any key flags. This option may be specified multiple times. -.RE -.PP +Treat specified key as a key signing key ignoring any key flags\&. This option may be specified multiple times\&. +.TP \-l \fIdomain\fR -.RS 4 -Generate a DLV set in addition to the key (DNSKEY) and DS sets. The domain is appended to the name of the records. -.RE -.PP +Generate a DLV set in addition to the key (DNSKEY) and DS sets\&. The domain is appended to the name of the records\&. +.TP \-d \fIdirectory\fR -.RS 4 -Look for -\fIkeyset\fR -files in -\fBdirectory\fR -as the directory -.RE -.PP +Look for \fIkeyset\fR files in \fBdirectory\fR as the directory +.TP \-g -.RS 4 -Generate DS records for child zones from keyset files. Existing DS records will be removed. -.RE -.PP +Generate DS records for child zones from keyset files\&. Existing DS records will be removed\&. +.TP \-s \fIstart\-time\fR -.RS 4 -Specify the date and time when the generated RRSIG records become valid. This can be either an absolute or relative time. An absolute start time is indicated by a number in YYYYMMDDHHMMSS notation; 20000530144500 denotes 14:45:00 UTC on May 30th, 2000. A relative start time is indicated by +N, which is N seconds from the current time. If no -\fBstart\-time\fR -is specified, the current time minus 1 hour (to allow for clock skew) is used. -.RE -.PP +Specify the date and time when the generated RRSIG records become valid\&. This can be either an absolute or relative time\&. An absolute start time is indicated by a number in YYYYMMDDHHMMSS notation; 20000530144500 denotes 14:45:00 UTC on May 30th, 2000\&. A relative start time is indicated by +N, which is N seconds from the current time\&. If no \fBstart\-time\fR is specified, the current time minus 1 hour (to allow for clock skew) is used\&. +.TP \-e \fIend\-time\fR -.RS 4 -Specify the date and time when the generated RRSIG records expire. As with -\fBstart\-time\fR, an absolute time is indicated in YYYYMMDDHHMMSS notation. A time relative to the start time is indicated with +N, which is N seconds from the start time. A time relative to the current time is indicated with now+N. If no -\fBend\-time\fR -is specified, 30 days from the start time is used as a default. -.RE -.PP +Specify the date and time when the generated RRSIG records expire\&. As with \fBstart\-time\fR, an absolute time is indicated in YYYYMMDDHHMMSS notation\&. A time relative to the start time is indicated with +N, which is N seconds from the start time\&. A time relative to the current time is indicated with now+N\&. If no \fBend\-time\fR is specified, 30 days from the start time is used as a default\&. +.TP \-f \fIoutput\-file\fR -.RS 4 -The name of the output file containing the signed zone. The default is to append -\fI.signed\fR -to the input filename. -.RE -.PP +The name of the output file containing the signed zone\&. The default is to append \fI\&.signed\fR to the input filename\&. +.TP \-h -.RS 4 -Prints a short summary of the options and arguments to -\fBdnssec\-signzone\fR. -.RE -.PP +Prints a short summary of the options and arguments to \fBdnssec\-signzone\fR\&. +.TP \-i \fIinterval\fR -.RS 4 -When a previously\-signed zone is passed as input, records may be resigned. The -\fBinterval\fR -option specifies the cycle interval as an offset from the current time (in seconds). If a RRSIG record expires after the cycle interval, it is retained. Otherwise, it is considered to be expiring soon, and it will be replaced. -.sp -The default cycle interval is one quarter of the difference between the signature end and start times. So if neither -\fBend\-time\fR -or -\fBstart\-time\fR -are specified, -\fBdnssec\-signzone\fR -generates signatures that are valid for 30 days, with a cycle interval of 7.5 days. Therefore, if any existing RRSIG records are due to expire in less than 7.5 days, they would be replaced. -.RE -.PP +When a previously\-signed zone is passed as input, records may be resigned\&. The \fBinterval\fR option specifies the cycle interval as an offset from the current time (in seconds)\&. If a RRSIG record expires after the cycle interval, it is retained\&. Otherwise, it is considered to be expiring soon, and it will be replaced\&. +The default cycle interval is one quarter of the difference between the signature end and start times\&. So if neither \fBend\-time\fR or \fBstart\-time\fR are specified, \fBdnssec\-signzone\fR generates signatures that are valid for 30 days, with a cycle interval of 7\&.5 days\&. Therefore, if any existing RRSIG records are due to expire in less than 7\&.5 days, they would be replaced\&. +.TP \-I \fIinput\-format\fR -.RS 4 -The format of the input zone file. Possible formats are -\fB"text"\fR -(default) and -\fB"raw"\fR. This option is primarily intended to be used for dynamic signed zones so that the dumped zone file in a non\-text format containing updates can be signed directly. The use of this option does not make much sense for non\-dynamic zones. -.RE -.PP +The format of the input zone file\&. Possible formats are \fB"text"\fR (default) and \fB"raw"\fR\&. This option is primarily intended to be used for dynamic signed zones so that the dumped zone file in a non\-text format containing updates can be signed directly\&. The use of this option does not make much sense for non\-dynamic zones\&. +.TP \-j \fIjitter\fR -.RS 4 -When signing a zone with a fixed signature lifetime, all RRSIG records issued at the time of signing expires simultaneously. If the zone is incrementally signed, i.e. a previously\-signed zone is passed as input to the signer, all expired signatures have to be regenerated at about the same time. The -\fBjitter\fR -option specifies a jitter window that will be used to randomize the signature expire time, thus spreading incremental signature regeneration over time. -.sp -Signature lifetime jitter also to some extent benefits validators and servers by spreading out cache expiration, i.e. if large numbers of RRSIGs don't expire at the same time from all caches there will be less congestion than if all validators need to refetch at mostly the same time. -.RE -.PP +When signing a zone with a fixed signature lifetime, all RRSIG records issued at the time of signing expires simultaneously\&. If the zone is incrementally signed, i\&.e\&. a previously\-signed zone is passed as input to the signer, all expired signatures have to be regenerated at about the same time\&. The \fBjitter\fR option specifies a jitter window that will be used to randomize the signature expire time, thus spreading incremental signature regeneration over time\&. +Signature lifetime jitter also to some extent benefits validators and servers by spreading out cache expiration, i\&.e\&. if large numbers of RRSIGs don't expire at the same time from all caches there will be less congestion than if all validators need to refetch at mostly the same time\&. +.TP \-n \fIncpus\fR -.RS 4 -Specifies the number of threads to use. By default, one thread is started for each detected CPU. -.RE -.PP +Specifies the number of threads to use\&. By default, one thread is started for each detected CPU\&. +.TP \-N \fIsoa\-serial\-format\fR -.RS 4 -The SOA serial number format of the signed zone. Possible formats are -\fB"keep"\fR -(default), -\fB"increment"\fR -and -\fB"unixtime"\fR. -.RS 4 -.PP +The SOA serial number format of the signed zone\&. Possible formats are \fB"keep"\fR (default), \fB"increment"\fR and \fB"unixtime"\fR\&. +.RS +.TP \fB"keep"\fR -.RS 4 -Do not modify the SOA serial number. -.RE -.PP +Do not modify the SOA serial number\&. +.TP \fB"increment"\fR -.RS 4 -Increment the SOA serial number using RFC 1982 arithmetics. -.RE -.PP +Increment the SOA serial number using RFC 1982 arithmetics\&. +.TP \fB"unixtime"\fR -.RS 4 -Set the SOA serial number to the number of seconds since epoch. -.RE +Set the SOA serial number to the number of seconds since epoch\&. .RE -.RE -.PP +.IP +.TP \-o \fIorigin\fR -.RS 4 -The zone origin. If not specified, the name of the zone file is assumed to be the origin. -.RE -.PP +The zone origin\&. If not specified, the name of the zone file is assumed to be the origin\&. +.TP \-O \fIoutput\-format\fR -.RS 4 -The format of the output file containing the signed zone. Possible formats are -\fB"text"\fR -(default) and -\fB"raw"\fR. -.RE -.PP +The format of the output file containing the signed zone\&. Possible formats are \fB"text"\fR (default) and \fB"raw"\fR\&. +.TP \-p -.RS 4 -Use pseudo\-random data when signing the zone. This is faster, but less secure, than using real random data. This option may be useful when signing large zones or when the entropy source is limited. -.RE -.PP +Use pseudo\-random data when signing the zone\&. This is faster, but less secure, than using real random data\&. This option may be useful when signing large zones or when the entropy source is limited\&. +.TP \-r \fIrandomdev\fR -.RS 4 -Specifies the source of randomness. If the operating system does not provide a -\fI/dev/random\fR -or equivalent device, the default source of randomness is keyboard input. -\fIrandomdev\fR -specifies the name of a character device or file containing random data to be used instead of the default. The special value -\fIkeyboard\fR -indicates that keyboard input should be used. -.RE -.PP +Specifies the source of randomness\&. If the operating system does not provide a \fI/dev/random\fR or equivalent device, the default source of randomness is keyboard input\&. \fIrandomdev\fR specifies the name of a character device or file containing random data to be used instead of the default\&. The special value \fIkeyboard\fR indicates that keyboard input should be used\&. +.TP \-t -.RS 4 -Print statistics at completion. -.RE -.PP +Print statistics at completion\&. +.TP \-v \fIlevel\fR -.RS 4 -Sets the debugging level. -.RE -.PP +Sets the debugging level\&. +.TP \-z -.RS 4 -Ignore KSK flag on key when determining what to sign. -.RE -.PP +Ignore KSK flag on key when determining what to sign\&. +.TP \-3 \fIsalt\fR -.RS 4 -Generate a NSEC3 chain with the given hex encoded salt. A dash (\fIsalt\fR) can be used to indicate that no salt is to be used when generating the NSEC3 chain. -.RE -.PP +Generate a NSEC3 chain with the given hex encoded salt\&. A dash (\fIsalt\fR) can be used to indicate that no salt is to be used when generating the NSEC3 chain\&. +.TP \-H \fIiterations\fR -.RS 4 -When generating a NSEC3 chain use this many interations. The default is 100. -.RE -.PP +When generating a NSEC3 chain use this many interations\&. The default is 100\&. +.TP \-A -.RS 4 -When generating a NSEC3 chain set the OPTOUT flag on all NSEC3 records and do not generate NSEC3 records for insecure delegations. -.RE -.PP +When generating a NSEC3 chain set the OPTOUT flag on all NSEC3 records and do not generate NSEC3 records for insecure delegations\&. +.TP zonefile -.RS 4 -The file containing the zone to be signed. -.RE -.PP +The file containing the zone to be signed\&. +.TP key -.RS 4 -Specify which keys should be used to sign the zone. If no keys are specified, then the zone will be examined for DNSKEY records at the zone apex. If these are found and there are matching private keys, in the current directory, then these will be used for signing. -.RE +Specify which keys should be used to sign the zone\&. If no keys are specified, then the zone will be examined for DNSKEY records at the zone apex\&. If these are found and there are matching private keys, in the current directory, then these will be used for signing\&. .SH "EXAMPLE" .PP -The following command signs the -\fBexample.com\fR -zone with the DSA key generated by -\fBdnssec\-keygen\fR -(Kexample.com.+003+17247). The zone's keys must be in the master file (\fIdb.example.com\fR). This invocation looks for -\fIkeyset\fR -files, in the current directory, so that DS records can be generated from them (\fB\-g\fR). -.sp -.RS 4 +The following command signs the \fBexample\&.com\fR zone with the DSA key generated by \fBdnssec\-keygen\fR (Kexample\&.com\&.+003+17247)\&. The zone's keys must be in the master file (\fIdb\&.example\&.com\fR)\&. This invocation looks for \fIkeyset\fR files, in the current directory, so that DS records can be generated from them (\fB\-g\fR)\&. .nf -% dnssec\-signzone \-g \-o example.com db.example.com \\ -Kexample.com.+003+17247 -db.example.com.signed +% dnssec\-signzone \-g \-o example\&.com db\&.example\&.com \\ +Kexample\&.com\&.+003+17247 +db\&.example\&.com\&.signed % .fi -.RE .PP -In the above example, -\fBdnssec\-signzone\fR -creates the file -\fIdb.example.com.signed\fR. This file should be referenced in a zone statement in a -\fInamed.conf\fR -file. -.PP -This example re\-signs a previously signed zone with default parameters. The private keys are assumed to be in the current directory. -.sp -.RS 4 +In the above example, \fBdnssec\-signzone\fR creates the file \fIdb\&.example\&.com\&.signed\fR\&. This file should be referenced in a zone statement in a \fInamed\&.conf\fR file\&. +.PP +This example re\-signs a previously signed zone with default parameters\&. The private keys are assumed to be in the current directory\&. .nf -% cp db.example.com.signed db.example.com -% dnssec\-signzone \-o example.com db.example.com -db.example.com.signed +% cp db\&.example\&.com\&.signed db\&.example\&.com +% dnssec\-signzone \-o example\&.com db\&.example\&.com +db\&.example\&.com\&.signed % .fi -.RE +.SH "KNOWN BUGS" +.PP + \fBdnssec\-signzone\fR was designed so that it could sign a zone partially, using only a subset of the DNSSEC keys needed to produce a fully\-signed zone\&. This permits a zone administrator, for example, to sign a zone with one key on one machine, move the resulting partially\-signed zone to a second machine, and sign it again with a second key\&. +.PP +An unfortunate side\-effect of this flexibility is that \fBdnssec\-signzone\fR does not check to make sure it's signing a zone with any valid keys at all\&. An attempt to sign a zone without any keys will appear to succeed, producing a "signed" zone with no signatures\&. There is no warning issued when a zone is not fully signed\&. +.PP +This will be corrected in a future release\&. In the meantime, ISC recommends examining the output of \fBdnssec\-signzone\fR to confirm that the zone is properly signed by all keys before using it\&. .SH "SEE ALSO" .PP -\fBdnssec\-keygen\fR(8), -BIND 9 Administrator Reference Manual, -RFC 4033. +\fBdnssec\-keygen\fR(8), BIND 9 Administrator Reference Manual, RFC 4033\&. .SH "AUTHOR" .PP -Internet Systems Consortium -.SH "COPYRIGHT" -Copyright \(co 2004\-2008 Internet Systems Consortium, Inc. ("ISC") -.br -Copyright \(co 2000\-2003 Internet Software Consortium. -.br +Internet Systems Consortium Modified: head/contrib/bind9/bin/dnssec/dnssec-signzone.c ============================================================================== --- head/contrib/bind9/bin/dnssec/dnssec-signzone.c Thu Jun 25 19:06:08 2009 (r194994) +++ head/contrib/bind9/bin/dnssec/dnssec-signzone.c Thu Jun 25 19:16:29 2009 (r194995) @@ -29,7 +29,7 @@ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnssec-signzone.c,v 1.209.12.3 2009/01/18 23:25:15 marka Exp $ */ +/* $Id: dnssec-signzone.c,v 1.209.12.8 2009/06/08 22:23:06 each Exp $ */ /*! \file */ Modified: head/contrib/bind9/bin/dnssec/dnssec-signzone.docbook ============================================================================== --- head/contrib/bind9/bin/dnssec/dnssec-signzone.docbook Thu Jun 25 19:06:08 2009 (r194994) +++ head/contrib/bind9/bin/dnssec/dnssec-signzone.docbook Thu Jun 25 19:16:29 2009 (r194995) @@ -2,7 +2,7 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" []> - + - June 30, 2000 + June 08, 2009 @@ -42,6 +42,7 @@ 2006 2007 2008 + 2009 Internet Systems Consortium, Inc. ("ISC") @@ -490,6 +491,33 @@ db.example.com.signed + KNOWN BUGS + + dnssec-signzone was designed so that it could + sign a zone partially, using only a subset of the DNSSEC keys + needed to produce a fully-signed zone. This permits a zone + administrator, for example, to sign a zone with one key on one + machine, move the resulting partially-signed zone to a second + machine, and sign it again with a second key. + + + An unfortunate side-effect of this flexibility is that + dnssec-signzone does not check to make sure + it's signing a zone with any valid keys at all. An attempt to + sign a zone without any keys will appear to succeed, producing + a "signed" zone with no signatures. There is no warning issued + when a zone is not fully signed. + + + + This will be corrected in a future release. In the meantime, ISC + recommends examining the output of dnssec-signzone + to confirm that the zone is properly signed by all keys before + using it. + + + + SEE ALSO dnssec-keygen8 Modified: head/contrib/bind9/bin/dnssec/dnssec-signzone.html ============================================================================== --- head/contrib/bind9/bin/dnssec/dnssec-signzone.html Thu Jun 25 19:06:08 2009 (r194994) +++ head/contrib/bind9/bin/dnssec/dnssec-signzone.html Thu Jun 25 19:16:29 2009 (r194995) @@ -1,5 +1,5 @@ - + dnssec-signzone - +
@@ -32,7 +32,7 @@

dnssec-signzone [-a] [-c class] [-d directory] [-e end-time] [-f output-file] [-g] [-h] [-k key] [-l domain] [-i interval] [-I input-format] [-j jitter] [-N soa-seria l-format] [-o origin] [-O output-format] [-p] [-r randomdev] [-s start-time] [-t] [-v level] [-z] [-3 salt] [-H iterations] [-A] {zonefile} [key...]

-

DESCRIPTION

+

DESCRIPTION

dnssec-signzone signs a zone. It generates NSEC and RRSIG records and produces a signed version of the @@ -43,7 +43,7 @@

-

OPTIONS

+

OPTIONS

-a

@@ -258,7 +258,7 @@

-

EXAMPLE

+

EXAMPLE

The following command signs the example.com zone with the DSA key generated by dnssec-keygen @@ -287,14 +287,39 @@ db.example.com.signed %

-

SEE ALSO

+

KNOWN BUGS

+

+ dnssec-signzone was designed so that it could + sign a zone partially, using only a subset of the DNSSEC keys + needed to produce a fully-signed zone. This permits a zone + administrator, for example, to sign a zone with one key on one + machine, move the resulting partially-signed zone to a second + machine, and sign it again with a second key. +

+

+ An unfortunate side-effect of this flexibility is that + dnssec-signzone does not check to make sure + it's signing a zone with any valid keys at all. An attempt to + sign a zone without any keys will appear to succeed, producing + a "signed" zone with no signatures. There is no warning issued + when a zone is not fully signed. +

+

+ This will be corrected in a future release. In the meantime, ISC + recommends examining the output of dnssec-signzone + to confirm that the zone is properly signed by all keys before + using it. +

+
+
+

SEE ALSO

dnssec-keygen(8), BIND 9 Administrator Reference Manual, RFC 4033.

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

Modified: head/contrib/bind9/bin/dnssec/dnssectool.c ============================================================================== --- head/contrib/bind9/bin/dnssec/dnssectool.c Thu Jun 25 19:06:08 2009 (r194994) +++ head/contrib/bind9/bin/dnssec/dnssectool.c Thu Jun 25 19:16:29 2009 (r194995) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnssectool.c,v 1.45 2007/06/19 23:46:59 tbox Exp $ */ +/* $Id: dnssectool.c,v 1.45.334.4 2009/06/08 23:47:00 tbox Exp $ */ /*! \file */ @@ -222,7 +222,7 @@ setup_entropy(isc_mem_t *mctx, const cha int usekeyboard = ISC_ENTROPY_KEYBOARDMAYBE; REQUIRE(ectx != NULL); - + if (*ectx == NULL) { result = isc_entropy_create(mctx, ectx); if (result != ISC_R_SUCCESS) Modified: head/contrib/bind9/doc/arm/Bv9ARM-book.xml ============================================================================== --- head/contrib/bind9/doc/arm/Bv9ARM-book.xml Thu Jun 25 19:06:08 2009 (r194994) +++ head/contrib/bind9/doc/arm/Bv9ARM-book.xml Thu Jun 25 19:16:29 2009 (r194995) @@ -18,7 +18,7 @@ - PERFORMANCE OF THIS SOFTWARE. --> - + BIND 9 Administrator Reference Manual @@ -4333,16 +4333,16 @@ category notify { null; }; delegation-only - - - Delegation only. Logs queries that have - been forced to NXDOMAIN as the result of a - delegation-only zone or - a delegation-only in a - hint or stub zone declaration. - - - + + + Delegation only. Logs queries that have been + forced to NXDOMAIN as the result of a + delegation-only zone or a + delegation-only in a hint + or stub zone declaration. + + + edns-disabled @@ -5116,17 +5116,45 @@ category notify { null; }; - + root-delegation-only - Turn on enforcement of delegation-only in TLDs (top level domains) and root zones - with an optional - exclude list. + Turn on enforcement of delegation-only in TLDs + (top level domains) and root zones with an optional + exclude list. + + DS queries are expected to be made to and be answered by + delegation only zones. Such queries and responses are + treated as a exception to delegation-only processing + and are not converted to NXDOMAIN responses provided + a CNAME is not discovered at the query name. + + + If a delegation only zone server also serves a child + zone it is not always possible to determine whether + a answer comes from the delegation only zone or the + child zone. SOA NS and DNSKEY records are apex + only records and a matching response that contains + these records or DS is treated as coming from a + child zone. RRSIG records are also examined to see + if they are signed by a child zone or not. The + authority section is also examined to see if there + is evidence that the answer is from the child zone. + Answers that are determined to be from a child zone + are not converted to NXDOMAIN responses. Despite + all these checks there is still a possibility of + false negatives when a child zone is being served. + + + Similarly false positives can arise from empty nodes + (no records at the name) in the delegation only zone + when the query type is not ANY. + - Note some TLDs are not delegation only (e.g. "DE", "LV", "US" - and "MUSEUM"). + Note some TLDs are not delegation only (e.g. "DE", "LV", + "US" and "MUSEUM"). This list is not exhaustive. @@ -9027,20 +9055,22 @@ zone zone_name - This is used to enforce the delegation-only - status of infrastructure zones (e.g. COM, NET, ORG). - Any answer that - is received without an explicit or implicit delegation - in the authority - section will be treated as NXDOMAIN. This does not - apply to the zone - apex. This should not be applied to leaf zones. + This is used to enforce the delegation-only + status of infrastructure zones (e.g. COM, + NET, ORG). Any answer that is received + without an explicit or implicit delegation + in the authority section will be treated + as NXDOMAIN. This does not apply to the + zone apex. This should not be applied to + leaf zones. delegation-only has no - effect on answers received - from forwarders. + effect on answers received from forwarders. + + See caveats in . + @@ -9299,9 +9329,11 @@ zone zone_name The flag only applies to hint and stub zones. If set to yes, then the zone will also be - treated as if it - is also a delegation-only type zone. + treated as if it is also a delegation-only type zone.
+ + See caveats in . + Modified: head/contrib/bind9/doc/arm/Bv9ARM.ch06.html ============================================================================== --- head/contrib/bind9/doc/arm/Bv9ARM.ch06.html Thu Jun 25 19:06:08 2009 (r194994) +++ head/contrib/bind9/doc/arm/Bv9ARM.ch06.html Thu Jun 25 19:16:29 2009 (r194995) @@ -14,7 +14,7 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> - + @@ -78,25 +78,25 @@
server Statement Definition and Usage
statistics-channels Statement Grammar
-
statistics-channels Statement Definition and +
statistics-channels Statement Definition and Usage
-
trusted-keys Statement Grammar
-
trusted-keys Statement Definition +
trusted-keys Statement Grammar
+
trusted-keys Statement Definition and Usage
view Statement Grammar
-
view Statement Definition and Usage
+
view Statement Definition and Usage
zone Statement Grammar
-
zone Statement Definition and Usage
+
zone Statement Definition and Usage
-
Zone File
+
Zone File
Types of Resource Records and When to Use Them
-
Discussion of MX Records
+
Discussion of MX Records
Setting TTLs
-
Inverse Mapping in IPv4
-
Other Zone File Directives
-
BIND Master File Extension: the $GENERATE Directive
+
Inverse Mapping in IPv4
+
Other Zone File Directives
+
BIND Master File Extension: the $GENERATE Directive
Additional File Formats
BIND9 Statistics
@@ -1677,11 +1677,11 @@ category notify { null; };

- Delegation only. Logs queries that have - been forced to NXDOMAIN as the result of a - delegation-only zone or - a delegation-only in a - hint or stub zone declaration. + Delegation only. Logs queries that have been + forced to NXDOMAIN as the result of a + delegation-only zone or a + delegation-only in a hint + or stub zone declaration.

@@ -2367,16 +2367,46 @@ category notify { null; }; in the additional section of a query response. The default is not to prefer any type (NONE).

-
root-delegation-only
+
+root-delegation-only +

- Turn on enforcement of delegation-only in TLDs (top level domains) and root zones - with an optional + Turn on enforcement of delegation-only in TLDs + (top level domains) and root zones with an optional exclude list.

- Note some TLDs are not delegation only (e.g. "DE", "LV", "US" - and "MUSEUM"). + DS queries are expected to be made to and be answered by + delegation only zones. Such queries and responses are + treated as a exception to delegation-only processing + and are not converted to NXDOMAIN responses provided + a CNAME is not discovered at the query name. +

+

+ If a delegation only zone server also serves a child + zone it is not always possible to determine whether + a answer comes from the delegation only zone or the + child zone. SOA NS and DNSKEY records are apex + only records and a matching response that contains + these records or DS is treated as coming from a + child zone. RRSIG records are also examined to see + if they are signed by a child zone or not. The + authority section is also examined to see if there + is evidence that the answer is from the child zone. + Answers that are determined to be from a child zone + are not converted to NXDOMAIN responses. Despite + all these checks there is still a possibility of + false negatives when a child zone is being served. +

+

+ Similarly false positives can arise from empty nodes + (no records at the name) in the delegation only zone + when the query type is not ANY. +

+

+ Note some TLDs are not delegation only (e.g. "DE", "LV", + "US" and "MUSEUM"). This list is not exhaustive.

 options {
@@ -3151,7 +3181,7 @@ options {
 
 

-Forwarding

+Forwarding

The forwarding facility can be used to create a large site-wide cache on a few servers, reducing traffic over links to external @@ -3195,7 +3225,7 @@ options {

-Dual-stack Servers

+Dual-stack Servers

Dual-stack servers are used as servers of last resort to work around @@ -3392,7 +3422,7 @@ options {

-Interfaces

+Interfaces

The interfaces and ports that the server will answer queries from may be specified using the listen-on option. listen-on takes @@ -3844,7 +3874,7 @@ avoid-v6-udp-ports {};

-UDP Port Lists

+UDP Port Lists

use-v4-udp-ports, avoid-v4-udp-ports, @@ -3886,7 +3916,7 @@ avoid-v6-udp-ports { 40000; range 50000

-Operating System Resource Limits

+Operating System Resource Limits

The server's usage of many system resources can be limited. Scaled values are allowed when specifying resource limits. For @@ -4048,7 +4078,7 @@ avoid-v6-udp-ports { 40000; range 50000

-Periodic Task Intervals

+Periodic Task Intervals
cleaning-interval

@@ -5026,7 +5056,7 @@ avoid-v6-udp-ports { 40000; range 50000

-statistics-channels Statement Definition and +statistics-channels Statement Definition and Usage

The statistics-channels statement @@ -5077,7 +5107,7 @@ avoid-v6-udp-ports { 40000; range 50000

-trusted-keys Statement Grammar

+trusted-keys Statement Grammar
trusted-keys {
     string number number number string ;
     [ string number number number string ; [...]]
@@ -5086,7 +5116,7 @@ avoid-v6-udp-ports { 40000; range 50000 
 
 

-trusted-keys Statement Definition +trusted-keys Statement Definition and Usage

The trusted-keys statement defines @@ -5132,7 +5162,7 @@ avoid-v6-udp-ports { 40000; range 50000

-view Statement Definition and Usage

+view Statement Definition and Usage
*** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 19:23:25 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B27AC106564A; Thu, 25 Jun 2009 19:23:25 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A0B548FC0A; Thu, 25 Jun 2009 19:23:25 +0000 (UTC) (envelope-from rnoland@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PJNP2M062270; Thu, 25 Jun 2009 19:23:25 GMT (envelope-from rnoland@svn.freebsd.org) Received: (from rnoland@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PJNPO9062268; Thu, 25 Jun 2009 19:23:25 GMT (envelope-from rnoland@svn.freebsd.org) Message-Id: <200906251923.n5PJNPO9062268@svn.freebsd.org> From: Robert Noland Date: Thu, 25 Jun 2009 19:23:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194996 - head/sys/dev/drm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 19:23:26 -0000 Author: rnoland Date: Thu Jun 25 19:23:25 2009 New Revision: 194996 URL: http://svn.freebsd.org/changeset/base/194996 Log: We shouldn't need to drop and reaquire the lock here. MFC after: 3 days Modified: head/sys/dev/drm/i915_dma.c Modified: head/sys/dev/drm/i915_dma.c ============================================================================== --- head/sys/dev/drm/i915_dma.c Thu Jun 25 19:16:29 2009 (r194995) +++ head/sys/dev/drm/i915_dma.c Thu Jun 25 19:23:25 2009 (r194996) @@ -644,18 +644,17 @@ static int i915_batchbuffer(struct drm_d return -EFAULT; } } - DRM_LOCK(); ret = i915_dispatch_batchbuffer(dev, batch); - if (sarea_priv) - sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); - - DRM_UNLOCK(); if (batch->num_cliprects) vsunlock(batch->cliprects, cliplen); + DRM_LOCK(); + if (sarea_priv) + sarea_priv->last_dispatch = READ_BREADCRUMB(dev_priv); + return ret; } @@ -697,10 +696,9 @@ static int i915_cmdbuffer(struct drm_dev return -EFAULT; } } - DRM_LOCK(); ret = i915_dispatch_cmdbuffer(dev, cmdbuf); - DRM_UNLOCK(); + if (cmdbuf->num_cliprects) { vsunlock(cmdbuf->buf, cmdbuf->sz); vsunlock(cmdbuf->cliprects, cliplen); From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 19:26:23 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 779A6106564A; Thu, 25 Jun 2009 19:26:23 +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 666EA8FC15; Thu, 25 Jun 2009 19:26:23 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PJQNtW062381; Thu, 25 Jun 2009 19:26:23 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PJQNOR062379; Thu, 25 Jun 2009 19:26:23 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200906251926.n5PJQNOR062379@svn.freebsd.org> From: Ed Schouten Date: Thu, 25 Jun 2009 19:26:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194997 - head/sys/sun4v/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 19:26:23 -0000 Author: ed Date: Thu Jun 25 19:26:23 2009 New Revision: 194997 URL: http://svn.freebsd.org/changeset/base/194997 Log: Remove COMPAT_43 from sun4v's GENERIC. I think it's very unlikely that we have binaries for sun4v that use features provided by COMPAT_43. Remove it from GENERIC. Approved by: kib Modified: head/sys/sun4v/conf/GENERIC Modified: head/sys/sun4v/conf/GENERIC ============================================================================== --- head/sys/sun4v/conf/GENERIC Thu Jun 25 19:23:25 2009 (r194996) +++ head/sys/sun4v/conf/GENERIC Thu Jun 25 19:26:23 2009 (r194997) @@ -51,7 +51,6 @@ options PROCFS # Process filesystem ( options PSEUDOFS # Pseudo-filesystem framework options GEOM_PART_GPT # GUID Partition Tables. options GEOM_LABEL # Provides labelization -options COMPAT_43 # Compatible with BSD 4.3 (sgtty) options COMPAT_43TTY # BSD 4.3 TTY compat (sgtty) options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI options KTRACE # ktrace(1) support From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 19:44:28 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5B65106564A; Thu, 25 Jun 2009 19:44:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id BC6358FC12; Thu, 25 Jun 2009 19:44:27 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from [212.86.226.226] (account mav@alkar.net HELO mavbook.mavhome.dp.ua) by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9) with ESMTPSA id 246841320; Thu, 25 Jun 2009 22:44:24 +0300 Message-ID: <4A43D392.2070203@FreeBSD.org> Date: Thu, 25 Jun 2009 22:44:18 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.21 (X11/20090405) MIME-Version: 1.0 To: John Baldwin References: <200906251813.n5PIDkfl060004@svn.freebsd.org> In-Reply-To: <200906251813.n5PIDkfl060004@svn.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194985 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 19:44:29 -0000 John Baldwin wrote: > Author: jhb > Date: Thu Jun 25 18:13:46 2009 > New Revision: 194985 > URL: http://svn.freebsd.org/changeset/base/194985 > > Log: > - Restore the behavior of pre-allocating IDT vectors for MSI interrupts. > This is mostly important for the multiple MSI message case where the > IDT vectors for the entire group need to be allocated together. This > also restores the assumptions made by the PCI bus code that it could > invoke PCIB_MAP_MSI() once MSI vectors were allocated. > - To avoid whiplash with CPU assignments, change the way that CPUs are > assigned to interrupt sources on activation. Instead of assigning the > CPU via pic_assign_cpu() before calling enable_intr(), allow the > different interrupt source drivers to ask the MD interrupt code which > CPU to use when they allocate an IDT vector. I/O APIC interrupt pins > do this in their pic_enable_intr() routines giving the same behavior as > before. MSI sources do it when the IDT vectors are allocated during > msi_alloc() and msix_alloc(). > - Change the intr_table_lock from an sx lock to a mutex. > > Tested by: rnoland It seems also fixed previously not working multi-vector MSI mode of AHCI on my less lucky laptop. Thanks. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 19:52:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 994B1106566C; Thu, 25 Jun 2009 19:52:45 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8769D8FC08; Thu, 25 Jun 2009 19:52:45 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PJqjLj063025; Thu, 25 Jun 2009 19:52:45 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PJqj6K063023; Thu, 25 Jun 2009 19:52:45 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200906251952.n5PJqj6K063023@svn.freebsd.org> From: Doug Barton Date: Thu, 25 Jun 2009 19:52: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: r195000 - head/contrib/bind9/lib/isc/ia64/include/isc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 19:52:46 -0000 Author: dougb Date: Thu Jun 25 19:52:45 2009 New Revision: 195000 URL: http://svn.freebsd.org/changeset/base/195000 Log: This is the solution that ISC committed after 9.6.1-release for the gcc warning issue. It should be included in the next upstream release. Modified: head/contrib/bind9/lib/isc/ia64/include/isc/atomic.h Modified: head/contrib/bind9/lib/isc/ia64/include/isc/atomic.h ============================================================================== --- head/contrib/bind9/lib/isc/ia64/include/isc/atomic.h Thu Jun 25 19:39:16 2009 (r194999) +++ head/contrib/bind9/lib/isc/ia64/include/isc/atomic.h Thu Jun 25 19:52:45 2009 (r195000) @@ -31,6 +31,9 @@ * (e.g., 1 and -1)? */ static inline isc_int32_t +#ifdef __GNUC__ +__attribute__ ((unused)) +#endif isc_atomic_xadd(isc_int32_t *p, isc_int32_t val) { isc_int32_t prev, swapped; @@ -54,6 +57,9 @@ isc_atomic_xadd(isc_int32_t *p, isc_int3 * This routine atomically stores the value 'val' in 'p'. */ static inline void +#ifdef __GNUC__ +__attribute__ ((unused)) +#endif isc_atomic_store(isc_int32_t *p, isc_int32_t val) { __asm__ volatile( @@ -70,6 +76,9 @@ isc_atomic_store(isc_int32_t *p, isc_int * case. */ static inline isc_int32_t +#ifdef __GNUC__ +__attribute__ ((unused)) +#endif isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { isc_int32_t ret; From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 20:09:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 771A4106566C; Thu, 25 Jun 2009 20:09:54 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EEDFE8FC14; Thu, 25 Jun 2009 20:09:53 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PK9rD2063423; Thu, 25 Jun 2009 20:09:53 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PK9rYY063421; Thu, 25 Jun 2009 20:09:53 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200906252009.n5PK9rYY063421@svn.freebsd.org> From: Doug Barton Date: Thu, 25 Jun 2009 20:09: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: r195001 - head/share/doc/bind9 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 20:09:54 -0000 Author: dougb Date: Thu Jun 25 20:09:53 2009 New Revision: 195001 URL: http://svn.freebsd.org/changeset/base/195001 Log: Add the KNOWN-DEFECTS file back in for the 9.6.1 release. Modified: head/share/doc/bind9/Makefile Modified: head/share/doc/bind9/Makefile ============================================================================== --- head/share/doc/bind9/Makefile Thu Jun 25 19:52:45 2009 (r195000) +++ head/share/doc/bind9/Makefile Thu Jun 25 20:09:53 2009 (r195001) @@ -8,7 +8,7 @@ SRCDIR= ${BIND_DIR}/doc NO_OBJ= FILESGROUPS= TOP ARM MISC -TOP= CHANGES COPYRIGHT FAQ NSEC3-NOTES README \ +TOP= CHANGES COPYRIGHT FAQ KNOWN-DEFECTS NSEC3-NOTES README \ README.idnkit README.pkcs11 TOPDIR= ${DOCDIR}/bind9 ARM= Bv9ARM.ch01.html Bv9ARM.ch02.html Bv9ARM.ch03.html \ From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 20:35:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A38C0106564A; Thu, 25 Jun 2009 20:35:46 +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 86F6B8FC0C; Thu, 25 Jun 2009 20:35:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PKZkG3063796; Thu, 25 Jun 2009 20:35:46 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PKZkws063791; Thu, 25 Jun 2009 20:35:46 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906252035.n5PKZkws063791@svn.freebsd.org> From: John Baldwin Date: Thu, 25 Jun 2009 20:35: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: r195002 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 20:35:47 -0000 Author: jhb Date: Thu Jun 25 20:35:46 2009 New Revision: 195002 URL: http://svn.freebsd.org/changeset/base/195002 Log: Fix kernels compiled without SMP support. Make intr_next_cpu() available for UP kernels but as a stub that always returns the single CPU's local APIC ID. Reported by: kib Modified: head/sys/amd64/amd64/intr_machdep.c head/sys/amd64/include/intr_machdep.h head/sys/i386/i386/intr_machdep.c head/sys/i386/include/intr_machdep.h Modified: head/sys/amd64/amd64/intr_machdep.c ============================================================================== --- head/sys/amd64/amd64/intr_machdep.c Thu Jun 25 20:09:53 2009 (r195001) +++ head/sys/amd64/amd64/intr_machdep.c Thu Jun 25 20:35:46 2009 (r195002) @@ -518,4 +518,14 @@ intr_shuffle_irqs(void *arg __unused) } SYSINIT(intr_shuffle_irqs, SI_SUB_SMP, SI_ORDER_SECOND, intr_shuffle_irqs, NULL); +#else +/* + * Always route interrupts to the current processor in the UP case. + */ +u_int +intr_next_cpu(void) +{ + + return (PCPU_GET(apic_id)); +} #endif Modified: head/sys/amd64/include/intr_machdep.h ============================================================================== --- head/sys/amd64/include/intr_machdep.h Thu Jun 25 20:09:53 2009 (r195001) +++ head/sys/amd64/include/intr_machdep.h Thu Jun 25 20:35:46 2009 (r195002) @@ -152,9 +152,7 @@ int intr_bind(u_int vector, u_char cpu); int intr_config_intr(int vector, enum intr_trigger trig, enum intr_polarity pol); void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame); -#ifdef SMP u_int intr_next_cpu(void); -#endif struct intsrc *intr_lookup_source(int vector); int intr_register_pic(struct pic *pic); int intr_register_source(struct intsrc *isrc); Modified: head/sys/i386/i386/intr_machdep.c ============================================================================== --- head/sys/i386/i386/intr_machdep.c Thu Jun 25 20:09:53 2009 (r195001) +++ head/sys/i386/i386/intr_machdep.c Thu Jun 25 20:35:46 2009 (r195002) @@ -491,4 +491,14 @@ intr_shuffle_irqs(void *arg __unused) } SYSINIT(intr_shuffle_irqs, SI_SUB_SMP, SI_ORDER_SECOND, intr_shuffle_irqs, NULL); +#else +/* + * Always route interrupts to the current processor in the UP case. + */ +u_int +intr_next_cpu(void) +{ + + return (PCPU_GET(apic_id)); +} #endif Modified: head/sys/i386/include/intr_machdep.h ============================================================================== --- head/sys/i386/include/intr_machdep.h Thu Jun 25 20:09:53 2009 (r195001) +++ head/sys/i386/include/intr_machdep.h Thu Jun 25 20:35:46 2009 (r195002) @@ -139,9 +139,7 @@ int intr_bind(u_int vector, u_char cpu); int intr_config_intr(int vector, enum intr_trigger trig, enum intr_polarity pol); void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame); -#ifdef SMP u_int intr_next_cpu(void); -#endif struct intsrc *intr_lookup_source(int vector); int intr_register_pic(struct pic *pic); int intr_register_source(struct intsrc *isrc); From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 20:40:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3F59106566C; Thu, 25 Jun 2009 20:40:13 +0000 (UTC) (envelope-from snb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B24768FC1B; Thu, 25 Jun 2009 20:40:13 +0000 (UTC) (envelope-from snb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PKeDHL063890; Thu, 25 Jun 2009 20:40:13 GMT (envelope-from snb@svn.freebsd.org) Received: (from snb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PKeDPm063888; Thu, 25 Jun 2009 20:40:13 GMT (envelope-from snb@svn.freebsd.org) Message-Id: <200906252040.n5PKeDPm063888@svn.freebsd.org> From: Sean Nicholas Barkas Date: Thu, 25 Jun 2009 20:40: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: r195003 - head/sys/ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 20:40:14 -0000 Author: snb Date: Thu Jun 25 20:40:13 2009 New Revision: 195003 URL: http://svn.freebsd.org/changeset/base/195003 Log: Fix a bug reported by pho@ where one can induce a panic by decreasing vfs.ufs.dirhash_maxmem below the current amount of memory used by dirhash. When ufsdirhash_build() is called with the memory in use greater than dirhash_maxmem, it attempts to free up memory by calling ufsdirhash_recycle(). If successful in freeing enough memory, ufsdirhash_recycle() leaves the dirhash list locked. But at this point in ufsdirhash_build(), the list is not explicitly unlocked after the call(s) to ufsdirhash_recycle(). When we next attempt to lock the dirhash list, we will get a "panic: _mtx_lock_sleep: recursed on non-recursive mutex dirhash list". Tested by: pho Approved by: dwmalone (mentor) MFC after: 3 weeks Modified: head/sys/ufs/ufs/ufs_dirhash.c Modified: head/sys/ufs/ufs/ufs_dirhash.c ============================================================================== --- head/sys/ufs/ufs/ufs_dirhash.c Thu Jun 25 20:35:46 2009 (r195002) +++ head/sys/ufs/ufs/ufs_dirhash.c Thu Jun 25 20:40:13 2009 (r195003) @@ -348,9 +348,12 @@ ufsdirhash_build(struct inode *ip) int dirblocks, i, j, memreqd, nblocks, narrays, nslots, slot; /* Take care of a decreased sysctl value. */ - while (ufs_dirhashmem > ufs_dirhashmaxmem) + while (ufs_dirhashmem > ufs_dirhashmaxmem) { if (ufsdirhash_recycle(0) != 0) return (-1); + /* Recycled enough memory, so unlock the list. */ + DIRHASHLIST_UNLOCK(); + } /* Check if we can/should use dirhash. */ if (ip->i_size < ufs_mindirhashsize || OFSFMT(ip->i_vnode) || From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 20:57:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D827106564A; Thu, 25 Jun 2009 20:57:54 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EF8AD8FC0A; Thu, 25 Jun 2009 20:57:53 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PKvrfM064158; Thu, 25 Jun 2009 20:57:53 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PKvrCQ064155; Thu, 25 Jun 2009 20:57:53 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <200906252057.n5PKvrCQ064155@svn.freebsd.org> From: Edward Tomasz Napierala Date: Thu, 25 Jun 2009 20:57: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: r195004 - head/lib/libc/posix1e X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 20:57:54 -0000 Author: trasz Date: Thu Jun 25 20:57:53 2009 New Revision: 195004 URL: http://svn.freebsd.org/changeset/base/195004 Log: Fix acl_set_fd(3) and acl_get_fd(3) for cases where the kernel doesn't know anything about _PC_ACL_NFS4. Modified: head/lib/libc/posix1e/acl_get.c head/lib/libc/posix1e/acl_set.c Modified: head/lib/libc/posix1e/acl_get.c ============================================================================== --- head/lib/libc/posix1e/acl_get.c Thu Jun 25 20:40:13 2009 (r195003) +++ head/lib/libc/posix1e/acl_get.c Thu Jun 25 20:57:53 2009 (r195004) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" #include +#include #include #include #include @@ -102,7 +103,7 @@ acl_get_link_np(const char *path_p, acl_ acl_t acl_get_fd(int fd) { - if (fpathconf(fd, _PC_ACL_NFS4)) + if (fpathconf(fd, _PC_ACL_NFS4) == 1) return (acl_get_fd_np(fd, ACL_TYPE_NFS4)); return (acl_get_fd_np(fd, ACL_TYPE_ACCESS)); Modified: head/lib/libc/posix1e/acl_set.c ============================================================================== --- head/lib/libc/posix1e/acl_set.c Thu Jun 25 20:40:13 2009 (r195003) +++ head/lib/libc/posix1e/acl_set.c Thu Jun 25 20:57:53 2009 (r195004) @@ -108,7 +108,7 @@ int acl_set_fd(int fd, acl_t acl) { - if (fpathconf(fd, _PC_ACL_NFS4)) + if (fpathconf(fd, _PC_ACL_NFS4) == 1) return (acl_set_fd_np(fd, acl, ACL_TYPE_NFS4)); return (acl_set_fd_np(fd, acl, ACL_TYPE_ACCESS)); From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 20:59:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 914A51065670; Thu, 25 Jun 2009 20:59:37 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 64CBD8FC13; Thu, 25 Jun 2009 20:59:37 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PKxbRj064217; Thu, 25 Jun 2009 20:59:37 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PKxbRo064214; Thu, 25 Jun 2009 20:59:37 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200906252059.n5PKxbRo064214@svn.freebsd.org> From: Attilio Rao Date: Thu, 25 Jun 2009 20:59: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: r195005 - head/sys/dev/hwpmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 20:59:38 -0000 Author: attilio Date: Thu Jun 25 20:59:37 2009 New Revision: 195005 URL: http://svn.freebsd.org/changeset/base/195005 Log: Fix a LOR between pmc_sx and proctree/allproc when creating a new thread for the pmclog. Reported by: Ryan Stone Tested by: Ryan Stone Sponsored by: Sandvine Incorporated Modified: head/sys/dev/hwpmc/hwpmc_logging.c head/sys/dev/hwpmc/hwpmc_mod.c Modified: head/sys/dev/hwpmc/hwpmc_logging.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_logging.c Thu Jun 25 20:57:53 2009 (r195004) +++ head/sys/dev/hwpmc/hwpmc_logging.c Thu Jun 25 20:59:37 2009 (r195005) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -552,6 +553,12 @@ pmclog_configure_log(struct pmc_mdep *md int error; struct proc *p; + /* + * As long as it is possible to get a LOR between pmc_sx lock and + * proctree/allproc sx locks used for adding a new process, assure + * the former is not held here. + */ + sx_assert(&pmc_sx, SA_UNLOCKED); PMCDBG(LOG,CFG,1, "config po=%p logfd=%d", po, logfd); p = po->po_owner; Modified: head/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mod.c Thu Jun 25 20:57:53 2009 (r195004) +++ head/sys/dev/hwpmc/hwpmc_mod.c Thu Jun 25 20:59:37 2009 (r195005) @@ -2663,7 +2663,7 @@ static const char *pmc_op_to_name[] = { static int pmc_syscall_handler(struct thread *td, void *syscall_args) { - int error, is_sx_downgraded, op; + int error, is_sx_downgraded, is_sx_locked, op; struct pmc_syscall_args *c; void *arg; @@ -2672,6 +2672,7 @@ pmc_syscall_handler(struct thread *td, v DROP_GIANT(); is_sx_downgraded = 0; + is_sx_locked = 1; c = (struct pmc_syscall_args *) syscall_args; @@ -2720,9 +2721,11 @@ pmc_syscall_handler(struct thread *td, v * a log file configured, flush its buffers and * de-configure it. */ - if (cl.pm_logfd >= 0) + if (cl.pm_logfd >= 0) { + sx_xunlock(&pmc_sx); + is_sx_locked = 0; error = pmclog_configure_log(md, po, cl.pm_logfd); - else if (po->po_flags & PMC_PO_OWNS_LOGFILE) { + } else if (po->po_flags & PMC_PO_OWNS_LOGFILE) { pmclog_process_closelog(po); error = pmclog_flush(po); if (error == 0) { @@ -3772,10 +3775,12 @@ pmc_syscall_handler(struct thread *td, v break; } - if (is_sx_downgraded) - sx_sunlock(&pmc_sx); - else - sx_xunlock(&pmc_sx); + if (is_sx_locked != 0) { + if (is_sx_downgraded) + sx_sunlock(&pmc_sx); + else + sx_xunlock(&pmc_sx); + } if (error) atomic_add_int(&pmc_stats.pm_syscall_errors, 1); From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 21:31:54 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 884741065670; Thu, 25 Jun 2009 21:31:54 +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 5A1078FC13; Thu, 25 Jun 2009 21:31:54 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id F289846B2D; Thu, 25 Jun 2009 17:31:53 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 0D9058A079; Thu, 25 Jun 2009 17:31:53 -0400 (EDT) From: John Baldwin To: Alexander Motin Date: Thu, 25 Jun 2009 17:24:24 -0400 User-Agent: KMail/1.9.7 References: <200906251813.n5PIDkfl060004@svn.freebsd.org> <4A43D392.2070203@FreeBSD.org> In-Reply-To: <4A43D392.2070203@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906251724.24450.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 25 Jun 2009 17:31:53 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194985 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 21:31:54 -0000 On Thursday 25 June 2009 3:44:18 pm Alexander Motin wrote: > John Baldwin wrote: > > Author: jhb > > Date: Thu Jun 25 18:13:46 2009 > > New Revision: 194985 > > URL: http://svn.freebsd.org/changeset/base/194985 > > > > Log: > > - Restore the behavior of pre-allocating IDT vectors for MSI interrupts. > > This is mostly important for the multiple MSI message case where the > > IDT vectors for the entire group need to be allocated together. This > > also restores the assumptions made by the PCI bus code that it could > > invoke PCIB_MAP_MSI() once MSI vectors were allocated. > > - To avoid whiplash with CPU assignments, change the way that CPUs are > > assigned to interrupt sources on activation. Instead of assigning the > > CPU via pic_assign_cpu() before calling enable_intr(), allow the > > different interrupt source drivers to ask the MD interrupt code which > > CPU to use when they allocate an IDT vector. I/O APIC interrupt pins > > do this in their pic_enable_intr() routines giving the same behavior as > > before. MSI sources do it when the IDT vectors are allocated during > > msi_alloc() and msix_alloc(). > > - Change the intr_table_lock from an sx lock to a mutex. > > > > Tested by: rnoland > > It seems also fixed previously not working multi-vector MSI mode of AHCI > on my less lucky laptop. Thanks. I still need to do additional work to make it possible to use cpuset to move multi-vector MSI groups around. Does your laptop have multiple cores? -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 21:47:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 793C1106564A; Thu, 25 Jun 2009 21:47:47 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id 4F6188FC16; Thu, 25 Jun 2009 21:47:46 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from [212.86.226.226] (account mav@alkar.net HELO mavbook.mavhome.dp.ua) by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9) with ESMTPSA id 246847083; Fri, 26 Jun 2009 00:47:42 +0300 Message-ID: <4A43F079.4090401@FreeBSD.org> Date: Fri, 26 Jun 2009 00:47:37 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.21 (X11/20090405) MIME-Version: 1.0 To: John Baldwin References: <200906251813.n5PIDkfl060004@svn.freebsd.org> <4A43D392.2070203@FreeBSD.org> <200906251724.24450.jhb@freebsd.org> In-Reply-To: <200906251724.24450.jhb@freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194985 - in head/sys: amd64/amd64 amd64/include i386/i386 i386/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 21:47:47 -0000 John Baldwin wrote: > On Thursday 25 June 2009 3:44:18 pm Alexander Motin wrote: >> John Baldwin wrote: >>> Author: jhb >>> Date: Thu Jun 25 18:13:46 2009 >>> New Revision: 194985 >>> URL: http://svn.freebsd.org/changeset/base/194985 >>> >>> Log: >>> - Restore the behavior of pre-allocating IDT vectors for MSI interrupts. >>> This is mostly important for the multiple MSI message case where the >>> IDT vectors for the entire group need to be allocated together. This >>> also restores the assumptions made by the PCI bus code that it could >>> invoke PCIB_MAP_MSI() once MSI vectors were allocated. >>> - To avoid whiplash with CPU assignments, change the way that CPUs are >>> assigned to interrupt sources on activation. Instead of assigning the >>> CPU via pic_assign_cpu() before calling enable_intr(), allow the >>> different interrupt source drivers to ask the MD interrupt code which >>> CPU to use when they allocate an IDT vector. I/O APIC interrupt pins >>> do this in their pic_enable_intr() routines giving the same behavior as >>> before. MSI sources do it when the IDT vectors are allocated during >>> msi_alloc() and msix_alloc(). >>> - Change the intr_table_lock from an sx lock to a mutex. >>> >>> Tested by: rnoland >> It seems also fixed previously not working multi-vector MSI mode of AHCI >> on my less lucky laptop. Thanks. > > I still need to do additional work to make it possible to use cpuset to move > multi-vector MSI groups around. Does your laptop have multiple cores? Yes. Two. -- Alexander Motin From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 21:50:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C817710656AA; Thu, 25 Jun 2009 21:50:15 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B55B58FC19; Thu, 25 Jun 2009 21:50:15 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PLoFSa065355; Thu, 25 Jun 2009 21:50:15 GMT (envelope-from np@svn.freebsd.org) Received: (from np@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PLoFph065351; Thu, 25 Jun 2009 21:50:15 GMT (envelope-from np@svn.freebsd.org) Message-Id: <200906252150.n5PLoFph065351@svn.freebsd.org> From: Navdeep Parhar Date: Thu, 25 Jun 2009 21:50: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: r195006 - in head/sys/dev/cxgb: . sys X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 21:50:16 -0000 Author: np Date: Thu Jun 25 21:50:15 2009 New Revision: 195006 URL: http://svn.freebsd.org/changeset/base/195006 Log: mvec routines should have no knowledge of the SG engine. Reviewed by: kmacy Approved by: gnn (mentor) Modified: head/sys/dev/cxgb/cxgb_sge.c head/sys/dev/cxgb/sys/mvec.h head/sys/dev/cxgb/sys/uipc_mvec.c Modified: head/sys/dev/cxgb/cxgb_sge.c ============================================================================== --- head/sys/dev/cxgb/cxgb_sge.c Thu Jun 25 20:59:37 2009 (r195005) +++ head/sys/dev/cxgb/cxgb_sge.c Thu Jun 25 21:50:15 2009 (r195006) @@ -1152,17 +1152,18 @@ busdma_map_mbufs(struct mbuf **m, struct { struct mbuf *m0; int err, pktlen, pass = 0; + bus_dma_tag_t tag = txq->entry_tag; retry: err = 0; m0 = *m; pktlen = m0->m_pkthdr.len; #if defined(__i386__) || defined(__amd64__) - if (busdma_map_sg_collapse(txq, txsd->map, m, segs, nsegs) == 0) { + if (busdma_map_sg_collapse(tag, txsd->map, m, segs, nsegs) == 0) { goto done; } else #endif - err = bus_dmamap_load_mbuf_sg(txq->entry_tag, txsd->map, m0, segs, nsegs, 0); + err = bus_dmamap_load_mbuf_sg(tag, txsd->map, m0, segs, nsegs, 0); if (err == 0) { goto done; @@ -1189,7 +1190,7 @@ retry: } done: #if !defined(__i386__) && !defined(__amd64__) - bus_dmamap_sync(txq->entry_tag, txsd->map, BUS_DMASYNC_PREWRITE); + bus_dmamap_sync(tag, txsd->map, BUS_DMASYNC_PREWRITE); #endif txsd->flags |= TX_SW_DESC_MAPPED; @@ -1412,11 +1413,12 @@ t3_encap(struct sge_qset *qs, struct mbu tso_info = V_LSO_MSS(m0->m_pkthdr.tso_segsz); #endif if (m0->m_nextpkt != NULL) { - busdma_map_sg_vec(txq, txsd->map, m0, segs, &nsegs); + busdma_map_sg_vec(txq->entry_tag, txsd->map, m0, segs, &nsegs); ndesc = 1; mlen = 0; } else { - if ((err = busdma_map_sg_collapse(txq, txsd->map, &m0, segs, &nsegs))) { + if ((err = busdma_map_sg_collapse(txq->entry_tag, txsd->map, + &m0, segs, &nsegs))) { if (cxgb_debug) printf("failed ... err=%d\n", err); return (err); Modified: head/sys/dev/cxgb/sys/mvec.h ============================================================================== --- head/sys/dev/cxgb/sys/mvec.h Thu Jun 25 20:59:37 2009 (r195005) +++ head/sys/dev/cxgb/sys/mvec.h Thu Jun 25 21:50:15 2009 (r195006) @@ -43,7 +43,7 @@ #define m_ulp_mode m_pkthdr.tso_segsz /* upper level protocol */ static __inline void -busdma_map_mbuf_fast(struct sge_txq *txq, bus_dmamap_t map, +busdma_map_mbuf_fast(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf *m, bus_dma_segment_t *seg) { #if defined(__i386__) || defined(__amd64__) @@ -52,14 +52,13 @@ busdma_map_mbuf_fast(struct sge_txq *txq #else int nsegstmp; - bus_dmamap_load_mbuf_sg(txq->entry_tag, map, m, seg, - &nsegstmp, 0); + bus_dmamap_load_mbuf_sg(tag, map, m, seg, &nsegstmp, 0); #endif } -int busdma_map_sg_collapse(struct sge_txq *txq, bus_dmamap_t map, +int busdma_map_sg_collapse(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf **m, bus_dma_segment_t *segs, int *nsegs); -void busdma_map_sg_vec(struct sge_txq *txq, bus_dmamap_t map, +void busdma_map_sg_vec(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf *m, bus_dma_segment_t *segs, int *nsegs); static __inline int busdma_map_sgl(bus_dma_segment_t *vsegs, bus_dma_segment_t *segs, int count) Modified: head/sys/dev/cxgb/sys/uipc_mvec.c ============================================================================== --- head/sys/dev/cxgb/sys/uipc_mvec.c Thu Jun 25 20:59:37 2009 (r195005) +++ head/sys/dev/cxgb/sys/uipc_mvec.c Thu Jun 25 21:50:15 2009 (r195006) @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); #endif int -busdma_map_sg_collapse(struct sge_txq *txq, bus_dmamap_t map, +busdma_map_sg_collapse(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf **m, bus_dma_segment_t *segs, int *nsegs) { struct mbuf *n = *m; @@ -73,7 +73,7 @@ retry: psegs = segs; seg_count = 0; if (n->m_next == NULL) { - busdma_map_mbuf_fast(txq, map, n, segs); + busdma_map_mbuf_fast(tag, map, n, segs); *nsegs = 1; return (0); } @@ -84,14 +84,13 @@ retry: */ if (__predict_true(n->m_len != 0)) { seg_count++; - busdma_map_mbuf_fast(txq, map, n, psegs); + busdma_map_mbuf_fast(tag, map, n, psegs); psegs++; } n = n->m_next; } #else - err = bus_dmamap_load_mbuf_sg(txq->entry_tag, map, *m, segs, - &seg_count, 0); + err = bus_dmamap_load_mbuf_sg(tag, map, *m, segs, &seg_count, 0); #endif if (seg_count == 0) { if (cxgb_debug) @@ -122,11 +121,11 @@ err_out: } void -busdma_map_sg_vec(struct sge_txq *txq, bus_dmamap_t map, +busdma_map_sg_vec(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf *m, bus_dma_segment_t *segs, int *nsegs) { for (*nsegs = 0; m != NULL ; segs++, *nsegs += 1, m = m->m_nextpkt) - busdma_map_mbuf_fast(txq, map, m, segs); + busdma_map_mbuf_fast(tag, map, m, segs); } From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 22:20:04 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9B537106564A; Thu, 25 Jun 2009 22:20:04 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 39E1F8FC0C; Thu, 25 Jun 2009 22:20:04 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 1E45D1CCD8; Fri, 26 Jun 2009 00:20:03 +0200 (CEST) Date: Fri, 26 Jun 2009 00:20:03 +0200 From: Ed Schouten To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <20090625222003.GA48776@hoeg.nl> References: <200906251926.n5PJQNOR062379@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="QG4eSQjbZgLlyL/H" Content-Disposition: inline In-Reply-To: <200906251926.n5PJQNOR062379@svn.freebsd.org> User-Agent: Mutt/1.5.19 (2009-01-05) Cc: Subject: Re: svn commit: r194997 - head/sys/sun4v/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 22:20:05 -0000 --QG4eSQjbZgLlyL/H Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Ed Schouten wrote: > Approved by: kib Kib, Kip; this should have said: Approved by: kmacy --=20 Ed Schouten WWW: http://80386.nl/ --QG4eSQjbZgLlyL/H Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkpD+BMACgkQ52SDGA2eCwWH5ACfXXDa83OHv0JAKFnI3u7sdp36 Mm4AmwZFlB5g77N/VFdTEc5sQN1vBuiA =23AQ -----END PGP SIGNATURE----- --QG4eSQjbZgLlyL/H-- From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 22:42:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1C2B106567C; Thu, 25 Jun 2009 22:42:20 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8ED5C8FC08; Thu, 25 Jun 2009 22:42:20 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PMgJhN066617; Thu, 25 Jun 2009 22:42:19 GMT (envelope-from jamie@svn.freebsd.org) Received: (from jamie@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PMgJR5066615; Thu, 25 Jun 2009 22:42:19 GMT (envelope-from jamie@svn.freebsd.org) Message-Id: <200906252242.n5PMgJR5066615@svn.freebsd.org> From: Jamie Gritton Date: Thu, 25 Jun 2009 22:42: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: r195011 - head/lib/libjail X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 22:42:21 -0000 Author: jamie Date: Thu Jun 25 22:42:19 2009 New Revision: 195011 URL: http://svn.freebsd.org/changeset/base/195011 Log: Fix dynamic (re)allocation logic in jailparam_set and jailparam_get. Touch up jailparam_import a bit while I'm at it. Approved by: bz (mentor) Modified: head/lib/libjail/jail.c Modified: head/lib/libjail/jail.c ============================================================================== --- head/lib/libjail/jail.c Thu Jun 25 22:24:13 2009 (r195010) +++ head/lib/libjail/jail.c Thu Jun 25 22:42:19 2009 (r195011) @@ -248,14 +248,14 @@ jailparam_import(struct jailparam *jp, c int i, nval, fw; if (!jp->jp_ctltype && jailparam_type(jp) < 0) - goto error; + return (-1); if (value == NULL) return (0); if ((jp->jp_ctltype & CTLTYPE) == CTLTYPE_STRING) { jp->jp_value = strdup(value); - if (!jp->jp_value) { + if (jp->jp_value == NULL) { strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); - goto error; + return (-1); } return (0); } @@ -263,9 +263,9 @@ jailparam_import(struct jailparam *jp, c if (jp->jp_elemlen) { if (value[0] == '\0' || (value[0] == '-' && value[1] == '\0')) { jp->jp_value = strdup(""); - if (value == NULL) { + if (jp->jp_value == NULL) { strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); - goto error; + return (-1); } jp->jp_valuelen = 0; return (0); @@ -275,9 +275,9 @@ jailparam_import(struct jailparam *jp, c jp->jp_valuelen = jp->jp_elemlen * nval; } jp->jp_value = malloc(jp->jp_valuelen); - if (!jp->jp_value) { + if (jp->jp_value == NULL) { strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); - goto error; + return (-1); } avalue = value; for (i = 0; i < nval; i++) { @@ -395,17 +395,18 @@ jailparam_set(struct jailparam *jp, unsi { struct iovec *jiov; char *nname; - int i, jid; + int i, jid, bool0; unsigned j; jiov = alloca(sizeof(struct iovec) * 2 * (njp + 1)); + bool0 = 0; for (i = j = 0; j < njp; j++) { jiov[i].iov_base = jp[j].jp_name; jiov[i].iov_len = strlen(jp[j].jp_name) + 1; i++; if (jp[j].jp_flags & (JP_BOOL | JP_NOBOOL)) { /* - * Set booleans without values. If one have a value of + * Set booleans without values. If one has a value of * zero, change it to (or from) its "no" counterpart. */ jiov[i].iov_base = NULL; @@ -413,13 +414,18 @@ jailparam_set(struct jailparam *jp, unsi if (jp[j].jp_value != NULL && jp[j].jp_valuelen == sizeof(int) && !*(int *)jp[j].jp_value) { + bool0 = 1; nname = jp[j].jp_flags & JP_BOOL - ? noname(jiov[i].iov_base) - : nononame(jiov[i].iov_base); - if (nname == NULL) - return (-1); - free(jp[j].jp_name); - jiov[i].iov_base = jp[j].jp_name = nname; + ? noname(jp[j].jp_name) + : nononame(jp[j].jp_name); + if (nname == NULL) { + njp = j; + jid = -1; + goto done; + } + jiov[i - 1].iov_base = nname; + jiov[i - 1].iov_len = strlen(nname) + 1; + } } else { jiov[i].iov_base = jp[j].jp_value; @@ -441,6 +447,14 @@ jailparam_set(struct jailparam *jp, unsi if (jid < 0 && !jail_errmsg[0]) snprintf(jail_errmsg, sizeof(jail_errmsg), "jail_set: %s", strerror(errno)); + done: + if (bool0) + for (j = 0; j < njp; j++) + if ((jp[j].jp_flags & (JP_BOOL | JP_NOBOOL)) && + jp[j].jp_value != NULL && + jp[j].jp_valuelen == sizeof(int) && + !*(int *)jp[j].jp_value) + free(jiov[j * 2].iov_base); return (jid); } @@ -452,11 +466,16 @@ jailparam_get(struct jailparam *jp, unsi int i, ai, ki, jid, arrays, sanity; unsigned j; - /* Find the key and any array parameters. */ + /* + * Get the types for all parameters. + * Find the key and any array parameters. + */ jiov = alloca(sizeof(struct iovec) * 2 * (njp + 1)); jp_lastjid = jp_jid = jp_name = NULL; arrays = 0; for (ai = j = 0; j < njp; j++) { + if (!jp[j].jp_ctltype && jailparam_type(jp + j) < 0) + return (-1); if (!strcmp(jp[j].jp_name, "lastjid")) jp_lastjid = jp + j; else if (!strcmp(jp[j].jp_name, "jid")) @@ -507,24 +526,36 @@ jailparam_get(struct jailparam *jp, unsi if (jp[j].jp_elemlen && !(jp[j].jp_flags & JP_RAWVALUE)) { ai++; jiov[ai].iov_len += jp[j].jp_elemlen * ARRAY_SLOP; - jiov[ai].iov_base = jp[j].jp_value = - malloc(jiov[ai].iov_len); - if (jiov[ai].iov_base == NULL) { - strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); - return (-1); + if (jp[j].jp_valuelen >= jiov[ai].iov_len) + jiov[ai].iov_len = jp[j].jp_valuelen; + else { + jp[j].jp_valuelen = jiov[ai].iov_len; + if (jp[j].jp_value != NULL) + free(jp[j].jp_value); + jp[j].jp_value = malloc(jp[j].jp_valuelen); + if (jp[j].jp_value == NULL) { + strerror_r(errno, jail_errmsg, + JAIL_ERRMSGLEN); + return (-1); + } } + jiov[ai].iov_base = jp[j].jp_value; memset(jiov[ai].iov_base, 0, jiov[ai].iov_len); ai++; } else if (jp + j != jp_key) { jiov[i].iov_base = jp[j].jp_name; jiov[i].iov_len = strlen(jp[j].jp_name) + 1; i++; - jiov[i].iov_base = jp[j].jp_value = - malloc(jp[j].jp_valuelen); - if (jiov[i].iov_base == NULL) { - strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); - return (-1); + if (jp[j].jp_value == NULL && + !(jp[j].jp_flags & JP_RAWVALUE)) { + jp[j].jp_value = malloc(jp[j].jp_valuelen); + if (jp[j].jp_value == NULL) { + strerror_r(errno, jail_errmsg, + JAIL_ERRMSGLEN); + return (-1); + } } + jiov[i].iov_base = jp[j].jp_value; jiov[i].iov_len = jp[j].jp_valuelen; memset(jiov[i].iov_base, 0, jiov[i].iov_len); i++; @@ -543,8 +574,7 @@ jailparam_get(struct jailparam *jp, unsi if (jp[j].jp_elemlen && !(jp[j].jp_flags & JP_RAWVALUE)) { ai++; - free(jiov[ai].iov_base); - jiov[ai].iov_base = jp[j].jp_value = NULL; + jiov[ai].iov_base = NULL; jiov[ai].iov_len = 0; ai++; } @@ -557,13 +587,21 @@ jailparam_get(struct jailparam *jp, unsi ai++; jiov[ai].iov_len += jp[j].jp_elemlen * ARRAY_SLOP; - jiov[ai].iov_base = jp[j].jp_value = - malloc(jiov[ai].iov_len); - if (jiov[ai].iov_base == NULL) { - strerror_r(errno, jail_errmsg, - JAIL_ERRMSGLEN); - return (-1); + if (jp[j].jp_valuelen >= jiov[ai].iov_len) + jiov[ai].iov_len = jp[j].jp_valuelen; + else { + jp[j].jp_valuelen = jiov[ai].iov_len; + if (jp[j].jp_value != NULL) + free(jp[j].jp_value); + jp[j].jp_value = + malloc(jiov[ai].iov_len); + if (jp[j].jp_value == NULL) { + strerror_r(errno, jail_errmsg, + JAIL_ERRMSGLEN); + return (-1); + } } + jiov[ai].iov_base = jp[j].jp_value; memset(jiov[ai].iov_base, 0, jiov[ai].iov_len); ai++; } From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 23:10:59 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B80E81065678; Thu, 25 Jun 2009 23:10:59 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A5EFB8FC08; Thu, 25 Jun 2009 23:10:59 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PNAxB3067264; Thu, 25 Jun 2009 23:10:59 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PNAxha067262; Thu, 25 Jun 2009 23:10:59 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906252310.n5PNAxha067262@svn.freebsd.org> From: Xin LI Date: Thu, 25 Jun 2009 23:10:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195012 - head/usr.sbin/sysinstall/help X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 23:11:00 -0000 Author: delphij Date: Thu Jun 25 23:10:59 2009 New Revision: 195012 URL: http://svn.freebsd.org/changeset/base/195012 Log: Correct a typo (which you can use to in order -> which you can use in order to). PR: bin/136040 Submitted by: "Vikentii L. Karabin" MFC after: 1 weeks Modified: head/usr.sbin/sysinstall/help/usage.hlp Modified: head/usr.sbin/sysinstall/help/usage.hlp ============================================================================== --- head/usr.sbin/sysinstall/help/usage.hlp Thu Jun 25 22:42:19 2009 (r195011) +++ head/usr.sbin/sysinstall/help/usage.hlp Thu Jun 25 23:10:59 2009 (r195012) @@ -56,7 +56,7 @@ it's also useful when dealing with sub-s that don't use menus and tend to scroll their output off the top of the screen. -FreeBSD also supports multiple "virtual consoles" which you can use to +FreeBSD also supports multiple "virtual consoles" which you can use in order to have several active sessions at once. Use ALT-F to switch between screens, where `F' is the function key corresponding to the screen you wish to see. By default, the system comes with 8 From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 23:59:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 210AC106566C; Thu, 25 Jun 2009 23:59:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F0DC8FC16; Thu, 25 Jun 2009 23:59:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5PNxNlK068323; Thu, 25 Jun 2009 23:59:23 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5PNxNHR068321; Thu, 25 Jun 2009 23:59:23 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906252359.n5PNxNHR068321@svn.freebsd.org> From: Xin LI Date: Thu, 25 Jun 2009 23:59:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195015 - head/lib/libc/stdtime X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 23:59:24 -0000 Author: delphij Date: Thu Jun 25 23:59:23 2009 New Revision: 195015 URL: http://svn.freebsd.org/changeset/base/195015 Log: Implement %z for strptime. PR: kern/63064 Submitted by: Stefan `Sec` Zehl (with some small changes) MFC after: 1 month Modified: head/lib/libc/stdtime/strptime.c Modified: head/lib/libc/stdtime/strptime.c ============================================================================== --- head/lib/libc/stdtime/strptime.c Thu Jun 25 23:22:25 2009 (r195014) +++ head/lib/libc/stdtime/strptime.c Thu Jun 25 23:59:23 2009 (r195015) @@ -514,6 +514,34 @@ label: } } break; + + case 'z': + { + int sign = 1; + + if (*buf != '+') { + if (*buf == '-') + sign = -1; + else + return 0; + } + + buf++; + i = 0; + for (len = 4; len > 0; len--) { + if (isdigit((int)*buf)) { + i *= 10; + i += *buf - '0'; + buf++; + } else + return 0; + } + + tm->tm_hour -= sign * (i / 100); + tm->tm_min -= sign * (i % 100); + *GMTp = 1; + } + break; } } return (char *)buf; From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 00:19:26 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A1C91065670; Fri, 26 Jun 2009 00:19:26 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E090F8FC16; Fri, 26 Jun 2009 00:19:25 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5Q0JPi1068918; Fri, 26 Jun 2009 00:19:25 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5Q0JPoP068916; Fri, 26 Jun 2009 00:19:25 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906260019.n5Q0JPoP068916@svn.freebsd.org> From: Robert Watson Date: Fri, 26 Jun 2009 00:19: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: r195019 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 00:19:26 -0000 Author: rwatson Date: Fri Jun 26 00:19:25 2009 New Revision: 195019 URL: http://svn.freebsd.org/changeset/base/195019 Log: Convert netisr to use dynamic per-CPU storage (DPCPU) instead of sizing arrays to [MAXCPU], offering moderate memory savings. In some places, this requires using CPU_ABSENT() to handle less common platforms with sparse CPU IDs. In several places, assert that the selected CPUID for work placement or statistics is not CPU_ABSENT() to be on the safe side. Discussed with: bz, jeff Modified: head/sys/net/netisr.c Modified: head/sys/net/netisr.c ============================================================================== --- head/sys/net/netisr.c Fri Jun 26 00:15:26 2009 (r195018) +++ head/sys/net/netisr.c Fri Jun 26 00:19:25 2009 (r195019) @@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -258,14 +259,14 @@ struct netisr_workstream { } __aligned(CACHE_LINE_SIZE); /* - * Per-CPU workstream data, indexed by CPU ID. + * Per-CPU workstream data. */ -static struct netisr_workstream nws[MAXCPU]; +DPCPU_DEFINE(struct netisr_workstream, nws); /* * Map contiguous values between 0 and nws_count into CPU IDs appropriate for - * indexing the nws[] array. This allows constructions of the form - * nws[nws_array(arbitraryvalue % nws_count)]. + * accessing workstreams. This allows constructions of the form + * DPCPU_ID_GET(nws_array[arbitraryvalue % nws_count], nws). */ static u_int nws_array[MAXCPU]; @@ -393,7 +394,9 @@ netisr_register(const struct netisr_hand np[proto].np_qlimit = nhp->nh_qlimit; np[proto].np_policy = nhp->nh_policy; for (i = 0; i < MAXCPU; i++) { - npwp = &nws[i].nws_work[proto]; + if (CPU_ABSENT(i)) + continue; + npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto]; bzero(npwp, sizeof(*npwp)); npwp->nw_qlimit = np[proto].np_qlimit; } @@ -425,7 +428,9 @@ netisr_clearqdrops(const struct netisr_h name)); for (i = 0; i < MAXCPU; i++) { - npwp = &nws[i].nws_work[proto]; + if (CPU_ABSENT(i)) + continue; + npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto]; npwp->nw_qdrops = 0; } NETISR_WUNLOCK(); @@ -458,7 +463,9 @@ netisr_getqdrops(const struct netisr_han name)); for (i = 0; i < MAXCPU; i++) { - npwp = &nws[i].nws_work[proto]; + if (CPU_ABSENT(i)) + continue; + npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto]; *qdropp += npwp->nw_qdrops; } NETISR_RUNLOCK(&tracker); @@ -522,7 +529,9 @@ netisr_setqlimit(const struct netisr_han np[proto].np_qlimit = qlimit; for (i = 0; i < MAXCPU; i++) { - npwp = &nws[i].nws_work[proto]; + if (CPU_ABSENT(i)) + continue; + npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto]; npwp->nw_qlimit = qlimit; } NETISR_WUNLOCK(); @@ -586,7 +595,9 @@ netisr_unregister(const struct netisr_ha np[proto].np_qlimit = 0; np[proto].np_policy = 0; for (i = 0; i < MAXCPU; i++) { - npwp = &nws[i].nws_work[proto]; + if (CPU_ABSENT(i)) + continue; + npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto]; netisr_drain_proto(npwp); bzero(npwp, sizeof(*npwp)); } @@ -809,10 +820,11 @@ netisr_queue_internal(u_int proto, struc #endif KASSERT(cpuid < MAXCPU, ("%s: cpuid too big (%u, %u)", __func__, cpuid, MAXCPU)); + KASSERT(!CPU_ABSENT(cpuid), ("%s: CPU %u absent", __func__, cpuid)); dosignal = 0; error = 0; - nwsp = &nws[cpuid]; + nwsp = DPCPU_ID_PTR(cpuid, nws); npwp = &nwsp->nws_work[proto]; NWS_LOCK(nwsp); error = netisr_queue_workstream(nwsp, proto, npwp, m, &dosignal); @@ -841,9 +853,11 @@ netisr_queue_src(u_int proto, uintptr_t ("%s: invalid proto %u", __func__, proto)); m = netisr_select_cpuid(&np[proto], source, m, &cpuid); - if (m != NULL) + if (m != NULL) { + KASSERT(!CPU_ABSENT(cpuid), ("%s: CPU %u absent", __func__, + cpuid)); error = netisr_queue_internal(proto, m, cpuid); - else + } else error = ENOBUFS; #ifdef NETISR_LOCKING NETISR_RUNLOCK(&tracker); @@ -895,7 +909,7 @@ netisr_dispatch_src(u_int proto, uintptr * to always being forced to directly dispatch. */ if (netisr_direct_force) { - nwsp = &nws[curcpu]; + nwsp = DPCPU_PTR(nws); npwp = &nwsp->nws_work[proto]; npwp->nw_dispatched++; npwp->nw_handled++; @@ -914,10 +928,11 @@ netisr_dispatch_src(u_int proto, uintptr error = ENOBUFS; goto out_unlock; } + KASSERT(!CPU_ABSENT(cpuid), ("%s: CPU %u absent", __func__, cpuid)); sched_pin(); if (cpuid != curcpu) goto queue_fallback; - nwsp = &nws[cpuid]; + nwsp = DPCPU_PTR(nws); npwp = &nwsp->nws_work[proto]; /*- @@ -931,7 +946,7 @@ netisr_dispatch_src(u_int proto, uintptr if (nwsp->nws_flags & (NWS_RUNNING | NWS_DISPATCHING | NWS_SCHEDULED)) { error = netisr_queue_workstream(nwsp, proto, npwp, m, &dosignal); - NWS_UNLOCK(nws); + NWS_UNLOCK(nwsp); if (dosignal) NWS_SIGNAL(nwsp); goto out_unpin; @@ -999,7 +1014,7 @@ netisr_sched_poll(void) { struct netisr_workstream *nwsp; - nwsp = &nws[nws_array[0]]; + nwsp = DPCPU_ID_PTR(nws_array[0], nws); NWS_SIGNAL(nwsp); } #endif @@ -1011,7 +1026,9 @@ netisr_start_swi(u_int cpuid, struct pcp struct netisr_workstream *nwsp; int error; - nwsp = &nws[cpuid]; + KASSERT(!CPU_ABSENT(cpuid), ("%s: CPU %u absent", __func__, cpuid)); + + nwsp = DPCPU_ID_PTR(cpuid, nws); mtx_init(&nwsp->nws_mtx, "netisr_mtx", NULL, MTX_DEF); nwsp->nws_cpu = cpuid; snprintf(swiname, sizeof(swiname), "netisr %u", cpuid); @@ -1107,12 +1124,14 @@ DB_SHOW_COMMAND(netisr, db_show_netisr) struct netisr_workstream *nwsp; struct netisr_work *nwp; int first, proto; - u_int cpu; + u_int cpuid; db_printf("%3s %6s %5s %5s %5s %8s %8s %8s %8s\n", "CPU", "Proto", "Len", "WMark", "Max", "Disp", "HDisp", "Drop", "Queue"); - for (cpu = 0; cpu < MAXCPU; cpu++) { - nwsp = &nws[cpu]; + for (cpuid = 0; cpuid < MAXCPU; cpuid++) { + if (CPU_ABSENT(cpuid)) + continue; + nwsp = DPCPU_ID_PTR(cpuid, nws); if (nwsp->nws_intr_event == NULL) continue; first = 1; @@ -1121,7 +1140,7 @@ DB_SHOW_COMMAND(netisr, db_show_netisr) continue; nwp = &nwsp->nws_work[proto]; if (first) { - db_printf("%3d ", cpu); + db_printf("%3d ", cpuid); first = 0; } else db_printf("%3s ", ""); From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 00:36:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB5F1106566C; Fri, 26 Jun 2009 00:36:47 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8F0CC8FC08; Fri, 26 Jun 2009 00:36:47 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5Q0alhb069273; Fri, 26 Jun 2009 00:36:47 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5Q0alNk069270; Fri, 26 Jun 2009 00:36:47 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906260036.n5Q0alNk069270@svn.freebsd.org> From: Robert Watson Date: Fri, 26 Jun 2009 00:36:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195020 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 00:36:48 -0000 Author: rwatson Date: Fri Jun 26 00:36:47 2009 New Revision: 195020 URL: http://svn.freebsd.org/changeset/base/195020 Log: Define four wrapper functions for interface address locking, if_addr_rlock() and if_addr_runlock() for regular address lists, and if_maddr_rlock() and if_maddr_runlock() for multicast address lists. We will use these in various kernel modules to avoid encoding specific type and locking strategy information into modules that currently use IF_ADDR_LOCK() and IF_ADDR_UNLOCK() directly. MFC after: 6 weeks Modified: head/sys/net/if.c head/sys/net/if_var.h Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Fri Jun 26 00:19:25 2009 (r195019) +++ head/sys/net/if.c Fri Jun 26 00:36:47 2009 (r195020) @@ -1419,6 +1419,40 @@ if_rtdel(struct radix_node *rn, void *ar } /* + * Wrapper functions for struct ifnet address list locking macros. These are + * used by kernel modules to avoid encoding programming interface or binary + * interface assumptions that may be violated when kernel-internal locking + * approaches change. + */ +void +if_addr_rlock(struct ifnet *ifp) +{ + + IF_ADDR_LOCK(ifp); +} + +void +if_addr_runlock(struct ifnet *ifp) +{ + + IF_ADDR_UNLOCK(ifp); +} + +void +if_maddr_rlock(struct ifnet *ifp) +{ + + IF_ADDR_LOCK(ifp); +} + +void +if_maddr_runlock(struct ifnet *ifp) +{ + + IF_ADDR_UNLOCK(ifp); +} + +/* * Reference count functions for ifaddrs. */ void Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Fri Jun 26 00:19:25 2009 (r195019) +++ head/sys/net/if_var.h Fri Jun 26 00:36:47 2009 (r195020) @@ -253,6 +253,16 @@ typedef void if_init_f_t(void *); #define IF_ADDR_LOCK_ASSERT(if) mtx_assert(&(if)->if_addr_mtx, MA_OWNED) /* + * Function variations on locking macros intended to be used by loadable + * kernel modules in order to divorce them from the internals of address list + * locking. + */ +void if_addr_rlock(struct ifnet *ifp); /* if_addrhead */ +void if_addr_runlock(struct ifnet *ifp); /* if_addrhead */ +void if_maddr_rlock(struct ifnet *ifp); /* if_multiaddrs */ +void if_maddr_runlock(struct ifnet *ifp); /* if_multiaddrs */ + +/* * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq) * are queues of messages stored on ifqueue structures * (defined above). Entries are added to and deleted from these structures From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 00:45:20 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6247106566C; Fri, 26 Jun 2009 00:45:20 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 944DE8FC19; Fri, 26 Jun 2009 00:45:20 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5Q0jKq4069507; Fri, 26 Jun 2009 00:45:20 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5Q0jKDT069504; Fri, 26 Jun 2009 00:45:20 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906260045.n5Q0jKDT069504@svn.freebsd.org> From: Robert Watson Date: Fri, 26 Jun 2009 00:45: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: r195022 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 00:45:21 -0000 Author: rwatson Date: Fri Jun 26 00:45:20 2009 New Revision: 195022 URL: http://svn.freebsd.org/changeset/base/195022 Log: Update if_stf and if_tun to use if_addr_rlock()/if_addr_runlock() rather than IF_ADDR_LOCK()/IF_ADDR_UNLOCK() when iterating ifp->if_addrhead. MFC after: 6 weeks Modified: head/sys/net/if_stf.c head/sys/net/if_tun.c Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Fri Jun 26 00:44:23 2009 (r195021) +++ head/sys/net/if_stf.c Fri Jun 26 00:45:20 2009 (r195022) @@ -384,7 +384,7 @@ stf_getsrcifa6(ifp) struct sockaddr_in6 *sin6; struct in_addr in; - IF_ADDR_LOCK(ifp); + if_addr_rlock(ifp); TAILQ_FOREACH(ia, &ifp->if_addrhead, ifa_link) { if (ia->ifa_addr->sa_family != AF_INET6) continue; @@ -400,10 +400,10 @@ stf_getsrcifa6(ifp) continue; ifa_ref(ia); - IF_ADDR_UNLOCK(ifp); + if_addr_runlock(ifp); return (struct in6_ifaddr *)ia; } - IF_ADDR_UNLOCK(ifp); + if_addr_runlock(ifp); return NULL; } Modified: head/sys/net/if_tun.c ============================================================================== --- head/sys/net/if_tun.c Fri Jun 26 00:44:23 2009 (r195021) +++ head/sys/net/if_tun.c Fri Jun 26 00:45:20 2009 (r195022) @@ -520,7 +520,7 @@ tuninit(struct ifnet *ifp) getmicrotime(&ifp->if_lastchange); #ifdef INET - IF_ADDR_LOCK(ifp); + if_addr_rlock(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_INET) { struct sockaddr_in *si; @@ -536,7 +536,7 @@ tuninit(struct ifnet *ifp) mtx_unlock(&tp->tun_mtx); } } - IF_ADDR_UNLOCK(ifp); + if_addr_runlock(ifp); #endif return (error); } From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 00:46:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 702DA1065676; Fri, 26 Jun 2009 00:46:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5DFF78FC1D; Fri, 26 Jun 2009 00:46:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5Q0koVq069573; Fri, 26 Jun 2009 00:46:50 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5Q0koPH069569; Fri, 26 Jun 2009 00:46:50 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906260046.n5Q0koPH069569@svn.freebsd.org> From: Robert Watson Date: Fri, 26 Jun 2009 00:46: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: r195023 - in head/sys/netinet: . ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 00:46:50 -0000 Author: rwatson Date: Fri Jun 26 00:46:50 2009 New Revision: 195023 URL: http://svn.freebsd.org/changeset/base/195023 Log: Update various IPFW-related modules to use if_addr_rlock()/ if_addr_runlock() rather than IF_ADDR_LOCK()/IF_ADDR_UNLOCK(). MFC after: 6 weeks Modified: head/sys/netinet/ip_divert.c head/sys/netinet/ipfw/ip_fw2.c head/sys/netinet/ipfw/ip_fw_nat.c Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Fri Jun 26 00:45:20 2009 (r195022) +++ head/sys/netinet/ip_divert.c Fri Jun 26 00:46:50 2009 (r195023) @@ -254,7 +254,7 @@ divert_packet(struct mbuf *m, int incomi /* Find IP address for receive interface */ ifp = m->m_pkthdr.rcvif; - IF_ADDR_LOCK(ifp); + if_addr_rlock(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; @@ -262,7 +262,7 @@ divert_packet(struct mbuf *m, int incomi ((struct sockaddr_in *) ifa->ifa_addr)->sin_addr; break; } - IF_ADDR_UNLOCK(ifp); + if_addr_runlock(ifp); } /* * Record the incoming interface name whenever we have one. Modified: head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw2.c Fri Jun 26 00:45:20 2009 (r195022) +++ head/sys/netinet/ipfw/ip_fw2.c Fri Jun 26 00:46:50 2009 (r195023) @@ -475,17 +475,17 @@ iface_match(struct ifnet *ifp, ipfw_insn } else { struct ifaddr *ia; - IF_ADDR_LOCK(ifp); + if_addr_rlock(ifp); TAILQ_FOREACH(ia, &ifp->if_addrhead, ifa_link) { if (ia->ifa_addr->sa_family != AF_INET) continue; if (cmd->p.ip.s_addr == ((struct sockaddr_in *) (ia->ifa_addr))->sin_addr.s_addr) { - IF_ADDR_UNLOCK(ifp); + if_addr_runlock(ifp); return(1); /* match */ } } - IF_ADDR_UNLOCK(ifp); + if_addr_runlock(ifp); } return(0); /* no match, fail ... */ } @@ -588,7 +588,7 @@ search_ip6_addr_net (struct in6_addr * i struct in6_addr copia; TAILQ_FOREACH(mdc, &V_ifnet, if_link) { - IF_ADDR_LOCK(mdc); + if_addr_rlock(mdc); TAILQ_FOREACH(mdc2, &mdc->if_addrhead, ifa_link) { if (mdc2->ifa_addr->sa_family == AF_INET6) { fdm = (struct in6_ifaddr *)mdc2; @@ -596,12 +596,12 @@ search_ip6_addr_net (struct in6_addr * i /* need for leaving scope_id in the sock_addr */ in6_clearscope(&copia); if (IN6_ARE_ADDR_EQUAL(ip6_addr, &copia)) { - IF_ADDR_UNLOCK(mdc); + if_addr_runlock(mdc); return 1; } } } - IF_ADDR_UNLOCK(mdc); + if_addr_runlock(mdc); } return 0; } Modified: head/sys/netinet/ipfw/ip_fw_nat.c ============================================================================== --- head/sys/netinet/ipfw/ip_fw_nat.c Fri Jun 26 00:45:20 2009 (r195022) +++ head/sys/netinet/ipfw/ip_fw_nat.c Fri Jun 26 00:46:50 2009 (r195023) @@ -92,7 +92,7 @@ ifaddr_change(void *arg __unused, struct LIST_FOREACH(ptr, &V_layer3_chain.nat, _next) { /* ...using nic 'ifp->if_xname' as dynamic alias address. */ if (strncmp(ptr->if_name, ifp->if_xname, IF_NAMESIZE) == 0) { - IF_ADDR_LOCK(ifp); + if_addr_rlock(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr == NULL) continue; @@ -102,7 +102,7 @@ ifaddr_change(void *arg __unused, struct (ifa->ifa_addr))->sin_addr; LibAliasSetAddress(ptr->lib, ptr->ip); } - IF_ADDR_UNLOCK(ifp); + if_addr_runlock(ifp); } } IPFW_WUNLOCK(&V_layer3_chain); From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 00:49:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05EF7106564A; Fri, 26 Jun 2009 00:49:13 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E81D78FC0C; Fri, 26 Jun 2009 00:49:12 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5Q0nCHj069649; Fri, 26 Jun 2009 00:49:12 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5Q0nCoG069646; Fri, 26 Jun 2009 00:49:12 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906260049.n5Q0nCoG069646@svn.freebsd.org> From: Robert Watson Date: Fri, 26 Jun 2009 00:49:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195024 - head/sys/netgraph X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 00:49:13 -0000 Author: rwatson Date: Fri Jun 26 00:49:12 2009 New Revision: 195024 URL: http://svn.freebsd.org/changeset/base/195024 Log: Update Netgraph nodes to use if_addr_rlock()/if_addr_runlock() instead of IF_ADDR_LOCK()/IF_ADDR_UNLOCK() when iterating ifp->if_addrhead. MFC after: 6 weeks Modified: head/sys/netgraph/ng_eiface.c head/sys/netgraph/ng_iface.c Modified: head/sys/netgraph/ng_eiface.c ============================================================================== --- head/sys/netgraph/ng_eiface.c Fri Jun 26 00:46:50 2009 (r195023) +++ head/sys/netgraph/ng_eiface.c Fri Jun 26 00:49:12 2009 (r195024) @@ -466,12 +466,12 @@ ng_eiface_rcvmsg(node_p node, item_p ite /* Determine size of response and allocate it */ buflen = 0; - IF_ADDR_LOCK(ifp); + if_addr_rlock(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) buflen += SA_SIZE(ifa->ifa_addr); NG_MKRESPONSE(resp, msg, buflen, M_NOWAIT); if (resp == NULL) { - IF_ADDR_UNLOCK(ifp); + if_addr_runlock(ifp); error = ENOMEM; break; } @@ -490,7 +490,7 @@ ng_eiface_rcvmsg(node_p node, item_p ite ptr += len; buflen -= len; } - IF_ADDR_UNLOCK(ifp); + if_addr_runlock(ifp); break; } Modified: head/sys/netgraph/ng_iface.c ============================================================================== --- head/sys/netgraph/ng_iface.c Fri Jun 26 00:46:50 2009 (r195023) +++ head/sys/netgraph/ng_iface.c Fri Jun 26 00:49:12 2009 (r195024) @@ -683,7 +683,7 @@ ng_iface_rcvmsg(node_p node, item_p item struct ifaddr *ifa; /* Return the first configured IP address */ - IF_ADDR_LOCK(ifp); + if_addr_rlock(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct ng_cisco_ipaddr *ips; @@ -701,7 +701,7 @@ ng_iface_rcvmsg(node_p node, item_p item ifa->ifa_netmask)->sin_addr; break; } - IF_ADDR_UNLOCK(ifp); + if_addr_runlock(ifp); /* No IP addresses on this interface? */ if (ifa == NULL) From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 01:04:51 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F6021065670; Fri, 26 Jun 2009 01:04:51 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D3DC8FC1C; Fri, 26 Jun 2009 01:04:51 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5Q14pL4070050; Fri, 26 Jun 2009 01:04:51 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5Q14pRu070043; Fri, 26 Jun 2009 01:04:51 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200906260104.n5Q14pRu070043@svn.freebsd.org> From: Doug Barton Date: Fri, 26 Jun 2009 01:04: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: r195026 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 01:04:51 -0000 Author: dougb Date: Fri Jun 26 01:04:50 2009 New Revision: 195026 URL: http://svn.freebsd.org/changeset/base/195026 Log: Reverse the effect of r193198 for pf and ipfw which will once again allow them to start after netif. There were too many problems reported with this change in the short period of time that it lived in HEAD, and we are too late in the release cycle to properly shake it out. IMO the issue of having the firewalls up before the network is still a valid concern, particularly for pf whose default state is wide open. However properly solving this issue is going to take some investment on the part of the people who actually use those tools. This is not a strict reversion of all the changes for r193198 since it also included some simplification of the BEFORE/REQUIRE logic which is still valid for ipfilter and ip6fw. Modified: head/etc/rc.d/NETWORKING head/etc/rc.d/ipfw head/etc/rc.d/netif head/etc/rc.d/pf head/etc/rc.d/pflog head/etc/rc.d/pfsync Modified: head/etc/rc.d/NETWORKING ============================================================================== --- head/etc/rc.d/NETWORKING Fri Jun 26 01:01:50 2009 (r195025) +++ head/etc/rc.d/NETWORKING Fri Jun 26 01:04:50 2009 (r195026) @@ -4,7 +4,7 @@ # # PROVIDE: NETWORKING NETWORK -# REQUIRE: netif netoptions routing network_ipv6 ppp +# REQUIRE: netif netoptions routing network_ipv6 ppp ipfw # REQUIRE: defaultroute routed mrouted route6d mroute6d resolv # This is a dummy dependency, for services which require networking Modified: head/etc/rc.d/ipfw ============================================================================== --- head/etc/rc.d/ipfw Fri Jun 26 01:01:50 2009 (r195025) +++ head/etc/rc.d/ipfw Fri Jun 26 01:04:50 2009 (r195026) @@ -4,7 +4,7 @@ # # PROVIDE: ipfw -# REQUIRE: FILESYSTEMS +# REQUIRE: ppp # KEYWORD: nojail . /etc/rc.subr Modified: head/etc/rc.d/netif ============================================================================== --- head/etc/rc.d/netif Fri Jun 26 01:01:50 2009 (r195025) +++ head/etc/rc.d/netif Fri Jun 26 01:04:50 2009 (r195026) @@ -27,7 +27,7 @@ # PROVIDE: netif # REQUIRE: atm1 cleanvar FILESYSTEMS serial sppp sysctl -# REQUIRE: ipfilter ipfs pf ipfw +# REQUIRE: ipfilter ipfs # KEYWORD: nojail . /etc/rc.subr Modified: head/etc/rc.d/pf ============================================================================== --- head/etc/rc.d/pf Fri Jun 26 01:01:50 2009 (r195025) +++ head/etc/rc.d/pf Fri Jun 26 01:04:50 2009 (r195026) @@ -4,7 +4,7 @@ # # PROVIDE: pf -# REQUIRE: FILESYSTEMS pflog pfsync +# REQUIRE: FILESYSTEMS netif pflog pfsync # BEFORE: routing # KEYWORD: nojail Modified: head/etc/rc.d/pflog ============================================================================== --- head/etc/rc.d/pflog Fri Jun 26 01:01:50 2009 (r195025) +++ head/etc/rc.d/pflog Fri Jun 26 01:04:50 2009 (r195026) @@ -4,7 +4,7 @@ # # PROVIDE: pflog -# REQUIRE: FILESYSTEMS cleanvar +# REQUIRE: FILESYSTEMS netif cleanvar # KEYWORD: nojail . /etc/rc.subr Modified: head/etc/rc.d/pfsync ============================================================================== --- head/etc/rc.d/pfsync Fri Jun 26 01:01:50 2009 (r195025) +++ head/etc/rc.d/pfsync Fri Jun 26 01:04:50 2009 (r195026) @@ -4,7 +4,7 @@ # # PROVIDE: pfsync -# REQUIRE: FILESYSTEMS +# REQUIRE: FILESYSTEMS netif # KEYWORD: nojail . /etc/rc.subr From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 01:10:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33E751065672; Fri, 26 Jun 2009 01:10:11 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 227E48FC08; Fri, 26 Jun 2009 01:10:11 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5Q1ABcb070237; Fri, 26 Jun 2009 01:10:11 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5Q1ABJC070235; Fri, 26 Jun 2009 01:10:11 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200906260110.n5Q1ABJC070235@svn.freebsd.org> From: Doug Barton Date: Fri, 26 Jun 2009 01:10: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: r195028 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 01:10:11 -0000 Author: dougb Date: Fri Jun 26 01:10:10 2009 New Revision: 195028 URL: http://svn.freebsd.org/changeset/base/195028 Log: Revert the entry about pf and ipfw starting before netif Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Jun 26 01:08:35 2009 (r195027) +++ head/UPDATING Fri Jun 26 01:10:10 2009 (r195028) @@ -80,12 +80,6 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. rebuilt. Bump __FreeBSD_version to 800096. -20090531: - For those who use ipfw and especially pf, those two firewalls - are now started BEFORE the network is initialized (i.e., before - rc.d/netif). Please review your rules to make sure that your - interfaces will be properly described. - 20090530: Remove the tunable/sysctl debug.mpsafevfs as its initial purpose is no more valid. From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 01:27:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 189291065673; Fri, 26 Jun 2009 01:27:17 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 06AC78FC08; Fri, 26 Jun 2009 01:27:17 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5Q1RGMx070586; Fri, 26 Jun 2009 01:27:16 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5Q1RG7N070584; Fri, 26 Jun 2009 01:27:16 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <200906260127.n5Q1RG7N070584@svn.freebsd.org> From: Doug Barton Date: Fri, 26 Jun 2009 01:27:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195029 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 01:27:18 -0000 Author: dougb Date: Fri Jun 26 01:27:16 2009 New Revision: 195029 URL: http://svn.freebsd.org/changeset/base/195029 Log: rtsol should not be run on the wireless NIC interfaces directly, it will run on wlan0 instead. Modified: head/etc/network.subr Modified: head/etc/network.subr ============================================================================== --- head/etc/network.subr Fri Jun 26 01:10:10 2009 (r195028) +++ head/etc/network.subr Fri Jun 26 01:27:16 2009 (r195029) @@ -863,6 +863,9 @@ network6_interface_setup() case ${i} in lo0|gif[0-9]*|stf[0-9]*|faith[0-9]*|lp[0-9]*|sl[0-9]*|tun[0-9]*|pflog[0-9]*|pfsync[0-9]*) ;; + # Wireless NIC cards are virtualized through the wlan interface + an[0-9]*|ath[0-9]*|ipw[0-9]*|iwi[0-9]*|iwn[0-9]*|ral[0-9]*|wi[0-9]*|wl[0-9]*|wpi[0-9]*) + ;; *) rtsol_interfaces="${rtsol_interfaces} ${i}" ;; From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 01:42:42 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61DBC106566C; Fri, 26 Jun 2009 01:42:42 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4FF558FC13; Fri, 26 Jun 2009 01:42:42 +0000 (UTC) (envelope-from weongyo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5Q1gf5p070941; Fri, 26 Jun 2009 01:42:41 GMT (envelope-from weongyo@svn.freebsd.org) Received: (from weongyo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5Q1gfVj070939; Fri, 26 Jun 2009 01:42:41 GMT (envelope-from weongyo@svn.freebsd.org) Message-Id: <200906260142.n5Q1gfVj070939@svn.freebsd.org> From: Weongyo Jeong Date: Fri, 26 Jun 2009 01:42:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195031 - head/sys/compat/ndis X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 01:42:42 -0000 Author: weongyo Date: Fri Jun 26 01:42:41 2009 New Revision: 195031 URL: http://svn.freebsd.org/changeset/base/195031 Log: provides a extra write buffer when the NDIS driver want to send a request whose body has some datas through the default pipe. Tested by: Nikos Vassiliadis Modified: head/sys/compat/ndis/subr_usbd.c Modified: head/sys/compat/ndis/subr_usbd.c ============================================================================== --- head/sys/compat/ndis/subr_usbd.c Fri Jun 26 01:27:31 2009 (r195030) +++ head/sys/compat/ndis/subr_usbd.c Fri Jun 26 01:42:41 2009 (r195031) @@ -82,10 +82,11 @@ static usb_callback_t usbd_ctrl_callback #define USBD_CTRL_WRITE_PIPE 1 #define USBD_CTRL_MAX_PIPE 2 #define USBD_CTRL_READ_BUFFER_SP 256 +#define USBD_CTRL_WRITE_BUFFER_SP 256 #define USBD_CTRL_READ_BUFFER_SIZE \ (sizeof(struct usb_device_request) + USBD_CTRL_READ_BUFFER_SP) #define USBD_CTRL_WRITE_BUFFER_SIZE \ - (sizeof(struct usb_device_request)) + (sizeof(struct usb_device_request) + USBD_CTRL_WRITE_BUFFER_SP) static struct usb_config usbd_default_epconfig[USBD_CTRL_MAX_PIPE] = { [USBD_CTRL_READ_PIPE] = { .type = UE_CONTROL, @@ -1065,7 +1066,7 @@ next: vcreq->uvc_trans_buflen)); usbd_xfer_set_frames(xfer, 2); } else { - if (nx->nx_urblen > 0) + if (nx->nx_urblen > USBD_CTRL_WRITE_BUFFER_SP) device_printf(sc->ndis_dev, "warning: not enough write buffer space" " (%d).\n", nx->nx_urblen); From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 01:52:45 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 48B221065670; Fri, 26 Jun 2009 01:52:45 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.freebsd.org (Postfix) with ESMTP id 1BF0B8FC1C; Fri, 26 Jun 2009 01:52:44 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from trouble.errno.com (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n5Q1qilI042438 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 25 Jun 2009 18:52:44 -0700 (PDT) (envelope-from sam@freebsd.org) Message-ID: <4A4429EC.6050202@freebsd.org> Date: Thu, 25 Jun 2009 18:52:44 -0700 From: Sam Leffler Organization: FreeBSD Project User-Agent: Thunderbird 2.0.0.21 (X11/20090411) MIME-Version: 1.0 To: Doug Barton References: <200906260127.n5Q1RG7N070584@svn.freebsd.org> In-Reply-To: <200906260127.n5Q1RG7N070584@svn.freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-DCC-x.dcc-servers-Metrics: ebb.errno.com; whitelist Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r195029 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 01:52:45 -0000 Doug Barton wrote: > Author: dougb > Date: Fri Jun 26 01:27:16 2009 > New Revision: 195029 > URL: http://svn.freebsd.org/changeset/base/195029 > > Log: > rtsol should not be run on the wireless NIC interfaces directly, > it will run on wlan0 instead. > > Modified: > head/etc/network.subr > > Modified: head/etc/network.subr > ============================================================================== > --- head/etc/network.subr Fri Jun 26 01:10:10 2009 (r195028) > +++ head/etc/network.subr Fri Jun 26 01:27:16 2009 (r195029) > @@ -863,6 +863,9 @@ network6_interface_setup() > case ${i} in > lo0|gif[0-9]*|stf[0-9]*|faith[0-9]*|lp[0-9]*|sl[0-9]*|tun[0-9]*|pflog[0-9]*|pfsync[0-9]*) > ;; > + # Wireless NIC cards are virtualized through the wlan interface > + an[0-9]*|ath[0-9]*|ipw[0-9]*|iwi[0-9]*|iwn[0-9]*|ral[0-9]*|wi[0-9]*|wl[0-9]*|wpi[0-9]*) > + ;; > *) > rtsol_interfaces="${rtsol_interfaces} ${i}" > ;; > > > Using device names is a bad idea. Take a look at wpa_supplicant (for example) for how to check the media status to determine whether a device is wireless. Sam From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 02:50:58 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 41DB91065670; Fri, 26 Jun 2009 02:50:58 +0000 (UTC) (envelope-from kaduk@MIT.EDU) Received: from biscayne-one-station.mit.edu (BISCAYNE-ONE-STATION.MIT.EDU [18.7.7.80]) by mx1.freebsd.org (Postfix) with ESMTP id E96B78FC15; Fri, 26 Jun 2009 02:50:57 +0000 (UTC) (envelope-from kaduk@MIT.EDU) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by biscayne-one-station.mit.edu (8.13.6/8.9.2) with ESMTP id n5Q2osTc009797; Thu, 25 Jun 2009 22:50:54 -0400 (EDT) Received: from multics.mit.edu (MULTICS.MIT.EDU [18.187.1.73]) (authenticated bits=56) (User authenticated as kaduk@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id n5Q2oqjX008725 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 25 Jun 2009 22:50:53 -0400 (EDT) Received: (from kaduk@localhost) by multics.mit.edu (8.12.9.20060308) id n5Q2oo5M014076; Thu, 25 Jun 2009 22:50:50 -0400 (EDT) Date: Thu, 25 Jun 2009 22:50:50 -0400 (EDT) From: Benjamin Kaduk To: Oleg Bulyzhin In-Reply-To: <20090625104451.GA273@lath.rinet.ru> Message-ID: References: <200906242257.n5OMv71d032996@svn.freebsd.org> <47d0403c0906241644v70f35ba5r7c6440a45c95c369@mail.gmail.com> <20090625104451.GA273@lath.rinet.ru> User-Agent: Alpine 1.10 (GSO 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Scanned-By: MIMEDefang 2.42 X-Spam-Flag: NO X-Spam-Score: 0.00 Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, freebsd-doc@FreeBSD.org, Ben Kaduk Subject: Re: svn commit: r194930 - in head: sbin/ipfw sys/netinet sys/netinet/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 02:50:58 -0000 On Thu, 25 Jun 2009, Oleg Bulyzhin wrote: > On Wed, Jun 24, 2009 at 07:44:04PM -0400, Ben Kaduk wrote: > >> There's a grammar error and a style error, here. I'm actually not >> entirely sure what >> the intended meaning is, so it's a bit hard to fix the grammar error. > > It's no wonder - my english writing skill is poor. > >> Looking at the code, it seems that in burst mode, extra data will be >> allowed to be sent, though >> it is capped to not exceed the pipe bandwidth. >> Perhaps "... bytes of data is allowed to bypass the dummynet scheduler >> (...), though >> the transmission rate will still be capped so as to not exceed the >> pipe's bandwidth."? > > Let me explain. For example, we have pipe with bw 1Mbit/s and burst size is > 5GByte. If we try to download 10Gbyte through this pipe following will happen: > 1) 1st 5Gbyte of data will go with 'wire speed'. > 2) last 5Gbyte will be shaped to 1Mbit/s > > Could you please mail me whole 'burst' part (as it should be), and i will fix > it. I think the following will suffice: .It Cm burst Ar size If the data to be sent exceeds the pipe's bandwidth limit (and the pipe was previously idle), up to .Ar size bytes of data are allowed to bypass the .Nm dummynet scheduler, and will be sent as fast as the physical link allows. Any additional data will be transmitted at the rate specified by the .Nm pipe bandwidth. The burst size depends on how long the pipe has been idle; the effective burst size is calculated as follows: MAX( .Ar size , .Nm bw * pipe_idle_time). .Pp The mdoc police may need to correct my markup. > >> >> The style error is that the new sentence ("Effective burst size ...") >> should start >> on a new line. >> >> I would also prefer to see the new sentence be an actual complete sentence >> (i.e., "The effective burst size is calculated as follows"), though >> there appears >> to be at least one other bug of this form in the file already (see, >> for example, the >> quoted text at the beginning of this hunk: "Default value is no delay.", which >> would benefit from a "the".) >> >> >> Unrelated to this commit, there is a grammar error early in the file: >> >> 312 Once >> 313 .Fl p >> 314 has been specified, any additional arguments as passed on to the preproc >> essor >> 315 for interpretation. >> >> The 'as' in line 314 should be 'are'. >> (This is from CVS r1.220, so the line numbers may not be current.) I will submit a doc PR about the other issues. Thanks for taking care of this! -Ben Kaduk From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 03:02:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 918191065670 for ; Fri, 26 Jun 2009 03:02:15 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 20E4C8FC15 for ; Fri, 26 Jun 2009 03:02:14 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: (qmail 9713 invoked by uid 399); 26 Jun 2009 03:02:14 -0000 Received: from localhost (HELO ?192.168.0.102?) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 26 Jun 2009 03:02:14 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4A443A34.8030805@FreeBSD.org> Date: Thu, 25 Jun 2009 20:02:12 -0700 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 To: Sam Leffler References: <200906260127.n5Q1RG7N070584@svn.freebsd.org> <4A4429EC.6050202@freebsd.org> In-Reply-To: <4A4429EC.6050202@freebsd.org> X-Enigmail-Version: 0.95.7 OpenPGP: id=D5B2F0FB Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r195029 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 03:02:16 -0000 Sam Leffler wrote: > Using device names is a bad idea. Take a look at wpa_supplicant (for > example) for how to check the media status to determine whether a device > is wireless. I agree that it's not optimal, and I would prefer a dynamic solution as opposed to a static one. What mechanism would you suggest that would be available to a shell script relatively early in the boot process? Doug From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 04:47:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E444106564A; Fri, 26 Jun 2009 04:47:44 +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 192A38FC13; Fri, 26 Jun 2009 04:47:44 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5Q4likx074944; Fri, 26 Jun 2009 04:47:44 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5Q4lhpD074928; Fri, 26 Jun 2009 04:47:43 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200906260447.n5Q4lhpD074928@svn.freebsd.org> From: Alan Cox Date: Fri, 26 Jun 2009 04:47: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: r195033 - in head/sys: amd64/include arm/include i386/include ia64/include kern mips/include powerpc/include sparc64/include sun4v/include sun4v/sun4v vm X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 04:47:44 -0000 Author: alc Date: Fri Jun 26 04:47:43 2009 New Revision: 195033 URL: http://svn.freebsd.org/changeset/base/195033 Log: This change is the next step in implementing the cache control functionality required by video card drivers. Specifically, this change introduces vm_cache_mode_t with an appropriate VM_CACHE_DEFAULT definition on all architectures. In addition, this changes adds a vm_cache_mode_t parameter to kmem_alloc_contig() and vm_phys_alloc_contig(). These will be the interfaces for allocating mapped kernel memory and physical memory, respectively, with non-default cache modes. In collaboration with: jhb Added: head/sys/amd64/include/vm.h (contents, props changed) head/sys/arm/include/vm.h (contents, props changed) head/sys/i386/include/vm.h (contents, props changed) head/sys/ia64/include/vm.h (contents, props changed) head/sys/mips/include/vm.h (contents, props changed) head/sys/powerpc/include/vm.h (contents, props changed) head/sys/sparc64/include/vm.h (contents, props changed) head/sys/sun4v/include/vm.h (contents, props changed) Modified: head/sys/kern/kern_mbuf.c head/sys/sun4v/sun4v/pmap.c head/sys/vm/vm.h head/sys/vm/vm_contig.c head/sys/vm/vm_extern.h head/sys/vm/vm_phys.c head/sys/vm/vm_phys.h Added: head/sys/amd64/include/vm.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/include/vm.h Fri Jun 26 04:47:43 2009 (r195033) @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2009 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_VM_H_ +#define _MACHINE_VM_H_ + +#include + +/* Cache control options. */ +#define VM_CACHE_UNCACHEABLE ((vm_cache_mode_t)PAT_UNCACHEABLE) +#define VM_CACHE_WRITE_COMBINING ((vm_cache_mode_t)PAT_WRITE_COMBINING) +#define VM_CACHE_WRITE_THROUGH ((vm_cache_mode_t)PAT_WRITE_THROUGH) +#define VM_CACHE_WRITE_PROTECTED ((vm_cache_mode_t)PAT_WRITE_PROTECTED) +#define VM_CACHE_WRITE_BACK ((vm_cache_mode_t)PAT_WRITE_BACK) +#define VM_CACHE_UNCACHED ((vm_cache_mode_t)PAT_UNCACHED) + +#define VM_CACHE_DEFAULT VM_CACHE_WRITE_BACK + +#endif /* !_MACHINE_PMAP_H_ */ Added: head/sys/arm/include/vm.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/include/vm.h Fri Jun 26 04:47:43 2009 (r195033) @@ -0,0 +1,35 @@ +/*- + * Copyright (c) 2009 Alan L. Cox + * 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$ + */ + +#ifndef _MACHINE_VM_H_ +#define _MACHINE_VM_H_ + +/* Cache control is not (yet) implemented. */ +#define VM_CACHE_DEFAULT 0 + +#endif /* !_MACHINE_PMAP_H_ */ Added: head/sys/i386/include/vm.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/i386/include/vm.h Fri Jun 26 04:47:43 2009 (r195033) @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2009 Advanced Computing Technologies LLC + * Written by: John H. Baldwin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_VM_H_ +#define _MACHINE_VM_H_ + +#include + +/* Cache control options. */ +#define VM_CACHE_UNCACHEABLE ((vm_cache_mode_t)PAT_UNCACHEABLE) +#define VM_CACHE_WRITE_COMBINING ((vm_cache_mode_t)PAT_WRITE_COMBINING) +#define VM_CACHE_WRITE_THROUGH ((vm_cache_mode_t)PAT_WRITE_THROUGH) +#define VM_CACHE_WRITE_PROTECTED ((vm_cache_mode_t)PAT_WRITE_PROTECTED) +#define VM_CACHE_WRITE_BACK ((vm_cache_mode_t)PAT_WRITE_BACK) +#define VM_CACHE_UNCACHED ((vm_cache_mode_t)PAT_UNCACHED) + +#define VM_CACHE_DEFAULT VM_CACHE_WRITE_BACK + +#endif /* !_MACHINE_PMAP_H_ */ Added: head/sys/ia64/include/vm.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/ia64/include/vm.h Fri Jun 26 04:47:43 2009 (r195033) @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 2009 Alan L. Cox + * 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$ + */ + +#ifndef _MACHINE_VM_H_ +#define _MACHINE_VM_H_ + +#include +#include + +/* Cache control options. */ +#define VM_CACHE_WRITE_BACK ((vm_cache_mode_t)PTE_MA_WB) +#define VM_CACHE_UNCACHEABLE ((vm_cache_mode_t)PTE_MA_UC) +#define VM_CACHE_UNCACHEABLE_EXPORTED ((vm_cache_mode_t)PTE_MA_UCE) +#define VM_CACHE_WRITE_COMBINING ((vm_cache_mode_t)PTE_MA_WC) +#define VM_CACHE_NATPAGE ((vm_cache_mode_t)PTE_MA_NATPAGE) + +#define VM_CACHE_DEFAULT VM_CACHE_WRITE_BACK + +#endif /* !_MACHINE_PMAP_H_ */ Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Fri Jun 26 02:27:57 2009 (r195032) +++ head/sys/kern/kern_mbuf.c Fri Jun 26 04:47:43 2009 (r195033) @@ -356,7 +356,7 @@ mbuf_jumbo_alloc(uma_zone_t zone, int by /* Inform UMA that this allocator uses kernel_map/object. */ *flags = UMA_SLAB_KERNEL; return ((void *)kmem_alloc_contig(kernel_map, bytes, wait, - (vm_paddr_t)0, ~(vm_paddr_t)0, 1, 0)); + (vm_paddr_t)0, ~(vm_paddr_t)0, 1, 0, VM_CACHE_DEFAULT)); } /* Added: head/sys/mips/include/vm.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/include/vm.h Fri Jun 26 04:47:43 2009 (r195033) @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2009 Alan L. Cox + * 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$ + */ + +#ifndef _MACHINE_VM_H_ +#define _MACHINE_VM_H_ + +#include + +/* Cache control options. */ +#define VM_CACHE_UNCACHED ((vm_cache_mode_t)PTE_UNCACHED) +#define VM_CACHE_CACHEABLE_NONCOHERENT ((vm_cache_mode_t)PTE_CACHE) + +#define VM_CACHE_DEFAULT VM_CACHE_CACHEABLE_NONCOHERENT + +#endif /* !_MACHINE_PMAP_H_ */ Added: head/sys/powerpc/include/vm.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/include/vm.h Fri Jun 26 04:47:43 2009 (r195033) @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2009 Alan L. Cox + * 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$ + */ + +#ifndef _MACHINE_VM_H_ +#define _MACHINE_VM_H_ + +#include + +/* Cache control options. */ +#define VM_CACHE_INHIBIT ((vm_cache_mode_t)PTE_I) +#define VM_CACHE_WRITE_THROUGH ((vm_cache_mode_t)PTE_W) + +#define VM_CACHE_DEFAULT 0 + +#endif /* !_MACHINE_PMAP_H_ */ Added: head/sys/sparc64/include/vm.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sparc64/include/vm.h Fri Jun 26 04:47:43 2009 (r195033) @@ -0,0 +1,35 @@ +/*- + * Copyright (c) 2009 Alan L. Cox + * 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$ + */ + +#ifndef _MACHINE_VM_H_ +#define _MACHINE_VM_H_ + +/* Cache control is not (yet) implemented. */ +#define VM_CACHE_DEFAULT 0 + +#endif /* !_MACHINE_PMAP_H_ */ Added: head/sys/sun4v/include/vm.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sun4v/include/vm.h Fri Jun 26 04:47:43 2009 (r195033) @@ -0,0 +1,35 @@ +/*- + * Copyright (c) 2009 Alan L. Cox + * 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$ + */ + +#ifndef _MACHINE_VM_H_ +#define _MACHINE_VM_H_ + +/* Cache control is not (yet) implemented. */ +#define VM_CACHE_DEFAULT 0 + +#endif /* !_MACHINE_PMAP_H_ */ Modified: head/sys/sun4v/sun4v/pmap.c ============================================================================== --- head/sys/sun4v/sun4v/pmap.c Fri Jun 26 02:27:57 2009 (r195032) +++ head/sys/sun4v/sun4v/pmap.c Fri Jun 26 04:47:43 2009 (r195033) @@ -1297,7 +1297,8 @@ pmap_alloc_zeroed_contig_pages(int npage while (m == NULL) { for (i = 0; phys_avail[i + 1] != 0; i += 2) { m = vm_phys_alloc_contig(npages, phys_avail[i], - phys_avail[i + 1], alignment, (1UL<<34)); + phys_avail[i + 1], alignment, (1UL<<34), + VM_CACHE_DEFAULT); if (m) goto found; } Modified: head/sys/vm/vm.h ============================================================================== --- head/sys/vm/vm.h Fri Jun 26 02:27:57 2009 (r195032) +++ head/sys/vm/vm.h Fri Jun 26 04:47:43 2009 (r195033) @@ -61,6 +61,14 @@ #ifndef VM_H #define VM_H +#include + +/* + * The exact set of cache control codes is machine dependent. However, every + * machine is required to define VM_CACHE_DEFAULT. + */ +typedef char vm_cache_mode_t; /* cache control codes */ + typedef char vm_inherit_t; /* inheritance codes */ #define VM_INHERIT_SHARE ((vm_inherit_t) 0) Modified: head/sys/vm/vm_contig.c ============================================================================== --- head/sys/vm/vm_contig.c Fri Jun 26 02:27:57 2009 (r195032) +++ head/sys/vm/vm_contig.c Fri Jun 26 04:47:43 2009 (r195033) @@ -236,7 +236,7 @@ contigmalloc( void *ret; ret = (void *)kmem_alloc_contig(kernel_map, size, flags, low, high, - alignment, boundary); + alignment, boundary, VM_CACHE_DEFAULT); if (ret != NULL) malloc_type_allocated(type, round_page(size)); return (ret); @@ -244,7 +244,8 @@ contigmalloc( vm_offset_t kmem_alloc_contig(vm_map_t map, vm_size_t size, int flags, vm_paddr_t low, - vm_paddr_t high, unsigned long alignment, unsigned long boundary) + vm_paddr_t high, unsigned long alignment, unsigned long boundary, + vm_cache_mode_t mode) { vm_offset_t ret; vm_page_t pages; @@ -255,7 +256,8 @@ kmem_alloc_contig(vm_map_t map, vm_size_ npgs = size >> PAGE_SHIFT; tries = 0; retry: - pages = vm_phys_alloc_contig(npgs, low, high, alignment, boundary); + pages = vm_phys_alloc_contig(npgs, low, high, alignment, boundary, + mode); if (pages == NULL) { if (tries < ((flags & M_NOWAIT) != 0 ? 1 : 3)) { vm_page_lock_queues(); Modified: head/sys/vm/vm_extern.h ============================================================================== --- head/sys/vm/vm_extern.h Fri Jun 26 02:27:57 2009 (r195032) +++ head/sys/vm/vm_extern.h Fri Jun 26 04:47:43 2009 (r195033) @@ -43,7 +43,7 @@ int kernacc(void *, int, int); vm_offset_t kmem_alloc(vm_map_t, vm_size_t); vm_offset_t kmem_alloc_contig(vm_map_t map, vm_size_t size, int flags, vm_paddr_t low, vm_paddr_t high, unsigned long alignment, - unsigned long boundary); + unsigned long boundary, vm_cache_mode_t mode); vm_offset_t kmem_alloc_nofault(vm_map_t, vm_size_t); vm_offset_t kmem_alloc_wait(vm_map_t, vm_size_t); void kmem_free(vm_map_t, vm_offset_t, vm_size_t); Modified: head/sys/vm/vm_phys.c ============================================================================== --- head/sys/vm/vm_phys.c Fri Jun 26 02:27:57 2009 (r195032) +++ head/sys/vm/vm_phys.c Fri Jun 26 04:47:43 2009 (r195033) @@ -588,7 +588,7 @@ vm_phys_zero_pages_idle(void) */ vm_page_t vm_phys_alloc_contig(unsigned long npages, vm_paddr_t low, vm_paddr_t high, - unsigned long alignment, unsigned long boundary) + unsigned long alignment, unsigned long boundary, vm_cache_mode_t mode) { struct vm_freelist *fl; struct vm_phys_seg *seg; Modified: head/sys/vm/vm_phys.h ============================================================================== --- head/sys/vm/vm_phys.h Fri Jun 26 02:27:57 2009 (r195032) +++ head/sys/vm/vm_phys.h Fri Jun 26 04:47:43 2009 (r195033) @@ -43,7 +43,7 @@ void vm_phys_add_page(vm_paddr_t pa); vm_page_t vm_phys_alloc_contig(unsigned long npages, vm_paddr_t low, vm_paddr_t high, - unsigned long alignment, unsigned long boundary); + unsigned long alignment, unsigned long boundary, vm_cache_mode_t mode); vm_page_t vm_phys_alloc_pages(int pool, int order); vm_paddr_t vm_phys_bootstrap_alloc(vm_size_t size, unsigned long alignment); void vm_phys_free_pages(vm_page_t m, int order); From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 04:52:31 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 84A82106564A; Fri, 26 Jun 2009 04:52:31 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.freebsd.org (Postfix) with ESMTP id 253898FC08; Fri, 26 Jun 2009 04:52:30 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from trouble.errno.com (trouble.errno.com [10.0.0.248]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n5Q4qUid043210 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 25 Jun 2009 21:52:30 -0700 (PDT) (envelope-from sam@freebsd.org) Message-ID: <4A44540E.7080503@freebsd.org> Date: Thu, 25 Jun 2009 21:52:30 -0700 From: Sam Leffler Organization: FreeBSD Project User-Agent: Thunderbird 2.0.0.21 (X11/20090411) MIME-Version: 1.0 To: Doug Barton References: <200906260127.n5Q1RG7N070584@svn.freebsd.org> <4A4429EC.6050202@freebsd.org> <4A443A34.8030805@FreeBSD.org> In-Reply-To: <4A443A34.8030805@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-DCC-x.dcc-servers-Metrics: ebb.errno.com; whitelist Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r195029 - head/etc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 04:52:32 -0000 Doug Barton wrote: > Sam Leffler wrote: > >> Using device names is a bad idea. Take a look at wpa_supplicant (for >> example) for how to check the media status to determine whether a device >> is wireless. >> > > I agree that it's not optimal, and I would prefer a dynamic solution > as opposed to a static one. What mechanism would you suggest that > would be available to a shell script relatively early in the boot process? > As I said, use the technique /etc/rc.d/wpa_supplicant uses to check the media status. I've sent you working code privately. Sam From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 05:09:00 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DC21106566C; Fri, 26 Jun 2009 05:09:00 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C8BA8FC26; Fri, 26 Jun 2009 05:09:00 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5Q590iC075531; Fri, 26 Jun 2009 05:09:00 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5Q590gF075529; Fri, 26 Jun 2009 05:09:00 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <200906260509.n5Q590gF075529@svn.freebsd.org> From: Maxim Konovalov Date: Fri, 26 Jun 2009 05:09: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: r195036 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 05:09:00 -0000 Author: maxim Date: Fri Jun 26 05:09:00 2009 New Revision: 195036 URL: http://svn.freebsd.org/changeset/base/195036 Log: o Kill grammar nits. PR: docs/136061 Submitted by: Ben Kaduk MFC after: 1 week Modified: head/sbin/ipfw/ipfw.8 Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Fri Jun 26 05:08:32 2009 (r195035) +++ head/sbin/ipfw/ipfw.8 Fri Jun 26 05:09:00 2009 (r195036) @@ -316,7 +316,7 @@ file systems are mounted (yet) by the ti is being run (e.g.\& when they are mounted over NFS). Once .Fl p -has been specified, any additional arguments as passed on to the preprocessor +has been specified, any additional arguments are passed on to the preprocessor for interpretation. This allows for flexible configuration files (like conditionalizing them on the local hostname) and the use of macros to centralize @@ -1941,7 +1941,7 @@ with .Dq "options HZ=1000" to reduce the granularity to 1ms or less). -Default value is 0, meaning no delay. +The default value is 0, meaning no delay. .Pp .It Cm burst Ar size If the data rate exceeds the pipe bandwith limit From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 05:50:35 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E0DC1065675; Fri, 26 Jun 2009 05:50:35 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from ebb.errno.com (ebb.errno.com [69.12.149.25]) by mx1.freebsd.org (Postfix) with ESMTP id 1C4648FC08; Fri, 26 Jun 2009 05:50:35 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from Macintosh-4.local ([10.0.0.200]) (authenticated bits=0) by ebb.errno.com (8.13.6/8.12.6) with ESMTP id n5Q5oQgH043442 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 25 Jun 2009 22:50:26 -0700 (PDT) (envelope-from sam@freebsd.org) Message-ID: <4A4461A2.4070005@freebsd.org> Date: Thu, 25 Jun 2009 22:50:26 -0700 From: Sam Leffler Organization: FreeBSD Project User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: Andrew Gallatin References: <200906242109.n5OL9uVb029380@svn.freebsd.org> <4A42983C.6050307@freebsd.org> <4A42D629.8060806@cs.duke.edu> In-Reply-To: <4A42D629.8060806@cs.duke.edu> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-DCC-x.dcc-servers-Metrics: ebb.errno.com; whitelist Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r194909 - head/sys/dev/mxge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 05:50:35 -0000 Andrew Gallatin wrote: > Sam Leffler wrote: > >> There's something else wrong. This is just covering up the real bug. > > I'm pretty sure the "real bug" is in bpf, but I'm not sure its a bug, > and I suspect there are probably other, similar, bugs lurking when > you try to tear down a busy interface. FWIW my point was that we need to stop adding "hacks" to drivers to workaround issues like this. There should be a standard way drivers are written to handle detach that avoids races. > > What I was doing was: > > - point a packet generator offering 1.5Mpps at the NIC > > - in a tight shell loop, do > > while (1) > tcpdump -ni mxge0 host 172.31.0.1 > end > > - in another shell loop: > > while (1) > ifconfig mxge0 192.168.1.22 up > sleep 1 > kldunload if_mxge > end > > Before the commit, with the old order: > > lock() > close() > unlock() > ether_ifdetach() > > I'd see either an exhaustion of mbufs because tcpdump snuck in after > I'd closed the device and re-opened it on me (so I never closed it > again, resulting in leaked mbufs), or a panic. > > I then moved the ether_ifdetach() to the new position: > ether_ifdetach() > lock() > close() > unlock() > > This worked great until I started the packet generator, > then it crashed. The stack I saw (which I don't have > saved, so this is from memory) when I had ether_ifdetach() > first was: > > > panic: mtx_lock() (don't remember exact text) > bpf_mtap() > ether_input() > mxge_rx_done_small() > mxge_clean_rx_done() > mxge_intr() > <...> > > When I looked at the ifp in kgdb, I noticed that all the operations > (if_input(), if_output(), etc) pointed to ifdead_* > The machine I'm using for this is a MacPro, and I can't get ddb > to work on the USB based console, so I'm working purely from dumps. > I don't know how to get a stack of another process in kgdb on > amd64, so that's all the information I have. > > My assumption is that my interrupt thread was running when > ether_ifdetach() called bpfdetach(), and was starting bpf_mtap() > while bpfdetach() was destroying the bpf_if. There doesn't > seem to be anything to prevent bpfdetach() from racing with > bpf_mtap(). > > By calling my close() routine (with a dying flag so nothing can > sneak in before detach), I'm assured that my NIC is quiescent, > and cannot be calling into the stack while the interface is being > torn down. I'd prefer to leave my commit as-is because: > > 1) it works, and fixes a bug > 2) it can be MFC'ed as is > 3) it just feels wrong to be blasting packets up into the stack > while detaching. With this NIC, the best way to make it > quiescent is to call close(). There's an interrupt handshake > done with the NIC to ensure its is quiescent, so doing something > like disabling its interrupt could leave the things in a weird state. I'm not asking you to revert your commit; what I want is a generic solution for all drivers so we can eliminate stuff like this. I don't care about MFC'ing at the moment; there have been issues with ifnet detach for a long time but with recent changes to the ifnet layer in HEAD I think it's time to work out issues like this. bpf has several problems (at the top of my list is how it holds a private mtx over ifpromisc calls which causes heartburn for drivers that need to block when processing such requests). It sounds like bpf needs to push tap'd packets through a method ifnet can "deaden" and/or bpf needs to explicitly handle this case. At that point you can eliminate your dying flag (as can some other drivers that I've seen recently grow similar hacks). Sam From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 05:57:47 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15635106566C; Fri, 26 Jun 2009 05:57:47 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: from mail-ew0-f213.google.com (mail-ew0-f213.google.com [209.85.219.213]) by mx1.freebsd.org (Postfix) with ESMTP id 180618FC20; Fri, 26 Jun 2009 05:57:45 +0000 (UTC) (envelope-from mat.macy@gmail.com) Received: by ewy9 with SMTP id 9so1534844ewy.43 for ; Thu, 25 Jun 2009 22:57:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=rrkr8bxS7vzCVYgtxiCyeuIWh7uX5rKPijnV9iedJKY=; b=R8VY1/gfzQ7FKiHReBQDVFVw/NRCKjuWOX2H+hbVwnbg634/7ED9upRFSpfss85swP tSn5Hr6AtLeAXWZ0HL9syAmy3lwP8UpFjWc3pGux5h03aTbfXpfwCcXlJNeWYZk3OBBK zxAmUjawDwvGCS8Qg2wY8vTgkrfo0kGhGkOuA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=mVBET529Ws1kbAmQleEsRAqIQaiL9NA1lA6txAgDlwongV79v0SUWUriXCcGsTTPDz msPCo4+8FGytc1G6sKDKEFtn/cc1+Zo5e78jA2oZzIRTmUVSGkuIYRvYTHlCDbF1FT2w h5ykZYhZI0tjoJ+UPlBgtvzzXkucwAbmr4Zdw= MIME-Version: 1.0 Sender: mat.macy@gmail.com Received: by 10.216.11.200 with SMTP id 50mr1001384wex.183.1245995865099; Thu, 25 Jun 2009 22:57:45 -0700 (PDT) In-Reply-To: <4A42D629.8060806@cs.duke.edu> References: <200906242109.n5OL9uVb029380@svn.freebsd.org> <4A42983C.6050307@freebsd.org> <4A42D629.8060806@cs.duke.edu> Date: Thu, 25 Jun 2009 22:57:45 -0700 X-Google-Sender-Auth: 811bb01f70decaa4 Message-ID: <3c1674c90906252257q7fe4c725m3840b2bb3c8aeb51@mail.gmail.com> From: Kip Macy To: Andrew Gallatin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Sam Leffler , src-committers@freebsd.org Subject: Re: svn commit: r194909 - head/sys/dev/mxge X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 05:57:47 -0000 This is my bug. Hold off for a day or two. -Kip On Wed, Jun 24, 2009 at 6:43 PM, Andrew Gallatin wrot= e: > Sam Leffler wrote: > >> There's something else wrong. =A0This is just covering up the real bug. > > I'm pretty sure the "real bug" is in bpf, but I'm not sure its a bug, > and I suspect there are probably other, similar, bugs lurking when > you try to tear down a busy interface. > > What I was doing was: > > - point a packet generator offering 1.5Mpps at the NIC > > - in a tight shell loop, do > > while (1) > =A0 =A0 =A0 =A0tcpdump -ni mxge0 host 172.31.0.1 > end > > - in another shell loop: > > while (1) > =A0 =A0 =A0 =A0ifconfig mxge0 192.168.1.22 up > =A0 =A0 =A0 =A0sleep 1 > =A0 =A0 =A0 =A0kldunload if_mxge > end > > Before the commit, with the old order: > > =A0 =A0 =A0 lock() > =A0 =A0 =A0 close() > =A0 =A0 =A0 unlock() > =A0 =A0 =A0 ether_ifdetach() > > I'd see either an exhaustion of mbufs because tcpdump snuck in after > I'd closed the device and re-opened it on me (so I never closed it > again, resulting in leaked mbufs), or a panic. > > I then moved the ether_ifdetach() to the new position: > =A0 =A0 =A0 ether_ifdetach() > =A0 =A0 =A0 lock() > =A0 =A0 =A0 close() > =A0 =A0 =A0 unlock() > > This worked great until I started the packet generator, > then it crashed. =A0 The stack I saw (which I don't have > saved, so this is from memory) when I had ether_ifdetach() > first was: > > > panic: mtx_lock() (don't remember exact text) > bpf_mtap() > ether_input() > mxge_rx_done_small() > mxge_clean_rx_done() > mxge_intr() > <...> > > When I looked at the ifp in kgdb, I noticed that all the operations > (if_input(), if_output(), etc) pointed to ifdead_* > The machine I'm using for this is a MacPro, and I can't get ddb > to work on the USB based console, so I'm working purely from dumps. > I don't know how to get a stack of another process in kgdb on > amd64, so that's all the information I have. > > My assumption is that my interrupt thread was running when > ether_ifdetach() called bpfdetach(), and was starting bpf_mtap() > while bpfdetach() was destroying the bpf_if. =A0There doesn't > seem to be anything to prevent bpfdetach() from racing with > bpf_mtap(). > > By calling my close() routine (with a dying flag so nothing can > sneak in before detach), I'm assured that my NIC is quiescent, > and cannot be calling into the stack while the interface is being > torn down. =A0I'd prefer to leave my commit as-is because: > > 1) it works, and fixes a bug > 2) it can be MFC'ed as is > 3) it just feels wrong to be blasting packets up into the stack > =A0 while detaching. =A0With this NIC, the best way to make it > =A0 quiescent is to call close(). =A0There's an interrupt handshake > =A0 done with the NIC to ensure its is quiescent, so doing something > =A0 like disabling its interrupt could leave the things in a weird state. > > Drew > --=20 When bad men combine, the good must associate; else they will fall one by one, an unpitied sacrifice in a contemptible struggle. Edmund Burke From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 07:11:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 58A06106564A; Fri, 26 Jun 2009 07:11:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2CE538FC08; Fri, 26 Jun 2009 07:11:15 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5Q7BFHJ078378; Fri, 26 Jun 2009 07:11:15 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5Q7BFMP078376; Fri, 26 Jun 2009 07:11:15 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200906260711.n5Q7BFMP078376@svn.freebsd.org> From: Warner Losh Date: Fri, 26 Jun 2009 07:11: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: r195044 - head/share/misc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 07:11:15 -0000 Author: imp Date: Fri Jun 26 07:11:14 2009 New Revision: 195044 URL: http://svn.freebsd.org/changeset/base/195044 Log: Correct some minor nits with the 2BSD and 3BSD series of releases based on the information at The Unix Historical Society web page (http://www.tuhs.org/Unix_History). Where multiple sources differ, retain all data. Prefer 2.79BSD to 2.7.9BSD, since the former is from /LABEL form the actual release. Use the /LABEL date as in the TUHS tables (the curious can read http://minnie.tuhs.org/Unix_History/2bsd for all the conflicting date confusion if they want). Approved by: re@ Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Fri Jun 26 06:59:47 2009 (r195043) +++ head/share/misc/bsd-family-tree Fri Jun 26 07:11:14 2009 (r195044) @@ -25,7 +25,7 @@ Seventh Edition (V7) | \/ | 3BSD | | | - 4.0BSD 2.7.9BSD + 4.0BSD 2.79BSD | | 4.1BSD --------------> 2.8BSD | | @@ -260,6 +260,7 @@ was the announcement in Usenet or if it [OBD] OpenBSD Project, The. [QCU] Salus, Peter H. A quarter century of UNIX. [SMS] Steven M. Schultz. 2.11BSD, UNIX for the PDP-11. +[TUHS] The Unix Historical Society. http://minnie.tuhs.org/Unix_History/. [USE] Usenet announcement. [WRS] Wind River Systems, Inc. [dmr] Dennis Ritchie, via E-Mail @@ -297,15 +298,15 @@ Tenth Edition 1989-10-xx [QCU] PDP-11, Pascal, ex(1) 30 free copies of 1BSD sent out 35 tapes sold for 50 USD [QCU] -2BSD mid 1978 [QCU] +2BSD mid 1978 [QCU] 1979-05-10 [TUHS] 75 2BSD tapes shipped -2.7.9BSD ?? [SMS] +2.79BSD 1980-04-xx [TUHS] 2.8BSD 1981-07-xx [KSJ] 2.8.1BSD 1982-01-xx [QCU] set of performance improvements 2.9BSD 1983-07-xx [KSJ] -2.9.1BSD 1983-11-xx +2.9.1BSD 1983-11-xx [TUHS] 2.9BSD-Seismo 1985-08-xx [SMS] 2.10BSD 1987-04-xx [KKK] 2.10.1BSD 1989-01-xx [SMS] @@ -313,7 +314,7 @@ Tenth Edition 1989-10-xx [QCU] 2.11BSD rev #430 1999-12-13 [SMS] 32V 1978-1[01]-xx [QCU] -3BSD late 1979 [QCU] +3BSD late 1979 [QCU] March 1980 [TUHS] virtual memory, page replacement, demand paging 4.0BSD 1980-10-xx From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 08:43:27 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 657FA106564A; Fri, 26 Jun 2009 08:43:27 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 240278FC18; Fri, 26 Jun 2009 08:43:27 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id CDA3B46B1A; Fri, 26 Jun 2009 04:43:26 -0400 (EDT) Date: Fri, 26 Jun 2009 09:43:26 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Doug Barton In-Reply-To: <200906260104.n5Q14pRu070043@svn.freebsd.org> Message-ID: References: <200906260104.n5Q14pRu070043@svn.freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) 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: r195026 - head/etc/rc.d X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 08:43:27 -0000 On Fri, 26 Jun 2009, Doug Barton wrote: > Reverse the effect of r193198 for pf and ipfw which will once again > allow them to start after netif. There were too many problems reported > with this change in the short period of time that it lived in HEAD, and > we are too late in the release cycle to properly shake it out. > > IMO the issue of having the firewalls up before the network is still a > valid concern, particularly for pf whose default state is wide open. > However properly solving this issue is going to take some investment > on the part of the people who actually use those tools. This sounds right to me, FWIW -- being able to fully configure the policy before network traffic starts is definitely right in the abstract, it's just a question of getting there... Robert N M Watson Computer Laboratory University of Cambridge > > This is not a strict reversion of all the changes for r193198 since it > also included some simplification of the BEFORE/REQUIRE logic which is > still valid for ipfilter and ip6fw. > > Modified: > head/etc/rc.d/NETWORKING > head/etc/rc.d/ipfw > head/etc/rc.d/netif > head/etc/rc.d/pf > head/etc/rc.d/pflog > head/etc/rc.d/pfsync > > Modified: head/etc/rc.d/NETWORKING > ============================================================================== > --- head/etc/rc.d/NETWORKING Fri Jun 26 01:01:50 2009 (r195025) > +++ head/etc/rc.d/NETWORKING Fri Jun 26 01:04:50 2009 (r195026) > @@ -4,7 +4,7 @@ > # > > # PROVIDE: NETWORKING NETWORK > -# REQUIRE: netif netoptions routing network_ipv6 ppp > +# REQUIRE: netif netoptions routing network_ipv6 ppp ipfw > # REQUIRE: defaultroute routed mrouted route6d mroute6d resolv > > # This is a dummy dependency, for services which require networking > > Modified: head/etc/rc.d/ipfw > ============================================================================== > --- head/etc/rc.d/ipfw Fri Jun 26 01:01:50 2009 (r195025) > +++ head/etc/rc.d/ipfw Fri Jun 26 01:04:50 2009 (r195026) > @@ -4,7 +4,7 @@ > # > > # PROVIDE: ipfw > -# REQUIRE: FILESYSTEMS > +# REQUIRE: ppp > # KEYWORD: nojail > > . /etc/rc.subr > > Modified: head/etc/rc.d/netif > ============================================================================== > --- head/etc/rc.d/netif Fri Jun 26 01:01:50 2009 (r195025) > +++ head/etc/rc.d/netif Fri Jun 26 01:04:50 2009 (r195026) > @@ -27,7 +27,7 @@ > > # PROVIDE: netif > # REQUIRE: atm1 cleanvar FILESYSTEMS serial sppp sysctl > -# REQUIRE: ipfilter ipfs pf ipfw > +# REQUIRE: ipfilter ipfs > # KEYWORD: nojail > > . /etc/rc.subr > > Modified: head/etc/rc.d/pf > ============================================================================== > --- head/etc/rc.d/pf Fri Jun 26 01:01:50 2009 (r195025) > +++ head/etc/rc.d/pf Fri Jun 26 01:04:50 2009 (r195026) > @@ -4,7 +4,7 @@ > # > > # PROVIDE: pf > -# REQUIRE: FILESYSTEMS pflog pfsync > +# REQUIRE: FILESYSTEMS netif pflog pfsync > # BEFORE: routing > # KEYWORD: nojail > > > Modified: head/etc/rc.d/pflog > ============================================================================== > --- head/etc/rc.d/pflog Fri Jun 26 01:01:50 2009 (r195025) > +++ head/etc/rc.d/pflog Fri Jun 26 01:04:50 2009 (r195026) > @@ -4,7 +4,7 @@ > # > > # PROVIDE: pflog > -# REQUIRE: FILESYSTEMS cleanvar > +# REQUIRE: FILESYSTEMS netif cleanvar > # KEYWORD: nojail > > . /etc/rc.subr > > Modified: head/etc/rc.d/pfsync > ============================================================================== > --- head/etc/rc.d/pfsync Fri Jun 26 01:01:50 2009 (r195025) > +++ head/etc/rc.d/pfsync Fri Jun 26 01:04:50 2009 (r195026) > @@ -4,7 +4,7 @@ > # > > # PROVIDE: pfsync > -# REQUIRE: FILESYSTEMS > +# REQUIRE: FILESYSTEMS netif > # KEYWORD: nojail > > . /etc/rc.subr > From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 09:32:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F2B05106564A; Fri, 26 Jun 2009 09:32:31 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E10E38FC0A; Fri, 26 Jun 2009 09:32:31 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5Q9WV5O081206; Fri, 26 Jun 2009 09:32:31 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5Q9WVK9081205; Fri, 26 Jun 2009 09:32:31 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200906260932.n5Q9WVK9081205@svn.freebsd.org> From: Rui Paulo Date: Fri, 26 Jun 2009 09:32:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195045 - head/sys/boot/i386/libi386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 09:32:32 -0000 Author: rpaulo Date: Fri Jun 26 09:32:31 2009 New Revision: 195045 URL: http://svn.freebsd.org/changeset/base/195045 Log: On special systems where the MBR and the GPT are in sync (up to the 4th slicei, Apple EFI hardware), the bootloader will fail to recognize the GPT if it finds anything else but the EFI partition. Change the check to continue detecting the GPT by looking at the EFI partition on the MBR but stopping successfuly after finding it. PR: kern/134590 Submitted by: Christoph Langguth Reviewed by: jhb MFC after: 2 weeks Approved by: re (kib) Modified: head/sys/boot/i386/libi386/biosdisk.c Modified: head/sys/boot/i386/libi386/biosdisk.c ============================================================================== --- head/sys/boot/i386/libi386/biosdisk.c Fri Jun 26 07:11:14 2009 (r195044) +++ head/sys/boot/i386/libi386/biosdisk.c Fri Jun 26 09:32:31 2009 (r195045) @@ -880,7 +880,7 @@ bd_open_gpt(struct open_disk *od, struct for (i = 0; i < NDOSPART; i++) { if (dp[i].dp_typ == 0xee) part++; - else if (dp[i].dp_typ != 0x00) + else if ((part != 1) && (dp[i].dp_typ != 0x00)) return (EINVAL); } if (part != 1) From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 10:23:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2799106566C; Fri, 26 Jun 2009 10:23:17 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CF79E8FC08; Fri, 26 Jun 2009 10:23:17 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5QANH9E083489; Fri, 26 Jun 2009 10:23:17 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5QANHJT083486; Fri, 26 Jun 2009 10:23:17 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <200906261023.n5QANHJT083486@svn.freebsd.org> From: Rui Paulo Date: Fri, 26 Jun 2009 10:23: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: r195046 - head/sys/dev/asmc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 10:23:18 -0000 Author: rpaulo Date: Fri Jun 26 10:23:17 2009 New Revision: 195046 URL: http://svn.freebsd.org/changeset/base/195046 Log: Add support for MacBook4,1. Submitted by: Christoph Langguth MFC after: 2 weeks Approved by: re (kib) Modified: head/sys/dev/asmc/asmc.c head/sys/dev/asmc/asmcvar.h Modified: head/sys/dev/asmc/asmc.c ============================================================================== --- head/sys/dev/asmc/asmc.c Fri Jun 26 09:32:31 2009 (r195045) +++ head/sys/dev/asmc/asmc.c Fri Jun 26 10:23:17 2009 (r195046) @@ -68,7 +68,9 @@ static int asmc_detach(device_t dev); * SMC functions. */ static int asmc_init(device_t dev); +static int asmc_command(device_t dev, uint8_t command); static int asmc_wait(device_t dev, uint8_t val); +static int asmc_wait_ack(device_t dev, uint8_t val, int amount); static int asmc_key_write(device_t dev, const char *key, uint8_t *buf, uint8_t len); static int asmc_key_read(device_t dev, const char *key, uint8_t *buf, @@ -99,6 +101,7 @@ static int asmc_mb_sysctl_sms_y(SYSCTL_ static int asmc_mb_sysctl_sms_z(SYSCTL_HANDLER_ARGS); static int asmc_mbp_sysctl_light_left(SYSCTL_HANDLER_ARGS); static int asmc_mbp_sysctl_light_right(SYSCTL_HANDLER_ARGS); +static int asmc_mbp_sysctl_light_control(SYSCTL_HANDLER_ARGS); struct asmc_model { const char *smc_model; /* smbios.system.product env var. */ @@ -115,6 +118,7 @@ struct asmc_model { int (*smc_fan_targetspeed)(SYSCTL_HANDLER_ARGS); int (*smc_light_left)(SYSCTL_HANDLER_ARGS); int (*smc_light_right)(SYSCTL_HANDLER_ARGS); + int (*smc_light_control)(SYSCTL_HANDLER_ARGS); const char *smc_temps[ASMC_TEMP_MAX]; const char *smc_tempnames[ASMC_TEMP_MAX]; @@ -131,18 +135,19 @@ static struct asmc_model *asmc_match(dev asmc_mb_sysctl_fanmaxspeed, \ asmc_mb_sysctl_fantargetspeed #define ASMC_LIGHT_FUNCS asmc_mbp_sysctl_light_left, \ - asmc_mbp_sysctl_light_right + asmc_mbp_sysctl_light_right, \ + asmc_mbp_sysctl_light_control struct asmc_model asmc_models[] = { { "MacBook1,1", "Apple SMC MacBook Core Duo", - ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, + ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL, ASMC_MB_TEMPS, ASMC_MB_TEMPNAMES, ASMC_MB_TEMPDESCS }, { "MacBook2,1", "Apple SMC MacBook Core 2 Duo", - ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, + ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL, ASMC_MB_TEMPS, ASMC_MB_TEMPNAMES, ASMC_MB_TEMPDESCS }, @@ -182,12 +187,18 @@ struct asmc_model asmc_models[] = { ASMC_MBP_TEMPS, ASMC_MBP_TEMPNAMES, ASMC_MBP_TEMPDESCS }, + { + "MacBookPro4,1", "Apple SMC MacBook Pro Core 2 Duo (Penryn)", + ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, ASMC_LIGHT_FUNCS, + ASMC_MBP4_TEMPS, ASMC_MBP4_TEMPNAMES, ASMC_MBP4_TEMPDESCS + }, + /* The Mac Mini has no SMS */ { "Macmini1,1", "Apple SMC Mac Mini", NULL, NULL, NULL, ASMC_FAN_FUNCS, - NULL, NULL, + NULL, NULL, NULL, ASMC_MM_TEMPS, ASMC_MM_TEMPNAMES, ASMC_MM_TEMPDESCS }, @@ -196,13 +207,13 @@ struct asmc_model asmc_models[] = { "MacPro2", "Apple SMC Mac Pro (8-core)", NULL, NULL, NULL, ASMC_FAN_FUNCS, - NULL, NULL, + NULL, NULL, NULL, ASMC_MP_TEMPS, ASMC_MP_TEMPNAMES, ASMC_MP_TEMPDESCS }, { "MacBookAir1,1", "Apple SMC MacBook Air", - ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, + ASMC_SMS_FUNCS, ASMC_FAN_FUNCS, NULL, NULL, NULL, ASMC_MBA_TEMPS, ASMC_MBA_TEMPNAMES, ASMC_MBA_TEMPDESCS }, @@ -242,6 +253,7 @@ ACPI_MODULE_NAME("ASMC") #define ASMC_DPRINTF(str) #endif +/* NB: can't be const */ static char *asmc_ids[] = { "APP0001", NULL }; static devclass_t asmc_devclass; @@ -385,6 +397,33 @@ asmc_attach(device_t dev) model->smc_tempdescs[i]); } + /* + * dev.asmc.n.light + */ + if (model->smc_light_left) { + sc->sc_light_tree = SYSCTL_ADD_NODE(sysctlctx, + SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "light", + CTLFLAG_RD, 0, "Keyboard backlight sensors"); + + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sc->sc_light_tree), + OID_AUTO, "left", CTLTYPE_INT | CTLFLAG_RD, + dev, 0, model->smc_light_left, "I", + "Keyboard backlight left sensor"); + + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sc->sc_light_tree), + OID_AUTO, "right", CTLTYPE_INT | CTLFLAG_RD, + dev, 0, model->smc_light_right, "I", + "Keyboard backlight right sensor"); + + SYSCTL_ADD_PROC(sysctlctx, + SYSCTL_CHILDREN(sc->sc_light_tree), + OID_AUTO, "control", CTLTYPE_INT | CTLFLAG_RW, + dev, 0, model->smc_light_control, "I", + "Keyboard backlight brightness control"); + } + if (model->smc_sms_x == NULL) goto nosms; @@ -414,27 +453,6 @@ asmc_attach(device_t dev) "Sudden Motion Sensor Z value"); /* - * dev.asmc.n.light - */ - if (model->smc_light_left) { - sc->sc_light_tree = SYSCTL_ADD_NODE(sysctlctx, - SYSCTL_CHILDREN(sysctlnode), OID_AUTO, "light", - CTLFLAG_RD, 0, "Keyboard backlight sensors"); - - SYSCTL_ADD_PROC(sysctlctx, - SYSCTL_CHILDREN(sc->sc_light_tree), - OID_AUTO, "left", CTLTYPE_INT | CTLFLAG_RW, - dev, 0, model->smc_light_left, "I", - "Keyboard backlight left sensor"); - - SYSCTL_ADD_PROC(sysctlctx, - SYSCTL_CHILDREN(sc->sc_light_tree), - OID_AUTO, "right", CTLTYPE_INT | CTLFLAG_RW, - dev, 0, model->smc_light_right, "I", - "Keyboard backlight right sensor"); - } - - /* * Need a taskqueue to send devctl_notify() events * when the SMS interrupt us. * @@ -606,38 +624,81 @@ nosms: /* * We need to make sure that the SMC acks the byte sent. - * Just wait up to 100 ms. + * Just wait up to (amount * 10) ms. */ static int -asmc_wait(device_t dev, uint8_t val) +asmc_wait_ack(device_t dev, uint8_t val, int amount) { struct asmc_softc *sc = device_get_softc(dev); u_int i; val = val & ASMC_STATUS_MASK; - for (i = 0; i < 1000; i++) { + for (i = 0; i < amount; i++) { if ((ASMC_CMDPORT_READ(sc) & ASMC_STATUS_MASK) == val) return (0); DELAY(10); } + return (1); +} + +/* + * We need to make sure that the SMC acks the byte sent. + * Just wait up to 100 ms. + */ +static int +asmc_wait(device_t dev, uint8_t val) +{ + struct asmc_softc *sc; + + if (asmc_wait_ack(dev, val, 1000) == 0) + return (0); + + sc = device_get_softc(dev); + val = val & ASMC_STATUS_MASK; + +#ifdef DEBUG device_printf(dev, "%s failed: 0x%x, 0x%x\n", __func__, val, ASMC_CMDPORT_READ(sc)); +#endif + return (1); +} +/* + * Send the given command, retrying up to 10 times if + * the acknowledgement fails. + */ +static int +asmc_command(device_t dev, uint8_t command) { + + int i; + struct asmc_softc *sc = device_get_softc(dev); + + for (i=0; i < 10; i++) { + ASMC_CMDPORT_WRITE(sc, command); + if (asmc_wait_ack(dev, 0x0c, 100) == 0) { + return (0); + } + } + +#ifdef DEBUG + device_printf(dev, "%s failed: 0x%x, 0x%x\n", __func__, command, + ASMC_CMDPORT_READ(sc)); +#endif return (1); } static int asmc_key_read(device_t dev, const char *key, uint8_t *buf, uint8_t len) { - int i, error = 1; + int i, error = 1, try = 0; struct asmc_softc *sc = device_get_softc(dev); mtx_lock_spin(&sc->sc_mtx); - ASMC_CMDPORT_WRITE(sc, ASMC_CMDREAD); - if (asmc_wait(dev, 0x0c)) +begin: + if (asmc_command(dev, ASMC_CMDREAD)) goto out; for (i = 0; i < 4; i++) { @@ -656,6 +717,12 @@ asmc_key_read(device_t dev, const char * error = 0; out: + if (error) { + if (++try < 10) goto begin; + device_printf(dev,"%s for key %s failed %d times, giving up\n", + __func__, key, try); + } + mtx_unlock_spin(&sc->sc_mtx); return (error); @@ -664,14 +731,14 @@ out: static int asmc_key_write(device_t dev, const char *key, uint8_t *buf, uint8_t len) { - int i, error = -1; + int i, error = -1, try = 0; struct asmc_softc *sc = device_get_softc(dev); mtx_lock_spin(&sc->sc_mtx); +begin: ASMC_DPRINTF(("cmd port: cmd write\n")); - ASMC_CMDPORT_WRITE(sc, ASMC_CMDWRITE); - if (asmc_wait(dev, 0x0c)) + if (asmc_command(dev, ASMC_CMDWRITE)) goto out; ASMC_DPRINTF(("data port: key\n")); @@ -692,6 +759,12 @@ asmc_key_write(device_t dev, const char error = 0; out: + if (error) { + if (++try < 10) goto begin; + device_printf(dev,"%s for key %s failed %d times, giving up\n", + __func__, key, try); + } + mtx_unlock_spin(&sc->sc_mtx); return (error); @@ -993,20 +1066,11 @@ asmc_mbp_sysctl_light_left(SYSCTL_HANDLE device_t dev = (device_t) arg1; uint8_t buf[6]; int error; - unsigned int level; int32_t v; asmc_key_read(dev, ASMC_KEY_LIGHTLEFT, buf, 6); v = buf[2]; error = sysctl_handle_int(oidp, &v, sizeof(v), req); - if (error == 0 && req->newptr != NULL) { - level = *(unsigned int *)req->newptr; - if (level > 255) - return (EINVAL); - buf[0] = level; - buf[1] = 0x00; - asmc_key_write(dev, ASMC_KEY_LIGHTVALUE, buf, 2); - } return (error); } @@ -1017,16 +1081,30 @@ asmc_mbp_sysctl_light_right(SYSCTL_HANDL device_t dev = (device_t) arg1; uint8_t buf[6]; int error; - unsigned int level; int32_t v; asmc_key_read(dev, ASMC_KEY_LIGHTRIGHT, buf, 6); v = buf[2]; error = sysctl_handle_int(oidp, &v, sizeof(v), req); + + return (error); +} + +static int +asmc_mbp_sysctl_light_control(SYSCTL_HANDLER_ARGS) +{ + device_t dev = (device_t) arg1; + uint8_t buf[2]; + int error; + unsigned int level; + static int32_t v; + + error = sysctl_handle_int(oidp, &v, sizeof(v), req); if (error == 0 && req->newptr != NULL) { level = *(unsigned int *)req->newptr; if (level > 255) return (EINVAL); + v = level; buf[0] = level; buf[1] = 0x00; asmc_key_write(dev, ASMC_KEY_LIGHTVALUE, buf, 2); Modified: head/sys/dev/asmc/asmcvar.h ============================================================================== --- head/sys/dev/asmc/asmcvar.h Fri Jun 26 09:32:31 2009 (r195045) +++ head/sys/dev/asmc/asmcvar.h Fri Jun 26 10:23:17 2009 (r195046) @@ -155,6 +155,25 @@ struct asmc_softc { "Graphics Chip", "Graphics Heatsink", \ "Unknown", } +#define ASMC_MBP4_TEMPS { "TB0T", "Th0H", "Th1H", "Th2H", "Tm0P", \ + "TG0H", "TG0D", "TC0D", "TC0P", "Ts0P", \ + "TTF0", "TW0P", NULL } + +#define ASMC_MBP4_TEMPNAMES { "enclosure", "heatsink1", "heatsink2", \ + "heatsink3", "memory", "graphicssink", \ + "graphics", "cpu", "cpu2", "unknown1", \ + "unknown2", "wireless", } + +#define ASMC_MBP4_TEMPDESCS { "Enclosure Bottomside", \ + "Main Heatsink 1", "Main Heatsink 2", \ + "Main Heatsink 3", \ + "Memory Controller", \ + "Graphics Chip Heatsink", \ + "Graphics Chip Diode", \ + "CPU Temperature Diode", "CPU Point 2", \ + "Unknown", "Unknown", \ + "Wireless Module", } + #define ASMC_MM_TEMPS { "TN0P", "TN1P", NULL } #define ASMC_MM_TEMPNAMES { "northbridge1", "northbridge2" } #define ASMC_MM_TEMPDESCS { "Northbridge Point 1", \ From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 11:45:08 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 404DD106566C; Fri, 26 Jun 2009 11:45:08 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 29BA78FC15; Fri, 26 Jun 2009 11:45:08 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5QBj8iC085387; Fri, 26 Jun 2009 11:45:08 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5QBj7KP085340; Fri, 26 Jun 2009 11:45:07 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906261145.n5QBj7KP085340@svn.freebsd.org> From: Robert Watson Date: Fri, 26 Jun 2009 11:45: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: r195049 - in head/sys: arm/at91 arm/xscale/ixp425 dev/ae dev/age dev/alc dev/ale dev/ath dev/bce dev/bfe dev/bge dev/bm dev/cas dev/cs dev/dc dev/de dev/e1000 dev/ed dev/et dev/ex dev/f... X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 11:45:08 -0000 Author: rwatson Date: Fri Jun 26 11:45:06 2009 New Revision: 195049 URL: http://svn.freebsd.org/changeset/base/195049 Log: Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/ IF_ADDR_UNLOCK() across network device drivers when accessing the per-interface multicast address list, if_multiaddrs. This will allow us to change the locking strategy without affecting our driver programming interface or binary interface. For two wireless drivers, remove unnecessary locking, since they don't actually access the multicast address list. Approved by: re (kib) MFC after: 6 weeks Modified: head/sys/arm/at91/if_ate.c head/sys/arm/xscale/ixp425/if_npe.c head/sys/dev/ae/if_ae.c head/sys/dev/age/if_age.c head/sys/dev/alc/if_alc.c head/sys/dev/ale/if_ale.c head/sys/dev/ath/if_ath.c head/sys/dev/bce/if_bce.c head/sys/dev/bfe/if_bfe.c head/sys/dev/bge/if_bge.c head/sys/dev/bm/if_bm.c head/sys/dev/cas/if_cas.c head/sys/dev/cs/if_cs.c head/sys/dev/dc/if_dc.c head/sys/dev/de/if_de.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/ed/if_ed.c head/sys/dev/et/if_et.c head/sys/dev/ex/if_ex.c head/sys/dev/fe/if_fe.c head/sys/dev/fxp/if_fxp.c head/sys/dev/gem/if_gem.c head/sys/dev/hme/if_hme.c head/sys/dev/ie/if_ie.c head/sys/dev/if_ndis/if_ndis.c head/sys/dev/ixgb/if_ixgb.c head/sys/dev/ixgbe/ixgbe.c head/sys/dev/jme/if_jme.c head/sys/dev/le/lance.c head/sys/dev/lge/if_lge.c head/sys/dev/malo/if_malo.c head/sys/dev/mge/if_mge.c head/sys/dev/msk/if_msk.c head/sys/dev/mxge/if_mxge.c head/sys/dev/my/if_my.c head/sys/dev/nfe/if_nfe.c head/sys/dev/nge/if_nge.c head/sys/dev/nve/if_nve.c head/sys/dev/nxge/if_nxge.c head/sys/dev/pcn/if_pcn.c head/sys/dev/pdq/pdq_ifsubr.c head/sys/dev/re/if_re.c head/sys/dev/sf/if_sf.c head/sys/dev/sis/if_sis.c head/sys/dev/sk/if_sk.c head/sys/dev/sn/if_sn.c head/sys/dev/snc/dp83932.c head/sys/dev/ste/if_ste.c head/sys/dev/stge/if_stge.c head/sys/dev/ti/if_ti.c head/sys/dev/tl/if_tl.c head/sys/dev/tsec/if_tsec.c head/sys/dev/tx/if_tx.c head/sys/dev/txp/if_txp.c head/sys/dev/usb/net/if_aue.c head/sys/dev/usb/net/if_axe.c head/sys/dev/usb/net/if_cue.c head/sys/dev/usb/net/if_kue.c head/sys/dev/usb/net/if_rue.c head/sys/dev/usb/net/if_udav.c head/sys/dev/usb/wlan/if_upgt.c head/sys/dev/usb/wlan/if_urtw.c head/sys/dev/usb/wlan/if_zyd.c head/sys/dev/vge/if_vge.c head/sys/dev/vr/if_vr.c head/sys/dev/wb/if_wb.c head/sys/dev/wi/if_wi.c head/sys/dev/wl/if_wl.c head/sys/dev/xe/if_xe.c head/sys/dev/xl/if_xl.c head/sys/mips/adm5120/if_admsw.c head/sys/netgraph/ng_ether.c head/sys/pci/if_rl.c Modified: head/sys/arm/at91/if_ate.c ============================================================================== --- head/sys/arm/at91/if_ate.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/arm/at91/if_ate.c Fri Jun 26 11:45:06 2009 (r195049) @@ -413,7 +413,7 @@ ate_setmcast(struct ate_softc *sc) */ mcaf[0] = 0; mcaf[1] = 0; - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -421,14 +421,14 @@ ate_setmcast(struct ate_softc *sc) ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; af[index >> 3] |= 1 << (index & 7); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); /* * Write the hash to the hash register. This card can also * accept unicast packets as well as multicast packets using this * register for easier bridging operations, but we don't take * advantage of that. Locks here are to avoid LOR with the - * IF_ADDR_LOCK, but might not be strictly necessary. + * if_maddr_rlock, but might not be strictly necessary. */ WR4(sc, ETH_HSL, mcaf[0]); WR4(sc, ETH_HSH, mcaf[1]); Modified: head/sys/arm/xscale/ixp425/if_npe.c ============================================================================== --- head/sys/arm/xscale/ixp425/if_npe.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/arm/xscale/ixp425/if_npe.c Fri Jun 26 11:45:06 2009 (r195049) @@ -435,7 +435,7 @@ npe_setmcast(struct npe_softc *sc) memset(clr, 0, ETHER_ADDR_LEN); memset(set, 0xff, ETHER_ADDR_LEN); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -445,7 +445,7 @@ npe_setmcast(struct npe_softc *sc) set[i] &= mac[i]; } } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); for (i = 0; i < ETHER_ADDR_LEN; i++) { mask[i] = set[i] | ~clr[i]; Modified: head/sys/dev/ae/if_ae.c ============================================================================== --- head/sys/dev/ae/if_ae.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/ae/if_ae.c Fri Jun 26 11:45:06 2009 (r195049) @@ -2073,7 +2073,7 @@ ae_rxfilter(ae_softc_t *sc) * Load multicast tables. */ bzero(mchash, sizeof(mchash)); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -2081,7 +2081,7 @@ ae_rxfilter(ae_softc_t *sc) ifma->ifma_addr), ETHER_ADDR_LEN); mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); AE_WRITE_4(sc, AE_REG_MHT0, mchash[0]); AE_WRITE_4(sc, AE_REG_MHT1, mchash[1]); AE_WRITE_4(sc, AE_MAC_REG, rxcfg); Modified: head/sys/dev/age/if_age.c ============================================================================== --- head/sys/dev/age/if_age.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/age/if_age.c Fri Jun 26 11:45:06 2009 (r195049) @@ -3131,7 +3131,7 @@ age_rxfilter(struct age_softc *sc) /* Program new filter. */ bzero(mchash, sizeof(mchash)); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &sc->age_ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -3139,7 +3139,7 @@ age_rxfilter(struct age_softc *sc) ifma->ifma_addr), ETHER_ADDR_LEN); mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); CSR_WRITE_4(sc, AGE_MAR0, mchash[0]); CSR_WRITE_4(sc, AGE_MAR1, mchash[1]); Modified: head/sys/dev/alc/if_alc.c ============================================================================== --- head/sys/dev/alc/if_alc.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/alc/if_alc.c Fri Jun 26 11:45:06 2009 (r195049) @@ -3446,7 +3446,7 @@ alc_rxfilter(struct alc_softc *sc) goto chipit; } - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &sc->alc_ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -3454,7 +3454,7 @@ alc_rxfilter(struct alc_softc *sc) ifma->ifma_addr), ETHER_ADDR_LEN); mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); chipit: CSR_WRITE_4(sc, ALC_MAR0, mchash[0]); Modified: head/sys/dev/ale/if_ale.c ============================================================================== --- head/sys/dev/ale/if_ale.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/ale/if_ale.c Fri Jun 26 11:45:06 2009 (r195049) @@ -3048,7 +3048,7 @@ ale_rxfilter(struct ale_softc *sc) /* Program new filter. */ bzero(mchash, sizeof(mchash)); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &sc->ale_ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -3056,7 +3056,7 @@ ale_rxfilter(struct ale_softc *sc) ifma->ifma_addr), ETHER_ADDR_LEN); mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); CSR_WRITE_4(sc, ALE_MAR0, mchash[0]); CSR_WRITE_4(sc, ALE_MAR1, mchash[1]); Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/ath/if_ath.c Fri Jun 26 11:45:06 2009 (r195049) @@ -2408,7 +2408,7 @@ ath_update_mcast(struct ifnet *ifp) * Merge multicast addresses to form the hardware filter. */ mfilt[0] = mfilt[1] = 0; - IF_ADDR_LOCK(ifp); /* XXX need some fiddling to remove? */ + if_maddr_rlock(ifp); /* XXX need some fiddling to remove? */ TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { caddr_t dl; u_int32_t val; @@ -2423,7 +2423,7 @@ ath_update_mcast(struct ifnet *ifp) pos &= 0x3f; mfilt[pos / 32] |= (1 << (pos % 32)); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); } else mfilt[0] = mfilt[1] = ~0; ath_hal_setmcastfilter(sc->sc_ah, mfilt[0], mfilt[1]); Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/bce/if_bce.c Fri Jun 26 11:45:06 2009 (r195049) @@ -7260,7 +7260,7 @@ bce_set_rx_mode(struct bce_softc *sc) /* Accept one or more multicast(s). */ DBPRINT(sc, BCE_INFO_MISC, "Enabling selective multicast mode.\n"); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -7268,7 +7268,7 @@ bce_set_rx_mode(struct bce_softc *sc) ifma->ifma_addr), ETHER_ADDR_LEN) & 0xFF; hashes[(h & 0xE0) >> 5] |= 1 << (h & 0x1F); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); for (i = 0; i < NUM_MC_HASH_REGISTERS; i++) REG_WR(sc, BCE_EMAC_MULTICAST_HASH0 + (i * 4), hashes[i]); Modified: head/sys/dev/bfe/if_bfe.c ============================================================================== --- head/sys/dev/bfe/if_bfe.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/bfe/if_bfe.c Fri Jun 26 11:45:06 2009 (r195049) @@ -1111,14 +1111,14 @@ bfe_set_rx_mode(struct bfe_softc *sc) val |= BFE_RXCONF_ALLMULTI; else { val &= ~BFE_RXCONF_ALLMULTI; - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; bfe_cam_write(sc, LLADDR((struct sockaddr_dl *)ifma->ifma_addr), i++); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); } CSR_WRITE_4(sc, BFE_RXCONF, val); Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/bge/if_bge.c Fri Jun 26 11:45:06 2009 (r195049) @@ -1186,7 +1186,7 @@ bge_setmulti(struct bge_softc *sc) CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), 0); /* Now program new ones. */ - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1194,7 +1194,7 @@ bge_setmulti(struct bge_softc *sc) ifma->ifma_addr), ETHER_ADDR_LEN) & 0x7F; hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); for (i = 0; i < 4; i++) CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), hashes[i]); Modified: head/sys/dev/bm/if_bm.c ============================================================================== --- head/sys/dev/bm/if_bm.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/bm/if_bm.c Fri Jun 26 11:45:06 2009 (r195049) @@ -1072,7 +1072,7 @@ bm_setladrf(struct bm_softc *sc) /* Clear the hash table. */ memset(hash, 0, sizeof(hash)); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { if (inm->ifma_addr->sa_family != AF_LINK) continue; @@ -1085,7 +1085,7 @@ bm_setladrf(struct bm_softc *sc) /* Set the corresponding bit in the filter. */ hash[crc >> 4] |= 1 << (crc & 0xf); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); } /* Write out new hash table */ Modified: head/sys/dev/cas/if_cas.c ============================================================================== --- head/sys/dev/cas/if_cas.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/cas/if_cas.c Fri Jun 26 11:45:06 2009 (r195049) @@ -2531,7 +2531,7 @@ cas_setladrf(struct cas_softc *sc) /* Clear the hash table. */ memset(hash, 0, sizeof(hash)); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { if (inm->ifma_addr->sa_family != AF_LINK) continue; @@ -2544,7 +2544,7 @@ cas_setladrf(struct cas_softc *sc) /* Set the corresponding bit in the filter. */ hash[crc >> 4] |= 1 << (15 - (crc & 15)); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); v |= CAS_MAC_RX_CONF_HFILTER; Modified: head/sys/dev/cs/if_cs.c ============================================================================== --- head/sys/dev/cs/if_cs.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/cs/if_cs.c Fri Jun 26 11:45:06 2009 (r195049) @@ -1022,7 +1022,7 @@ cs_setmode(struct cs_softc *sc) * Set up the filter to only accept multicast * frames we're interested in. */ - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { struct sockaddr_dl *dl = (struct sockaddr_dl *)ifma->ifma_addr; @@ -1032,7 +1032,7 @@ cs_setmode(struct cs_softc *sc) mask = (u_int16_t) (1 << (index & 0xf)); af[port] |= mask; } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); } cs_writereg(sc, PP_LAF + 0, af[0]); Modified: head/sys/dev/dc/if_dc.c ============================================================================== --- head/sys/dev/dc/if_dc.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/dc/if_dc.c Fri Jun 26 11:45:06 2009 (r195049) @@ -1110,7 +1110,7 @@ dc_setfilt_21143(struct dc_softc *sc) else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1118,7 +1118,7 @@ dc_setfilt_21143(struct dc_softc *sc) LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); sp[h >> 4] |= htole32(1 << (h & 0xF)); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); if (ifp->if_flags & IFF_BROADCAST) { h = dc_mchash_le(sc, ifp->if_broadcastaddr); @@ -1185,7 +1185,7 @@ dc_setfilt_admtek(struct dc_softc *sc) return; /* Now program new ones. */ - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1200,7 +1200,7 @@ dc_setfilt_admtek(struct dc_softc *sc) else hashes[1] |= (1 << (h - 32)); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); CSR_WRITE_4(sc, DC_AL_MAR0, hashes[0]); CSR_WRITE_4(sc, DC_AL_MAR1, hashes[1]); @@ -1258,7 +1258,7 @@ dc_setfilt_asix(struct dc_softc *sc) return; /* now program new ones */ - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1268,7 +1268,7 @@ dc_setfilt_asix(struct dc_softc *sc) else hashes[1] |= (1 << (h - 32)); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_MAR0); CSR_WRITE_4(sc, DC_AX_FILTDATA, hashes[0]); @@ -1313,7 +1313,7 @@ dc_setfilt_xircom(struct dc_softc *sc) else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1321,7 +1321,7 @@ dc_setfilt_xircom(struct dc_softc *sc) LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); sp[h >> 4] |= htole32(1 << (h & 0xF)); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); if (ifp->if_flags & IFF_BROADCAST) { h = dc_mchash_le(sc, ifp->if_broadcastaddr); Modified: head/sys/dev/de/if_de.c ============================================================================== --- head/sys/dev/de/if_de.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/de/if_de.c Fri Jun 26 11:45:06 2009 (r195049) @@ -3041,7 +3041,7 @@ tulip_addr_filter(tulip_softc_t * const multicnt = 0; ifp = sc->tulip_ifp; - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); /* Copy MAC address on stack to align. */ if (ifp->if_input != NULL) @@ -3134,7 +3134,7 @@ tulip_addr_filter(tulip_softc_t * const *sp++ = TULIP_SP_MAC(eaddr[2]); } } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); } static void Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/e1000/if_em.c Fri Jun 26 11:45:06 2009 (r195049) @@ -2538,7 +2538,7 @@ em_set_multi(struct adapter *adapter) if (mta == NULL) panic("em_set_multi memory failure\n"); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -2550,7 +2550,7 @@ em_set_multi(struct adapter *adapter) &mta[mcnt * ETH_ADDR_LEN], ETH_ADDR_LEN); mcnt++; } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES) { reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/e1000/if_igb.c Fri Jun 26 11:45:06 2009 (r195049) @@ -1886,7 +1886,7 @@ igb_set_multi(struct adapter *adapter) IOCTL_DEBUGOUT("igb_set_multi: begin"); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1898,7 +1898,7 @@ igb_set_multi(struct adapter *adapter) &mta[mcnt * ETH_ADDR_LEN], ETH_ADDR_LEN); mcnt++; } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES) { reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); Modified: head/sys/dev/ed/if_ed.c ============================================================================== --- head/sys/dev/ed/if_ed.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/ed/if_ed.c Fri Jun 26 11:45:06 2009 (r195049) @@ -1614,7 +1614,7 @@ ed_ds_getmcaf(struct ed_softc *sc, uint3 mcaf[0] = 0; mcaf[1] = 0; - IF_ADDR_LOCK(sc->ifp); + if_maddr_rlock(sc->ifp); TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1622,7 +1622,7 @@ ed_ds_getmcaf(struct ed_softc *sc, uint3 ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; af[index >> 3] |= 1 << (index & 7); } - IF_ADDR_UNLOCK(sc->ifp); + if_maddr_runlock(sc->ifp); } int Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/et/if_et.c Fri Jun 26 11:45:06 2009 (r195049) @@ -1361,7 +1361,7 @@ et_setmulti(struct et_softc *sc) } count = 0; - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { uint32_t *hp, h; @@ -1387,7 +1387,7 @@ et_setmulti(struct et_softc *sc) ++count; } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); for (i = 0; i < 4; ++i) CSR_WRITE_4(sc, ET_MULTI_HASH + (i * 4), hash[i]); Modified: head/sys/dev/ex/if_ex.c ============================================================================== --- head/sys/dev/ex/if_ex.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/ex/if_ex.c Fri Jun 26 11:45:06 2009 (r195049) @@ -870,13 +870,13 @@ ex_setmulti(struct ex_softc *sc) ifp = sc->ifp; count = 0; - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) { if (maddr->ifma_addr->sa_family != AF_LINK) continue; count++; } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); if ((ifp->if_flags & IFF_PROMISC) || (ifp->if_flags & IFF_ALLMULTI) || count > 63) { @@ -904,7 +904,7 @@ ex_setmulti(struct ex_softc *sc) CSR_WRITE_2(sc, IO_PORT_REG, 0); CSR_WRITE_2(sc, IO_PORT_REG, (count + 1) * 6); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(maddr, &ifp->if_multiaddrs, ifma_link) { if (maddr->ifma_addr->sa_family != AF_LINK) continue; @@ -915,7 +915,7 @@ ex_setmulti(struct ex_softc *sc) CSR_WRITE_2(sc, IO_PORT_REG, *addr++); CSR_WRITE_2(sc, IO_PORT_REG, *addr++); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); /* Program our MAC address as well */ /* XXX: Is this necessary? The Linux driver does this Modified: head/sys/dev/fe/if_fe.c ============================================================================== --- head/sys/dev/fe/if_fe.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/fe/if_fe.c Fri Jun 26 11:45:06 2009 (r195049) @@ -2080,7 +2080,7 @@ fe_mcaf ( struct fe_softc *sc ) struct ifmultiaddr *ifma; filter = fe_filter_nothing; - IF_ADDR_LOCK(sc->ifp); + if_maddr_rlock(sc->ifp); TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -2093,7 +2093,7 @@ fe_mcaf ( struct fe_softc *sc ) filter.data[index >> 3] |= 1 << (index & 7); } - IF_ADDR_UNLOCK(sc->ifp); + if_maddr_runlock(sc->ifp); return ( filter ); } Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/fxp/if_fxp.c Fri Jun 26 11:45:06 2009 (r195049) @@ -2851,7 +2851,7 @@ fxp_mc_addrs(struct fxp_softc *sc) nmcasts = 0; if ((ifp->if_flags & IFF_ALLMULTI) == 0) { - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -2864,7 +2864,7 @@ fxp_mc_addrs(struct fxp_softc *sc) &sc->mcsp->mc_addr[nmcasts][0], ETHER_ADDR_LEN); nmcasts++; } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); } mcsp->mc_cnt = htole16(nmcasts * ETHER_ADDR_LEN); return (nmcasts); Modified: head/sys/dev/gem/if_gem.c ============================================================================== --- head/sys/dev/gem/if_gem.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/gem/if_gem.c Fri Jun 26 11:45:06 2009 (r195049) @@ -2201,7 +2201,7 @@ gem_setladrf(struct gem_softc *sc) /* Clear the hash table. */ memset(hash, 0, sizeof(hash)); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { if (inm->ifma_addr->sa_family != AF_LINK) continue; @@ -2214,7 +2214,7 @@ gem_setladrf(struct gem_softc *sc) /* Set the corresponding bit in the filter. */ hash[crc >> 4] |= 1 << (15 - (crc & 15)); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); v |= GEM_MAC_RX_HASH_FILTER; Modified: head/sys/dev/hme/if_hme.c ============================================================================== --- head/sys/dev/hme/if_hme.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/hme/if_hme.c Fri Jun 26 11:45:06 2009 (r195049) @@ -1710,7 +1710,7 @@ hme_setladrf(struct hme_softc *sc, int r * the word. */ - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { if (inm->ifma_addr->sa_family != AF_LINK) continue; @@ -1723,7 +1723,7 @@ hme_setladrf(struct hme_softc *sc, int r /* Set the corresponding bit in the filter. */ hash[crc >> 4] |= 1 << (crc & 0xf); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); chipit: /* Now load the hash table into the chip */ Modified: head/sys/dev/ie/if_ie.c ============================================================================== --- head/sys/dev/ie/if_ie.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/ie/if_ie.c Fri Jun 26 11:45:06 2009 (r195049) @@ -1675,7 +1675,7 @@ ie_mc_reset(struct ie_softc *sc) * Step through the list of addresses. */ sc->mcast_count = 0; - IF_ADDR_LOCK(sc->ifp); + if_maddr_rlock(sc->ifp); TAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1691,7 +1691,7 @@ ie_mc_reset(struct ie_softc *sc) &(sc->mcast_addrs[sc->mcast_count]), 6); sc->mcast_count++; } - IF_ADDR_UNLOCK(sc->ifp); + if_maddr_runlock(sc->ifp); setflag: sc->want_mcsetup = 1; Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/if_ndis/if_ndis.c Fri Jun 26 11:45:06 2009 (r195049) @@ -320,7 +320,7 @@ ndis_setmulti(sc) sc->ndis_filter |= NDIS_PACKET_TYPE_MULTICAST; len = 0; - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -328,13 +328,13 @@ ndis_setmulti(sc) mclist + (ETHER_ADDR_LEN * len), ETHER_ADDR_LEN); len++; if (len > mclistsz) { - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); sc->ndis_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; sc->ndis_filter &= ~NDIS_PACKET_TYPE_MULTICAST; goto out; } } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); len = len * ETHER_ADDR_LEN; error = ndis_set_info(sc, OID_802_3_MULTICAST_LIST, mclist, &len); Modified: head/sys/dev/ixgb/if_ixgb.c ============================================================================== --- head/sys/dev/ixgb/if_ixgb.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/ixgb/if_ixgb.c Fri Jun 26 11:45:06 2009 (r195049) @@ -1090,7 +1090,7 @@ ixgb_set_multi(struct adapter * adapter) IOCTL_DEBUGOUT("ixgb_set_multi: begin"); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); #if __FreeBSD_version < 500000 LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { #else @@ -1103,7 +1103,7 @@ ixgb_set_multi(struct adapter * adapter) &mta[mcnt * IXGB_ETH_LENGTH_OF_ADDRESS], IXGB_ETH_LENGTH_OF_ADDRESS); mcnt++; } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); if (mcnt > MAX_NUM_MULTICAST_ADDRESSES) { reg_rctl = IXGB_READ_REG(&adapter->hw, RCTL); Modified: head/sys/dev/ixgbe/ixgbe.c ============================================================================== --- head/sys/dev/ixgbe/ixgbe.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/ixgbe/ixgbe.c Fri Jun 26 11:45:06 2009 (r195049) @@ -1883,7 +1883,7 @@ ixgbe_set_multi(struct adapter *adapter) IXGBE_WRITE_REG(&adapter->hw, IXGBE_FCTRL, fctrl); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1892,7 +1892,7 @@ ixgbe_set_multi(struct adapter *adapter) IXGBE_ETH_LENGTH_OF_ADDRESS); mcnt++; } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); update_ptr = mta; ixgbe_update_mc_addr_list(&adapter->hw, Modified: head/sys/dev/jme/if_jme.c ============================================================================== --- head/sys/dev/jme/if_jme.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/jme/if_jme.c Fri Jun 26 11:45:06 2009 (r195049) @@ -3122,7 +3122,7 @@ jme_set_filter(struct jme_softc *sc) rxcfg |= RXMAC_MULTICAST; bzero(mchash, sizeof(mchash)); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &sc->jme_ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -3135,7 +3135,7 @@ jme_set_filter(struct jme_softc *sc) /* Set the corresponding bit in the hash table. */ mchash[crc >> 5] |= 1 << (crc & 0x1f); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); CSR_WRITE_4(sc, JME_MAR0, mchash[0]); CSR_WRITE_4(sc, JME_MAR1, mchash[1]); Modified: head/sys/dev/le/lance.c ============================================================================== --- head/sys/dev/le/lance.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/le/lance.c Fri Jun 26 11:45:06 2009 (r195049) @@ -605,7 +605,7 @@ lance_setladrf(struct lance_softc *sc, u } af[0] = af[1] = af[2] = af[3] = 0x0000; - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -619,7 +619,7 @@ lance_setladrf(struct lance_softc *sc, u /* Set the corresponding bit in the filter. */ af[crc >> 4] |= LE_HTOLE16(1 << (crc & 0xf)); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); } /* Modified: head/sys/dev/lge/if_lge.c ============================================================================== --- head/sys/dev/lge/if_lge.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/lge/if_lge.c Fri Jun 26 11:45:06 2009 (r195049) @@ -393,7 +393,7 @@ lge_setmulti(sc) CSR_WRITE_4(sc, LGE_MAR1, 0); /* now program new ones */ - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -404,7 +404,7 @@ lge_setmulti(sc) else hashes[1] |= (1 << (h - 32)); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); CSR_WRITE_4(sc, LGE_MAR0, hashes[0]); CSR_WRITE_4(sc, LGE_MAR1, hashes[1]); Modified: head/sys/dev/malo/if_malo.c ============================================================================== --- head/sys/dev/malo/if_malo.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/malo/if_malo.c Fri Jun 26 11:45:06 2009 (r195049) @@ -1577,14 +1577,14 @@ malo_setmcastfilter(struct malo_softc *s (ifp->if_flags & (IFF_ALLMULTI | IFF_PROMISC))) goto all; - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; if (nmc == MALO_HAL_MCAST_MAX) { ifp->if_flags |= IFF_ALLMULTI; - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); goto all; } IEEE80211_ADDR_COPY(mp, @@ -1592,7 +1592,7 @@ malo_setmcastfilter(struct malo_softc *s mp += IEEE80211_ADDR_LEN, nmc++; } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); malo_hal_setmcast(sc->malo_mh, nmc, macs); Modified: head/sys/dev/mge/if_mge.c ============================================================================== --- head/sys/dev/mge/if_mge.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/mge/if_mge.c Fri Jun 26 11:45:06 2009 (r195049) @@ -1731,7 +1731,7 @@ mge_setup_multicast(struct mge_softc *sc memset(smt, 0, sizeof(smt)); memset(omt, 0, sizeof(omt)); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1745,7 +1745,7 @@ mge_setup_multicast(struct mge_softc *sc omt[i >> 2] |= v << ((i & 0x03) << 3); } } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); } for (i = 0; i < MGE_MCAST_REG_NUMBER; i++) { Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/msk/if_msk.c Fri Jun 26 11:45:06 2009 (r195049) @@ -601,7 +601,7 @@ msk_rxfilter(struct msk_if_softc *sc_if) mchash[1] = 0xffff; } else { mode |= GM_RXCR_UCF_ENA; - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -612,7 +612,7 @@ msk_rxfilter(struct msk_if_softc *sc_if) /* Set the corresponding bit in the hash table. */ mchash[crc >> 5] |= 1 << (crc & 0x1f); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); if (mchash[0] != 0 || mchash[1] != 0) mode |= GM_RXCR_MCF_ENA; } Modified: head/sys/dev/mxge/if_mxge.c ============================================================================== --- head/sys/dev/mxge/if_mxge.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/mxge/if_mxge.c Fri Jun 26 11:45:06 2009 (r195049) @@ -1130,7 +1130,7 @@ mxge_set_multicast_list(mxge_softc_t *sc /* Walk the multicast list, and add each address */ - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -1146,11 +1146,11 @@ mxge_set_multicast_list(mxge_softc_t *sc "MXGEFW_JOIN_MULTICAST_GROUP, error status:" "%d\t", err); /* abort, leaving multicast filtering off */ - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); return; } } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); /* Enable multicast filtering */ err = mxge_send_cmd(sc, MXGEFW_DISABLE_ALLMULTI, &cmd); if (err != 0) { Modified: head/sys/dev/my/if_my.c ============================================================================== --- head/sys/dev/my/if_my.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/my/if_my.c Fri Jun 26 11:45:06 2009 (r195049) @@ -337,7 +337,7 @@ my_setmulti(struct my_softc * sc) CSR_WRITE_4(sc, MY_MAR1, 0); /* now program new ones */ - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -349,7 +349,7 @@ my_setmulti(struct my_softc * sc) hashes[1] |= (1 << (h - 32)); mcnt++; } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); if (mcnt) rxfilt |= MY_AM; Modified: head/sys/dev/nfe/if_nfe.c ============================================================================== --- head/sys/dev/nfe/if_nfe.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/nfe/if_nfe.c Fri Jun 26 11:45:06 2009 (r195049) @@ -2491,7 +2491,7 @@ nfe_setmulti(struct nfe_softc *sc) bcopy(etherbroadcastaddr, addr, ETHER_ADDR_LEN); bcopy(etherbroadcastaddr, mask, ETHER_ADDR_LEN); - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { u_char *addrp; @@ -2505,7 +2505,7 @@ nfe_setmulti(struct nfe_softc *sc) mask[i] &= ~mcaddr; } } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); for (i = 0; i < ETHER_ADDR_LEN; i++) { mask[i] |= addr[i]; Modified: head/sys/dev/nge/if_nge.c ============================================================================== --- head/sys/dev/nge/if_nge.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/nge/if_nge.c Fri Jun 26 11:45:06 2009 (r195049) @@ -863,7 +863,7 @@ nge_rxfilter(struct nge_softc *sc) * that needs to be updated, and the lower 4 bits represent * which bit within that byte needs to be set. */ - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -875,7 +875,7 @@ nge_rxfilter(struct nge_softc *sc) NGE_FILTADDR_MCAST_LO + (index * 2)); NGE_SETBIT(sc, NGE_RXFILT_DATA, (1 << bit)); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); done: CSR_WRITE_4(sc, NGE_RXFILT_CTL, rxfilt); Modified: head/sys/dev/nve/if_nve.c ============================================================================== --- head/sys/dev/nve/if_nve.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/nve/if_nve.c Fri Jun 26 11:45:06 2009 (r195049) @@ -1133,7 +1133,7 @@ nve_setmulti(struct nve_softc *sc) return; } /* Setup multicast filter */ - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { u_char *addrp; @@ -1147,7 +1147,7 @@ nve_setmulti(struct nve_softc *sc) oraddr[i] |= mcaddr; } } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); for (i = 0; i < 6; i++) { hwfilter.acMulticastAddress[i] = andaddr[i] & oraddr[i]; hwfilter.acMulticastMask[i] = andaddr[i] | (~oraddr[i]); Modified: head/sys/dev/nxge/if_nxge.c ============================================================================== --- head/sys/dev/nxge/if_nxge.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/nxge/if_nxge.c Fri Jun 26 11:45:06 2009 (r195049) @@ -2238,7 +2238,7 @@ xge_setmulti(xge_lldev_t *lldev) } /* Updating address list */ - IF_ADDR_LOCK(ifnetp); + if_maddr_rlock(ifnetp); index = 0; TAILQ_FOREACH(ifma, &ifnetp->if_multiaddrs, ifma_link) { if(ifma->ifma_addr->sa_family != AF_LINK) { @@ -2247,7 +2247,7 @@ xge_setmulti(xge_lldev_t *lldev) lladdr = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); index += 1; } - IF_ADDR_UNLOCK(ifnetp); + if_maddr_runlock(ifnetp); if((!lldev->all_multicast) && (index)) { lldev->macaddr_count = (index + 1); @@ -2263,7 +2263,7 @@ xge_setmulti(xge_lldev_t *lldev) } /* Add new addresses */ - IF_ADDR_LOCK(ifnetp); + if_maddr_rlock(ifnetp); index = 0; TAILQ_FOREACH(ifma, &ifnetp->if_multiaddrs, ifma_link) { if(ifma->ifma_addr->sa_family != AF_LINK) { @@ -2273,7 +2273,7 @@ xge_setmulti(xge_lldev_t *lldev) xge_hal_device_macaddr_set(hldev, (offset + index), lladdr); index += 1; } - IF_ADDR_UNLOCK(ifnetp); + if_maddr_runlock(ifnetp); _exit: return; Modified: head/sys/dev/pcn/if_pcn.c ============================================================================== --- head/sys/dev/pcn/if_pcn.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/pcn/if_pcn.c Fri Jun 26 11:45:06 2009 (r195049) @@ -371,7 +371,7 @@ pcn_setmulti(sc) pcn_csr_write(sc, PCN_CSR_MAR0 + i, 0); /* now program new ones */ - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -379,7 +379,7 @@ pcn_setmulti(sc) ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; hashes[h >> 4] |= 1 << (h & 0xF); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); for (i = 0; i < 4; i++) pcn_csr_write(sc, PCN_CSR_MAR0 + i, hashes[i]); Modified: head/sys/dev/pdq/pdq_ifsubr.c ============================================================================== --- head/sys/dev/pdq/pdq_ifsubr.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/pdq/pdq_ifsubr.c Fri Jun 26 11:45:06 2009 (r195049) @@ -273,7 +273,7 @@ pdq_os_addr_fill( PDQ_IFNET(sc)->if_flags &= ~IFF_ALLMULTI; #endif - IF_ADDR_LOCK(PDQ_IFNET(sc)); + if_maddr_rlock(PDQ_IFNET(sc)); for (ifma = TAILQ_FIRST(&PDQ_IFNET(sc)->if_multiaddrs); ifma && num_addrs > 0; ifma = TAILQ_NEXT(ifma, ifma_link)) { char *mcaddr; @@ -286,7 +286,7 @@ pdq_os_addr_fill( addr++; num_addrs--; } - IF_ADDR_UNLOCK(PDQ_IFNET(sc)); + if_maddr_runlock(PDQ_IFNET(sc)); /* * If not all the address fit into the CAM, turn on all-multicast mode. */ Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/re/if_re.c Fri Jun 26 11:45:06 2009 (r195049) @@ -640,7 +640,7 @@ re_set_rxmode(struct rl_softc *sc) goto done; } - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -651,7 +651,7 @@ re_set_rxmode(struct rl_softc *sc) else hashes[1] |= (1 << (h - 32)); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); if (hashes[0] != 0 || hashes[1] != 0) { /* Modified: head/sys/dev/sf/if_sf.c ============================================================================== --- head/sys/dev/sf/if_sf.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/sf/if_sf.c Fri Jun 26 11:45:06 2009 (r195049) @@ -494,7 +494,7 @@ sf_rxfilter(struct sf_softc *sc) /* Now program new ones. */ i = 1; - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH_REVERSE(ifma, &ifp->if_multiaddrs, ifmultihead, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) @@ -514,7 +514,7 @@ sf_rxfilter(struct sf_softc *sc) sf_sethash(sc, LLADDR((struct sockaddr_dl *)ifma->ifma_addr), 0); } - IF_ADDR_UNLOCK(ifp); + if_maddr_runlock(ifp); done: csr_write_4(sc, SF_RXFILT, rxfilt); Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Fri Jun 26 11:07:57 2009 (r195048) +++ head/sys/dev/sis/if_sis.c Fri Jun 26 11:45:06 2009 (r195049) @@ -773,7 +773,7 @@ sis_setmulti_ns(struct sis_softc *sc) CSR_WRITE_4(sc, SIS_RXFILT_DATA, 0); } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 14:52:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6224B106564A; Fri, 26 Jun 2009 14:52:44 +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 344358FC14; Fri, 26 Jun 2009 14:52:44 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id CB09E46B03; Fri, 26 Jun 2009 10:52:43 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id B93318A085; Fri, 26 Jun 2009 10:52:42 -0400 (EDT) From: John Baldwin To: Rui Paulo Date: Fri, 26 Jun 2009 09:30:30 -0400 User-Agent: KMail/1.9.7 References: <200906260932.n5Q9WVK9081205@svn.freebsd.org> In-Reply-To: <200906260932.n5Q9WVK9081205@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906260930.31050.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Fri, 26 Jun 2009 10:52:42 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r195045 - head/sys/boot/i386/libi386 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 14:52:44 -0000 On Friday 26 June 2009 5:32:31 am Rui Paulo wrote: > Author: rpaulo > Date: Fri Jun 26 09:32:31 2009 > New Revision: 195045 > URL: http://svn.freebsd.org/changeset/base/195045 > > Log: > On special systems where the MBR and the GPT are in sync (up to the 4th > slicei, Apple EFI hardware), the bootloader will fail to recognize the GPT > if it finds anything else but the EFI partition. Change the check to continue > detecting the GPT by looking at the EFI partition on the MBR but > stopping successfuly after finding it. Technically it is not an EFI partition btw. That is a different type. 0xee is a dedicated type used to mark a PMBR. -- John Baldwin From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 16:22:24 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82C571065740; Fri, 26 Jun 2009 16:22: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 6F60F8FC08; Fri, 26 Jun 2009 16:22:24 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5QGMOJJ091572; Fri, 26 Jun 2009 16:22:24 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5QGMOtT091563; Fri, 26 Jun 2009 16:22:24 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200906261622.n5QGMOtT091563@svn.freebsd.org> From: Alan Cox Date: Fri, 26 Jun 2009 16:22: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: r195060 - in head/sys: amd64/include arm/include i386/include ia64/include mips/include powerpc/include sparc64/include sun4v/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 16:22:25 -0000 Author: alc Date: Fri Jun 26 16:22:24 2009 New Revision: 195060 URL: http://svn.freebsd.org/changeset/base/195060 Log: Correct the #endif comment. Noticed by: jmallett Approved by: re (kib) Modified: head/sys/amd64/include/vm.h head/sys/arm/include/vm.h head/sys/i386/include/vm.h head/sys/ia64/include/vm.h head/sys/mips/include/vm.h head/sys/powerpc/include/vm.h head/sys/sparc64/include/vm.h head/sys/sun4v/include/vm.h Modified: head/sys/amd64/include/vm.h ============================================================================== --- head/sys/amd64/include/vm.h Fri Jun 26 16:22:07 2009 (r195059) +++ head/sys/amd64/include/vm.h Fri Jun 26 16:22:24 2009 (r195060) @@ -42,4 +42,4 @@ #define VM_CACHE_DEFAULT VM_CACHE_WRITE_BACK -#endif /* !_MACHINE_PMAP_H_ */ +#endif /* !_MACHINE_VM_H_ */ Modified: head/sys/arm/include/vm.h ============================================================================== --- head/sys/arm/include/vm.h Fri Jun 26 16:22:07 2009 (r195059) +++ head/sys/arm/include/vm.h Fri Jun 26 16:22:24 2009 (r195060) @@ -32,4 +32,4 @@ /* Cache control is not (yet) implemented. */ #define VM_CACHE_DEFAULT 0 -#endif /* !_MACHINE_PMAP_H_ */ +#endif /* !_MACHINE_VM_H_ */ Modified: head/sys/i386/include/vm.h ============================================================================== --- head/sys/i386/include/vm.h Fri Jun 26 16:22:07 2009 (r195059) +++ head/sys/i386/include/vm.h Fri Jun 26 16:22:24 2009 (r195060) @@ -42,4 +42,4 @@ #define VM_CACHE_DEFAULT VM_CACHE_WRITE_BACK -#endif /* !_MACHINE_PMAP_H_ */ +#endif /* !_MACHINE_VM_H_ */ Modified: head/sys/ia64/include/vm.h ============================================================================== --- head/sys/ia64/include/vm.h Fri Jun 26 16:22:07 2009 (r195059) +++ head/sys/ia64/include/vm.h Fri Jun 26 16:22:24 2009 (r195060) @@ -41,4 +41,4 @@ #define VM_CACHE_DEFAULT VM_CACHE_WRITE_BACK -#endif /* !_MACHINE_PMAP_H_ */ +#endif /* !_MACHINE_VM_H_ */ Modified: head/sys/mips/include/vm.h ============================================================================== --- head/sys/mips/include/vm.h Fri Jun 26 16:22:07 2009 (r195059) +++ head/sys/mips/include/vm.h Fri Jun 26 16:22:24 2009 (r195060) @@ -37,4 +37,4 @@ #define VM_CACHE_DEFAULT VM_CACHE_CACHEABLE_NONCOHERENT -#endif /* !_MACHINE_PMAP_H_ */ +#endif /* !_MACHINE_VM_H_ */ Modified: head/sys/powerpc/include/vm.h ============================================================================== --- head/sys/powerpc/include/vm.h Fri Jun 26 16:22:07 2009 (r195059) +++ head/sys/powerpc/include/vm.h Fri Jun 26 16:22:24 2009 (r195060) @@ -37,4 +37,4 @@ #define VM_CACHE_DEFAULT 0 -#endif /* !_MACHINE_PMAP_H_ */ +#endif /* !_MACHINE_VM_H_ */ Modified: head/sys/sparc64/include/vm.h ============================================================================== --- head/sys/sparc64/include/vm.h Fri Jun 26 16:22:07 2009 (r195059) +++ head/sys/sparc64/include/vm.h Fri Jun 26 16:22:24 2009 (r195060) @@ -32,4 +32,4 @@ /* Cache control is not (yet) implemented. */ #define VM_CACHE_DEFAULT 0 -#endif /* !_MACHINE_PMAP_H_ */ +#endif /* !_MACHINE_VM_H_ */ Modified: head/sys/sun4v/include/vm.h ============================================================================== --- head/sys/sun4v/include/vm.h Fri Jun 26 16:22:07 2009 (r195059) +++ head/sys/sun4v/include/vm.h Fri Jun 26 16:22:24 2009 (r195060) @@ -32,4 +32,4 @@ /* Cache control is not (yet) implemented. */ #define VM_CACHE_DEFAULT 0 -#endif /* !_MACHINE_PMAP_H_ */ +#endif /* !_MACHINE_VM_H_ */ From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 17:50:52 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA5B91065679; Fri, 26 Jun 2009 17:50:52 +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 C7E168FC21; Fri, 26 Jun 2009 17:50:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5QHoqIf093444; Fri, 26 Jun 2009 17:50:52 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5QHoqmv093441; Fri, 26 Jun 2009 17:50:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906261750.n5QHoqmv093441@svn.freebsd.org> From: John Baldwin Date: Fri, 26 Jun 2009 17:50: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: r195064 - in head: . sys/conf X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 17:50:53 -0000 Author: jhb Date: Fri Jun 26 17:50:52 2009 New Revision: 195064 URL: http://svn.freebsd.org/changeset/base/195064 Log: Note that as a result of the SYSV IPC changes, COMPAT_FREEBSD[456] now require COMPAT_FREEBSD7. Also, explicitly note in NOTES that any version of COMPAT_FREEBSD effectively requires for newer binaries (i.e. COMPAT_FREEBSD, etc.). While this has been true in practice previously, it used to compile ok before the commit earlier this week. Discussed with: peter Approved by: re (kensmith) Modified: head/UPDATING head/sys/conf/NOTES Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Jun 26 17:30:33 2009 (r195063) +++ head/UPDATING Fri Jun 26 17:50:52 2009 (r195064) @@ -22,6 +22,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20090624: + The ABI of various structures related to the SYSV IPC API have + been changed. As a result, the COMPAT_FREEBSD[456] kernel + options now all require COMPAT_FREEBSD7. Bump __FreeBSD_version + to 800100. + 20090622: Layout of struct vnet has changed as routing related variables were moved to their own Vimage module. Modules need to be Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Fri Jun 26 17:30:33 2009 (r195063) +++ head/sys/conf/NOTES Fri Jun 26 17:50:52 2009 (r195064) @@ -301,6 +301,9 @@ options COMPAT_43 # Old tty interface. options COMPAT_43TTY +# Note that as a general rule, COMPAT_FREEBSD depends on +# COMPAT_FREEBSD, COMPAT_FREEBSD, etc. + # Enable FreeBSD4 compatibility syscalls options COMPAT_FREEBSD4 From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 18:18:41 2009 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCC37106566C; Fri, 26 Jun 2009 18:18:41 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail05.syd.optusnet.com.au (mail05.syd.optusnet.com.au [211.29.132.186]) by mx1.freebsd.org (Postfix) with ESMTP id 6687D8FC14; Fri, 26 Jun 2009 18:18:41 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c122-107-126-113.carlnfd1.nsw.optusnet.com.au (c122-107-126-113.carlnfd1.nsw.optusnet.com.au [122.107.126.113]) by mail05.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n5QIG273002341 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 27 Jun 2009 04:16:06 +1000 Date: Sat, 27 Jun 2009 04:16:03 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: d@delphij.net In-Reply-To: <4A43B727.7010204@delphij.net> Message-ID: <20090627033608.P35379@delplex.bde.org> References: <200906232316.n5NNG1iT094289@svn.freebsd.org> <20090625154007.H33864@delplex.bde.org> <4A43B727.7010204@delphij.net> 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, Xin LI , Bruce Evans Subject: Re: svn commit: r194789 - head/usr.bin/usbhidctl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 18:18:42 -0000 On Thu, 25 Jun 2009, Xin LI wrote: > Bruce Evans wrote: >> On Tue, 23 Jun 2009, Xin LI wrote: >> >>> Log: >>> Use getprogname() instead of referencing __progname. >> >> Neither is permitted in FreeBSD in usage(). > > I didn't see references about this? If this is discouraged, perhaps we > should mention it in style(9) or somewhere. FreeBSD style(9) simply doesn't mention getprogname(), while NetBSD share/misc/style requires it in the example usage(). Actually, it is OK to use it in FreeBSD iff the system supports the same program having different names, like reboot/halt/etc. > It looks like that a lot of > programs are using (not necessarily from NetBSD), but also others. Do > we have some discussion in the past regarding this? Most are still from NetBSD, except for lots in tools/regression. Most other uses are still correct ones, for things like setproctitle() (and for not so correct things like fprintf() -- why not use warnx()?). This was discussed in FreeBSD mailing lists years ago, and IIRC no one disagreed with the existing practice of hard-coding the program name. It can be considered a feature that if you copy or rename "cp" to "foo", its usage message reminds you that it is still "cp". >>> Modified: >>> head/usr.bin/usbhidctl/usbhid.c >> >> This was obtained from NetBSD, which requires using getprogname() in >> usage(). > > This is purely coincidence... I didn't even looked at NetBSD code in > this case, otherwise I would have brought the TNF copyright changes, > etc. altogether. The __progname in usbhidctl was obtained from NetBSD. Without this, the usage() function would have been a normal one and you shouldn't have needed to fix it. NetBSD of course fixed it long ago (FreeBSD obtained the bug in 2000 and it was fixed in NetBSD in 2001). In my 2005 copy of NetBSD, all usage() messages in utilities seem to have been roto-tilled to use getprogname(). This gives 343 files matching getprogname in NetBSD 2005 (incomplete sources but I forget how incomplete). FreeBSD now has only 88 files matching. Bruce From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 18:50:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 137E3106566C; Fri, 26 Jun 2009 18:50:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DB8BB8FC18; Fri, 26 Jun 2009 18:50:49 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5QIonvW094926; Fri, 26 Jun 2009 18:50:49 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5QIonne094924; Fri, 26 Jun 2009 18:50:49 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906261850.n5QIonne094924@svn.freebsd.org> From: Robert Watson Date: Fri, 26 Jun 2009 18:50: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: r195070 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 18:50:50 -0000 Author: rwatson Date: Fri Jun 26 18:50:49 2009 New Revision: 195070 URL: http://svn.freebsd.org/changeset/base/195070 Log: Use if_addr_rlock/if_addr_runlock for if_spp when iterating if_addrhead, as it is loadable as a module. Approved by: re (kib) MFC after: 6 weeks Modified: head/sys/net/if_spppsubr.c Modified: head/sys/net/if_spppsubr.c ============================================================================== --- head/sys/net/if_spppsubr.c Fri Jun 26 18:40:29 2009 (r195069) +++ head/sys/net/if_spppsubr.c Fri Jun 26 18:50:49 2009 (r195070) @@ -4905,7 +4905,7 @@ sppp_get_ip_addrs(struct sppp *sp, u_lon * aliases don't make any sense on a p2p link anyway. */ si = 0; - IF_ADDR_LOCK(ifp); + if_addr_rlock(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (ifa->ifa_addr->sa_family == AF_INET) { si = (struct sockaddr_in *)ifa->ifa_addr; @@ -4924,7 +4924,7 @@ sppp_get_ip_addrs(struct sppp *sp, u_lon if (si && si->sin_addr.s_addr) ddst = si->sin_addr.s_addr; } - IF_ADDR_UNLOCK(ifp); + if_addr_runlock(ifp); if (dst) *dst = ntohl(ddst); if (src) *src = ntohl(ssrc); @@ -4948,7 +4948,7 @@ sppp_set_ip_addr(struct sppp *sp, u_long * aliases don't make any sense on a p2p link anyway. */ si = 0; - IF_ADDR_LOCK(ifp); + if_addr_rlock(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_INET) { si = (struct sockaddr_in *)ifa->ifa_addr; @@ -4958,7 +4958,7 @@ sppp_set_ip_addr(struct sppp *sp, u_long } } } - IF_ADDR_UNLOCK(ifp); + if_addr_runlock(ifp); if (ifa != NULL) { int error; @@ -5010,7 +5010,7 @@ sppp_get_ip6_addrs(struct sppp *sp, stru * aliases don't make any sense on a p2p link anyway. */ si = NULL; - IF_ADDR_LOCK(ifp); + if_addr_rlock(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (ifa->ifa_addr->sa_family == AF_INET6) { si = (struct sockaddr_in6 *)ifa->ifa_addr; @@ -5036,7 +5036,7 @@ sppp_get_ip6_addrs(struct sppp *sp, stru bcopy(&ddst, dst, sizeof(*dst)); if (src) bcopy(&ssrc, src, sizeof(*src)); - IF_ADDR_UNLOCK(ifp); + if_addr_runlock(ifp); } #ifdef IPV6CP_MYIFID_DYN @@ -5065,7 +5065,7 @@ sppp_set_ip6_addr(struct sppp *sp, const */ sin6 = NULL; - IF_ADDR_LOCK(ifp); + if_addr_rlock(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_INET6) { sin6 = (struct sockaddr_in6 *)ifa->ifa_addr; @@ -5075,7 +5075,7 @@ sppp_set_ip6_addr(struct sppp *sp, const } } } - IF_ADDR_UNLOCK(ifp); + if_addr_runlock(ifp); if (ifa != NULL) { int error; From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 19:04:09 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19374106564A; Fri, 26 Jun 2009 19:04:09 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 076E48FC08; Fri, 26 Jun 2009 19:04:09 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5QJ48oB095332; Fri, 26 Jun 2009 19:04:08 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5QJ48Fl095330; Fri, 26 Jun 2009 19:04:08 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906261904.n5QJ48Fl095330@svn.freebsd.org> From: Robert Watson Date: Fri, 26 Jun 2009 19:04: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: r195071 - head/sys/dev/cxgb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 19:04:09 -0000 Author: rwatson Date: Fri Jun 26 19:04:08 2009 New Revision: 195071 URL: http://svn.freebsd.org/changeset/base/195071 Log: Use if_maddr_rlock() instead of IF_ADDR_LOCK() to protect access to if_multiaddrs in if_cxgb. Approved by: re (kib) MFC after: 6 weeks Modified: head/sys/dev/cxgb/cxgb_adapter.h Modified: head/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- head/sys/dev/cxgb/cxgb_adapter.h Fri Jun 26 18:50:49 2009 (r195070) +++ head/sys/dev/cxgb/cxgb_adapter.h Fri Jun 26 19:04:08 2009 (r195071) @@ -467,7 +467,7 @@ t3_get_next_mcaddr(struct t3_rx_mode *rm struct ifmultiaddr *ifma; int i = 0; - IF_ADDR_LOCK(ifp); + if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_LINK) continue; @@ -477,8 +477,7 @@ t3_get_next_mcaddr(struct t3_rx_mode *rm } i++; } - IF_ADDR_UNLOCK(ifp); - + if_maddr_runlock(ifp); rm->idx++; return (macaddr); From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 19:39:33 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F02FC106564A; Fri, 26 Jun 2009 19:39:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DEA9E8FC0C; Fri, 26 Jun 2009 19:39:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5QJdXJC096235; Fri, 26 Jun 2009 19:39:33 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5QJdXLA096233; Fri, 26 Jun 2009 19:39:33 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200906261939.n5QJdXLA096233@svn.freebsd.org> From: John Baldwin Date: Fri, 26 Jun 2009 19:39: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: r195074 - head/sys/i386/linux X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 19:39:34 -0000 Author: jhb Date: Fri Jun 26 19:39:33 2009 New Revision: 195074 URL: http://svn.freebsd.org/changeset/base/195074 Log: Return ENOSYS instead of EINVAL for invalid function codes to match the behavior of Linux. Reported by: Alexander Best alexbestms of math.uni-muenster.de Approved by: re (kib) Modified: head/sys/i386/linux/linux_machdep.c Modified: head/sys/i386/linux/linux_machdep.c ============================================================================== --- head/sys/i386/linux/linux_machdep.c Fri Jun 26 19:14:53 2009 (r195073) +++ head/sys/i386/linux/linux_machdep.c Fri Jun 26 19:39:33 2009 (r195074) @@ -866,9 +866,6 @@ linux_modify_ldt(struct thread *td, stru union descriptor desc; int size, written; - if (uap->ptr == NULL) - return (EINVAL); - switch (uap->func) { case 0x00: /* read_ldt */ ldt.start = 0; @@ -911,7 +908,7 @@ linux_modify_ldt(struct thread *td, stru error = i386_set_ldt(td, &ldt, &desc); break; default: - error = EINVAL; + error = ENOSYS; break; } From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 19:49:07 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2CE3E1065674; Fri, 26 Jun 2009 19:49:07 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1ACF68FC0C; Fri, 26 Jun 2009 19:49:07 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5QJn6fZ096931; Fri, 26 Jun 2009 19:49:06 GMT (envelope-from oleg@svn.freebsd.org) Received: (from oleg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5QJn6XW096929; Fri, 26 Jun 2009 19:49:06 GMT (envelope-from oleg@svn.freebsd.org) Message-Id: <200906261949.n5QJn6XW096929@svn.freebsd.org> From: Oleg Bulyzhin Date: Fri, 26 Jun 2009 19:49:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195075 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 19:49:07 -0000 Author: oleg Date: Fri Jun 26 19:49:06 2009 New Revision: 195075 URL: http://svn.freebsd.org/changeset/base/195075 Log: - 'burst' description rewritten. Submitted by: Ben Kaduk Approved by: re (kib) Modified: head/sbin/ipfw/ipfw.8 Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Fri Jun 26 19:39:33 2009 (r195074) +++ head/sbin/ipfw/ipfw.8 Fri Jun 26 19:49:06 2009 (r195075) @@ -1944,13 +1944,18 @@ the granularity to 1ms or less). The default value is 0, meaning no delay. .Pp .It Cm burst Ar size -If the data rate exceeds the pipe bandwith limit -(and pipe was idle long enough), +If the data to be sent exceeds the pipe's bandwidth limit +(and the pipe was previously idle), up to .Ar size -bytes of data is allowed to bypass the +bytes of data are allowed to bypass the .Nm dummynet -scheduler (i.e. it will be sent without shaping), then transmission rate -will not exceed pipe bandwidth. Effective burst size calculated as follows: +scheduler, and will be sent as fast as the physical link allows. +Any additional data will be transmitted at the rate specified +by the +.Nm pipe +bandwidth. +The burst size depends on how long the pipe has been idle; +the effective burst size is calculated as follows: MAX( .Ar size , From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 20:39:36 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A84EA1065674; Fri, 26 Jun 2009 20:39:36 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 95CDF8FC0C; Fri, 26 Jun 2009 20:39:36 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5QKdaoV001319; Fri, 26 Jun 2009 20:39:36 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5QKda9c001316; Fri, 26 Jun 2009 20:39:36 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906262039.n5QKda9c001316@svn.freebsd.org> From: Robert Watson Date: Fri, 26 Jun 2009 20:39: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: r195078 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 20:39:37 -0000 Author: rwatson Date: Fri Jun 26 20:39:36 2009 New Revision: 195078 URL: http://svn.freebsd.org/changeset/base/195078 Log: In light of DPCPU use by netisr, revise various for loops from using MAXCPU to mp_maxid, and handling and reporting of requests to use more threads than we have CPUs to run them on. Reviewed by: bz Approved by: re (kib) MFC after: 6 weeks Modified: head/sys/net/netisr.c Modified: head/sys/net/netisr.c ============================================================================== --- head/sys/net/netisr.c Fri Jun 26 19:56:35 2009 (r195077) +++ head/sys/net/netisr.c Fri Jun 26 20:39:36 2009 (r195078) @@ -154,7 +154,7 @@ SYSCTL_INT(_net_isr, OID_AUTO, direct, C * CPU 0, so in practice we ignore values <= 1. This must be set at boot. * We will create at most one thread per CPU. */ -static int netisr_maxthreads = 1; /* Max number of threads. */ +static int netisr_maxthreads = -1; /* Max number of threads. */ TUNABLE_INT("net.isr.maxthreads", &netisr_maxthreads); SYSCTL_INT(_net_isr, OID_AUTO, maxthreads, CTLFLAG_RD, &netisr_maxthreads, 0, @@ -393,7 +393,7 @@ netisr_register(const struct netisr_hand } else np[proto].np_qlimit = nhp->nh_qlimit; np[proto].np_policy = nhp->nh_policy; - for (i = 0; i < MAXCPU; i++) { + for (i = 0; i <= mp_maxid; i++) { if (CPU_ABSENT(i)) continue; npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto]; @@ -427,7 +427,7 @@ netisr_clearqdrops(const struct netisr_h ("%s(%u): protocol not registered for %s", __func__, proto, name)); - for (i = 0; i < MAXCPU; i++) { + for (i = 0; i <= mp_maxid; i++) { if (CPU_ABSENT(i)) continue; npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto]; @@ -462,7 +462,7 @@ netisr_getqdrops(const struct netisr_han ("%s(%u): protocol not registered for %s", __func__, proto, name)); - for (i = 0; i < MAXCPU; i++) { + for (i = 0; i <= mp_maxid; i++) { if (CPU_ABSENT(i)) continue; npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto]; @@ -528,7 +528,7 @@ netisr_setqlimit(const struct netisr_han name)); np[proto].np_qlimit = qlimit; - for (i = 0; i < MAXCPU; i++) { + for (i = 0; i <= mp_maxid; i++) { if (CPU_ABSENT(i)) continue; npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto]; @@ -594,7 +594,7 @@ netisr_unregister(const struct netisr_ha np[proto].np_m2cpuid = NULL; np[proto].np_qlimit = 0; np[proto].np_policy = 0; - for (i = 0; i < MAXCPU; i++) { + for (i = 0; i <= mp_maxid; i++) { if (CPU_ABSENT(i)) continue; npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto]; @@ -818,8 +818,8 @@ netisr_queue_internal(u_int proto, struc #ifdef NETISR_LOCKING NETISR_LOCK_ASSERT(); #endif - KASSERT(cpuid < MAXCPU, ("%s: cpuid too big (%u, %u)", __func__, - cpuid, MAXCPU)); + KASSERT(cpuid <= mp_maxid, ("%s: cpuid too big (%u, %u)", __func__, + cpuid, mp_maxid)); KASSERT(!CPU_ABSENT(cpuid), ("%s: CPU %u absent", __func__, cpuid)); dosignal = 0; @@ -1064,17 +1064,16 @@ netisr_init(void *arg) KASSERT(curcpu == 0, ("%s: not on CPU 0", __func__)); NETISR_LOCK_INIT(); - if (netisr_maxthreads < 1) { - printf("netisr2: forcing maxthreads to 1\n"); + if (netisr_maxthreads < 1) netisr_maxthreads = 1; - } - if (netisr_maxthreads > MAXCPU) { - printf("netisr2: forcing maxthreads to %d\n", MAXCPU); - netisr_maxthreads = MAXCPU; + if (netisr_maxthreads > mp_ncpus) { + printf("netisr2: forcing maxthreads from %d to %d\n", + netisr_maxthreads, mp_ncpus); + netisr_maxthreads = mp_ncpus; } if (netisr_defaultqlimit > netisr_maxqlimit) { - printf("netisr2: forcing defaultqlimit to %d\n", - netisr_maxqlimit); + printf("netisr2: forcing defaultqlimit from %d to %d\n", + netisr_defaultqlimit, netisr_maxqlimit); netisr_defaultqlimit = netisr_maxqlimit; } #ifdef DEVICE_POLLING @@ -1128,7 +1127,7 @@ DB_SHOW_COMMAND(netisr, db_show_netisr) db_printf("%3s %6s %5s %5s %5s %8s %8s %8s %8s\n", "CPU", "Proto", "Len", "WMark", "Max", "Disp", "HDisp", "Drop", "Queue"); - for (cpuid = 0; cpuid < MAXCPU; cpuid++) { + for (cpuid = 0; cpuid <= mp_maxid; cpuid++) { if (CPU_ABSENT(cpuid)) continue; nwsp = DPCPU_ID_PTR(cpuid, nws); From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 21:47:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB821106564A; Fri, 26 Jun 2009 21:47:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D98D38FC15; Fri, 26 Jun 2009 21:47:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5QLlb0A006905; Fri, 26 Jun 2009 21:47:37 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5QLlbf6006902; Fri, 26 Jun 2009 21:47:37 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <200906262147.n5QLlbf6006902@svn.freebsd.org> From: Xin LI Date: Fri, 26 Jun 2009 21:47: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: r195080 - in head/sys/dev/usb: . storage X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 21:47:38 -0000 Author: delphij Date: Fri Jun 26 21:47:37 2009 New Revision: 195080 URL: http://svn.freebsd.org/changeset/base/195080 Log: Add quirks for Actions MP4 player. Submitted by: John Hixson Approved by: re (kib) MFC after: 2 weeks Modified: head/sys/dev/usb/storage/umass.c head/sys/dev/usb/usbdevs Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Fri Jun 26 21:31:07 2009 (r195079) +++ head/sys/dev/usb/storage/umass.c Fri Jun 26 21:47:37 2009 (r195080) @@ -961,6 +961,10 @@ static const struct umass_devdescr umass UMASS_PROTO_SCSI | UMASS_PROTO_BBB, NO_INQUIRY | NO_SYNCHRONIZE_CACHE }, + {USB_VENDOR_ACTIONS, USB_PRODUCT_ACTIONS_MP4, RID_WILDCARD, + UMASS_PROTO_SCSI | UMASS_PROTO_BBB, + NO_SYNCHRONIZE_CACHE + }, {VID_EOT, PID_EOT, RID_EOT, 0, 0} }; Modified: head/sys/dev/usb/usbdevs ============================================================================== --- head/sys/dev/usb/usbdevs Fri Jun 26 21:31:07 2009 (r195079) +++ head/sys/dev/usb/usbdevs Fri Jun 26 21:47:37 2009 (r195080) @@ -552,6 +552,7 @@ vendor USI 0x10ab USI vendor PLX 0x10b5 PLX vendor ASANTE 0x10bd Asante vendor SILABS 0x10c4 Silicon Labs +vendor ACTIONS 0x10d6 Actions vendor ANALOG 0x1110 Analog Devices vendor TENX 0x1130 Ten X Technology, Inc. vendor ISSC 0x1131 Integrated System Solution Corp. @@ -741,6 +742,9 @@ product ACERP AWL400 0x9001 AWL400 Wire /* Acer Warp products */ product ACERW WARPLINK 0x0204 Warplink +/* Actions products */ +product ACTIONS MP4 0x1101 Actions MP4 Player + /* Actiontec, Inc. products */ product ACTIONTEC PRISM_25 0x0408 Prism2.5 Wireless Adapter product ACTIONTEC PRISM_25A 0x0421 Prism2.5 Wireless Adapter A From owner-svn-src-head@FreeBSD.ORG Fri Jun 26 22:13:16 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39A86106566C; Fri, 26 Jun 2009 22:13:16 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 279AE8FC0C; Fri, 26 Jun 2009 22:13:16 +0000 (UTC) (envelope-from stas@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5QMDFYJ009010; Fri, 26 Jun 2009 22:13:15 GMT (envelope-from stas@svn.freebsd.org) Received: (from stas@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5QMDFKE009008; Fri, 26 Jun 2009 22:13:15 GMT (envelope-from stas@svn.freebsd.org) Message-Id: <200906262213.n5QMDFKE009008@svn.freebsd.org> From: Stanislav Sedov Date: Fri, 26 Jun 2009 22:13: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: r195081 - head/sys/dev/cpuctl X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 22:13:16 -0000 Author: stas Date: Fri Jun 26 22:13:15 2009 New Revision: 195081 URL: http://svn.freebsd.org/changeset/base/195081 Log: - Don't zero data field in case of MSR write operation. Before this change the value written to MSR register was always 0 regardless of value passed by user. - Use proper data pointer when performing AMD microcode update. Previously, the pointer to user-space data has been provided instead, which is totally incorrect. Approved by: re (kib) MFC after: 1 week Modified: head/sys/dev/cpuctl/cpuctl.c Modified: head/sys/dev/cpuctl/cpuctl.c ============================================================================== --- head/sys/dev/cpuctl/cpuctl.c Fri Jun 26 21:47:37 2009 (r195080) +++ head/sys/dev/cpuctl/cpuctl.c Fri Jun 26 22:13:15 2009 (r195081) @@ -222,14 +222,17 @@ cpuctl_do_msr(int cpu, cpuctl_msr_args_t * Explicitly clear cpuid data to avoid returning stale * info */ - data->data = 0; DPRINTF("[cpuctl,%d]: operating on MSR %#0x for %d cpu\n", __LINE__, data->msr, cpu); oldcpu = td->td_oncpu; is_bound = cpu_sched_is_bound(td); set_cpu(cpu, td); - ret = cmd == CPUCTL_RDMSR ? rdmsr_safe(data->msr, &data->data) : - wrmsr_safe(data->msr, data->data); + if (cmd == CPUCTL_RDMSR) { + data->data = 0; + ret = rdmsr_safe(data->msr, &data->data); + } else { + ret = wrmsr_safe(data->msr, data->data); + } restore_cpu(oldcpu, is_bound, td); return (ret); } @@ -368,7 +371,7 @@ update_amd(int cpu, cpuctl_update_args_t /* * Perform update. */ - wrmsr_safe(MSR_K8_UCODE_UPDATE, (uintptr_t)args->data); + wrmsr_safe(MSR_K8_UCODE_UPDATE, (uintptr_t)ptr); /* * Serialize instruction flow. From owner-svn-src-head@FreeBSD.ORG Sat Jun 27 02:20:32 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56D8C106566C; Sat, 27 Jun 2009 02:20:32 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2AD668FC08; Sat, 27 Jun 2009 02:20:32 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5R2KWl9029161; Sat, 27 Jun 2009 02:20:32 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5R2KWUF029160; Sat, 27 Jun 2009 02:20:32 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200906270220.n5R2KWUF029160@svn.freebsd.org> From: Takahashi Yoshihiro Date: Sat, 27 Jun 2009 02:20: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: r195089 - head/sys/pc98/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jun 2009 02:20:32 -0000 Author: nyan Date: Sat Jun 27 02:20:31 2009 New Revision: 195089 URL: http://svn.freebsd.org/changeset/base/195089 Log: Add stub vm.h for pc98. Approved by: re (kensmith) Added: head/sys/pc98/include/vm.h (contents, props changed) Added: head/sys/pc98/include/vm.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/pc98/include/vm.h Sat Jun 27 02:20:31 2009 (r195089) @@ -0,0 +1,6 @@ +/*- + * This file is in the public domain. + */ +/* $FreeBSD$ */ + +#include From owner-svn-src-head@FreeBSD.ORG Sat Jun 27 10:11:15 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83B751065672; Sat, 27 Jun 2009 10:11:15 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 688748FC13; Sat, 27 Jun 2009 10:11:15 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5RABFDU073136; Sat, 27 Jun 2009 10:11:15 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5RABFjF073134; Sat, 27 Jun 2009 10:11:15 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <200906271011.n5RABFjF073134@svn.freebsd.org> From: Antoine Brodin Date: Sat, 27 Jun 2009 10:11: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: r195096 - head X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jun 2009 10:11:15 -0000 Author: antoine Date: Sat Jun 27 10:11:15 2009 New Revision: 195096 URL: http://svn.freebsd.org/changeset/base/195096 Log: Update ObsoleteFiles.inc: - correct a few paths - some USB headers were removed - devclass_add_driver(9) is no longer public - bind 9.6.1rc1 was imported Approved by: re (kib) Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Sat Jun 27 06:37:08 2009 (r195095) +++ head/ObsoleteFiles.inc Sat Jun 27 10:11:15 2009 (r195096) @@ -15,57 +15,72 @@ # # 20090624: update usbdi(9) -OLD_FILES+=usr/share/man/man9/usbd_abort_default_pipe.9 -OLD_FILES+=usr/share/man/man9/usbd_abort_pipe.9 -OLD_FILES+=usr/share/man/man9/usbd_alloc_buffer.9 -OLD_FILES+=usr/share/man/man9/usbd_alloc_xfer.9 -OLD_FILES+=usr/share/man/man9/usbd_clear_endpoint_stall.9 -OLD_FILES+=usr/share/man/man9/usbd_clear_endpoint_stall_async.9 -OLD_FILES+=usr/share/man/man9/usbd_clear_endpoint_toggle.9 -OLD_FILES+=usr/share/man/man9/usbd_close_pipe.9 -OLD_FILES+=usr/share/man/man9/usbd_device2interface_handle.9 -OLD_FILES+=usr/share/man/man9/usbd_do_request_async.9 -OLD_FILES+=usr/share/man/man9/usbd_do_request_flags_pipe.9 -OLD_FILES+=usr/share/man/man9/usbd_endpoint_count.9 -OLD_FILES+=usr/share/man/man9/usbd_find_edesc.9 -OLD_FILES+=usr/share/man/man9/usbd_find_idesc.9 -OLD_FILES+=usr/share/man/man9/usbd_free_buffer.9 -OLD_FILES+=usr/share/man/man9/usbd_free_xfer.9 -OLD_FILES+=usr/share/man/man9/usbd_get_buffer.9 -OLD_FILES+=usr/share/man/man9/usbd_get_config.9 -OLD_FILES+=usr/share/man/man9/usbd_get_config_desc.9 -OLD_FILES+=usr/share/man/man9/usbd_get_config_desc_full.9 -OLD_FILES+=usr/share/man/man9/usbd_get_config_descriptor.9 -OLD_FILES+=usr/share/man/man9/usbd_get_device_descriptor.9 -OLD_FILES+=usr/share/man/man9/usbd_get_endpoint_descriptor.9 -OLD_FILES+=usr/share/man/man9/usbd_get_interface_altindex.9 -OLD_FILES+=usr/share/man/man9/usbd_get_interface_descriptor.9 -OLD_FILES+=usr/share/man/man9/usbd_get_no_alts.9 -OLD_FILES+=usr/share/man/man9/usbd_get_quirks.9 -OLD_FILES+=usr/share/man/man9/usbd_get_speed.9 -OLD_FILES+=usr/share/man/man9/usbd_get_string.9 -OLD_FILES+=usr/share/man/man9/usbd_get_string_desc.9 -OLD_FILES+=usr/share/man/man9/usbd_get_xfer_status.9 -OLD_FILES+=usr/share/man/man9/usbd_interface2device_handle.9 -OLD_FILES+=usr/share/man/man9/usbd_interface2endpoint_descriptor.9 -OLD_FILES+=usr/share/man/man9/usbd_interface_count.9 -OLD_FILES+=usr/share/man/man9/usbd_open_pipe.9 -OLD_FILES+=usr/share/man/man9/usbd_open_pipe_intr.9 -OLD_FILES+=usr/share/man/man9/usbd_pipe2device_handle.9 -OLD_FILES+=usr/share/man/man9/usbd_set_config_index.9 -OLD_FILES+=usr/share/man/man9/usbd_set_config_no.9 -OLD_FILES+=usr/share/man/man9/usbd_set_interface.9 -OLD_FILES+=usr/share/man/man9/usbd_setup_default_xfer.9 -OLD_FILES+=usr/share/man/man9/usbd_setup_isoc_xfer.9 -OLD_FILES+=usr/share/man/man9/usbd_setup_xfer.9 -OLD_FILES+=usr/share/man/man9/usbd_sync_transfer.9 -OLD_FILES+=usr/share/man/man9/usbd_transfer.9 -OLD_FILES+=usr/share/man/man9/usb_find_desc.9 +OLD_FILES+=usr/share/man/man9/usbd_abort_default_pipe.9.gz +OLD_FILES+=usr/share/man/man9/usbd_abort_pipe.9.gz +OLD_FILES+=usr/share/man/man9/usbd_alloc_buffer.9.gz +OLD_FILES+=usr/share/man/man9/usbd_alloc_xfer.9.gz +OLD_FILES+=usr/share/man/man9/usbd_clear_endpoint_stall.9.gz +OLD_FILES+=usr/share/man/man9/usbd_clear_endpoint_stall_async.9.gz +OLD_FILES+=usr/share/man/man9/usbd_clear_endpoint_toggle.9.gz +OLD_FILES+=usr/share/man/man9/usbd_close_pipe.9.gz +OLD_FILES+=usr/share/man/man9/usbd_device2interface_handle.9.gz +OLD_FILES+=usr/share/man/man9/usbd_do_request_async.9.gz +OLD_FILES+=usr/share/man/man9/usbd_do_request_flags_pipe.9.gz +OLD_FILES+=usr/share/man/man9/usbd_endpoint_count.9.gz +OLD_FILES+=usr/share/man/man9/usbd_find_edesc.9.gz +OLD_FILES+=usr/share/man/man9/usbd_find_idesc.9.gz +OLD_FILES+=usr/share/man/man9/usbd_free_buffer.9.gz +OLD_FILES+=usr/share/man/man9/usbd_free_xfer.9.gz +OLD_FILES+=usr/share/man/man9/usbd_get_buffer.9.gz +OLD_FILES+=usr/share/man/man9/usbd_get_config.9.gz +OLD_FILES+=usr/share/man/man9/usbd_get_config_desc.9.gz +OLD_FILES+=usr/share/man/man9/usbd_get_config_desc_full.9.gz +OLD_FILES+=usr/share/man/man9/usbd_get_config_descriptor.9.gz +OLD_FILES+=usr/share/man/man9/usbd_get_device_descriptor.9.gz +OLD_FILES+=usr/share/man/man9/usbd_get_endpoint_descriptor.9.gz +OLD_FILES+=usr/share/man/man9/usbd_get_interface_altindex.9.gz +OLD_FILES+=usr/share/man/man9/usbd_get_interface_descriptor.9.gz +OLD_FILES+=usr/share/man/man9/usbd_get_no_alts.9.gz +OLD_FILES+=usr/share/man/man9/usbd_get_quirks.9.gz +OLD_FILES+=usr/share/man/man9/usbd_get_speed.9.gz +OLD_FILES+=usr/share/man/man9/usbd_get_string.9.gz +OLD_FILES+=usr/share/man/man9/usbd_get_string_desc.9.gz +OLD_FILES+=usr/share/man/man9/usbd_get_xfer_status.9.gz +OLD_FILES+=usr/share/man/man9/usbd_interface2device_handle.9.gz +OLD_FILES+=usr/share/man/man9/usbd_interface2endpoint_descriptor.9.gz +OLD_FILES+=usr/share/man/man9/usbd_interface_count.9.gz +OLD_FILES+=usr/share/man/man9/usbd_open_pipe.9.gz +OLD_FILES+=usr/share/man/man9/usbd_open_pipe_intr.9.gz +OLD_FILES+=usr/share/man/man9/usbd_pipe2device_handle.9.gz +OLD_FILES+=usr/share/man/man9/usbd_set_config_index.9.gz +OLD_FILES+=usr/share/man/man9/usbd_set_config_no.9.gz +OLD_FILES+=usr/share/man/man9/usbd_set_interface.9.gz +OLD_FILES+=usr/share/man/man9/usbd_setup_default_xfer.9.gz +OLD_FILES+=usr/share/man/man9/usbd_setup_isoc_xfer.9.gz +OLD_FILES+=usr/share/man/man9/usbd_setup_xfer.9.gz +OLD_FILES+=usr/share/man/man9/usbd_sync_transfer.9.gz +OLD_FILES+=usr/share/man/man9/usbd_transfer.9.gz +OLD_FILES+=usr/share/man/man9/usb_find_desc.9.gz +# 20090623: number of headers needed for a usb driver reduced +OLD_FILES+=usr/include/dev/usb/usb_defs.h +OLD_FILES+=usr/include/dev/usb/usb_error.h +OLD_FILES+=usr/include/dev/usb/usb_handle_request.h +OLD_FILES+=usr/include/dev/usb/usb_hid.h +OLD_FILES+=usr/include/dev/usb/usb_lookup.h +OLD_FILES+=usr/include/dev/usb/usb_mfunc.h +OLD_FILES+=usr/include/dev/usb/usb_parse.h +OLD_FILES+=usr/include/dev/usb/usb_revision.h +# 20090609: devclass_add_driver is no longer public +OLD_FILES+=usr/share/man/man9/devclass_add_driver.9.gz +OLD_FILES+=usr/share/man/man9/devclass_delete_driver.9.gz +OLD_FILES+=usr/share/man/man9/devclass_find_driver.9.gz # 20090605: removal of clists OLD_FILES+=usr/include/sys/clist.h # 20090602: removal of window(1) OLD_FILES+=usr/bin/window OLD_FILES+=usr/share/man/man1/window.1.gz +# 20090531: bind 9.6.1rc1 import +OLD_LIBS+=usr/lib/liblwres.so.30 # 20090530: removal of early.sh OLD_FILES+=etc/rc.d/early.sh # 20090527: renaming of S{LIST,TAILQ}_REMOVE_NEXT() to _REMOVE_AFTER() @@ -105,7 +120,7 @@ OLD_DIRS+=usr/include/legacy/dev/usb OLD_DIRS+=usr/include/legacy/dev OLD_DIRS+=usr/include/legacy # 20090526: removal of makekey(8) -OLD_FILES+=libexec/makekey +OLD_FILES+=usr/libexec/makekey OLD_FILES+=usr/share/man/man8/makekey.8.gz # 20090522: removal of University of Michigan NFSv4 client OLD_FILES+=etc/rc.d/idmapd From owner-svn-src-head@FreeBSD.ORG Sat Jun 27 10:30:29 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A8901065695; Sat, 27 Jun 2009 10:30:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 17FE48FC24; Sat, 27 Jun 2009 10:30:29 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5RAUSfU073481; Sat, 27 Jun 2009 10:30:28 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5RAUS0j073479; Sat, 27 Jun 2009 10:30:28 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906271030.n5RAUS0j073479@svn.freebsd.org> From: Robert Watson Date: Sat, 27 Jun 2009 10:30: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: r195097 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jun 2009 10:30:30 -0000 Author: rwatson Date: Sat Jun 27 10:30:28 2009 New Revision: 195097 URL: http://svn.freebsd.org/changeset/base/195097 Log: Remove unnecessary include of kdb.h that snuck in during ifaddr refcount work. Reported by: pluknet Approved by: re (kib) Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Sat Jun 27 10:11:15 2009 (r195096) +++ head/sys/net/if.c Sat Jun 27 10:30:28 2009 (r195097) @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include From owner-svn-src-head@FreeBSD.ORG Sat Jun 27 11:05:53 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6307A1065679; Sat, 27 Jun 2009 11:05:53 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 519248FC1B; Sat, 27 Jun 2009 11:05:53 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5RB5rOZ076209; Sat, 27 Jun 2009 11:05:53 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5RB5rv5076207; Sat, 27 Jun 2009 11:05:53 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906271105.n5RB5rv5076207@svn.freebsd.org> From: Robert Watson Date: Sat, 27 Jun 2009 11:05: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: r195102 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jun 2009 11:05:53 -0000 Author: rwatson Date: Sat Jun 27 11:05:53 2009 New Revision: 195102 URL: http://svn.freebsd.org/changeset/base/195102 Log: In in6_update_ifa(), jump to 'cleanup' rather than returning directly in one additional case, avoiding an ifaddr reference leak. Defer releasing the in6_ifaddr's in6_ifaddrhead reference until the end of in6_unlink_ifa(), as callers are inconsistent regarding whether or not they hold a reference across the call. This avoids using the ifaddr after it may have been freed. Reported by: tegge Reviewed by: tegge Approved by: re (blanket) MFC after: 6 weeks Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Sat Jun 27 10:45:58 2009 (r195101) +++ head/sys/netinet6/in6.c Sat Jun 27 11:05:53 2009 (r195102) @@ -970,8 +970,7 @@ in6_update_ifa(struct ifnet *ifp, struct "%s on %s (errno=%d)\n", ip6_sprintf(ip6buf, &llsol), if_name(ifp), error)); - in6_purgeaddr((struct ifaddr *)ia); - return (error); + goto cleanup; } LIST_INSERT_HEAD(&ia->ia6_memberships, imm, i6mm_chain); @@ -1378,10 +1377,14 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st IF_ADDR_UNLOCK(ifp); ifa_free(&ia->ia_ifa); /* if_addrhead */ + /* + * Defer the release of what might be the last reference to the + * in6_ifaddr so that it can't be freed before the remainder of the + * cleanup. + */ IN6_IFADDR_WLOCK(); TAILQ_REMOVE(&V_in6_ifaddrhead, ia, ia_link); IN6_IFADDR_WUNLOCK(); - ifa_free(&ia->ia_ifa); /* in6_ifaddrhead */ /* * Release the reference to the base prefix. There should be a @@ -1404,7 +1407,7 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st if ((ia->ia6_flags & IN6_IFF_AUTOCONF)) { pfxlist_onlink_check(); } - + ifa_free(&ia->ia_ifa); /* in6_ifaddrhead */ splx(s); } From owner-svn-src-head@FreeBSD.ORG Sat Jun 27 13:58:44 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E01E7106566C; Sat, 27 Jun 2009 13:58:44 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CB0758FC14; Sat, 27 Jun 2009 13:58:44 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5RDwiL5079528; Sat, 27 Jun 2009 13:58:44 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5RDwiDU079506; Sat, 27 Jun 2009 13:58:44 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906271358.n5RDwiDU079506@svn.freebsd.org> From: Robert Watson Date: Sat, 27 Jun 2009 13:58: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: r195104 - in head/sys: amd64/amd64 compat/freebsd32 compat/linux i386/i386 kern nfs security/audit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jun 2009 13:58:45 -0000 Author: rwatson Date: Sat Jun 27 13:58:44 2009 New Revision: 195104 URL: http://svn.freebsd.org/changeset/base/195104 Log: Replace AUDIT_ARG() with variable argument macros with a set more more specific macros for each audit argument type. This makes it easier to follow call-graphs, especially for automated analysis tools (such as fxr). In MFC, we should leave the existing AUDIT_ARG() macros as they may be used by third-party kernel modules. Suggested by: brooks Approved by: re (kib) Obtained from: TrustedBSD Project MFC after: 1 week Modified: head/sys/amd64/amd64/sys_machdep.c head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/linux/linux_signal.c head/sys/i386/i386/sys_machdep.c head/sys/kern/kern_descrip.c head/sys/kern/kern_exec.c head/sys/kern/kern_exit.c head/sys/kern/kern_fork.c head/sys/kern/kern_prot.c head/sys/kern/kern_sig.c head/sys/kern/kern_thr.c head/sys/kern/sys_generic.c head/sys/kern/sys_process.c head/sys/kern/vfs_extattr.c head/sys/kern/vfs_lookup.c head/sys/kern/vfs_mount.c head/sys/kern/vfs_syscalls.c head/sys/nfs/nfs_nfssvc.c head/sys/security/audit/audit.h head/sys/security/audit/audit_syscalls.c Modified: head/sys/amd64/amd64/sys_machdep.c ============================================================================== --- head/sys/amd64/amd64/sys_machdep.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/amd64/amd64/sys_machdep.c Sat Jun 27 13:58:44 2009 (r195104) @@ -87,7 +87,7 @@ sysarch_ldt(struct thread *td, struct sy * XXXKIB check that the BSM generation code knows to encode * the op argument. */ - AUDIT_ARG(cmd, uap->op); + AUDIT_ARG_CMD(uap->op); if (uap_space == UIO_USERSPACE) { error = copyin(uap->parms, &la, sizeof(struct i386_ldt_args)); if (error != 0) Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/compat/freebsd32/freebsd32_misc.c Sat Jun 27 13:58:44 2009 (r195104) @@ -2924,7 +2924,7 @@ freebsd32_nmount(struct thread *td, struct uio *auio; int error; - AUDIT_ARG(fflags, uap->flags); + AUDIT_ARG_FFLAGS(uap->flags); /* * Filter out MNT_ROOTFS. We do not want clients of nmount() in Modified: head/sys/compat/linux/linux_signal.c ============================================================================== --- head/sys/compat/linux/linux_signal.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/compat/linux/linux_signal.c Sat Jun 27 13:58:44 2009 (r195104) @@ -546,8 +546,8 @@ linux_do_tkill(struct thread *td, l_int ksiginfo_t ksi; int error; - AUDIT_ARG(signum, signum); - AUDIT_ARG(pid, pid); + AUDIT_ARG_SIGNUM(signum); + AUDIT_ARG_PID(pid); /* * Allow signal 0 as a means to check for privileges @@ -563,7 +563,7 @@ linux_do_tkill(struct thread *td, l_int return (ESRCH); } - AUDIT_ARG(process, p); + AUDIT_ARG_PROCESS(p); error = p_cansignal(td, p, signum); if (error) goto out; Modified: head/sys/i386/i386/sys_machdep.c ============================================================================== --- head/sys/i386/i386/sys_machdep.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/i386/i386/sys_machdep.c Sat Jun 27 13:58:44 2009 (r195104) @@ -107,7 +107,7 @@ sysarch(td, uap) uint32_t base; struct segment_descriptor sd, *sdp; - AUDIT_ARG(cmd, uap->op); + AUDIT_ARG_CMD(uap->op); switch (uap->op) { case I386_GET_IOPERM: case I386_SET_IOPERM: Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/kern/kern_descrip.c Sat Jun 27 13:58:44 2009 (r195104) @@ -1144,7 +1144,7 @@ closefrom(struct thread *td, struct clos int fd; fdp = td->td_proc->p_fd; - AUDIT_ARG(fd, uap->lowfd); + AUDIT_ARG_FD(uap->lowfd); /* * Treat negative starting file descriptor values identical to @@ -1219,12 +1219,12 @@ kern_fstat(struct thread *td, int fd, st struct file *fp; int error; - AUDIT_ARG(fd, fd); + AUDIT_ARG_FD(fd); if ((error = fget(td, fd, &fp)) != 0) return (error); - AUDIT_ARG(file, td->td_proc, fp); + AUDIT_ARG_FILE(td->td_proc, fp); error = fo_stat(fp, sbp, td->td_ucred, td); fdrop(fp, td); Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/kern/kern_exec.c Sat Jun 27 13:58:44 2009 (r195104) @@ -274,9 +274,9 @@ kern_execve(td, args, mac_p) struct proc *p = td->td_proc; int error; - AUDIT_ARG(argv, args->begin_argv, args->argc, + AUDIT_ARG_ARGV(args->begin_argv, args->argc, args->begin_envv - args->begin_argv); - AUDIT_ARG(envv, args->begin_envv, args->envc, + AUDIT_ARG_ENVV(args->begin_envv, args->envc, args->endp - args->begin_envv); if (p->p_flag & P_HADTHREADS) { PROC_LOCK(p); @@ -413,13 +413,13 @@ interpret: binvp = nd.ni_vp; imgp->vp = binvp; } else { - AUDIT_ARG(fd, args->fd); + AUDIT_ARG_FD(args->fd); error = fgetvp(td, args->fd, &binvp); if (error) goto exec_fail; vfslocked = VFS_LOCK_GIANT(binvp->v_mount); vn_lock(binvp, LK_EXCLUSIVE | LK_RETRY); - AUDIT_ARG(vnode, binvp, ARG_VNODE1); + AUDIT_ARG_VNODE(binvp, ARG_VNODE1); imgp->vp = binvp; } Modified: head/sys/kern/kern_exit.c ============================================================================== --- head/sys/kern/kern_exit.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/kern/kern_exit.c Sat Jun 27 13:58:44 2009 (r195104) @@ -211,7 +211,7 @@ exit1(struct thread *td, int rv) * it was. The exit status is WEXITSTATUS(rv), but it's not clear * what the return value is. */ - AUDIT_ARG(exit, WEXITSTATUS(rv), 0); + AUDIT_ARG_EXIT(WEXITSTATUS(rv), 0); AUDIT_SYSCALL_EXIT(0, td); #endif @@ -803,7 +803,7 @@ kern_wait(struct thread *td, pid_t pid, struct proc *p, *q; int error, nfound; - AUDIT_ARG(pid, pid); + AUDIT_ARG_PID(pid); q = td->td_proc; if (pid == 0) { Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/kern/kern_fork.c Sat Jun 27 13:58:44 2009 (r195104) @@ -146,7 +146,7 @@ rfork(td, uap) if ((uap->flags & RFKERNELONLY) != 0) return (EINVAL); - AUDIT_ARG(fflags, uap->flags); + AUDIT_ARG_FFLAGS(uap->flags); error = fork1(td, uap->flags, 0, &p2); if (error == 0) { td->td_retval[0] = p2 ? p2->p_pid : 0; @@ -452,7 +452,7 @@ again: thread_lock(td); sched_fork(td, td2); thread_unlock(td); - AUDIT_ARG(pid, p2->p_pid); + AUDIT_ARG_PID(p2->p_pid); LIST_INSERT_HEAD(&allproc, p2, p_list); LIST_INSERT_HEAD(PIDHASH(p2->p_pid), p2, p_hash); Modified: head/sys/kern/kern_prot.c ============================================================================== --- head/sys/kern/kern_prot.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/kern/kern_prot.c Sat Jun 27 13:58:44 2009 (r195104) @@ -489,7 +489,7 @@ setuid(struct thread *td, struct setuid_ int error; uid = uap->uid; - AUDIT_ARG(uid, uid); + AUDIT_ARG_UID(uid); newcred = crget(); uip = uifind(uid); PROC_LOCK(p); @@ -600,7 +600,7 @@ seteuid(struct thread *td, struct seteui int error; euid = uap->euid; - AUDIT_ARG(euid, euid); + AUDIT_ARG_EUID(euid); newcred = crget(); euip = uifind(euid); PROC_LOCK(p); @@ -656,7 +656,7 @@ setgid(struct thread *td, struct setgid_ int error; gid = uap->gid; - AUDIT_ARG(gid, gid); + AUDIT_ARG_GID(gid); newcred = crget(); PROC_LOCK(p); oldcred = crcopysafe(p, newcred); @@ -754,7 +754,7 @@ setegid(struct thread *td, struct setegi int error; egid = uap->egid; - AUDIT_ARG(egid, egid); + AUDIT_ARG_EGID(egid); newcred = crget(); PROC_LOCK(p); oldcred = crcopysafe(p, newcred); @@ -819,7 +819,7 @@ kern_setgroups(struct thread *td, u_int if (ngrp > NGROUPS) return (EINVAL); - AUDIT_ARG(groupset, groups, ngrp); + AUDIT_ARG_GROUPSET(groups, ngrp); newcred = crget(); crextend(newcred, ngrp); PROC_LOCK(p); @@ -876,8 +876,8 @@ setreuid(register struct thread *td, str euid = uap->euid; ruid = uap->ruid; - AUDIT_ARG(euid, euid); - AUDIT_ARG(ruid, ruid); + AUDIT_ARG_EUID(euid); + AUDIT_ARG_RUID(ruid); newcred = crget(); euip = uifind(euid); ruip = uifind(ruid); @@ -942,8 +942,8 @@ setregid(register struct thread *td, str egid = uap->egid; rgid = uap->rgid; - AUDIT_ARG(egid, egid); - AUDIT_ARG(rgid, rgid); + AUDIT_ARG_EGID(egid); + AUDIT_ARG_RGID(rgid); newcred = crget(); PROC_LOCK(p); oldcred = crcopysafe(p, newcred); @@ -1009,9 +1009,9 @@ setresuid(register struct thread *td, st euid = uap->euid; ruid = uap->ruid; suid = uap->suid; - AUDIT_ARG(euid, euid); - AUDIT_ARG(ruid, ruid); - AUDIT_ARG(suid, suid); + AUDIT_ARG_EUID(euid); + AUDIT_ARG_RUID(ruid); + AUDIT_ARG_SUID(suid); newcred = crget(); euip = uifind(euid); ruip = uifind(ruid); @@ -1087,9 +1087,9 @@ setresgid(register struct thread *td, st egid = uap->egid; rgid = uap->rgid; sgid = uap->sgid; - AUDIT_ARG(egid, egid); - AUDIT_ARG(rgid, rgid); - AUDIT_ARG(sgid, sgid); + AUDIT_ARG_EGID(egid); + AUDIT_ARG_RGID(rgid); + AUDIT_ARG_SGID(sgid); newcred = crget(); PROC_LOCK(p); oldcred = crcopysafe(p, newcred); Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/kern/kern_sig.c Sat Jun 27 13:58:44 2009 (r195104) @@ -1674,8 +1674,8 @@ kill(td, uap) register struct proc *p; int error; - AUDIT_ARG(signum, uap->signum); - AUDIT_ARG(pid, uap->pid); + AUDIT_ARG_SIGNUM(uap->signum); + AUDIT_ARG_PID(uap->pid); if ((u_int)uap->signum > _SIG_MAXSIG) return (EINVAL); @@ -1685,7 +1685,7 @@ kill(td, uap) if ((p = zpfind(uap->pid)) == NULL) return (ESRCH); } - AUDIT_ARG(process, p); + AUDIT_ARG_PROCESS(p); error = p_cansignal(td, p, uap->signum); if (error == 0 && uap->signum) psignal(p, uap->signum); @@ -1717,8 +1717,8 @@ okillpg(td, uap) register struct okillpg_args *uap; { - AUDIT_ARG(signum, uap->signum); - AUDIT_ARG(pid, uap->pgid); + AUDIT_ARG_SIGNUM(uap->signum); + AUDIT_ARG_PID(uap->pgid); if ((u_int)uap->signum > _SIG_MAXSIG) return (EINVAL); Modified: head/sys/kern/kern_thr.c ============================================================================== --- head/sys/kern/kern_thr.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/kern/kern_thr.c Sat Jun 27 13:58:44 2009 (r195104) @@ -350,7 +350,7 @@ thr_kill2(struct thread *td, struct thr_ struct proc *p; int error; - AUDIT_ARG(signum, uap->sig); + AUDIT_ARG_SIGNUM(uap->sig); if (uap->pid == td->td_proc->p_pid) { p = td->td_proc; @@ -358,7 +358,7 @@ thr_kill2(struct thread *td, struct thr_ } else if ((p = pfind(uap->pid)) == NULL) { return (ESRCH); } - AUDIT_ARG(process, p); + AUDIT_ARG_PROCESS(p); error = p_cansignal(td, p, uap->sig); if (error == 0) { Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/kern/sys_generic.c Sat Jun 27 13:58:44 2009 (r195104) @@ -561,13 +561,13 @@ kern_ftruncate(td, fd, length) struct file *fp; int error; - AUDIT_ARG(fd, fd); + AUDIT_ARG_FD(fd); if (length < 0) return (EINVAL); error = fget(td, fd, &fp); if (error) return (error); - AUDIT_ARG(file, td->td_proc, fp); + AUDIT_ARG_FILE(td->td_proc, fp); if (!(fp->f_flag & FWRITE)) { fdrop(fp, td); return (EINVAL); Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/kern/sys_process.c Sat Jun 27 13:58:44 2009 (r195104) @@ -400,10 +400,10 @@ ptrace(struct thread *td, struct ptrace_ if (SV_CURPROC_FLAG(SV_ILP32)) wrap32 = 1; #endif - AUDIT_ARG(pid, uap->pid); - AUDIT_ARG(cmd, uap->req); - AUDIT_ARG(addr, uap->addr); - AUDIT_ARG(value, uap->data); + AUDIT_ARG_PID(uap->pid); + AUDIT_ARG_CMD(uap->req); + AUDIT_ARG_ADDR(uap->addr); + AUDIT_ARG_VALUE(uap->data); addr = &r; switch (uap->req) { case PT_GETREGS: @@ -549,7 +549,7 @@ kern_ptrace(struct thread *td, int req, pid = p->p_pid; } } - AUDIT_ARG(process, p); + AUDIT_ARG_PROCESS(p); if ((p->p_flag & P_WEXIT) != 0) { error = ESRCH; Modified: head/sys/kern/vfs_extattr.c ============================================================================== --- head/sys/kern/vfs_extattr.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/kern/vfs_extattr.c Sat Jun 27 13:58:44 2009 (r195104) @@ -70,8 +70,8 @@ extattrctl(td, uap) char attrname[EXTATTR_MAXNAMELEN]; int vfslocked, fnvfslocked, error; - AUDIT_ARG(cmd, uap->cmd); - AUDIT_ARG(value, uap->attrnamespace); + AUDIT_ARG_CMD(uap->cmd); + AUDIT_ARG_VALUE(uap->attrnamespace); /* * uap->attrname is not always defined. We check again later when we * invoke the VFS call so as to pass in NULL there if needed. @@ -82,7 +82,7 @@ extattrctl(td, uap) if (error) return (error); } - AUDIT_ARG(text, attrname); + AUDIT_ARG_TEXT(attrname); vfslocked = fnvfslocked = 0; mp = NULL; @@ -223,12 +223,12 @@ extattr_set_fd(td, uap) char attrname[EXTATTR_MAXNAMELEN]; int vfslocked, error; - AUDIT_ARG(fd, uap->fd); - AUDIT_ARG(value, uap->attrnamespace); + AUDIT_ARG_FD(uap->fd); + AUDIT_ARG_VALUE(uap->attrnamespace); error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL); if (error) return (error); - AUDIT_ARG(text, attrname); + AUDIT_ARG_TEXT(attrname); error = getvnode(td->td_proc->p_fd, uap->fd, &fp); if (error) @@ -258,11 +258,11 @@ extattr_set_file(td, uap) char attrname[EXTATTR_MAXNAMELEN]; int vfslocked, error; - AUDIT_ARG(value, uap->attrnamespace); + AUDIT_ARG_VALUE(uap->attrnamespace); error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL); if (error) return (error); - AUDIT_ARG(text, attrname); + AUDIT_ARG_TEXT(attrname); NDINIT(&nd, LOOKUP, MPSAFE | FOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->path, td); @@ -295,11 +295,11 @@ extattr_set_link(td, uap) char attrname[EXTATTR_MAXNAMELEN]; int vfslocked, error; - AUDIT_ARG(value, uap->attrnamespace); + AUDIT_ARG_VALUE(uap->attrnamespace); error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL); if (error) return (error); - AUDIT_ARG(text, attrname); + AUDIT_ARG_TEXT(attrname); NDINIT(&nd, LOOKUP, MPSAFE | NOFOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->path, td); @@ -403,12 +403,12 @@ extattr_get_fd(td, uap) char attrname[EXTATTR_MAXNAMELEN]; int vfslocked, error; - AUDIT_ARG(fd, uap->fd); - AUDIT_ARG(value, uap->attrnamespace); + AUDIT_ARG_FD(uap->fd); + AUDIT_ARG_VALUE(uap->attrnamespace); error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL); if (error) return (error); - AUDIT_ARG(text, attrname); + AUDIT_ARG_TEXT(attrname); error = getvnode(td->td_proc->p_fd, uap->fd, &fp); if (error) @@ -438,11 +438,11 @@ extattr_get_file(td, uap) char attrname[EXTATTR_MAXNAMELEN]; int vfslocked, error; - AUDIT_ARG(value, uap->attrnamespace); + AUDIT_ARG_VALUE(uap->attrnamespace); error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL); if (error) return (error); - AUDIT_ARG(text, attrname); + AUDIT_ARG_TEXT(attrname); NDINIT(&nd, LOOKUP, MPSAFE | FOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->path, td); @@ -475,11 +475,11 @@ extattr_get_link(td, uap) char attrname[EXTATTR_MAXNAMELEN]; int vfslocked, error; - AUDIT_ARG(value, uap->attrnamespace); + AUDIT_ARG_VALUE(uap->attrnamespace); error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL); if (error) return (error); - AUDIT_ARG(text, attrname); + AUDIT_ARG_TEXT(attrname); NDINIT(&nd, LOOKUP, MPSAFE | NOFOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->path, td); @@ -553,12 +553,12 @@ extattr_delete_fd(td, uap) char attrname[EXTATTR_MAXNAMELEN]; int vfslocked, error; - AUDIT_ARG(fd, uap->fd); - AUDIT_ARG(value, uap->attrnamespace); + AUDIT_ARG_FD(uap->fd); + AUDIT_ARG_VALUE(uap->attrnamespace); error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL); if (error) return (error); - AUDIT_ARG(text, attrname); + AUDIT_ARG_TEXT(attrname); error = getvnode(td->td_proc->p_fd, uap->fd, &fp); if (error) @@ -585,11 +585,11 @@ extattr_delete_file(td, uap) char attrname[EXTATTR_MAXNAMELEN]; int vfslocked, error; - AUDIT_ARG(value, uap->attrnamespace); + AUDIT_ARG_VALUE(uap->attrnamespace); error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL); if (error) return(error); - AUDIT_ARG(text, attrname); + AUDIT_ARG_TEXT(attrname); NDINIT(&nd, LOOKUP, MPSAFE | FOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->path, td); @@ -618,11 +618,11 @@ extattr_delete_link(td, uap) char attrname[EXTATTR_MAXNAMELEN]; int vfslocked, error; - AUDIT_ARG(value, uap->attrnamespace); + AUDIT_ARG_VALUE(uap->attrnamespace); error = copyinstr(uap->attrname, attrname, EXTATTR_MAXNAMELEN, NULL); if (error) return(error); - AUDIT_ARG(text, attrname); + AUDIT_ARG_TEXT(attrname); NDINIT(&nd, LOOKUP, MPSAFE | NOFOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->path, td); @@ -717,8 +717,8 @@ extattr_list_fd(td, uap) struct file *fp; int vfslocked, error; - AUDIT_ARG(fd, uap->fd); - AUDIT_ARG(value, uap->attrnamespace); + AUDIT_ARG_FD(uap->fd); + AUDIT_ARG_VALUE(uap->attrnamespace); error = getvnode(td->td_proc->p_fd, uap->fd, &fp); if (error) return (error); @@ -745,7 +745,7 @@ extattr_list_file(td, uap) struct nameidata nd; int vfslocked, error; - AUDIT_ARG(value, uap->attrnamespace); + AUDIT_ARG_VALUE(uap->attrnamespace); NDINIT(&nd, LOOKUP, MPSAFE | FOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->path, td); error = namei(&nd); @@ -775,7 +775,7 @@ extattr_list_link(td, uap) struct nameidata nd; int vfslocked, error; - AUDIT_ARG(value, uap->attrnamespace); + AUDIT_ARG_VALUE(uap->attrnamespace); NDINIT(&nd, LOOKUP, MPSAFE | NOFOLLOW | AUDITVNODE1, UIO_USERSPACE, uap->path, td); error = namei(&nd); Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/kern/vfs_lookup.c Sat Jun 27 13:58:44 2009 (r195104) @@ -164,9 +164,9 @@ namei(struct nameidata *ndp) /* If we are auditing the kernel pathname, save the user pathname. */ if (cnp->cn_flags & AUDITVNODE1) - AUDIT_ARG(upath, td, cnp->cn_pnbuf, ARG_UPATH1); + AUDIT_ARG_UPATH(td, cnp->cn_pnbuf, ARG_UPATH1); if (cnp->cn_flags & AUDITVNODE2) - AUDIT_ARG(upath, td, cnp->cn_pnbuf, ARG_UPATH2); + AUDIT_ARG_UPATH(td, cnp->cn_pnbuf, ARG_UPATH2); /* * Don't allow empty pathnames. @@ -460,9 +460,6 @@ lookup(struct nameidata *ndp) int dvfslocked; /* VFS Giant state for parent */ int tvfslocked; int lkflags_save; -#ifdef AUDIT - struct thread *td = curthread; -#endif /* * Setup: break out flag bits into variables. @@ -572,9 +569,9 @@ dirloop: ndp->ni_vp = dp; if (cnp->cn_flags & AUDITVNODE1) - AUDIT_ARG(vnode, dp, ARG_VNODE1); + AUDIT_ARG_VNODE(dp, ARG_VNODE1); else if (cnp->cn_flags & AUDITVNODE2) - AUDIT_ARG(vnode, dp, ARG_VNODE2); + AUDIT_ARG_VNODE(dp, ARG_VNODE2); if (!(cnp->cn_flags & (LOCKPARENT | LOCKLEAF))) VOP_UNLOCK(dp, 0); @@ -857,9 +854,9 @@ nextname: VOP_UNLOCK(ndp->ni_dvp, 0); if (cnp->cn_flags & AUDITVNODE1) - AUDIT_ARG(vnode, dp, ARG_VNODE1); + AUDIT_ARG_VNODE(dp, ARG_VNODE1); else if (cnp->cn_flags & AUDITVNODE2) - AUDIT_ARG(vnode, dp, ARG_VNODE2); + AUDIT_ARG_VNODE(dp, ARG_VNODE2); if ((cnp->cn_flags & LOCKLEAF) == 0) VOP_UNLOCK(dp, 0); Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/kern/vfs_mount.c Sat Jun 27 13:58:44 2009 (r195104) @@ -388,7 +388,7 @@ nmount(td, uap) int error; u_int iovcnt; - AUDIT_ARG(fflags, uap->flags); + AUDIT_ARG_FFLAGS(uap->flags); CTR4(KTR_VFS, "%s: iovp %p with iovcnt %d and flags %d", __func__, uap->iovp, uap->iovcnt, uap->flags); @@ -750,7 +750,7 @@ mount(td, uap) struct mntarg *ma = NULL; int error; - AUDIT_ARG(fflags, uap->flags); + AUDIT_ARG_FFLAGS(uap->flags); /* * Filter out MNT_ROOTFS. We do not want clients of mount() in @@ -767,7 +767,7 @@ mount(td, uap) return (error); } - AUDIT_ARG(text, fstype); + AUDIT_ARG_TEXT(fstype); mtx_lock(&Giant); vfsp = vfs_byname_kld(fstype, td, &error); free(fstype, M_TEMP); @@ -1125,7 +1125,7 @@ unmount(td, uap) free(pathbuf, M_TEMP); return (error); } - AUDIT_ARG(upath, td, pathbuf, ARG_UPATH1); + AUDIT_ARG_UPATH(td, pathbuf, ARG_UPATH1); mtx_lock(&Giant); if (uap->flags & MNT_BYFSID) { /* Decode the filesystem ID. */ Modified: head/sys/kern/vfs_syscalls.c ============================================================================== --- head/sys/kern/vfs_syscalls.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/kern/vfs_syscalls.c Sat Jun 27 13:58:44 2009 (r195104) @@ -189,8 +189,8 @@ quotactl(td, uap) int error; struct nameidata nd; - AUDIT_ARG(cmd, uap->cmd); - AUDIT_ARG(uid, uap->uid); + AUDIT_ARG_CMD(uap->cmd); + AUDIT_ARG_UID(uap->uid); if (!prison_allow(td->td_ucred, PR_ALLOW_QUOTAS)) return (EPERM); NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE | AUDITVNODE1, @@ -371,7 +371,7 @@ kern_fstatfs(struct thread *td, int fd, struct vnode *vp; int error; - AUDIT_ARG(fd, fd); + AUDIT_ARG_FD(fd); error = getvnode(td->td_proc->p_fd, fd, &fp); if (error) return (error); @@ -379,7 +379,7 @@ kern_fstatfs(struct thread *td, int fd, vfslocked = VFS_LOCK_GIANT(vp->v_mount); vn_lock(vp, LK_SHARED | LK_RETRY); #ifdef AUDIT - AUDIT_ARG(vnode, vp, ARG_VNODE1); + AUDIT_ARG_VNODE(vp, ARG_VNODE1); #endif mp = vp->v_mount; if (mp) @@ -744,7 +744,7 @@ fchdir(td, uap) int vfslocked; int error; - AUDIT_ARG(fd, uap->fd); + AUDIT_ARG_FD(uap->fd); if ((error = getvnode(fdp, uap->fd, &fp)) != 0) return (error); vp = fp->f_vnode; @@ -752,7 +752,7 @@ fchdir(td, uap) fdrop(fp, td); vfslocked = VFS_LOCK_GIANT(vp->v_mount); vn_lock(vp, LK_SHARED | LK_RETRY); - AUDIT_ARG(vnode, vp, ARG_VNODE1); + AUDIT_ARG_VNODE(vp, ARG_VNODE1); error = change_dir(vp, td); while (!error && (mp = vp->v_mountedhere) != NULL) { int tvfslocked; @@ -1055,8 +1055,8 @@ kern_openat(struct thread *td, int fd, c struct nameidata nd; int vfslocked; - AUDIT_ARG(fflags, flags); - AUDIT_ARG(mode, mode); + AUDIT_ARG_FFLAGS(flags); + AUDIT_ARG_MODE(mode); /* XXX: audit dirfd */ /* * Only one of the O_EXEC, O_RDONLY, O_WRONLY and O_RDWR may @@ -1265,8 +1265,8 @@ kern_mknodat(struct thread *td, int fd, struct nameidata nd; int vfslocked; - AUDIT_ARG(mode, mode); - AUDIT_ARG(dev, dev); + AUDIT_ARG_MODE(mode); + AUDIT_ARG_DEV(dev); switch (mode & S_IFMT) { case S_IFCHR: case S_IFBLK: @@ -1414,7 +1414,7 @@ kern_mkfifoat(struct thread *td, int fd, struct nameidata nd; int vfslocked; - AUDIT_ARG(mode, mode); + AUDIT_ARG_MODE(mode); restart: bwillwrite(); NDINIT_AT(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE1, @@ -1677,7 +1677,7 @@ kern_symlinkat(struct thread *td, char * if ((error = copyinstr(path1, syspath, MAXPATHLEN, NULL)) != 0) goto out; } - AUDIT_ARG(text, syspath); + AUDIT_ARG_TEXT(syspath); restart: bwillwrite(); NDINIT_AT(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE1, @@ -2689,7 +2689,7 @@ chflags(td, uap) struct nameidata nd; int vfslocked; - AUDIT_ARG(fflags, uap->flags); + AUDIT_ARG_FFLAGS(uap->flags); NDINIT(&nd, LOOKUP, FOLLOW | MPSAFE | AUDITVNODE1, UIO_USERSPACE, uap->path, td); if ((error = namei(&nd)) != 0) @@ -2717,7 +2717,7 @@ lchflags(td, uap) struct nameidata nd; int vfslocked; - AUDIT_ARG(fflags, uap->flags); + AUDIT_ARG_FFLAGS(uap->flags); NDINIT(&nd, LOOKUP, NOFOLLOW | MPSAFE | AUDITVNODE1, UIO_USERSPACE, uap->path, td); if ((error = namei(&nd)) != 0) @@ -2751,14 +2751,14 @@ fchflags(td, uap) int vfslocked; int error; - AUDIT_ARG(fd, uap->fd); - AUDIT_ARG(fflags, uap->flags); + AUDIT_ARG_FD(uap->fd); + AUDIT_ARG_FFLAGS(uap->flags); if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0) return (error); vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount); #ifdef AUDIT vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); - AUDIT_ARG(vnode, fp->f_vnode, ARG_VNODE1); + AUDIT_ARG_VNODE(fp->f_vnode, ARG_VNODE1); VOP_UNLOCK(fp->f_vnode, 0); #endif error = setfflags(td, fp->f_vnode, uap->flags); @@ -2877,7 +2877,7 @@ kern_fchmodat(struct thread *td, int fd, int vfslocked; int follow; - AUDIT_ARG(mode, mode); + AUDIT_ARG_MODE(mode); follow = (flag & AT_SYMLINK_NOFOLLOW) ? NOFOLLOW : FOLLOW; NDINIT_AT(&nd, LOOKUP, follow | MPSAFE | AUDITVNODE1, pathseg, path, fd, td); @@ -2912,14 +2912,14 @@ fchmod(td, uap) int vfslocked; int error; - AUDIT_ARG(fd, uap->fd); - AUDIT_ARG(mode, uap->mode); + AUDIT_ARG_FD(uap->fd); + AUDIT_ARG_MODE(uap->mode); if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0) return (error); vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount); #ifdef AUDIT vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); - AUDIT_ARG(vnode, fp->f_vnode, ARG_VNODE1); + AUDIT_ARG_VNODE(fp->f_vnode, ARG_VNODE1); VOP_UNLOCK(fp->f_vnode, 0); #endif error = setfmode(td, fp->f_vnode, uap->mode); @@ -3019,7 +3019,7 @@ kern_fchownat(struct thread *td, int fd, struct nameidata nd; int error, vfslocked, follow; - AUDIT_ARG(owner, uid, gid); + AUDIT_ARG_OWNER(uid, gid); follow = (flag & AT_SYMLINK_NOFOLLOW) ? NOFOLLOW : FOLLOW; NDINIT_AT(&nd, LOOKUP, follow | MPSAFE | AUDITVNODE1, pathseg, path, fd, td); @@ -3089,14 +3089,14 @@ fchown(td, uap) int vfslocked; int error; - AUDIT_ARG(fd, uap->fd); - AUDIT_ARG(owner, uap->uid, uap->gid); + AUDIT_ARG_FD(uap->fd); + AUDIT_ARG_OWNER(uap->uid, uap->gid); if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0) return (error); vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount); #ifdef AUDIT vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); - AUDIT_ARG(vnode, fp->f_vnode, ARG_VNODE1); + AUDIT_ARG_VNODE(fp->f_vnode, ARG_VNODE1); VOP_UNLOCK(fp->f_vnode, 0); #endif error = setfown(td, fp->f_vnode, uap->uid, uap->gid); @@ -3324,7 +3324,7 @@ kern_futimes(struct thread *td, int fd, int vfslocked; int error; - AUDIT_ARG(fd, fd); + AUDIT_ARG_FD(fd); if ((error = getutimes(tptr, tptrseg, ts)) != 0) return (error); if ((error = getvnode(td->td_proc->p_fd, fd, &fp)) != 0) @@ -3332,7 +3332,7 @@ kern_futimes(struct thread *td, int fd, vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount); #ifdef AUDIT vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY); - AUDIT_ARG(vnode, fp->f_vnode, ARG_VNODE1); + AUDIT_ARG_VNODE(fp->f_vnode, ARG_VNODE1); VOP_UNLOCK(fp->f_vnode, 0); #endif error = setutimes(td, fp->f_vnode, ts, 2, tptr == NULL); @@ -3478,7 +3478,7 @@ fsync(td, uap) int vfslocked; int error, lock_flags; - AUDIT_ARG(fd, uap->fd); + AUDIT_ARG_FD(uap->fd); if ((error = getvnode(td->td_proc->p_fd, uap->fd, &fp)) != 0) return (error); vp = fp->f_vnode; @@ -3492,7 +3492,7 @@ fsync(td, uap) lock_flags = LK_EXCLUSIVE; } vn_lock(vp, lock_flags | LK_RETRY); - AUDIT_ARG(vnode, vp, ARG_VNODE1); + AUDIT_ARG_VNODE(vp, ARG_VNODE1); if (vp->v_object != NULL) { VM_OBJECT_LOCK(vp->v_object); vm_object_page_clean(vp->v_object, 0, 0, 0); @@ -3717,7 +3717,7 @@ kern_mkdirat(struct thread *td, int fd, struct nameidata nd; int vfslocked; - AUDIT_ARG(mode, mode); + AUDIT_ARG_MODE(mode); restart: bwillwrite(); NDINIT_AT(&nd, CREATE, LOCKPARENT | SAVENAME | MPSAFE | AUDITVNODE1, @@ -4056,7 +4056,7 @@ kern_getdirentries(struct thread *td, in long loff; int error, eofflag; - AUDIT_ARG(fd, fd); + AUDIT_ARG_FD(fd); if (count > INT_MAX) return (EINVAL); if ((error = getvnode(td->td_proc->p_fd, fd, &fp)) != 0) @@ -4082,7 +4082,7 @@ unionread: auio.uio_td = td; auio.uio_resid = count; vn_lock(vp, LK_SHARED | LK_RETRY); - AUDIT_ARG(vnode, vp, ARG_VNODE1); + AUDIT_ARG_VNODE(vp, ARG_VNODE1); loff = auio.uio_offset = fp->f_offset; #ifdef MAC error = mac_vnode_check_readdir(td->td_ucred, vp); Modified: head/sys/nfs/nfs_nfssvc.c ============================================================================== --- head/sys/nfs/nfs_nfssvc.c Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/nfs/nfs_nfssvc.c Sat Jun 27 13:58:44 2009 (r195104) @@ -79,7 +79,7 @@ nfssvc(struct thread *td, struct nfssvc_ KASSERT(!mtx_owned(&Giant), ("nfssvc(): called with Giant")); - AUDIT_ARG(cmd, uap->flag); + AUDIT_ARG_CMD(uap->flag); error = priv_check(td, PRIV_NFS_DAEMON); if (error) Modified: head/sys/security/audit/audit.h ============================================================================== --- head/sys/security/audit/audit.h Sat Jun 27 13:29:41 2009 (r195103) +++ head/sys/security/audit/audit.h Sat Jun 27 13:58:44 2009 (r195104) @@ -182,12 +182,149 @@ void audit_thread_alloc(struct thread * void audit_thread_free(struct thread *td); /* - * Define a macro to wrap the audit_arg_* calls by checking the global + * Define macros to wrap the audit_arg_* calls by checking the global * audit_enabled flag before performing the actual call. */ -#define AUDIT_ARG(op, args...) do { \ - if (td->td_pflags & TDP_AUDITREC) \ - audit_arg_ ## op (args); \ +#define AUDITING_TD(td) ((td)->td_pflags & TDP_AUDITREC) + +#define AUDIT_ARG_ADDR(addr) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_addr((addr)); \ +} while (0) + +#define AUDIT_ARG_ARGV(argv, argc, length) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_argv((argv), (argc), (length)); \ +} while (0) + +#define AUDIT_ARG_AUDITON(udata) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_auditon((udata)); \ +} while (0) + +#define AUDIT_ARG_CMD(cmd) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_cmd((cmd)); \ +} while (0) + +#define AUDIT_ARG_DEV(dev) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_dev((dev)); \ +} while (0) + +#define AUDIT_ARG_EGID(egid) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_egid((egid)); \ +} while (0) + +#define AUDIT_ARG_ENVV(envv, envc, length) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_envv((envv), (envc), (length)); \ +} while (0) + +#define AUDIT_ARG_EXIT(status, retval) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_exit((status), (retval)); \ +} while (0) + +#define AUDIT_ARG_EUID(euid) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_euid((euid)); \ +} while (0) + +#define AUDIT_ARG_FD(fd) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_fd((fd)); \ +} while (0) + +#define AUDIT_ARG_FILE(p, fp) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_file((p), (fp)); \ +} while (0) + +#define AUDIT_ARG_FFLAGS(fflags) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_fflags((fflags)); \ +} while (0) + +#define AUDIT_ARG_GID(gid) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_gid((gid)); \ +} while (0) + +#define AUDIT_ARG_GROUPSET(gidset, gidset_size) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_groupset((gidset), (gidset_size)); \ +} while (0) + +#define AUDIT_ARG_MODE(mode) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_mode((mode)); \ +} while (0) + +#define AUDIT_ARG_OWNER(uid, gid) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_owner((uid), (gid)); \ +} while (0) + +#define AUDIT_ARG_PID(pid) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_pid((pid)); \ +} while (0) + +#define AUDIT_ARG_PROCESS(p) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_process((p)); \ +} while (0) + +#define AUDIT_ARG_RGID(rgid) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_gid((rgid)); \ +} while (0) + +#define AUDIT_ARG_RUID(ruid) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_ruid((ruid)); \ +} while (0) + +#define AUDIT_ARG_SIGNUM(signum) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_signum((signum)); \ +} while (0) + +#define AUDIT_ARG_SGID(sgid) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_sgid((sgid)); \ +} while (0) + +#define AUDIT_ARG_SUID(suid) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_suid((suid)); \ +} while (0) + +#define AUDIT_ARG_TEXT(text) do { \ + if (AUDITING_TD(curthread)) \ + audit_arg_text((text)); \ +} while (0) + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@FreeBSD.ORG Sat Jun 27 15:03:50 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 979F9106564A; Sat, 27 Jun 2009 15:03:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 856F38FC14; Sat, 27 Jun 2009 15:03:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5RF3od6080798; Sat, 27 Jun 2009 15:03:50 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5RF3oGs080796; Sat, 27 Jun 2009 15:03:50 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906271503.n5RF3oGs080796@svn.freebsd.org> From: Robert Watson Date: Sat, 27 Jun 2009 15:03: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: r195105 - head/sys/amd64/amd64 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jun 2009 15:03:51 -0000 Author: rwatson Date: Sat Jun 27 15:03:50 2009 New Revision: 195105 URL: http://svn.freebsd.org/changeset/base/195105 Log: Catch missed AUDIT_ARG() -> AUDIT_ARG_CMD() on amd64. Submitted by: Florian Smeets Approved by: re (kib) (implicit) MFC after: 1 week Modified: head/sys/amd64/amd64/sys_machdep.c Modified: head/sys/amd64/amd64/sys_machdep.c ============================================================================== --- head/sys/amd64/amd64/sys_machdep.c Sat Jun 27 13:58:44 2009 (r195104) +++ head/sys/amd64/amd64/sys_machdep.c Sat Jun 27 15:03:50 2009 (r195105) @@ -170,7 +170,7 @@ sysarch(td, uap) * XXXKIB check that the BSM generation code knows to encode * the op argument. */ - AUDIT_ARG(cmd, uap->op); + AUDIT_ARG_CMD(uap->op); switch (uap->op) { case I386_GET_IOPERM: case I386_SET_IOPERM: From owner-svn-src-head@FreeBSD.ORG Sat Jun 27 20:06:56 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CC79D1065670; Sat, 27 Jun 2009 20:06:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B72808FC24; Sat, 27 Jun 2009 20:06:56 +0000 (UTC) (envelope-from sam@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5RK6ufs086945; Sat, 27 Jun 2009 20:06:56 GMT (envelope-from sam@svn.freebsd.org) Received: (from sam@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5RK6upt086937; Sat, 27 Jun 2009 20:06:56 GMT (envelope-from sam@svn.freebsd.org) Message-Id: <200906272006.n5RK6upt086937@svn.freebsd.org> From: Sam Leffler Date: Sat, 27 Jun 2009 20:06: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: r195114 - in head/sys/dev/ath: . ath_hal ath_hal/ar5212 ath_hal/ar5416 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jun 2009 20:06:58 -0000 Author: sam Date: Sat Jun 27 20:06:56 2009 New Revision: 195114 URL: http://svn.freebsd.org/changeset/base/195114 Log: Add HAL_RX_FILTER_BSSID support (to disable bssid match): o add HAL_CAP_BSSIDMATCH to identify parts that have the support for disabling bssid match o honor capability for set/get rx filter o use HAL_CAP_BSSIDMATCH in driver to decide whether to use the bssid match disable or fall back to promisc mode Reviewed by: rpaulo Approved by: re (rwatson) Modified: head/sys/dev/ath/ath_hal/ah.c head/sys/dev/ath/ath_hal/ah.h head/sys/dev/ath/ath_hal/ah_internal.h head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c head/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c head/sys/dev/ath/if_athvar.h Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Sat Jun 27 19:57:55 2009 (r195113) +++ head/sys/dev/ath/ath_hal/ah.c Sat Jun 27 20:06:56 2009 (r195114) @@ -503,6 +503,8 @@ ath_hal_getcapability(struct ath_hal *ah case HAL_CAP_INTRMASK: /* mask of supported interrupts */ *result = pCap->halIntrMask; return HAL_OK; + case HAL_CAP_BSSIDMATCH: /* hardware has disable bssid match */ + return pCap->halBssidMatchSupport ? HAL_OK : HAL_ENOTSUPP; default: return HAL_EINVAL; } Modified: head/sys/dev/ath/ath_hal/ah.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah.h Sat Jun 27 19:57:55 2009 (r195113) +++ head/sys/dev/ath/ath_hal/ah.h Sat Jun 27 20:06:56 2009 (r195114) @@ -110,6 +110,7 @@ typedef enum { HAL_CAP_BB_HANG = 35, /* can baseband hang */ HAL_CAP_MAC_HANG = 36, /* can MAC hang */ HAL_CAP_INTRMASK = 37, /* bitmask of supported interrupts */ + HAL_CAP_BSSIDMATCH = 38, /* hardware has disable bssid match */ } HAL_CAPABILITY_TYPE; /* @@ -296,6 +297,7 @@ typedef enum { HAL_RX_FILTER_PHYERR = 0x00000100, /* Allow phy errors */ HAL_RX_FILTER_PHYRADAR = 0x00000200, /* Allow phy radar errors */ HAL_RX_FILTER_COMPBAR = 0x00000400, /* Allow compressed BAR */ + HAL_RX_FILTER_BSSID = 0x00000800, /* Disable BSSID match */ } HAL_RX_FILTER; typedef enum { Modified: head/sys/dev/ath/ath_hal/ah_internal.h ============================================================================== --- head/sys/dev/ath/ath_hal/ah_internal.h Sat Jun 27 19:57:55 2009 (r195113) +++ head/sys/dev/ath/ath_hal/ah_internal.h Sat Jun 27 20:06:56 2009 (r195114) @@ -193,7 +193,8 @@ typedef struct { halExtChanDfsSupport : 1, halForcePpmSupport : 1, halEnhancedPmSupport : 1, - halMbssidAggrSupport : 1; + halMbssidAggrSupport : 1, + halBssidMatchSupport : 1; uint32_t halWirelessModes; uint16_t halTotalQueues; uint16_t halKeyCacheSize; Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Sat Jun 27 19:57:55 2009 (r195113) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_attach.c Sat Jun 27 20:06:56 2009 (r195114) @@ -833,11 +833,15 @@ ar5212FillCapabilityInfo(struct ath_hal ahpriv->ah_rxornIsFatal = (AH_PRIVATE(ah)->ah_macVersion < AR_SREV_VERSION_VENICE); - /* h/w phy counters first appeared in Hainan */ - pCap->halHwPhyCounterSupport = - (AH_PRIVATE(ah)->ah_macVersion == AR_SREV_VERSION_VENICE && + /* enable features that first appeared in Hainan */ + if ((AH_PRIVATE(ah)->ah_macVersion == AR_SREV_VERSION_VENICE && AH_PRIVATE(ah)->ah_macRev == AR_SREV_HAINAN) || - AH_PRIVATE(ah)->ah_macVersion > AR_SREV_VERSION_VENICE; + AH_PRIVATE(ah)->ah_macVersion > AR_SREV_VERSION_VENICE) { + /* h/w phy counters */ + pCap->halHwPhyCounterSupport = AH_TRUE; + /* bssid match disable */ + pCap->halBssidMatchSupport = AH_TRUE; + } pCap->halTstampPrecision = 15; pCap->halIntrMask = HAL_INT_COMMON Modified: head/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c Sat Jun 27 19:57:55 2009 (r195113) +++ head/sys/dev/ath/ath_hal/ar5212/ar5212_recv.c Sat Jun 27 20:06:56 2009 (r195114) @@ -14,7 +14,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: ar5212_recv.c,v 1.4 2008/11/10 04:08:03 sam Exp $ + * $FreeBSD$ */ #include "opt_ah.h" @@ -163,6 +163,9 @@ ar5212GetRxFilter(struct ath_hal *ah) bits |= HAL_RX_FILTER_PHYRADAR; if (phybits & (AR_PHY_ERR_OFDM_TIMING|AR_PHY_ERR_CCK_TIMING)) bits |= HAL_RX_FILTER_PHYERR; + if (AH_PRIVATE(ah)->ah_caps.halBssidMatchSupport && + (OS_REG_READ(ah, AR_MISC_MODE) & AR_MISC_MODE_BSSID_MATCH_FORCE)) + bits |= HAL_RX_FILTER_BSSID; return bits; } @@ -175,7 +178,8 @@ ar5212SetRxFilter(struct ath_hal *ah, ui uint32_t phybits; OS_REG_WRITE(ah, AR_RX_FILTER, - bits &~ (HAL_RX_FILTER_PHYRADAR|HAL_RX_FILTER_PHYERR)); + bits &~ (HAL_RX_FILTER_PHYRADAR|HAL_RX_FILTER_PHYERR| + HAL_RX_FILTER_BSSID)); phybits = 0; if (bits & HAL_RX_FILTER_PHYRADAR) phybits |= AR_PHY_ERR_RADAR; @@ -189,6 +193,14 @@ ar5212SetRxFilter(struct ath_hal *ah, ui OS_REG_WRITE(ah, AR_RXCFG, OS_REG_READ(ah, AR_RXCFG) &~ AR_RXCFG_ZLFDMA); } + if (AH_PRIVATE(ah)->ah_caps.halBssidMatchSupport) { + uint32_t miscbits = OS_REG_READ(ah, AR_MISC_MODE); + if (bits & HAL_RX_FILTER_BSSID) + miscbits |= AR_MISC_MODE_BSSID_MATCH_FORCE; + else + miscbits &= ~AR_MISC_MODE_BSSID_MATCH_FORCE; + OS_REG_WRITE(ah, AR_MISC_MODE, miscbits); + } } /* Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c ============================================================================== --- head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Sat Jun 27 19:57:55 2009 (r195113) +++ head/sys/dev/ath/ath_hal/ar5416/ar5416_attach.c Sat Jun 27 20:06:56 2009 (r195114) @@ -811,6 +811,7 @@ ar5416FillCapabilityInfo(struct ath_hal pCap->halMbssidAggrSupport = AH_TRUE; pCap->halForcePpmSupport = AH_TRUE; pCap->halEnhancedPmSupport = AH_TRUE; + pCap->halBssidMatchSupport = AH_TRUE; if (ath_hal_eepromGetFlag(ah, AR_EEP_RFKILL) && ath_hal_eepromGet(ah, AR_EEP_RFSILENT, &ahpriv->ah_rfsilent) == HAL_OK) { Modified: head/sys/dev/ath/if_athvar.h ============================================================================== --- head/sys/dev/ath/if_athvar.h Sat Jun 27 19:57:55 2009 (r195113) +++ head/sys/dev/ath/if_athvar.h Sat Jun 27 20:06:56 2009 (r195114) @@ -590,6 +590,8 @@ void ath_intr(void *); (ath_hal_getcapability(_ah, HAL_CAP_FASTFRAME, 0, NULL) == HAL_OK) #define ath_hal_hasbssidmask(_ah) \ (ath_hal_getcapability(_ah, HAL_CAP_BSSIDMASK, 0, NULL) == HAL_OK) +#define ath_hal_hasbssidmatch(_ah) \ + (ath_hal_getcapability(_ah, HAL_CAP_BSSIDMATCH, 0, NULL) == HAL_OK) #define ath_hal_hastsfadjust(_ah) \ (ath_hal_getcapability(_ah, HAL_CAP_TSF_ADJUST, 0, NULL) == HAL_OK) #define ath_hal_gettsfadjust(_ah) \ From owner-svn-src-head@FreeBSD.ORG Sat Jun 27 21:21:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C30491065676; Sat, 27 Jun 2009 21:21:11 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B0B008FC21; Sat, 27 Jun 2009 21:21:11 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5RLLB7S088612; Sat, 27 Jun 2009 21:21:11 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5RLLBAq088610; Sat, 27 Jun 2009 21:21:11 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200906272121.n5RLLBAq088610@svn.freebsd.org> From: Andrew Thompson Date: Sat, 27 Jun 2009 21:21: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: r195120 - head/sys/dev/sound/usb X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jun 2009 21:21:12 -0000 Author: thompsa Date: Sat Jun 27 21:21:11 2009 New Revision: 195120 URL: http://svn.freebsd.org/changeset/base/195120 Log: Use the correct mutex in umidi_open() Submitted by: Hans Petter Selasky Approved by: re (kib) Modified: head/sys/dev/sound/usb/uaudio.c Modified: head/sys/dev/sound/usb/uaudio.c ============================================================================== --- head/sys/dev/sound/usb/uaudio.c Sat Jun 27 21:19:09 2009 (r195119) +++ head/sys/dev/sound/usb/uaudio.c Sat Jun 27 21:21:11 2009 (r195120) @@ -3671,24 +3671,24 @@ umidi_open(struct usb_fifo *fifo, int ff if (usb_fifo_alloc_buffer(fifo, 4, (1024 / 4))) { return (ENOMEM); } - mtx_lock(&Giant); + mtx_lock(&chan->mtx); chan->read_open_refcount++; sub->read_open = 1; - mtx_unlock(&Giant); + mtx_unlock(&chan->mtx); } if (fflags & FWRITE) { if (usb_fifo_alloc_buffer(fifo, 32, (1024 / 32))) { return (ENOMEM); } /* clear stall first */ - mtx_lock(&Giant); + mtx_lock(&chan->mtx); chan->flags |= UMIDI_FLAG_WRITE_STALL; chan->write_open_refcount++; sub->write_open = 1; /* reset */ sub->state = UMIDI_ST_UNKNOWN; - mtx_unlock(&Giant); + mtx_unlock(&chan->mtx); } return (0); /* success */ } From owner-svn-src-head@FreeBSD.ORG Sat Jun 27 21:23:30 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 875861065672; Sat, 27 Jun 2009 21:23:30 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 73C778FC0C; Sat, 27 Jun 2009 21:23:30 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5RLNUjX088710; Sat, 27 Jun 2009 21:23:30 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5RLNU2r088696; Sat, 27 Jun 2009 21:23:30 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200906272123.n5RLNU2r088696@svn.freebsd.org> From: Andrew Thompson Date: Sat, 27 Jun 2009 21:23:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195121 - in head/sys/dev/usb: . controller net storage X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jun 2009 21:23:31 -0000 Author: thompsa Date: Sat Jun 27 21:23:30 2009 New Revision: 195121 URL: http://svn.freebsd.org/changeset/base/195121 Log: Sync to p4 - Add support for devices that handle set and clear stall in hardware. - Add missing get timestamp function - Add more xfer flags Submitted by: Hans Petter Selasky Approved by: re (kib) Modified: head/sys/dev/usb/controller/at91dci.c head/sys/dev/usb/controller/atmegadci.c head/sys/dev/usb/controller/avr32dci.c head/sys/dev/usb/controller/musb_otg.c head/sys/dev/usb/controller/uss820dci.c head/sys/dev/usb/net/if_cdce.c head/sys/dev/usb/storage/ustorage_fs.c head/sys/dev/usb/usb_controller.h head/sys/dev/usb/usb_device.c head/sys/dev/usb/usb_handle_request.c head/sys/dev/usb/usb_if.m head/sys/dev/usb/usb_transfer.c head/sys/dev/usb/usbdi.h Modified: head/sys/dev/usb/controller/at91dci.c ============================================================================== --- head/sys/dev/usb/controller/at91dci.c Sat Jun 27 21:21:11 2009 (r195120) +++ head/sys/dev/usb/controller/at91dci.c Sat Jun 27 21:23:30 2009 (r195121) @@ -1227,7 +1227,7 @@ at91dci_device_done(struct usb_xfer *xfe static void at91dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer, - struct usb_endpoint *ep) + struct usb_endpoint *ep, uint8_t *did_stall) { struct at91dci_softc *sc; uint32_t csr_val; Modified: head/sys/dev/usb/controller/atmegadci.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci.c Sat Jun 27 21:21:11 2009 (r195120) +++ head/sys/dev/usb/controller/atmegadci.c Sat Jun 27 21:23:30 2009 (r195121) @@ -1113,7 +1113,7 @@ atmegadci_device_done(struct usb_xfer *x static void atmegadci_set_stall(struct usb_device *udev, struct usb_xfer *xfer, - struct usb_endpoint *ep) + struct usb_endpoint *ep, uint8_t *did_stall) { struct atmegadci_softc *sc; uint8_t ep_no; Modified: head/sys/dev/usb/controller/avr32dci.c ============================================================================== --- head/sys/dev/usb/controller/avr32dci.c Sat Jun 27 21:21:11 2009 (r195120) +++ head/sys/dev/usb/controller/avr32dci.c Sat Jun 27 21:23:30 2009 (r195121) @@ -1081,7 +1081,7 @@ avr32dci_device_done(struct usb_xfer *xf static void avr32dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer, - struct usb_endpoint *ep) + struct usb_endpoint *ep, uint8_t *did_stall) { struct avr32dci_softc *sc; uint8_t ep_no; Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Sat Jun 27 21:21:11 2009 (r195120) +++ head/sys/dev/usb/controller/musb_otg.c Sat Jun 27 21:23:30 2009 (r195121) @@ -1473,7 +1473,7 @@ musbotg_device_done(struct usb_xfer *xfe static void musbotg_set_stall(struct usb_device *udev, struct usb_xfer *xfer, - struct usb_endpoint *ep) + struct usb_endpoint *ep, uint8_t *did_stall) { struct musbotg_softc *sc; uint8_t ep_no; Modified: head/sys/dev/usb/controller/uss820dci.c ============================================================================== --- head/sys/dev/usb/controller/uss820dci.c Sat Jun 27 21:21:11 2009 (r195120) +++ head/sys/dev/usb/controller/uss820dci.c Sat Jun 27 21:23:30 2009 (r195121) @@ -1202,7 +1202,7 @@ uss820dci_device_done(struct usb_xfer *x static void uss820dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer, - struct usb_endpoint *ep) + struct usb_endpoint *ep, uint8_t *did_stall) { struct uss820dci_softc *sc; uint8_t ep_no; Modified: head/sys/dev/usb/net/if_cdce.c ============================================================================== --- head/sys/dev/usb/net/if_cdce.c Sat Jun 27 21:21:11 2009 (r195120) +++ head/sys/dev/usb/net/if_cdce.c Sat Jun 27 21:23:30 2009 (r195121) @@ -764,7 +764,7 @@ tr_setup: static int cdce_handle_request(device_t dev, const void *req, void **pptr, uint16_t *plen, - uint16_t offset, uint8_t is_complete) + uint16_t offset, uint8_t *pstate) { return (ENXIO); /* use builtin handler */ } Modified: head/sys/dev/usb/storage/ustorage_fs.c ============================================================================== --- head/sys/dev/usb/storage/ustorage_fs.c Sat Jun 27 21:21:11 2009 (r195120) +++ head/sys/dev/usb/storage/ustorage_fs.c Sat Jun 27 21:23:30 2009 (r195121) @@ -475,10 +475,11 @@ ustorage_fs_transfer_stop(struct ustorag static int ustorage_fs_handle_request(device_t dev, const void *preq, void **pptr, uint16_t *plen, - uint16_t offset, uint8_t is_complete) + uint16_t offset, uint8_t *pstate) { struct ustorage_fs_softc *sc = device_get_softc(dev); const struct usb_device_request *req = preq; + uint8_t is_complete = *pstate; if (!is_complete) { if ((req->bmRequestType == UT_WRITE_CLASS_INTERFACE) && Modified: head/sys/dev/usb/usb_controller.h ============================================================================== --- head/sys/dev/usb/usb_controller.h Sat Jun 27 21:21:11 2009 (r195120) +++ head/sys/dev/usb/usb_controller.h Sat Jun 27 21:23:30 2009 (r195121) @@ -96,7 +96,7 @@ struct usb_bus_methods { /* USB Device mode only - Mandatory */ void (*get_hw_ep_profile) (struct usb_device *udev, const struct usb_hw_ep_profile **ppf, uint8_t ep_addr); - void (*set_stall) (struct usb_device *udev, struct usb_xfer *xfer, struct usb_endpoint *ep); + void (*set_stall) (struct usb_device *udev, struct usb_xfer *xfer, struct usb_endpoint *ep, uint8_t *did_stall); void (*clear_stall) (struct usb_device *udev, struct usb_endpoint *ep); }; Modified: head/sys/dev/usb/usb_device.c ============================================================================== --- head/sys/dev/usb/usb_device.c Sat Jun 27 21:21:11 2009 (r195120) +++ head/sys/dev/usb/usb_device.c Sat Jun 27 21:23:30 2009 (r195121) @@ -936,7 +936,7 @@ usbd_set_endpoint_stall(struct usb_devic * complete the USB transfer like in case of a timeout * setting the error code "USB_ERR_STALLED". */ - (udev->bus->methods->set_stall) (udev, xfer, ep); + (udev->bus->methods->set_stall) (udev, xfer, ep, &do_stall); } if (!do_stall) { ep->toggle_next = 0; /* reset data toggle */ Modified: head/sys/dev/usb/usb_handle_request.c ============================================================================== --- head/sys/dev/usb/usb_handle_request.c Sat Jun 27 21:21:11 2009 (r195120) +++ head/sys/dev/usb/usb_handle_request.c Sat Jun 27 21:23:30 2009 (r195121) @@ -198,6 +198,7 @@ usb_handle_iface_request(struct usb_xfer struct usb_device *udev = xfer->xroot->udev; int error; uint8_t iface_index; + uint8_t temp_state; if ((req.bmRequestType & 0x1F) == UT_INTERFACE) { iface_index = req.wIndex[0]; /* unicast */ @@ -222,6 +223,10 @@ tr_repeat: /* end of interfaces non-existing interface */ goto tr_stalled; } + /* set initial state */ + + temp_state = state; + /* forward request to interface, if any */ if ((error != 0) && @@ -233,7 +238,7 @@ tr_repeat: #endif error = USB_HANDLE_REQUEST(iface->subdev, &req, ppdata, plen, - off, state); + off, &temp_state); } iface_parent = usbd_get_iface(udev, iface->parent_iface_index); @@ -252,14 +257,18 @@ tr_repeat: (iface_parent->subdev != iface->subdev) && device_is_attached(iface_parent->subdev)) { error = USB_HANDLE_REQUEST(iface_parent->subdev, - &req, ppdata, plen, off, - state); + &req, ppdata, plen, off, &temp_state); } if (error == 0) { /* negativly adjust pointer and length */ *ppdata = ((uint8_t *)(*ppdata)) - off; *plen += off; - goto tr_valid; + + if ((state == USB_HR_NOT_COMPLETE) && + (temp_state == USB_HR_COMPLETE_OK)) + goto tr_short; + else + goto tr_valid; } else if (error == ENOTTY) { goto tr_stalled; } @@ -337,6 +346,12 @@ tr_valid: USB_XFER_LOCK(xfer); return (0); +tr_short: + mtx_unlock(&Giant); + sx_unlock(udev->default_sx + 1); + USB_XFER_LOCK(xfer); + return (USB_ERR_SHORT_XFER); + tr_stalled: mtx_unlock(&Giant); sx_unlock(udev->default_sx + 1); @@ -444,6 +459,7 @@ usb_handle_request(struct usb_xfer *xfer uint16_t wValue; uint16_t wIndex; uint8_t state; + uint8_t is_complete = 1; usb_error_t err; union { uWord wStatus; @@ -596,6 +612,9 @@ usb_handle_request(struct usb_xfer *xfer USB_ADD_BYTES(&src_zcopy, 0), &max_len, req, off, state); if (err == 0) { + is_complete = 0; + goto tr_valid; + } else if (err == USB_ERR_SHORT_XFER) { goto tr_valid; } /* @@ -735,7 +754,7 @@ tr_valid: if (rem > xfer->max_data_length) { rem = usbd_xfer_max_len(xfer); } - if (rem != max_len) { + if ((rem != max_len) && (is_complete != 0)) { /* * If we don't transfer the data we can transfer, then * the transfer is short ! Modified: head/sys/dev/usb/usb_if.m ============================================================================== --- head/sys/dev/usb/usb_if.m Sat Jun 27 21:21:11 2009 (r195120) +++ head/sys/dev/usb/usb_if.m Sat Jun 27 21:23:30 2009 (r195121) @@ -36,6 +36,11 @@ INTERFACE usb; # The device received a control request # +# The value pointed to by "pstate" can be updated to +# "USB_HR_COMPLETE_OK" to indicate that the control +# read transfer is complete, in case of short USB +# control transfers. +# # Return values: # 0: Success # ENOTTY: Transaction stalled @@ -47,5 +52,5 @@ METHOD int handle_request { void **pptr; /* data pointer */ uint16_t *plen; /* maximum transfer length */ uint16_t offset; /* data offset */ - uint8_t is_complete; /* set if transfer is complete, see USB_HR_XXX */ + uint8_t *pstate; /* set if transfer is complete, see USB_HR_XXX */ }; Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Sat Jun 27 21:21:11 2009 (r195120) +++ head/sys/dev/usb/usb_transfer.c Sat Jun 27 21:23:30 2009 (r195121) @@ -2352,29 +2352,37 @@ usbd_pipe_start(struct usb_xfer_queue *p (type == UE_INTERRUPT)) { struct usb_device *udev; struct usb_xfer_root *info; + uint8_t did_stall; info = xfer->xroot; udev = info->udev; - ep->is_stalled = 1; + did_stall = 1; if (udev->flags.usb_mode == USB_MODE_DEVICE) { (udev->bus->methods->set_stall) ( - udev, NULL, ep); + udev, NULL, ep, &did_stall); } else if (udev->default_xfer[1]) { info = udev->default_xfer[1]->xroot; - if (usb_proc_msignal( + usb_proc_msignal( &info->bus->non_giant_callback_proc, - &udev->cs_msg[0], &udev->cs_msg[1])) { - /* ignore */ - } + &udev->cs_msg[0], &udev->cs_msg[1]); } else { /* should not happen */ DPRINTFN(0, "No stall handler!\n"); } /* - * We get started again when the stall is cleared! + * Check if we should stall. Some USB hardware + * handles set- and clear-stall in hardware. */ - return; + if (did_stall) { + /* + * The transfer will be continued when + * the clear-stall control endpoint + * message is received. + */ + ep->is_stalled = 1; + return; + } } } /* Set or clear stall complete - special case */ @@ -2966,6 +2974,12 @@ usbd_xfer_set_flag(struct usb_xfer *xfer case USB_SHORT_XFER_OK: xfer->flags.short_xfer_ok = 1; break; + case USB_MULTI_SHORT_OK: + xfer->flags.short_frames_ok = 1; + break; + case USB_MANUAL_STATUS: + xfer->flags.manual_status = 1; + break; } } @@ -2979,5 +2993,22 @@ usbd_xfer_clr_flag(struct usb_xfer *xfer case USB_SHORT_XFER_OK: xfer->flags.short_xfer_ok = 0; break; + case USB_MULTI_SHORT_OK: + xfer->flags.short_frames_ok = 0; + break; + case USB_MANUAL_STATUS: + xfer->flags.manual_status = 0; + break; } } + +/* + * The following function returns in milliseconds when the isochronous + * transfer was completed by the hardware. The returned value wraps + * around 65536 milliseconds. + */ +uint16_t +usbd_xfer_get_timestamp(struct usb_xfer *xfer) +{ + return (xfer->isoc_time_complete); +} Modified: head/sys/dev/usb/usbdi.h ============================================================================== --- head/sys/dev/usb/usbdi.h Sat Jun 27 21:21:11 2009 (r195120) +++ head/sys/dev/usb/usbdi.h Sat Jun 27 21:23:30 2009 (r195121) @@ -78,6 +78,8 @@ typedef enum { /* keep in sync with usb_ #define USB_SHORT_XFER_OK 0x0004 /* allow short reads */ #define USB_DELAY_STATUS_STAGE 0x0010 /* insert delay before STATUS stage */ #define USB_USER_DATA_PTR 0x0020 /* internal flag */ +#define USB_MULTI_SHORT_OK 0x0040 /* allow multiple short frames */ +#define USB_MANUAL_STATUS 0x0080 /* manual ctrl status */ #define USB_NO_TIMEOUT 0 #define USB_DEFAULT_TIMEOUT 5000 /* 5000 ms = 5 seconds */ @@ -486,6 +488,7 @@ void usbd_xfer_set_stall(struct usb_xfer int usbd_xfer_is_stalled(struct usb_xfer *xfer); void usbd_xfer_set_flag(struct usb_xfer *xfer, int flag); void usbd_xfer_clr_flag(struct usb_xfer *xfer, int flag); +uint16_t usbd_xfer_get_timestamp(struct usb_xfer *xfer); void usbd_copy_in(struct usb_page_cache *cache, usb_frlength_t offset, const void *ptr, usb_frlength_t len); From owner-svn-src-head@FreeBSD.ORG Sat Jun 27 21:37:37 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 264731065672; Sat, 27 Jun 2009 21:37:37 +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 14B8C8FC16; Sat, 27 Jun 2009 21:37:37 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5RLbalU089045; Sat, 27 Jun 2009 21:37:36 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5RLbaEJ089043; Sat, 27 Jun 2009 21:37:36 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <200906272137.n5RLbaEJ089043@svn.freebsd.org> From: Alan Cox Date: Sat, 27 Jun 2009 21:37: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: r195122 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Jun 2009 21:37:37 -0000 Author: alc Date: Sat Jun 27 21:37:36 2009 New Revision: 195122 URL: http://svn.freebsd.org/changeset/base/195122 Log: Correct a long-standing performance bug in cluster_rbuild(). Specifically, in the case of a file system with a block size that is less than the page size, cluster_rbuild() looks at too many of the page's valid bits. Consequently, it may terminate prematurely, resulting in poor performance. Reported by: bde Reviewed by: tegge Approved by: re (kib) Modified: head/sys/kern/vfs_cluster.c Modified: head/sys/kern/vfs_cluster.c ============================================================================== --- head/sys/kern/vfs_cluster.c Sat Jun 27 21:23:30 2009 (r195121) +++ head/sys/kern/vfs_cluster.c Sat Jun 27 21:37:36 2009 (r195122) @@ -310,7 +310,9 @@ cluster_rbuild(vp, filesize, lbn, blkno, struct bufobj *bo; struct buf *bp, *tbp; daddr_t bn; - int i, inc, j; + off_t off; + long tinc, tsize; + int i, inc, j, toff; KASSERT(size == vp->v_mount->mnt_stat.f_iosize, ("cluster_rbuild: size %ld != filesize %jd\n", @@ -402,15 +404,24 @@ cluster_rbuild(vp, filesize, lbn, blkno, * take part in the cluster. If it is partially valid * then we stop. */ + off = tbp->b_offset; + tsize = size; VM_OBJECT_LOCK(tbp->b_bufobj->bo_object); - for (j = 0;j < tbp->b_npages; j++) { + for (j = 0; tsize > 0; j++) { + toff = off & PAGE_MASK; + tinc = tsize; + if (toff + tinc > PAGE_SIZE) + tinc = PAGE_SIZE - toff; VM_OBJECT_LOCK_ASSERT(tbp->b_pages[j]->object, MA_OWNED); - if (tbp->b_pages[j]->valid) + if ((tbp->b_pages[j]->valid & + vm_page_bits(toff, tinc)) != 0) break; + off += tinc; + tsize -= tinc; } VM_OBJECT_UNLOCK(tbp->b_bufobj->bo_object); - if (j != tbp->b_npages) { + if (tsize > 0) { bqrelse(tbp); break; }