From owner-svn-src-user@FreeBSD.ORG Sun Oct 20 09:51:38 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id AC461FF5; Sun, 20 Oct 2013 09:51:38 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 893282FAE; Sun, 20 Oct 2013 09:51:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9K9pcX2009734; Sun, 20 Oct 2013 09:51:38 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9K9pamY009717; Sun, 20 Oct 2013 09:51:36 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201310200951.r9K9pamY009717@svn.freebsd.org> From: Andre Oppermann Date: Sun, 20 Oct 2013 09:51:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256780 - in user/andre/mbuf_staging: dev/bxe dev/cas dev/lge dev/mwl dev/wb kern sys X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2013 09:51:38 -0000 Author: andre Date: Sun Oct 20 09:51:36 2013 New Revision: 256780 URL: http://svnweb.freebsd.org/changeset/base/256780 Log: Give ext_free way more latitude in handling of external mbuf storage and associated refcounts. The behavior is managed by using the m_ext.ext_flags to signal various combinations of external storage and refcount management. At every step (*ext_free) can capture the whole mbuf freeing process by using the return values EXT_FREE_CONT or EXT_FREE_DONE. With EXT_FLAG_EMBREF no external refcount storage is allocated by the mbuf system and a pointer must be supplied by the m_extadd() caller. The location of the refcount storage must be inside the attached external memory. It is managed as usual by incrementing/decrementing the value at the location. With EXT_FLAG_EXTREF no external refcount storage is allocated by the mbuf system and a pointer must be supplied by the m_extadd() caller. The location of the refcount storage can be anywhere within KVM. It must not disappear until after the associated external storage has been freed. It is managed as usual by incrementing/decrementing the value at the location. With EXT_FLAG_REFCNT no external refcount storage is alloced by the mbuf system. No pointer needs to be supplied. Every in/decrement of the refcount is done through (*m_ext_free) and the new parameters EXT_FREE_REFINC, EXT_FREE_REFDEC, and EXT_FREE_REFDEL. The previous mbuf type EXT_EXTREF is removed and the m_ext.ext_flags are used instead. As long as the new features are not used the behavior remains the same as before. NB: This is API and implementation is still subject to changes and refinements. Other changes: Simplify m_free() by removing m_tag_delete_chain() which is done in the zone_mbuf dtor anyways. Add typedef ext_free_t for (*)(struct mbuf *, void *, void *, int). m_extadd() gains two more parameters: u_int refcnt, int ext_flags. Users of the m_extadd()/MEXTADD() APIs in the generic kernel are adjusted. Within modules there is some fallout not yet fixed. Modified: user/andre/mbuf_staging/dev/bxe/bxe.c user/andre/mbuf_staging/dev/cas/if_cas.c user/andre/mbuf_staging/dev/lge/if_lge.c user/andre/mbuf_staging/dev/mwl/if_mwl.c user/andre/mbuf_staging/dev/wb/if_wb.c user/andre/mbuf_staging/kern/kern_mbuf.c user/andre/mbuf_staging/kern/uipc_mbuf.c user/andre/mbuf_staging/kern/uipc_syscalls.c user/andre/mbuf_staging/sys/mbuf.h user/andre/mbuf_staging/sys/sf_buf.h Modified: user/andre/mbuf_staging/dev/bxe/bxe.c ============================================================================== --- user/andre/mbuf_staging/dev/bxe/bxe.c Sun Oct 20 01:40:59 2013 (r256779) +++ user/andre/mbuf_staging/dev/bxe/bxe.c Sun Oct 20 09:51:36 2013 (r256780) @@ -5052,7 +5052,6 @@ bxe_dump_mbuf(struct bxe_softc *sc, case EXT_NET_DRV: type = "EXT_NET_DRV"; break; case EXT_MOD_TYPE: type = "EXT_MOD_TYPE"; break; case EXT_DISPOSABLE: type = "EXT_DISPOSABLE"; break; - case EXT_EXTREF: type = "EXT_EXTREF"; break; default: type = "UNKNOWN"; break; } Modified: user/andre/mbuf_staging/dev/cas/if_cas.c ============================================================================== --- user/andre/mbuf_staging/dev/cas/if_cas.c Sun Oct 20 01:40:59 2013 (r256779) +++ user/andre/mbuf_staging/dev/cas/if_cas.c Sun Oct 20 09:51:36 2013 (r256780) @@ -132,7 +132,7 @@ static void cas_detach(struct cas_softc static int cas_disable_rx(struct cas_softc *sc); static int cas_disable_tx(struct cas_softc *sc); static void cas_eint(struct cas_softc *sc, u_int status); -static int cas_free(struct mbuf *m, void *arg1, void* arg2); +static int cas_free(struct mbuf *m, void *arg1, void* arg2, int action); static void cas_init(void *xsc); static void cas_init_locked(struct cas_softc *sc); static void cas_init_regs(struct cas_softc *sc); @@ -1888,7 +1888,7 @@ cas_rint(struct cas_softc *sc) } static int -cas_free(struct mbuf *m, void *arg1, void *arg2) +cas_free(struct mbuf *m, void *arg1, void *arg2, int action) { struct cas_rxdsoft *rxds; struct cas_softc *sc; Modified: user/andre/mbuf_staging/dev/lge/if_lge.c ============================================================================== --- user/andre/mbuf_staging/dev/lge/if_lge.c Sun Oct 20 01:40:59 2013 (r256779) +++ user/andre/mbuf_staging/dev/lge/if_lge.c Sun Oct 20 09:51:36 2013 (r256780) @@ -122,7 +122,7 @@ static int lge_detach(device_t); static int lge_alloc_jumbo_mem(struct lge_softc *); static void lge_free_jumbo_mem(struct lge_softc *); static void *lge_jalloc(struct lge_softc *); -static int lge_jfree(struct mbuf *, void *, void *); +static int lge_jfree(struct mbuf *, void *, void *, int); static int lge_newbuf(struct lge_softc *, struct lge_rx_desc *, struct mbuf *); static int lge_encap(struct lge_softc *, struct mbuf *, u_int32_t *); @@ -847,7 +847,7 @@ lge_jalloc(sc) * Release a jumbo buffer. */ static int -lge_jfree(struct mbuf *m, void *buf, void *args) +lge_jfree(struct mbuf *m, void *buf, void *args, int action) { struct lge_softc *sc; int i; Modified: user/andre/mbuf_staging/dev/mwl/if_mwl.c ============================================================================== --- user/andre/mbuf_staging/dev/mwl/if_mwl.c Sun Oct 20 01:40:59 2013 (r256779) +++ user/andre/mbuf_staging/dev/mwl/if_mwl.c Sun Oct 20 09:51:36 2013 (r256780) @@ -2622,7 +2622,7 @@ mwl_rxbuf_init(struct mwl_softc *sc, str } static int -mwl_ext_free(struct mbuf *m, void *data, void *arg) +mwl_ext_free(struct mbuf *m, void *data, void *arg, int action) { struct mwl_softc *sc = arg; Modified: user/andre/mbuf_staging/dev/wb/if_wb.c ============================================================================== --- user/andre/mbuf_staging/dev/wb/if_wb.c Sun Oct 20 01:40:59 2013 (r256779) +++ user/andre/mbuf_staging/dev/wb/if_wb.c Sun Oct 20 09:51:36 2013 (r256780) @@ -142,7 +142,7 @@ static int wb_probe(device_t); static int wb_attach(device_t); static int wb_detach(device_t); -static int wb_bfree(struct mbuf *, void *addr, void *args); +static int wb_bfree(struct mbuf *, void *addr, void *args, int action); static int wb_newbuf(struct wb_softc *, struct wb_chain_onefrag *, struct mbuf *); static int wb_encap(struct wb_softc *, struct wb_chain *, struct mbuf *); @@ -823,7 +823,7 @@ wb_list_rx_init(sc) } static int -wb_bfree(struct mbuf *m, void *buf, void *args) +wb_bfree(struct mbuf *m, void *buf, void *args, int action) { return (EXT_FREE_OK); Modified: user/andre/mbuf_staging/kern/kern_mbuf.c ============================================================================== --- user/andre/mbuf_staging/kern/kern_mbuf.c Sun Oct 20 01:40:59 2013 (r256779) +++ user/andre/mbuf_staging/kern/kern_mbuf.c Sun Oct 20 09:51:36 2013 (r256780) @@ -482,7 +482,7 @@ mb_dtor_pack(void *mem, int size, void * struct mbuf *m; m = (struct mbuf *)mem; - if ((m->m_flags & M_PKTHDR) != 0) + if ((m->m_flags & M_PKTHDR) && !SLIST_EMPTY(&m->m_pkthdr.tags)) m_tag_delete_chain(m, NULL); /* Make sure we've got a clean cluster back. */ @@ -555,7 +555,7 @@ mb_ctor_clust(void *mem, int size, void } m = (struct mbuf *)arg; - refcnt = uma_find_refcnt(zone, mem); + refcnt = uma_find_refcnt(zone, mem); /* XXX */ *refcnt = 1; if (m != NULL) { m->m_ext.ext_buf = (caddr_t)mem; @@ -920,7 +920,6 @@ m_cljset(struct mbuf *m, void *cl, int t m->m_ext.ext_flags = 0; m->m_ext.ref_cnt = uma_find_refcnt(zone, cl); m->m_flags |= M_EXT; - } /* @@ -1039,12 +1038,11 @@ m_free(struct mbuf *m) { struct mbuf *n = m->m_next; - if ((m->m_flags & (M_PKTHDR|M_NOFREE)) == (M_PKTHDR|M_NOFREE)) - m_tag_delete_chain(m, NULL); if (m->m_flags & M_EXT) mb_free_ext(m); - else if ((m->m_flags & M_NOFREE) == 0) - uma_zfree(zone_mbuf, m); + else + uma_zfree(zone_mbuf, m); /* free's tag chain */ + return (n); } @@ -1078,28 +1076,30 @@ m_freem(struct mbuf *mb) * Nothing. */ int -m_extadd(struct mbuf *mb, caddr_t buf, u_int size, - int (*freef)(struct mbuf *, void *, void *), void *arg1, void *arg2, - int flags, int type, int wait) +m_extadd(struct mbuf *mb, caddr_t buf, u_int size, ext_free_t freef, + void *arg1, void *arg2, int flags, int type, u_int *refcnt, int ext_flags, + int wait) { - KASSERT(type != EXT_CLUSTER, ("%s: EXT_CLUSTER not allowed", __func__)); - if (type != EXT_EXTREF) + if (refcnt == NULL) { mb->m_ext.ref_cnt = uma_zalloc(zone_ext_refcnt, wait); + if (mb->m_ext.ref_cnt == NULL) + return (ENOMEM); + *(mb->m_ext.ref_cnt) = 1; + } else + mb->m_ext.ref_cnt = refcnt; - if (mb->m_ext.ref_cnt == NULL) - return (ENOMEM); + KASSERT(mb->m_ext.ref_cnt != NULL, ("%s: ref_cnt is NULL", __func__)); + KASSERT(*(mb->m_ext.ref_cnt) >= 1, ("%s: refcount is <1", __func__)); - *(mb->m_ext.ref_cnt) = 1; mb->m_flags |= (M_EXT | flags); - mb->m_ext.ext_buf = buf; - mb->m_data = mb->m_ext.ext_buf; + mb->m_data = mb->m_ext.ext_buf = buf; mb->m_ext.ext_size = size; mb->m_ext.ext_free = freef; mb->m_ext.ext_arg1 = arg1; mb->m_ext.ext_arg2 = arg2; mb->m_ext.ext_type = type; - mb->m_ext.ext_flags = 0; + mb->m_ext.ext_flags = ext_flags; return (0); } @@ -1109,7 +1109,7 @@ m_extadd(struct mbuf *mb, caddr_t buf, u */ void m_extaddref(struct mbuf *m, caddr_t buf, u_int size, u_int *ref_cnt, - int (*freef)(struct mbuf *, void *, void *), void *arg1, void *arg2) + ext_free_t freef, void *arg1, void *arg2) { KASSERT(ref_cnt != NULL, ("%s: ref_cnt not provided", __func__)); @@ -1124,35 +1124,60 @@ m_extaddref(struct mbuf *m, caddr_t buf, m->m_ext.ext_arg1 = arg1; m->m_ext.ext_arg2 = arg2; m->m_ext.ext_flags = 0; - m->m_ext.ext_type = EXT_EXTREF; + m->m_ext.ext_type = EXT_NET_DRV; } /* * Non-directly-exported function to clean up after mbufs with M_EXT - * storage attached to them if the reference count hits 1. + * storage attached to them if the reference count is decremented or + * hits 1. + * + * The normal behavior for the built in types is to free the cluster + * to one of our cluster zones, free the refcount to the UMA external + * refcount zone, and to free the mbuf to the mbuf zone. The exeption + * is the packet zone where the mbuf+cluster package is returned whole. + * + * To give advanced users of the mbuf system more latitude the behavior + * can be modified with these flags: + * + * With EXT_FLAG_EMBREF we don't call any refcount disposal function. + * With EXT_FLAG_REFCNT we call (*ext_free) on every decrement. + * With EXT_FLAG_EXTREF we call (*ext_free) on for refcount disposal. + * + * At ext_free (*ext_free) can return EXT_FREE_DONE letting us know + * that everthing has been handled and we can return immediately. + * + * NB: Two separate free/disposal steps are done here: 1) disposal of + * the external storage; 2) disposal of the refcount storage. + * NB: The ref_cnt pointer must be maintained and valid for reading at + * all times. */ static void mb_free_ext(struct mbuf *m) { - int skipmbuf; - + KASSERT((m->m_flags & M_EXT) == M_EXT, ("%s: M_EXT not set", __func__)); - KASSERT(m->m_ext.ref_cnt != NULL, ("%s: ref_cnt not set", __func__)); /* - * check if the header is embedded in the cluster + * If the (*ext_free) function does full refcount management, + * allow it handle this mbuf at its discretion. */ - skipmbuf = (m->m_flags & M_NOFREE); + if (m->m_ext.ext_flags & EXT_FLAG_REFCNT) + if ((*(m->m_ext.ext_free))(m, m->m_ext.ext_arg1, + m->m_ext.ext_arg2, EXT_FREE_REFDEC) == EXT_FREE_DONE) + return; - /* Free attached storage if this mbuf is the only reference to it. */ + /* + * Free attached storage if this mbuf is the only reference to it. + * Otherwise we only decrement the reference count, detach and free + * this mbuf. + */ if (*(m->m_ext.ref_cnt) == 1 || atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 1) { switch (m->m_ext.ext_type) { case EXT_PACKET: /* The packet zone is special. */ - if (*(m->m_ext.ref_cnt) == 0) - *(m->m_ext.ref_cnt) = 1; - uma_zfree(zone_pack, m); - return; /* Job done. */ + uma_zfree(zone_pack, m); /* frees tag chain */ + return; case EXT_CLUSTER: uma_zfree(zone_clust, m->m_ext.ext_buf); break; @@ -1169,28 +1194,46 @@ mb_free_ext(struct mbuf *m) case EXT_NET_DRV: case EXT_MOD_TYPE: case EXT_DISPOSABLE: - *(m->m_ext.ref_cnt) = 0; - uma_zfree(zone_ext_refcnt, __DEVOLATILE(u_int *, - m->m_ext.ref_cnt)); - /* FALLTHROUGH */ - case EXT_EXTREF: - KASSERT(m->m_ext.ext_free != NULL, - ("%s: ext_free not set", __func__)); - (void)(*(m->m_ext.ext_free))(m, m->m_ext.ext_arg1, - m->m_ext.ext_arg2); - break; + case EXT_VENDOR1: + case EXT_VENDOR2: + case EXT_VENDOR3: + case EXT_VENDOR4: + case EXT_EXP1: + case EXT_EXP2: + case EXT_EXP3: + case EXT_EXP4: default: - KASSERT(m->m_ext.ext_type == 0, - ("%s: unknown ext_type", __func__)); + if ((*(m->m_ext.ext_free))(m, m->m_ext.ext_arg1, + m->m_ext.ext_arg2, EXT_FREE_DISPOSE) == + EXT_FREE_DONE) + return; + break; + } + + /* + * Free the reference count storage. + */ + if (m->m_ext.ext_flags & EXT_FLAG_EMBREF) { +#ifdef INVARIANTS + *(m->m_ext.ref_cnt) = 0; +#endif + } else if (m->m_ext.ext_flags & EXT_FLAG_EXTREF) { + if ((*(m->m_ext.ext_free))(m, m->m_ext.ext_arg1, + m->m_ext.ext_arg2, EXT_FREE_REFDEL) == + EXT_FREE_DONE) + return; + } else if (m->m_ext.ref_cnt != NULL) { + *(m->m_ext.ref_cnt) = 0; + uma_zfree(zone_ext_refcnt, + __DEVOLATILE(u_int *, m->m_ext.ref_cnt)); } } - if (skipmbuf) - return; - + /* - * Free this mbuf back to the mbuf zone with all m_ext - * information purged. + * Free this mbuf back to the mbuf zone with all m_ext information + * purged. */ +#ifdef INVARIANTS m->m_ext.ext_buf = NULL; m->m_ext.ext_free = NULL; m->m_ext.ext_arg1 = NULL; @@ -1199,8 +1242,9 @@ mb_free_ext(struct mbuf *m) m->m_ext.ext_size = 0; m->m_ext.ext_type = 0; m->m_ext.ext_flags = 0; +#endif m->m_flags &= ~M_EXT; - uma_zfree(zone_mbuf, m); + uma_zfree(zone_mbuf, m); /* frees tag chain */ } /* Modified: user/andre/mbuf_staging/kern/uipc_mbuf.c ============================================================================== --- user/andre/mbuf_staging/kern/uipc_mbuf.c Sun Oct 20 01:40:59 2013 (r256779) +++ user/andre/mbuf_staging/kern/uipc_mbuf.c Sun Oct 20 09:51:36 2013 (r256780) @@ -95,7 +95,10 @@ mb_dupcl(struct mbuf *n, struct mbuf *m) KASSERT(m->m_ext.ref_cnt != NULL, ("%s: ref_cnt not set", __func__)); KASSERT((n->m_flags & M_EXT) == 0, ("%s: M_EXT set", __func__)); - if (*(m->m_ext.ref_cnt) == 1) + if (m->m_ext.ext_flags & EXT_FLAG_REFCNT) + (void)(*m->m_ext.ext_free)(m, m->m_ext.ext_arg1, + m->m_ext.ext_arg2, EXT_FREE_REFINC); + else if (*(m->m_ext.ref_cnt) == 1) *(m->m_ext.ref_cnt) += 1; else atomic_add_int(m->m_ext.ref_cnt, 1); @@ -1777,6 +1780,10 @@ m_unshare(struct mbuf *m0, int how) return (m0); } +/* + * Check if the mbuf data section is writable or not. + * XXXAO: The non-atomic read of ref_cnt is safe enough for this purpose. + */ int _m_writable(const struct mbuf *m) { Modified: user/andre/mbuf_staging/kern/uipc_syscalls.c ============================================================================== --- user/andre/mbuf_staging/kern/uipc_syscalls.c Sun Oct 20 01:40:59 2013 (r256779) +++ user/andre/mbuf_staging/kern/uipc_syscalls.c Sun Oct 20 09:51:36 2013 (r256780) @@ -1854,7 +1854,7 @@ struct sendfile_sync { * Detach mapped page and release resources back to the system. */ int -sf_buf_mext(struct mbuf *mb, void *addr, void *args) +sf_buf_mext(struct mbuf *mb, void *addr, void *args, int flags) { vm_page_t m; struct sendfile_sync *sfs; @@ -1879,7 +1879,7 @@ sf_buf_mext(struct mbuf *mb, void *addr, if (--sfs->count == 0) cv_signal(&sfs->cv); mtx_unlock(&sfs->mtx); - return (EXT_FREE_OK); + return (EXT_FREE_CONT); } /* @@ -2441,14 +2441,14 @@ retry_space: m0 = m_get((mnw ? M_NOWAIT : M_WAITOK), MT_DATA); if (m0 == NULL) { error = (mnw ? EAGAIN : ENOBUFS); - (void)sf_buf_mext(NULL, NULL, sf); + (void)sf_buf_mext(NULL, NULL, sf, 0); break; } if (m_extadd(m0, (caddr_t )sf_buf_kva(sf), PAGE_SIZE, - sf_buf_mext, sfs, sf, M_RDONLY, EXT_SFBUF, + sf_buf_mext, sfs, sf, M_RDONLY, EXT_SFBUF, NULL, 0, (mnw ? M_NOWAIT : M_WAITOK)) != 0) { error = (mnw ? EAGAIN : ENOBUFS); - (void)sf_buf_mext(NULL, NULL, sf); + (void)sf_buf_mext(NULL, NULL, sf, 0); m_freem(m0); break; } Modified: user/andre/mbuf_staging/sys/mbuf.h ============================================================================== --- user/andre/mbuf_staging/sys/mbuf.h Sun Oct 20 01:40:59 2013 (r256779) +++ user/andre/mbuf_staging/sys/mbuf.h Sun Oct 20 09:51:36 2013 (r256780) @@ -76,6 +76,9 @@ struct uio; */ #define mtod(m, t) ((t)((m)->m_data)) #define mtodo(m, o) ((void *)(((m)->m_data) + (o))) + +struct mbuf; +typedef int (*ext_free_t)(struct mbuf *, void *, void *, int); #endif /* _KERNEL */ /* @@ -166,8 +169,7 @@ struct mh_ext { uint32_t ext_size; /* size of buffer, for ext_free */ uint32_t ext_type:8, /* type of external storage */ ext_flags:24; /* external storage mbuf flags */ - int (*ext_free) /* free routine if not the usual */ - (struct mbuf *, void *, void *); + ext_free_t ext_free; void *ext_arg1; /* optional argument pointer */ void *ext_arg2; /* optional argument pointer */ }; @@ -337,15 +339,14 @@ struct mbuf { #define EXT_NET_DRV 252 /* custom ext_buf provided by net driver(s) */ #define EXT_MOD_TYPE 253 /* custom module's ext_buf type */ #define EXT_DISPOSABLE 254 /* can throw this buffer away w/page flipping */ -#define EXT_EXTREF 255 /* has externally maintained ref_cnt ptr */ /* * Flags for external mbuf buffer types. * NB: limited to the lower 24 bits. */ -#define EXT_FLAG_EMBREF 0x000001 /* embedded ref_cnt, notyet */ -#define EXT_FLAG_EXTREF 0x000002 /* external ref_cnt, notyet */ -#define EXT_FLAG_NOFREE 0x000010 /* don't free mbuf to pool, notyet */ +#define EXT_FLAG_EMBREF 0x000001 /* embedded ref_cnt */ +#define EXT_FLAG_EXTREF 0x000002 /* external alloc ref_cnt */ +#define EXT_FLAG_REFCNT 0x000004 /* ref_cnt mgnt by ext_free */ #define EXT_FLAG_VENDOR1 0x010000 /* for vendor-internal use */ #define EXT_FLAG_VENDOR2 0x020000 /* for vendor-internal use */ @@ -361,15 +362,25 @@ struct mbuf { * EXT flag description for use with printf(9) %b identifier. */ #define EXT_FLAG_BITS \ - "\20\1EXT_FLAG_EMBREF\2EXT_FLAG_EXTREF\5EXT_FLAG_NOFREE" \ + "\20\1EXT_FLAG_EMBREF\2EXT_FLAG_EXTREF\5EXT_FLAG_REFCNT" \ "\21EXT_FLAG_VENDOR1\22EXT_FLAG_VENDOR2\23EXT_FLAG_VENDOR3" \ "\24EXT_FLAG_VENDOR4\25EXT_FLAG_EXP1\26EXT_FLAG_EXP2\27EXT_FLAG_EXP3" \ "\30EXT_FLAG_EXP4" /* + * Flags used when calling (*ext_free). + */ +#define EXT_FREE_DISPOSE 0 /* Free the external storage */ +#define EXT_FREE_REFINC 1 /* Increment externally managed refcount */ +#define EXT_FREE_REFDEC 2 /* Decrement externally managed refocunt */ +#define EXT_FREE_REFDEL 3 /* Delete externally managed refcount */ + +/* * Return values for (*ext_free). */ -#define EXT_FREE_OK 0 /* Normal return */ +#define EXT_FREE_DONE 0 /* Work done and mb_free_ext shall return */ +#define EXT_FREE_CONT 1 /* Work done and mb_free_ext shall continue */ +#define EXT_FREE_OK EXT_FREE_CONT /* * Flags indicating checksum, segmentation and other offload work to be @@ -479,11 +490,10 @@ struct mbuf { * as implemented in kern/kern_mbuf.c. */ int m_pkthdr_init(struct mbuf *, int); -int m_extadd(struct mbuf *, caddr_t, u_int, - int (*)(struct mbuf *, void *, void *), void *, void *, - int, int, int); +int m_extadd(struct mbuf *, caddr_t, u_int, ext_free_t, + void *, void *, int, int, u_int *, int, int); void m_extaddref(struct mbuf *, caddr_t, u_int, u_int *, - int (*)(struct mbuf *, void *, void *), void *, void *); + ext_free_t, void *, void *); int m_init(struct mbuf *, int, int, short, int); struct mbuf *m_get(int, short); struct mbuf *m_getclr(int, short); @@ -509,7 +519,7 @@ struct mbuf *m_uiotombuf(struct uio *, i m_getm2((m), (len), (how), (type), M_PKTHDR) #define MEXTADD(m, buf, size, free, arg1, arg2, flags, type) \ (void )m_extadd((m), (caddr_t)(buf), (size), (free), (arg1), (arg2),\ - (flags), (type), M_NOWAIT) + (flags), (type), NULL, 0, M_NOWAIT) #define MBTOM(how) (how) #define M_DONTWAIT M_NOWAIT #define M_TRYWAIT M_WAITOK Modified: user/andre/mbuf_staging/sys/sf_buf.h ============================================================================== --- user/andre/mbuf_staging/sys/sf_buf.h Sun Oct 20 01:40:59 2013 (r256779) +++ user/andre/mbuf_staging/sys/sf_buf.h Sun Oct 20 09:51:36 2013 (r256780) @@ -61,6 +61,6 @@ extern counter_u64_t sfstat[sizeof(struc #define SFSTAT_INC(name) SFSTAT_ADD(name, 1) #endif /* _KERNEL */ -int sf_buf_mext(struct mbuf *mb, void *addr, void *args); +int sf_buf_mext(struct mbuf *mb, void *addr, void *args, int flags); #endif /* !_SYS_SF_BUF_H_ */ From owner-svn-src-user@FreeBSD.ORG Sun Oct 20 10:02:13 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id A38C729B; Sun, 20 Oct 2013 10:02:13 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8ABEF200B; Sun, 20 Oct 2013 10:02:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9KA2DtK015631; Sun, 20 Oct 2013 10:02:13 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9KA257c015538; Sun, 20 Oct 2013 10:02:05 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201310201002.r9KA257c015538@svn.freebsd.org> From: Andre Oppermann Date: Sun, 20 Oct 2013 10:02:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256781 - in user/andre/mbuf_staging: amd64/amd64 amd64/conf amd64/include amd64/vmm amd64/vmm/intel arm/arm arm/freescale/imx arm/include arm/mv arm/versatile arm/xscale/i80321 arm/xsc... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2013 10:02:13 -0000 Author: andre Date: Sun Oct 20 10:02:04 2013 New Revision: 256781 URL: http://svnweb.freebsd.org/changeset/base/256781 Log: IFC @r256780. Added: user/andre/mbuf_staging/dev/altera/atse/ - copied from r256780, head/sys/dev/altera/atse/ user/andre/mbuf_staging/dev/cxgbe/firmware/t4fw-1.9.12.0.bin.uu - copied unchanged from r256780, head/sys/dev/cxgbe/firmware/t4fw-1.9.12.0.bin.uu user/andre/mbuf_staging/dev/cxgbe/firmware/t5fw-1.9.12.0.bin.uu - copied unchanged from r256780, head/sys/dev/cxgbe/firmware/t5fw-1.9.12.0.bin.uu user/andre/mbuf_staging/dev/cxgbe/iw_cxgbe/ - copied from r256780, head/sys/dev/cxgbe/iw_cxgbe/ user/andre/mbuf_staging/dev/etherswitch/arswitch/arswitch_9340.c - copied unchanged from r256780, head/sys/dev/etherswitch/arswitch/arswitch_9340.c user/andre/mbuf_staging/dev/etherswitch/arswitch/arswitch_9340.h - copied unchanged from r256780, head/sys/dev/etherswitch/arswitch/arswitch_9340.h user/andre/mbuf_staging/dev/random/dummy_rng.c - copied unchanged from r256780, head/sys/dev/random/dummy_rng.c user/andre/mbuf_staging/dev/random/live_entropy_sources.c - copied unchanged from r256780, head/sys/dev/random/live_entropy_sources.c user/andre/mbuf_staging/dev/random/live_entropy_sources.h - copied unchanged from r256780, head/sys/dev/random/live_entropy_sources.h user/andre/mbuf_staging/dev/random/rwfile.c - copied unchanged from r256780, head/sys/dev/random/rwfile.c user/andre/mbuf_staging/dev/random/rwfile.h - copied unchanged from r256780, head/sys/dev/random/rwfile.h user/andre/mbuf_staging/modules/cxgbe/iw_cxgbe/ - copied from r256780, head/sys/modules/cxgbe/iw_cxgbe/ user/andre/mbuf_staging/powerpc/pseries/phyp_llan.c - copied unchanged from r256780, head/sys/powerpc/pseries/phyp_llan.c Deleted: user/andre/mbuf_staging/contrib/rdma/core_priv.h user/andre/mbuf_staging/contrib/rdma/ib_addr.h user/andre/mbuf_staging/contrib/rdma/ib_cache.h user/andre/mbuf_staging/contrib/rdma/ib_cm.h user/andre/mbuf_staging/contrib/rdma/ib_fmr_pool.h user/andre/mbuf_staging/contrib/rdma/ib_mad.h user/andre/mbuf_staging/contrib/rdma/ib_marshall.h user/andre/mbuf_staging/contrib/rdma/ib_pack.h user/andre/mbuf_staging/contrib/rdma/ib_sa.h user/andre/mbuf_staging/contrib/rdma/ib_smi.h user/andre/mbuf_staging/contrib/rdma/ib_umem.h user/andre/mbuf_staging/contrib/rdma/ib_user_cm.h user/andre/mbuf_staging/contrib/rdma/ib_user_mad.h user/andre/mbuf_staging/contrib/rdma/ib_user_sa.h user/andre/mbuf_staging/contrib/rdma/ib_user_verbs.h user/andre/mbuf_staging/contrib/rdma/ib_verbs.h user/andre/mbuf_staging/contrib/rdma/iw_cm.h user/andre/mbuf_staging/contrib/rdma/rdma_addr.c user/andre/mbuf_staging/contrib/rdma/rdma_cache.c user/andre/mbuf_staging/contrib/rdma/rdma_cm.h user/andre/mbuf_staging/contrib/rdma/rdma_cm_ib.h user/andre/mbuf_staging/contrib/rdma/rdma_cma.c user/andre/mbuf_staging/contrib/rdma/rdma_device.c user/andre/mbuf_staging/contrib/rdma/rdma_iwcm.c user/andre/mbuf_staging/contrib/rdma/rdma_user_cm.h user/andre/mbuf_staging/contrib/rdma/rdma_verbs.c user/andre/mbuf_staging/contrib/rdma/types.h user/andre/mbuf_staging/dev/cxgbe/firmware/t4fw-1.8.11.0.bin.uu user/andre/mbuf_staging/dev/cxgbe/firmware/t5fw-1.8.22.0.bin.uu user/andre/mbuf_staging/dev/random/pseudo_rng.c user/andre/mbuf_staging/modules/rdma/addr/ user/andre/mbuf_staging/modules/rdma/cma/ user/andre/mbuf_staging/modules/rdma/core/ user/andre/mbuf_staging/modules/rdma/iwcm/ Modified: user/andre/mbuf_staging/amd64/amd64/pmap.c user/andre/mbuf_staging/amd64/conf/GENERIC user/andre/mbuf_staging/amd64/include/vmm.h (contents, props changed) user/andre/mbuf_staging/amd64/vmm/intel/vmx.c user/andre/mbuf_staging/amd64/vmm/intel/vmx.h user/andre/mbuf_staging/amd64/vmm/intel/vmx_controls.h user/andre/mbuf_staging/amd64/vmm/vmm_dev.c user/andre/mbuf_staging/amd64/vmm/x86.c user/andre/mbuf_staging/arm/arm/busdma_machdep-v6.c user/andre/mbuf_staging/arm/arm/cpufunc.c user/andre/mbuf_staging/arm/arm/cpufunc_asm_armv7.S user/andre/mbuf_staging/arm/arm/fusu.S user/andre/mbuf_staging/arm/arm/identcpu.c user/andre/mbuf_staging/arm/arm/locore.S user/andre/mbuf_staging/arm/arm/machdep.c user/andre/mbuf_staging/arm/arm/pl310.c user/andre/mbuf_staging/arm/arm/pmap-v6.c user/andre/mbuf_staging/arm/freescale/imx/imx51_ccm.c user/andre/mbuf_staging/arm/include/armreg.h user/andre/mbuf_staging/arm/include/pmap.h user/andre/mbuf_staging/arm/mv/common.c user/andre/mbuf_staging/arm/mv/mv_localbus.c user/andre/mbuf_staging/arm/mv/mvreg.h user/andre/mbuf_staging/arm/versatile/versatile_pci.c user/andre/mbuf_staging/arm/xscale/i80321/ep80219_machdep.c user/andre/mbuf_staging/arm/xscale/i80321/iq31244_machdep.c user/andre/mbuf_staging/arm/xscale/i8134x/crb_machdep.c user/andre/mbuf_staging/arm/xscale/ixp425/avila_machdep.c user/andre/mbuf_staging/arm/xscale/pxa/pxa_machdep.c user/andre/mbuf_staging/boot/forth/loader.conf user/andre/mbuf_staging/boot/i386/btx/btx/btx.S user/andre/mbuf_staging/cam/ata/ata_all.c user/andre/mbuf_staging/cam/ata/ata_all.h user/andre/mbuf_staging/cam/ata/ata_da.c user/andre/mbuf_staging/cam/ata/ata_pmp.c user/andre/mbuf_staging/cam/cam_periph.c user/andre/mbuf_staging/cam/cam_periph.h user/andre/mbuf_staging/cam/cam_xpt.c user/andre/mbuf_staging/cam/cam_xpt_periph.h user/andre/mbuf_staging/cam/scsi/scsi_all.c user/andre/mbuf_staging/cam/scsi/scsi_all.h user/andre/mbuf_staging/cam/scsi/scsi_cd.c user/andre/mbuf_staging/cam/scsi/scsi_ch.c user/andre/mbuf_staging/cam/scsi/scsi_da.c user/andre/mbuf_staging/cam/scsi/scsi_enc.c user/andre/mbuf_staging/cam/scsi/scsi_pass.c user/andre/mbuf_staging/cam/scsi/scsi_pt.c user/andre/mbuf_staging/cam/scsi/scsi_sa.c user/andre/mbuf_staging/cam/scsi/scsi_sg.c user/andre/mbuf_staging/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c user/andre/mbuf_staging/cddl/contrib/opensolaris/uts/common/sys/dtrace.h user/andre/mbuf_staging/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c user/andre/mbuf_staging/cddl/contrib/opensolaris/uts/powerpc/sys/fasttrap_isa.h user/andre/mbuf_staging/cddl/dev/dtrace/dtrace_sysctl.c user/andre/mbuf_staging/conf/NOTES user/andre/mbuf_staging/conf/files user/andre/mbuf_staging/conf/files.amd64 user/andre/mbuf_staging/conf/files.i386 user/andre/mbuf_staging/conf/files.powerpc user/andre/mbuf_staging/conf/kmod.mk user/andre/mbuf_staging/conf/newvers.sh user/andre/mbuf_staging/conf/options user/andre/mbuf_staging/contrib/dev/run/rt2870.fw.uu user/andre/mbuf_staging/contrib/rdma/krping/getopt.c user/andre/mbuf_staging/contrib/rdma/krping/krping.c user/andre/mbuf_staging/contrib/rdma/krping/krping.h user/andre/mbuf_staging/contrib/rdma/krping/krping_dev.c user/andre/mbuf_staging/dev/altera/sdcard/altera_sdcard.c user/andre/mbuf_staging/dev/altera/sdcard/altera_sdcard_io.c user/andre/mbuf_staging/dev/ata/ata-all.c user/andre/mbuf_staging/dev/ata/ata-card.c user/andre/mbuf_staging/dev/ath/if_ath.c user/andre/mbuf_staging/dev/ath/if_ath_tx.c user/andre/mbuf_staging/dev/bxe/bxe.c user/andre/mbuf_staging/dev/bxe/bxe_stats.c user/andre/mbuf_staging/dev/bxe/ecore_sp.h user/andre/mbuf_staging/dev/cfi/cfi_core.c user/andre/mbuf_staging/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c user/andre/mbuf_staging/dev/cxgbe/adapter.h user/andre/mbuf_staging/dev/cxgbe/common/common.h user/andre/mbuf_staging/dev/cxgbe/firmware/t4fw_cfg.txt user/andre/mbuf_staging/dev/cxgbe/firmware/t4fw_cfg_uwire.txt user/andre/mbuf_staging/dev/cxgbe/firmware/t4fw_interface.h user/andre/mbuf_staging/dev/cxgbe/firmware/t5fw_cfg.txt user/andre/mbuf_staging/dev/cxgbe/firmware/t5fw_cfg_uwire.txt user/andre/mbuf_staging/dev/cxgbe/t4_main.c user/andre/mbuf_staging/dev/cxgbe/t4_sge.c user/andre/mbuf_staging/dev/cxgbe/tom/t4_cpl_io.c user/andre/mbuf_staging/dev/drm2/radeon/radeon_drv.c user/andre/mbuf_staging/dev/etherswitch/arswitch/arswitch.c user/andre/mbuf_staging/dev/etherswitch/arswitch/arswitch_vlans.c user/andre/mbuf_staging/dev/etherswitch/arswitch/arswitchreg.h user/andre/mbuf_staging/dev/etherswitch/arswitch/arswitchvar.h user/andre/mbuf_staging/dev/glxsb/glxsb.c user/andre/mbuf_staging/dev/hifn/hifn7751.c user/andre/mbuf_staging/dev/hyperv/include/hyperv.h user/andre/mbuf_staging/dev/hyperv/netvsc/hv_net_vsc.h user/andre/mbuf_staging/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c user/andre/mbuf_staging/dev/hyperv/stordisengage/hv_ata_pci_disengage.c user/andre/mbuf_staging/dev/hyperv/vmbus/hv_channel.c user/andre/mbuf_staging/dev/hyperv/vmbus/hv_hv.c user/andre/mbuf_staging/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c user/andre/mbuf_staging/dev/isp/isp.c user/andre/mbuf_staging/dev/isp/isp_freebsd.c user/andre/mbuf_staging/dev/isp/isp_freebsd.h user/andre/mbuf_staging/dev/isp/ispvar.h user/andre/mbuf_staging/dev/random/harvest.c user/andre/mbuf_staging/dev/random/hash.h user/andre/mbuf_staging/dev/random/ivy.c user/andre/mbuf_staging/dev/random/nehemiah.c user/andre/mbuf_staging/dev/random/random_adaptors.c user/andre/mbuf_staging/dev/random/random_adaptors.h user/andre/mbuf_staging/dev/random/random_harvestq.c user/andre/mbuf_staging/dev/random/random_harvestq.h user/andre/mbuf_staging/dev/random/randomdev.c user/andre/mbuf_staging/dev/random/randomdev.h user/andre/mbuf_staging/dev/random/randomdev_soft.c user/andre/mbuf_staging/dev/random/randomdev_soft.h user/andre/mbuf_staging/dev/random/yarrow.c user/andre/mbuf_staging/dev/random/yarrow.h user/andre/mbuf_staging/dev/rndtest/rndtest.c user/andre/mbuf_staging/dev/safe/safe.c user/andre/mbuf_staging/dev/syscons/scmouse.c user/andre/mbuf_staging/dev/syscons/syscons.c user/andre/mbuf_staging/dev/ubsec/ubsec.c user/andre/mbuf_staging/dev/usb/controller/musb_otg.c user/andre/mbuf_staging/dev/usb/controller/musb_otg.h user/andre/mbuf_staging/dev/usb/controller/xhci.c user/andre/mbuf_staging/dev/usb/usbdevs user/andre/mbuf_staging/dev/usb/wlan/if_run.c user/andre/mbuf_staging/dev/usb/wlan/if_runreg.h user/andre/mbuf_staging/dev/vmware/vmxnet3/if_vmx.c user/andre/mbuf_staging/dev/vmware/vmxnet3/if_vmxvar.h user/andre/mbuf_staging/dev/xen/blkfront/blkfront.c user/andre/mbuf_staging/fs/devfs/devfs_vnops.c user/andre/mbuf_staging/geom/geom_dev.c user/andre/mbuf_staging/geom/geom_disk.c user/andre/mbuf_staging/geom/geom_io.c user/andre/mbuf_staging/geom/geom_slice.c user/andre/mbuf_staging/geom/label/g_label.c user/andre/mbuf_staging/geom/part/g_part.c user/andre/mbuf_staging/geom/part/g_part_apm.c user/andre/mbuf_staging/geom/part/g_part_bsd.c user/andre/mbuf_staging/geom/part/g_part_ebr.c user/andre/mbuf_staging/geom/part/g_part_gpt.c user/andre/mbuf_staging/geom/part/g_part_mbr.c user/andre/mbuf_staging/geom/part/g_part_pc98.c user/andre/mbuf_staging/geom/part/g_part_vtoc8.c user/andre/mbuf_staging/geom/raid/g_raid.c user/andre/mbuf_staging/geom/raid/g_raid.h user/andre/mbuf_staging/geom/raid/tr_concat.c user/andre/mbuf_staging/geom/raid/tr_raid0.c user/andre/mbuf_staging/geom/raid/tr_raid1.c user/andre/mbuf_staging/geom/raid/tr_raid1e.c user/andre/mbuf_staging/geom/raid/tr_raid5.c user/andre/mbuf_staging/i386/conf/GENERIC user/andre/mbuf_staging/kern/kern_exec.c user/andre/mbuf_staging/kern/kern_intr.c user/andre/mbuf_staging/kern/makesyscalls.sh user/andre/mbuf_staging/kern/subr_bus.c user/andre/mbuf_staging/kern/subr_devstat.c user/andre/mbuf_staging/kern/subr_taskqueue.c user/andre/mbuf_staging/kern/sys_generic.c user/andre/mbuf_staging/kern/vfs_bio.c user/andre/mbuf_staging/mips/atheros/ar71xx_chip.c user/andre/mbuf_staging/mips/atheros/ar71xx_cpudef.h user/andre/mbuf_staging/mips/atheros/ar71xx_machdep.c user/andre/mbuf_staging/mips/atheros/ar71xx_spi.c user/andre/mbuf_staging/mips/atheros/ar724x_chip.c user/andre/mbuf_staging/mips/atheros/ar91xx_chip.c user/andre/mbuf_staging/mips/atheros/ar933x_chip.c user/andre/mbuf_staging/mips/atheros/ar933xreg.h user/andre/mbuf_staging/mips/atheros/ar934x_chip.c user/andre/mbuf_staging/mips/atheros/ar934xreg.h user/andre/mbuf_staging/mips/atheros/if_arge.c user/andre/mbuf_staging/mips/atheros/if_argevar.h user/andre/mbuf_staging/mips/beri/beri_machdep.c user/andre/mbuf_staging/mips/beri/files.beri user/andre/mbuf_staging/mips/cavium/octeon_rnd.c user/andre/mbuf_staging/mips/conf/DB120 user/andre/mbuf_staging/mips/conf/DB120.hints user/andre/mbuf_staging/mips/include/asm.h user/andre/mbuf_staging/mips/include/pcb.h user/andre/mbuf_staging/mips/mips/bcopy.S user/andre/mbuf_staging/mips/mips/exception.S user/andre/mbuf_staging/mips/mips/fp.S user/andre/mbuf_staging/mips/mips/support.S user/andre/mbuf_staging/mips/mips/swtch.S user/andre/mbuf_staging/modules/Makefile user/andre/mbuf_staging/modules/cxgb/Makefile user/andre/mbuf_staging/modules/cxgbe/Makefile user/andre/mbuf_staging/modules/cxgbe/t4_firmware/Makefile user/andre/mbuf_staging/modules/cxgbe/t5_firmware/Makefile user/andre/mbuf_staging/modules/dtrace/Makefile user/andre/mbuf_staging/modules/dtrace/fasttrap/Makefile user/andre/mbuf_staging/modules/random/Makefile user/andre/mbuf_staging/modules/rdma/Makefile user/andre/mbuf_staging/net/flowtable.c user/andre/mbuf_staging/net/ieee8023ad_lacp.c user/andre/mbuf_staging/net/if.c user/andre/mbuf_staging/net/if_ethersubr.c user/andre/mbuf_staging/net/if_tun.c user/andre/mbuf_staging/net/if_var.h user/andre/mbuf_staging/net/radix.c user/andre/mbuf_staging/net/radix.h user/andre/mbuf_staging/net/route.c user/andre/mbuf_staging/net/rtsock.c user/andre/mbuf_staging/net80211/ieee80211_freebsd.c user/andre/mbuf_staging/netatalk/at_control.c user/andre/mbuf_staging/netgraph/ng_base.c user/andre/mbuf_staging/netgraph/ng_iface.c user/andre/mbuf_staging/netinet/in.c user/andre/mbuf_staging/netinet/in.h user/andre/mbuf_staging/netinet/in_var.h user/andre/mbuf_staging/netinet/ip_input.c user/andre/mbuf_staging/netinet/ip_output.c user/andre/mbuf_staging/netinet/sctp_constants.h user/andre/mbuf_staging/netinet/sctp_usrreq.c user/andre/mbuf_staging/netinet6/in6.c user/andre/mbuf_staging/netinet6/in6_var.h user/andre/mbuf_staging/netinet6/ip6_input.c user/andre/mbuf_staging/netinet6/ip6_output.c user/andre/mbuf_staging/netipx/ipx.c user/andre/mbuf_staging/netipx/ipx_if.h user/andre/mbuf_staging/ofed/drivers/net/mlx4/en_netdev.c user/andre/mbuf_staging/ofed/include/linux/gfp.h user/andre/mbuf_staging/powerpc/aim/interrupt.c user/andre/mbuf_staging/powerpc/aim/trap.c user/andre/mbuf_staging/powerpc/conf/GENERIC64 user/andre/mbuf_staging/powerpc/powermac/ata_kauai.c user/andre/mbuf_staging/powerpc/powermac/ata_macio.c user/andre/mbuf_staging/powerpc/pseries/phyp-hvcall.S user/andre/mbuf_staging/sys/counter.h user/andre/mbuf_staging/sys/devicestat.h user/andre/mbuf_staging/sys/param.h user/andre/mbuf_staging/sys/random.h user/andre/mbuf_staging/sys/systm.h user/andre/mbuf_staging/ufs/ufs/dinode.h user/andre/mbuf_staging/xen/xen-os.h Directory Properties: user/andre/mbuf_staging/ (props changed) user/andre/mbuf_staging/amd64/vmm/ (props changed) user/andre/mbuf_staging/boot/ (props changed) user/andre/mbuf_staging/cddl/contrib/opensolaris/ (props changed) user/andre/mbuf_staging/conf/ (props changed) user/andre/mbuf_staging/dev/hyperv/ (props changed) Modified: user/andre/mbuf_staging/amd64/amd64/pmap.c ============================================================================== --- user/andre/mbuf_staging/amd64/amd64/pmap.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/amd64/amd64/pmap.c Sun Oct 20 10:02:04 2013 (r256781) @@ -371,6 +371,8 @@ int pmap_pcid_enabled = 1; SYSCTL_INT(_vm_pmap, OID_AUTO, pcid_enabled, CTLFLAG_RDTUN, &pmap_pcid_enabled, 0, "Is TLB Context ID enabled ?"); int invpcid_works = 0; +SYSCTL_INT(_vm_pmap, OID_AUTO, invpcid_works, CTLFLAG_RD, &invpcid_works, 0, + "Is the invpcid instruction available ?"); static int pmap_pcid_save_cnt_proc(SYSCTL_HANDLER_ARGS) Modified: user/andre/mbuf_staging/amd64/conf/GENERIC ============================================================================== --- user/andre/mbuf_staging/amd64/conf/GENERIC Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/amd64/conf/GENERIC Sun Oct 20 10:02:04 2013 (r256781) @@ -72,7 +72,6 @@ options KDTRACE_FRAME # Ensure frames options KDTRACE_HOOKS # Kernel DTrace hooks options DDB_CTF # Kernel ELF linker loads CTF data options INCLUDE_CONFIG_FILE # Include this file in kernel -options XENHVM # Include Xen support # Debugging support. Always need this: options KDB # Enable kernel debugger support. @@ -345,8 +344,10 @@ device virtio_balloon # VirtIO Memory B # HyperV drivers device hyperv # HyperV drivers -# Xen support -device xenpci # Generic Xen bus +# Xen HVM Guest Optimizations +# NOTE: XENHVM depends on xenpci. They must be added or removed together. +options XENHVM # Xen HVM kernel infrastructure +device xenpci # Xen HVM Hypervisor services driver # VMware support device vmx # VMware VMXNET3 Ethernet Modified: user/andre/mbuf_staging/amd64/include/vmm.h ============================================================================== --- user/andre/mbuf_staging/amd64/include/vmm.h Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/amd64/include/vmm.h Sun Oct 20 10:02:04 2013 (r256781) @@ -223,6 +223,7 @@ enum vm_cap_type { VM_CAP_MTRAP_EXIT, VM_CAP_PAUSE_EXIT, VM_CAP_UNRESTRICTED_GUEST, + VM_CAP_ENABLE_INVPCID, VM_CAP_MAX }; Modified: user/andre/mbuf_staging/amd64/vmm/intel/vmx.c ============================================================================== --- user/andre/mbuf_staging/amd64/vmm/intel/vmx.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/amd64/vmm/intel/vmx.c Sun Oct 20 10:02:04 2013 (r256781) @@ -164,6 +164,7 @@ static int cap_halt_exit; static int cap_pause_exit; static int cap_unrestricted_guest; static int cap_monitor_trap; +static int cap_invpcid; static struct unrhdr *vpid_unr; static u_int vpid_alloc_failed; @@ -660,6 +661,11 @@ vmx_init(void) PROCBASED2_UNRESTRICTED_GUEST, 0, &tmp) == 0); + cap_invpcid = (vmx_set_ctlreg(MSR_VMX_PROCBASED_CTLS2, + MSR_VMX_PROCBASED_CTLS2, PROCBASED2_ENABLE_INVPCID, 0, + &tmp) == 0); + + /* Initialize EPT */ error = ept_init(); if (error) { @@ -828,6 +834,7 @@ vmx_vminit(struct vm *vm, pmap_t pmap) vmx->cap[i].set = 0; vmx->cap[i].proc_ctls = procbased_ctls; + vmx->cap[i].proc_ctls2 = procbased_ctls2; vmx->state[i].lastcpu = -1; vmx->state[i].vpid = vpid[i]; @@ -1932,6 +1939,10 @@ vmx_getcap(void *arg, int vcpu, int type if (cap_unrestricted_guest) ret = 0; break; + case VM_CAP_ENABLE_INVPCID: + if (cap_invpcid) + ret = 0; + break; default: break; } @@ -1988,11 +1999,21 @@ vmx_setcap(void *arg, int vcpu, int type case VM_CAP_UNRESTRICTED_GUEST: if (cap_unrestricted_guest) { retval = 0; - baseval = procbased_ctls2; + pptr = &vmx->cap[vcpu].proc_ctls2; + baseval = *pptr; flag = PROCBASED2_UNRESTRICTED_GUEST; reg = VMCS_SEC_PROC_BASED_CTLS; } break; + case VM_CAP_ENABLE_INVPCID: + if (cap_invpcid) { + retval = 0; + pptr = &vmx->cap[vcpu].proc_ctls2; + baseval = *pptr; + flag = PROCBASED2_ENABLE_INVPCID; + reg = VMCS_SEC_PROC_BASED_CTLS; + } + break; default: break; } Modified: user/andre/mbuf_staging/amd64/vmm/intel/vmx.h ============================================================================== --- user/andre/mbuf_staging/amd64/vmm/intel/vmx.h Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/amd64/vmm/intel/vmx.h Sun Oct 20 10:02:04 2013 (r256781) @@ -84,6 +84,7 @@ struct vmxctx { struct vmxcap { int set; uint32_t proc_ctls; + uint32_t proc_ctls2; }; struct vmxstate { Modified: user/andre/mbuf_staging/amd64/vmm/intel/vmx_controls.h ============================================================================== --- user/andre/mbuf_staging/amd64/vmm/intel/vmx_controls.h Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/amd64/vmm/intel/vmx_controls.h Sun Oct 20 10:02:04 2013 (r256781) @@ -68,6 +68,7 @@ #define PROCBASED2_WBINVD_EXITING (1 << 6) #define PROCBASED2_UNRESTRICTED_GUEST (1 << 7) #define PROCBASED2_PAUSE_LOOP_EXITING (1 << 10) +#define PROCBASED2_ENABLE_INVPCID (1 << 12) /* VM Exit Controls */ #define VM_EXIT_SAVE_DEBUG_CONTROLS (1 << 2) Modified: user/andre/mbuf_staging/amd64/vmm/vmm_dev.c ============================================================================== --- user/andre/mbuf_staging/amd64/vmm/vmm_dev.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/amd64/vmm/vmm_dev.c Sun Oct 20 10:02:04 2013 (r256781) @@ -60,7 +60,10 @@ struct vmmdev_softc { struct vm *vm; /* vm instance cookie */ struct cdev *cdev; SLIST_ENTRY(vmmdev_softc) link; + int flags; }; +#define VSC_LINKED 0x01 + static SLIST_HEAD(, vmmdev_softc) head; static struct mtx vmmdev_mtx; @@ -104,7 +107,6 @@ vmmdev_rw(struct cdev *cdev, struct uio static char zerobuf[PAGE_SIZE]; error = 0; - mtx_lock(&vmmdev_mtx); sc = vmmdev_lookup2(cdev); if (sc == NULL) error = ENXIO; @@ -134,8 +136,6 @@ vmmdev_rw(struct cdev *cdev, struct uio vm_gpa_release(cookie); } } - - mtx_unlock(&vmmdev_mtx); return (error); } @@ -379,34 +379,28 @@ vmmdev_mmap_single(struct cdev *cdev, vm int error; struct vmmdev_softc *sc; - mtx_lock(&vmmdev_mtx); - sc = vmmdev_lookup2(cdev); if (sc != NULL && (nprot & PROT_EXEC) == 0) error = vm_get_memobj(sc->vm, *offset, size, offset, object); else error = EINVAL; - mtx_unlock(&vmmdev_mtx); - return (error); } static void -vmmdev_destroy(struct vmmdev_softc *sc, boolean_t unlink) +vmmdev_destroy(void *arg) { - /* - * XXX must stop virtual machine instances that may be still - * running and cleanup their state. - */ - if (sc->cdev) + struct vmmdev_softc *sc = arg; + + if (sc->cdev != NULL) destroy_dev(sc->cdev); - if (sc->vm) + if (sc->vm != NULL) vm_destroy(sc->vm); - if (unlink) { + if ((sc->flags & VSC_LINKED) != 0) { mtx_lock(&vmmdev_mtx); SLIST_REMOVE(&head, sc, vmmdev_softc, link); mtx_unlock(&vmmdev_mtx); @@ -421,27 +415,38 @@ sysctl_vmm_destroy(SYSCTL_HANDLER_ARGS) int error; char buf[VM_MAX_NAMELEN]; struct vmmdev_softc *sc; + struct cdev *cdev; strlcpy(buf, "beavis", sizeof(buf)); error = sysctl_handle_string(oidp, buf, sizeof(buf), req); if (error != 0 || req->newptr == NULL) return (error); - /* - * XXX TODO if any process has this device open then fail - */ - mtx_lock(&vmmdev_mtx); sc = vmmdev_lookup(buf); - if (sc == NULL) { + if (sc == NULL || sc->cdev == NULL) { mtx_unlock(&vmmdev_mtx); return (EINVAL); } - sc->cdev->si_drv1 = NULL; + /* + * The 'cdev' will be destroyed asynchronously when 'si_threadcount' + * goes down to 0 so we should not do it again in the callback. + */ + cdev = sc->cdev; + sc->cdev = NULL; mtx_unlock(&vmmdev_mtx); - vmmdev_destroy(sc, TRUE); + /* + * Schedule the 'cdev' to be destroyed: + * + * - any new operations on this 'cdev' will return an error (ENXIO). + * + * - when the 'si_threadcount' dwindles down to zero the 'cdev' will + * be destroyed and the callback will be invoked in a taskqueue + * context. + */ + destroy_dev_sched_cb(cdev, vmmdev_destroy, sc); return (0); } @@ -462,6 +467,7 @@ sysctl_vmm_create(SYSCTL_HANDLER_ARGS) { int error; struct vm *vm; + struct cdev *cdev; struct vmmdev_softc *sc, *sc2; char buf[VM_MAX_NAMELEN]; @@ -489,22 +495,28 @@ sysctl_vmm_create(SYSCTL_HANDLER_ARGS) */ mtx_lock(&vmmdev_mtx); sc2 = vmmdev_lookup(buf); - if (sc2 == NULL) + if (sc2 == NULL) { SLIST_INSERT_HEAD(&head, sc, link); + sc->flags |= VSC_LINKED; + } mtx_unlock(&vmmdev_mtx); if (sc2 != NULL) { - vmmdev_destroy(sc, FALSE); + vmmdev_destroy(sc); return (EEXIST); } - error = make_dev_p(MAKEDEV_CHECKNAME, &sc->cdev, &vmmdevsw, NULL, + error = make_dev_p(MAKEDEV_CHECKNAME, &cdev, &vmmdevsw, NULL, UID_ROOT, GID_WHEEL, 0600, "vmm/%s", buf); if (error != 0) { - vmmdev_destroy(sc, TRUE); + vmmdev_destroy(sc); return (error); } + + mtx_lock(&vmmdev_mtx); + sc->cdev = cdev; sc->cdev->si_drv1 = sc; + mtx_unlock(&vmmdev_mtx); return (0); } Modified: user/andre/mbuf_staging/amd64/vmm/x86.c ============================================================================== --- user/andre/mbuf_staging/amd64/vmm/x86.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/amd64/vmm/x86.c Sun Oct 20 10:02:04 2013 (r256781) @@ -53,7 +53,7 @@ int x86_emulate_cpuid(struct vm *vm, int vcpu_id, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) { - int error; + int error, enable_invpcid; unsigned int func, regs[4]; enum x2apic_state x2apic_state; @@ -202,8 +202,22 @@ x86_emulate_cpuid(struct vm *vm, int vcp regs[0] |= 0x04008000; break; - case CPUID_0000_0006: case CPUID_0000_0007: + regs[0] = 0; + regs[1] = 0; + regs[2] = 0; + regs[3] = 0; + + /* leaf 0 */ + if (*ecx == 0) { + error = vm_get_capability(vm, vcpu_id, + VM_CAP_ENABLE_INVPCID, &enable_invpcid); + if (error == 0 && enable_invpcid) + regs[1] |= CPUID_STDEXT_INVPCID; + } + break; + + case CPUID_0000_0006: case CPUID_0000_000A: case CPUID_0000_000D: /* Modified: user/andre/mbuf_staging/arm/arm/busdma_machdep-v6.c ============================================================================== --- user/andre/mbuf_staging/arm/arm/busdma_machdep-v6.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/arm/busdma_machdep-v6.c Sun Oct 20 10:02:04 2013 (r256781) @@ -425,14 +425,21 @@ bus_dma_tag_create(bus_dma_tag_t parent, if (_bus_dma_can_bounce(newtag->lowaddr, newtag->highaddr) || newtag->alignment > 1) newtag->flags |= BUS_DMA_COULD_BOUNCE; - else - maxsize = 2; /* Need at most 2 bounce pages for unaligned access on cache line boundaries */ + /* + * Any request can auto-bounce due to cacheline alignment, in addition + * to any alignment or boundary specifications in the tag, so if the + * ALLOCNOW flag is set, there's always work to do. + */ if ((flags & BUS_DMA_ALLOCNOW) != 0) { struct bounce_zone *bz; - - /* Must bounce */ - + /* + * Round size up to a full page, and add one more page because + * there can always be one more boundary crossing than the + * number of pages in a transfer. + */ + maxsize = roundup2(maxsize, PAGE_SIZE) + PAGE_SIZE; + if ((error = alloc_bounce_zone(newtag)) != 0) { free(newtag, M_DEVBUF); return (error); @@ -518,20 +525,22 @@ static int allocate_bz_and_pages(bus_dma STAILQ_INIT(&(mapp->bpages)); /* - * Attempt to add pages to our pool on a per-instance - * basis up to a sane limit. + * Attempt to add pages to our pool on a per-instance basis up to a sane + * limit. Even if the tag isn't flagged as COULD_BOUNCE due to + * alignment and boundary constraints, it could still auto-bounce due to + * cacheline alignment, which requires at most two bounce pages. */ if (dmat->flags & BUS_DMA_COULD_BOUNCE) maxpages = MAX_BPAGES; else - maxpages = 2 * bz->map_count; /* Only need at most 2 pages for buffers unaligned on cache line boundaries */ + maxpages = 2 * bz->map_count; if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0 || (bz->map_count > 0 && bz->total_bpages < maxpages)) { int pages; - pages = MAX(atop(dmat->maxsize), 1); + pages = atop(roundup2(dmat->maxsize, PAGE_SIZE)) + 1; pages = MIN(maxpages - bz->total_bpages, pages); - pages = MAX(pages, 1); + pages = MAX(pages, 2); if (alloc_bounce_pages(dmat, pages) < pages) return (ENOMEM); @@ -1273,7 +1282,12 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus } break; + case BUS_DMASYNC_POSTREAD: + case BUS_DMASYNC_POSTWRITE: + case BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE: + break; default: + panic("unsupported combination of sync operations: 0x%08x\n", op); break; } } Modified: user/andre/mbuf_staging/arm/arm/cpufunc.c ============================================================================== --- user/andre/mbuf_staging/arm/arm/cpufunc.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/arm/cpufunc.c Sun Oct 20 10:02:04 2013 (r256781) @@ -1476,7 +1476,8 @@ set_cpufuncs() } #endif /* CPU_ARM1136 || CPU_ARM1176 */ #ifdef CPU_CORTEXA - if (cputype == CPU_ID_CORTEXA7 || + if (cputype == CPU_ID_CORTEXA5 || + cputype == CPU_ID_CORTEXA7 || cputype == CPU_ID_CORTEXA8R1 || cputype == CPU_ID_CORTEXA8R2 || cputype == CPU_ID_CORTEXA8R3 || Modified: user/andre/mbuf_staging/arm/arm/cpufunc_asm_armv7.S ============================================================================== --- user/andre/mbuf_staging/arm/arm/cpufunc_asm_armv7.S Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/arm/cpufunc_asm_armv7.S Sun Oct 20 10:02:04 2013 (r256781) @@ -57,9 +57,9 @@ __FBSDID("$FreeBSD$"); #define PT_OUTER_WBWA (1 << 3) #ifdef SMP -#define PT_ATTR (PT_S|PT_INNER_WT|PT_OUTER_WT|PT_NOS) +#define PT_ATTR (PT_S|PT_INNER_WBWA|PT_OUTER_WBWA|PT_NOS) #else -#define PT_ATTR (PT_INNER_WT|PT_OUTER_WT) +#define PT_ATTR (PT_INNER_WBWA|PT_OUTER_WBWA) #endif ENTRY(armv7_setttb) @@ -98,7 +98,7 @@ ENTRY(armv7_tlb_flushID_SE) ldr r1, .Lpage_mask bic r0, r0, r1 #ifdef SMP - mcr p15, 0, r0, c8, c3, 1 /* flush D tlb single entry Inner Shareable*/ + mcr p15, 0, r0, c8, c3, 3 /* flush D tlb single entry Inner Shareable*/ mcr p15, 0, r0, c7, c1, 6 /* flush BTB Inner Shareable */ #else mcr p15, 0, r0, c8, c7, 1 /* flush D tlb single entry */ Modified: user/andre/mbuf_staging/arm/arm/fusu.S ============================================================================== --- user/andre/mbuf_staging/arm/arm/fusu.S Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/arm/fusu.S Sun Oct 20 10:02:04 2013 (r256781) @@ -67,11 +67,27 @@ ENTRY(casuword) stmfd sp!, {r4, r5} adr r4, .Lcasuwordfault str r4, [r3, #PCB_ONFAULT] +#ifdef _ARM_ARCH_6 +1: + cmp r0, #KERNBASE + mvnhs r0, #0 + bhs 2f + + ldrex r5, [r0] + cmp r5, r1 + movne r0, r5 + bne 2f + strex r5, r2, [r0] + cmp r5, #0 + bne 1b +#else ldrt r5, [r0] cmp r5, r1 movne r0, r5 streqt r2, [r0] +#endif moveq r0, r1 +2: ldmfd sp!, {r4, r5} mov r1, #0x00000000 str r1, [r3, #PCB_ONFAULT] Modified: user/andre/mbuf_staging/arm/arm/identcpu.c ============================================================================== --- user/andre/mbuf_staging/arm/arm/identcpu.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/arm/identcpu.c Sun Oct 20 10:02:04 2013 (r256781) @@ -236,6 +236,8 @@ const struct cpuidtab cpuids[] = { { CPU_ID_ARM1026EJS, CPU_CLASS_ARM10EJ, "ARM1026EJ-S", generic_steppings }, + { CPU_ID_CORTEXA5, CPU_CLASS_CORTEXA, "Cortex A5", + generic_steppings }, { CPU_ID_CORTEXA7, CPU_CLASS_CORTEXA, "Cortex A7", generic_steppings }, { CPU_ID_CORTEXA8R1, CPU_CLASS_CORTEXA, "Cortex A8-r1", Modified: user/andre/mbuf_staging/arm/arm/locore.S ============================================================================== --- user/andre/mbuf_staging/arm/arm/locore.S Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/arm/locore.S Sun Oct 20 10:02:04 2013 (r256781) @@ -187,7 +187,7 @@ Lunmapped: mrc p15, 0, r0, c1, c0, 0 #ifdef _ARM_ARCH_6 orr r0, r0, #(CPU_CONTROL_V6_EXTPAGE | CPU_CONTROL_UNAL_ENABLE) - orr r2, r2, #(CPU_CONTROL_AFLT_ENABLE) + orr r0, r0, #(CPU_CONTROL_AFLT_ENABLE) orr r0, r0, #(CPU_CONTROL_AF_ENABLE) #endif orr r0, r0, #(CPU_CONTROL_MMU_ENABLE) Modified: user/andre/mbuf_staging/arm/arm/machdep.c ============================================================================== --- user/andre/mbuf_staging/arm/arm/machdep.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/arm/machdep.c Sun Oct 20 10:02:04 2013 (r256781) @@ -1169,11 +1169,15 @@ physmap_init(struct mem_region *availmem */ if (availmem_regions[i].mr_start > 0 || availmem_regions[i].mr_size > PAGE_SIZE) { + vm_size_t size; phys_avail[j] = availmem_regions[i].mr_start; - if (phys_avail[j] == 0) + + size = availmem_regions[i].mr_size; + if (phys_avail[j] == 0) { phys_avail[j] += PAGE_SIZE; - phys_avail[j + 1] = availmem_regions[i].mr_start + - availmem_regions[i].mr_size; + size -= PAGE_SIZE; + } + phys_avail[j + 1] = availmem_regions[i].mr_start + size; } else j -= 2; } Modified: user/andre/mbuf_staging/arm/arm/pl310.c ============================================================================== --- user/andre/mbuf_staging/arm/arm/pl310.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/arm/pl310.c Sun Oct 20 10:02:04 2013 (r256781) @@ -341,8 +341,13 @@ pl310_attach(device_t dev) ctrl_value = pl310_read4(sc, PL310_CTRL); if (sc->sc_enabled && !(ctrl_value & CTRL_ENABLED)) { + /* invalidate current content */ + pl310_write4(pl310_softc, PL310_INV_WAY, 0xffff); + pl310_wait_background_op(PL310_INV_WAY, 0xffff); + /* Enable the L2 cache if disabled */ platform_pl310_write_ctrl(sc, CTRL_ENABLED); + device_printf(dev, "L2 Cache enabled\n"); } if (!sc->sc_enabled && (ctrl_value & CTRL_ENABLED)) { @@ -375,6 +380,7 @@ pl310_attach(device_t dev) EVENT_COUNTER_CTRL_C0_RESET | EVENT_COUNTER_CTRL_C1_RESET); + device_printf(dev, "L2 Cache disabled\n"); } if (sc->sc_enabled) Modified: user/andre/mbuf_staging/arm/arm/pmap-v6.c ============================================================================== --- user/andre/mbuf_staging/arm/arm/pmap-v6.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/arm/pmap-v6.c Sun Oct 20 10:02:04 2013 (r256781) @@ -2441,6 +2441,8 @@ vm_paddr_t pmap_kextract(vm_offset_t va) { + if (kernel_vm_end == 0) + return (0); return (pmap_extract_locked(kernel_pmap, va)); } @@ -3310,7 +3312,7 @@ pmap_extract_locked(pmap_t pmap, vm_offs vm_paddr_t pa; u_int l1idx; - if (pmap != kernel_pmap) + if (kernel_vm_end != 0 && pmap != kernel_pmap) PMAP_ASSERT_LOCKED(pmap); l1idx = L1_IDX(va); l1pd = pmap->pm_l1->l1_kva[l1idx]; Modified: user/andre/mbuf_staging/arm/freescale/imx/imx51_ccm.c ============================================================================== --- user/andre/mbuf_staging/arm/freescale/imx/imx51_ccm.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/freescale/imx/imx51_ccm.c Sun Oct 20 10:02:04 2013 (r256781) @@ -278,8 +278,8 @@ imx51_get_clock(enum imx51_clock clk) case IMX51CLK_MAIN_BUS_CLK: freq = imx51_get_clock(IMX51CLK_MAIN_BUS_CLK_SRC); cdcr = bus_read_4(ccm_softc->res[0], CCMC_CDCR); - return freq / (cdcr & CDCR_PERIPH_CLK_DVFS_PODF_MASK) >> - CDCR_PERIPH_CLK_DVFS_PODF_SHIFT; + return freq / (1 + ((cdcr & CDCR_PERIPH_CLK_DVFS_PODF_MASK) >> + CDCR_PERIPH_CLK_DVFS_PODF_SHIFT)); case IMX51CLK_AHB_CLK_ROOT: freq = imx51_get_clock(IMX51CLK_MAIN_BUS_CLK); cbcdr = bus_read_4(ccm_softc->res[0], CCMC_CBCDR); Modified: user/andre/mbuf_staging/arm/include/armreg.h ============================================================================== --- user/andre/mbuf_staging/arm/include/armreg.h Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/include/armreg.h Sun Oct 20 10:02:04 2013 (r256781) @@ -147,6 +147,7 @@ #define CPU_ID_ARM1136JS 0x4107b360 #define CPU_ID_ARM1136JSR1 0x4117b360 #define CPU_ID_ARM1176JZS 0x410fb760 +#define CPU_ID_CORTEXA5 0x410fc050 #define CPU_ID_CORTEXA7 0x410fc070 #define CPU_ID_CORTEXA8R1 0x411fc080 #define CPU_ID_CORTEXA8R2 0x412fc080 Modified: user/andre/mbuf_staging/arm/include/pmap.h ============================================================================== --- user/andre/mbuf_staging/arm/include/pmap.h Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/include/pmap.h Sun Oct 20 10:02:04 2013 (r256781) @@ -63,7 +63,7 @@ #endif #define PTE_CACHE 6 #define PTE_DEVICE 2 -#define PTE_PAGETABLE 4 +#define PTE_PAGETABLE 6 #else #define PTE_NOCACHE 1 #define PTE_CACHE 2 @@ -489,7 +489,7 @@ extern int pmap_needs_pte_sync; #if (ARM_MMU_SA1 == 1) && (ARM_NMMUS == 1) #define PMAP_NEEDS_PTE_SYNC 1 #define PMAP_INCLUDE_PTE_SYNC -#elif defined(CPU_XSCALE_81342) +#elif defined(CPU_XSCALE_81342) || defined(ARM_ARCH_7) || defined(ARM_ARCH_7A) #define PMAP_NEEDS_PTE_SYNC 1 #define PMAP_INCLUDE_PTE_SYNC #elif (ARM_MMU_SA1 == 0) @@ -559,11 +559,18 @@ extern int pmap_needs_pte_sync; #define PMAP_INCLUDE_PTE_SYNC #endif +#ifdef ARM_L2_PIPT +#define _sync_l2(pte, size) cpu_l2cache_wb_range(vtophys(pte), size) +#else +#define _sync_l2(pte, size) cpu_l2cache_wb_range(pte, size) +#endif + #define PTE_SYNC(pte) \ do { \ if (PMAP_NEEDS_PTE_SYNC) { \ cpu_dcache_wb_range((vm_offset_t)(pte), sizeof(pt_entry_t));\ - cpu_l2cache_wb_range((vm_offset_t)(pte), sizeof(pt_entry_t));\ + cpu_drain_writebuf(); \ + _sync_l2((vm_offset_t)(pte), sizeof(pt_entry_t));\ } else \ cpu_drain_writebuf(); \ } while (/*CONSTCOND*/0) @@ -573,7 +580,8 @@ do { \ if (PMAP_NEEDS_PTE_SYNC) { \ cpu_dcache_wb_range((vm_offset_t)(pte), \ (cnt) << 2); /* * sizeof(pt_entry_t) */ \ - cpu_l2cache_wb_range((vm_offset_t)(pte), \ + cpu_drain_writebuf(); \ + _sync_l2((vm_offset_t)(pte), \ (cnt) << 2); /* * sizeof(pt_entry_t) */ \ } else \ cpu_drain_writebuf(); \ Modified: user/andre/mbuf_staging/arm/mv/common.c ============================================================================== --- user/andre/mbuf_staging/arm/mv/common.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/mv/common.c Sun Oct 20 10:02:04 2013 (r256781) @@ -153,8 +153,11 @@ struct fdt_pm_mask_entry fdt_pm_mask_tab static __inline int pm_is_disabled(uint32_t mask) { - +#if defined(SOC_MV_KIRKWOOD) + return (soc_power_ctrl_get(mask) == mask); +#else return (soc_power_ctrl_get(mask) == mask ? 0 : 1); +#endif } /* @@ -221,7 +224,16 @@ fdt_pm(phandle_t node) continue; compat = fdt_is_compatible(node, fdt_pm_mask_table[i].compat); - +#if defined(SOC_MV_KIRKWOOD) + if (compat && (cpu_pm_ctrl & fdt_pm_mask_table[i].mask)) { + dev_mask |= (1 << i); + ena = 0; + break; + } else if (compat) { + dev_mask |= (1 << i); + break; + } +#else if (compat && (~cpu_pm_ctrl & fdt_pm_mask_table[i].mask)) { dev_mask |= (1 << i); ena = 0; @@ -230,6 +242,7 @@ fdt_pm(phandle_t node) dev_mask |= (1 << i); break; } +#endif } return (ena); Modified: user/andre/mbuf_staging/arm/mv/mv_localbus.c ============================================================================== --- user/andre/mbuf_staging/arm/mv/mv_localbus.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/mv/mv_localbus.c Sun Oct 20 10:02:04 2013 (r256781) @@ -431,7 +431,7 @@ fdt_localbus_devmap(phandle_t dt_node, s bank = fdt_data_get((void *)rangesptr, 1); rangesptr += 1; - if (bank < 0 || bank > MV_LOCALBUS_MAX_BANKS) { + if (bank > MV_LOCALBUS_MAX_BANKS) { /* Bank out of range */ rangesptr += ((addr_cells - 1) + par_addr_cells + size_cells); Modified: user/andre/mbuf_staging/arm/mv/mvreg.h ============================================================================== --- user/andre/mbuf_staging/arm/mv/mvreg.h Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/mv/mvreg.h Sun Oct 20 10:02:04 2013 (r256781) @@ -142,7 +142,11 @@ /* * Power Control */ +#if defined(SOC_MV_KIRKWOOD) +#define CPU_PM_CTRL 0x18 +#else #define CPU_PM_CTRL 0x1C +#endif #define CPU_PM_CTRL_NONE 0 #define CPU_PM_CTRL_ALL ~0x0 Modified: user/andre/mbuf_staging/arm/versatile/versatile_pci.c ============================================================================== --- user/andre/mbuf_staging/arm/versatile/versatile_pci.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/versatile/versatile_pci.c Sun Oct 20 10:02:04 2013 (r256781) @@ -360,6 +360,9 @@ versatile_pci_activate_resource(device_t res = (BUS_ACTIVATE_RESOURCE(device_get_parent(bus), child, type, rid, r)); break; + default: + res = ENXIO; + break; } return (res); Modified: user/andre/mbuf_staging/arm/xscale/i80321/ep80219_machdep.c ============================================================================== --- user/andre/mbuf_staging/arm/xscale/i80321/ep80219_machdep.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/xscale/i80321/ep80219_machdep.c Sun Oct 20 10:02:04 2013 (r256781) @@ -365,7 +365,7 @@ initarm(struct arm_boot_params *abp) dump_avail[2] = 0; dump_avail[3] = 0; - vm_max_kernel_address = 0xd0000000; + vm_max_kernel_address = 0xe0000000; pmap_bootstrap(pmap_curmaxkvaddr, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; msgbufinit(msgbufp, msgbufsize); Modified: user/andre/mbuf_staging/arm/xscale/i80321/iq31244_machdep.c ============================================================================== --- user/andre/mbuf_staging/arm/xscale/i80321/iq31244_machdep.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/xscale/i80321/iq31244_machdep.c Sun Oct 20 10:02:04 2013 (r256781) @@ -366,7 +366,7 @@ initarm(struct arm_boot_params *abp) dump_avail[2] = 0; dump_avail[3] = 0; - vm_max_kernel_address = 0xd0000000; + vm_max_kernel_address = 0xe0000000; pmap_bootstrap(pmap_curmaxkvaddr, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; msgbufinit(msgbufp, msgbufsize); Modified: user/andre/mbuf_staging/arm/xscale/i8134x/crb_machdep.c ============================================================================== --- user/andre/mbuf_staging/arm/xscale/i8134x/crb_machdep.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/xscale/i8134x/crb_machdep.c Sun Oct 20 10:02:04 2013 (r256781) @@ -344,7 +344,7 @@ initarm(struct arm_boot_params *abp) dump_avail[2] = 0; dump_avail[3] = 0; - vm_max_kernel_address = 0xd0000000; + vm_max_kernel_address = 0xe0000000; pmap_bootstrap(pmap_curmaxkvaddr, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; msgbufinit(msgbufp, msgbufsize); Modified: user/andre/mbuf_staging/arm/xscale/ixp425/avila_machdep.c ============================================================================== --- user/andre/mbuf_staging/arm/xscale/ixp425/avila_machdep.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/xscale/ixp425/avila_machdep.c Sun Oct 20 10:02:04 2013 (r256781) @@ -429,7 +429,7 @@ initarm(struct arm_boot_params *abp) pmap_curmaxkvaddr = afterkern + PAGE_SIZE; arm_dump_avail_init(memsize, sizeof(dump_avail) / sizeof(dump_avail[0])); - vm_max_kernel_address = 0xd0000000; + vm_max_kernel_address = 0xe0000000; pmap_bootstrap(pmap_curmaxkvaddr, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; msgbufinit(msgbufp, msgbufsize); Modified: user/andre/mbuf_staging/arm/xscale/pxa/pxa_machdep.c ============================================================================== --- user/andre/mbuf_staging/arm/xscale/pxa/pxa_machdep.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/arm/xscale/pxa/pxa_machdep.c Sun Oct 20 10:02:04 2013 (r256781) @@ -362,7 +362,7 @@ initarm(struct arm_boot_params *abp) } dump_avail[i] = 0; dump_avail[i] = 0; - vm_max_kernel_address = 0xd0000000; + vm_max_kernel_address = 0xe0000000; pmap_bootstrap(pmap_curmaxkvaddr, &kernel_l1pt); msgbufp = (void*)msgbufpv.pv_va; msgbufinit(msgbufp, msgbufsize); Modified: user/andre/mbuf_staging/boot/forth/loader.conf ============================================================================== --- user/andre/mbuf_staging/boot/forth/loader.conf Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/boot/forth/loader.conf Sun Oct 20 10:02:04 2013 (r256781) @@ -39,6 +39,17 @@ bitmap_type="splash_image_data" # and pl ############################################################## +### Random number generator configuration ################### +############################################################## + +entropy_cache_load="NO" # Set this to YES to load entropy at boot time +entropy_cache_name="/boot/entropy" # Set this to the name of the file +entropy_cache_type="/boot/entropy" +#kern.random.sys.seeded="0" # Set this to 1 to start /dev/random + # without waiting for a (re)seed. + + +############################################################## ### Loader settings ######################################## ############################################################## Modified: user/andre/mbuf_staging/boot/i386/btx/btx/btx.S ============================================================================== --- user/andre/mbuf_staging/boot/i386/btx/btx/btx.S Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/boot/i386/btx/btx/btx.S Sun Oct 20 10:02:04 2013 (r256781) @@ -41,6 +41,8 @@ .set PSL_RESERVED_DEFAULT,0x00000002 .set PSL_T,0x00000100 # Trap flag .set PSL_I,0x00000200 # Interrupt enable flag + .set PSL_D,0x00000400 # String instruction direction + .set PSL_NT,0x00004000 # Nested task flag .set PSL_VM,0x00020000 # Virtual 8086 mode flag .set PSL_AC,0x00040000 # Alignment check flag /* @@ -611,8 +613,8 @@ rret_tramp: movw $MEM_ESPR-0x08,%sp # R pushl %ds # regs pushl %es pushfl # Save %eflags - cli # Disable interrupts - std # String ops dec + pushl $PSL_RESERVED_DEFAULT|PSL_D # Use clean %eflags with + popfl # string ops dec xorw %ax,%ax # Reset seg movw %ax,%ds # regs movw %ax,%es # (%ss is already 0) @@ -675,6 +677,7 @@ rret_tramp.1: xorl %ecx,%ecx # Zero testl $V86F_FLAGS,%edx # User wants flags? jz rret_tramp.3 # No movl MEM_ESPR-0x3c,%eax # Read real mode flags + andl $~(PSL_T|PSL_NT),%eax # Clear unsafe flags movw %ax,-0x08(%esi) # Update user flags (low 16) /* * Return to the user task Modified: user/andre/mbuf_staging/cam/ata/ata_all.c ============================================================================== --- user/andre/mbuf_staging/cam/ata/ata_all.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/cam/ata/ata_all.c Sun Oct 20 10:02:04 2013 (r256781) @@ -297,6 +297,18 @@ ata_print_ident(struct ata_params *ident } void +ata_print_ident_short(struct ata_params *ident_data) +{ + char product[48], revision[16]; + + cam_strvis(product, ident_data->model, sizeof(ident_data->model), + sizeof(product)); + cam_strvis(revision, ident_data->revision, sizeof(ident_data->revision), + sizeof(revision)); + printf("<%s %s>", product, revision); +} + +void semb_print_ident(struct sep_identify_data *ident_data) { char vendor[9], product[17], revision[5], fw[5], in[7], ins[5]; @@ -311,6 +323,18 @@ semb_print_ident(struct sep_identify_dat vendor, product, revision, fw, in, ins); } +void +semb_print_ident_short(struct sep_identify_data *ident_data) +{ + char vendor[9], product[17], revision[5], fw[5]; + + cam_strvis(vendor, ident_data->vendor_id, 8, sizeof(vendor)); + cam_strvis(product, ident_data->product_id, 16, sizeof(product)); + cam_strvis(revision, ident_data->product_rev, 4, sizeof(revision)); + cam_strvis(fw, ident_data->firmware_rev, 4, sizeof(fw)); + printf("<%s %s %s %s>", vendor, product, revision, fw); +} + uint32_t ata_logical_sector_size(struct ata_params *ident_data) { Modified: user/andre/mbuf_staging/cam/ata/ata_all.h ============================================================================== --- user/andre/mbuf_staging/cam/ata/ata_all.h Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/cam/ata/ata_all.h Sun Oct 20 10:02:04 2013 (r256781) @@ -109,6 +109,7 @@ int ata_status_sbuf(struct ccb_ataio *at int ata_res_sbuf(struct ccb_ataio *ataio, struct sbuf *sb); void ata_print_ident(struct ata_params *ident_data); +void ata_print_ident_short(struct ata_params *ident_data); uint32_t ata_logical_sector_size(struct ata_params *ident_data); uint64_t ata_physical_sector_size(struct ata_params *ident_data); @@ -143,6 +144,7 @@ int ata_identify_match(caddr_t identbuff int ata_static_identify_match(caddr_t identbuffer, caddr_t table_entry); void semb_print_ident(struct sep_identify_data *ident_data); +void semb_print_ident_short(struct sep_identify_data *ident_data); void semb_receive_diagnostic_results(struct ccb_ataio *ataio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb*), Modified: user/andre/mbuf_staging/cam/ata/ata_da.c ============================================================================== --- user/andre/mbuf_staging/cam/ata/ata_da.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/cam/ata/ata_da.c Sun Oct 20 10:02:04 2013 (r256781) @@ -293,6 +293,14 @@ static struct ada_quirk_entry ada_quirk_ }, { /* + * Corsair Neutron GTX SSDs + * 4k optimised & trim only works in 4k requests + 4k aligned + */ + { T_DIRECT, SIP_MEDIA_FIXED, "*", "Corsair Neutron GTX*", "*" }, + /*quirks*/ADA_Q_4K + }, + { + /* * Corsair Force GT SSDs * 4k optimised & trim only works in 4k requests + 4k aligned */ @@ -907,7 +915,6 @@ adaoninvalidate(struct cam_periph *perip bioq_flush(&softc->trim_queue, NULL, ENXIO); disk_gone(softc->disk); - xpt_print(periph->path, "lost device\n"); } static void @@ -917,7 +924,6 @@ adacleanup(struct cam_periph *periph) softc = (struct ada_softc *)periph->softc; - xpt_print(periph->path, "removing device entry\n"); cam_periph_unlock(periph); /* Modified: user/andre/mbuf_staging/cam/ata/ata_pmp.c ============================================================================== --- user/andre/mbuf_staging/cam/ata/ata_pmp.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/cam/ata/ata_pmp.c Sun Oct 20 10:02:04 2013 (r256781) @@ -241,7 +241,6 @@ pmponinvalidate(struct cam_periph *perip } } pmprelease(periph, -1); - xpt_print(periph->path, "lost device\n"); } static void @@ -251,7 +250,6 @@ pmpcleanup(struct cam_periph *periph) softc = (struct pmp_softc *)periph->softc; - xpt_print(periph->path, "removing device entry\n"); cam_periph_unlock(periph); /* Modified: user/andre/mbuf_staging/cam/cam_periph.c ============================================================================== --- user/andre/mbuf_staging/cam/cam_periph.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/cam/cam_periph.c Sun Oct 20 10:02:04 2013 (r256781) @@ -586,6 +586,8 @@ cam_periph_invalidate(struct cam_periph return; CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph invalidated\n")); + if (periph->flags & CAM_PERIPH_ANNOUNCED) + xpt_denounce_periph(periph); periph->flags |= CAM_PERIPH_INVALID; periph->flags &= ~CAM_PERIPH_NEW_DEV_FOUND; if (periph->periph_oninval != NULL) @@ -648,7 +650,10 @@ camperiphfree(struct cam_periph *periph) xpt_remove_periph(periph); xpt_unlock_buses(); - CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); + if (periph->flags & CAM_PERIPH_ANNOUNCED) { + xpt_print(periph->path, "Periph destroyed\n"); + } else + CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Periph destroyed\n")); if (periph->flags & CAM_PERIPH_NEW_DEV_FOUND) { union ccb ccb; Modified: user/andre/mbuf_staging/cam/cam_periph.h ============================================================================== --- user/andre/mbuf_staging/cam/cam_periph.h Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/cam/cam_periph.h Sun Oct 20 10:02:04 2013 (r256781) @@ -121,6 +121,7 @@ struct cam_periph { #define CAM_PERIPH_NEW_DEV_FOUND 0x10 #define CAM_PERIPH_RECOVERY_INPROG 0x20 #define CAM_PERIPH_FREE 0x80 +#define CAM_PERIPH_ANNOUNCED 0x100 u_int32_t immediate_priority; u_int32_t refcount; SLIST_HEAD(, ccb_hdr) ccb_list; /* For "immediate" requests */ Modified: user/andre/mbuf_staging/cam/cam_xpt.c ============================================================================== --- user/andre/mbuf_staging/cam/cam_xpt.c Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/cam/cam_xpt.c Sun Oct 20 10:02:04 2013 (r256781) @@ -1023,6 +1023,7 @@ xpt_announce_periph(struct cam_periph *p struct cam_path *path = periph->path; mtx_assert(periph->sim->mtx, MA_OWNED); + periph->flags |= CAM_PERIPH_ANNOUNCED; printf("%s%d at %s%d bus %d scbus%d target %d lun %d\n", periph->periph_name, periph->unit_number, @@ -1043,7 +1044,7 @@ xpt_announce_periph(struct cam_periph *p (struct sep_identify_data *)&path->device->ident_data); else printf("Unknown protocol device\n"); - if (bootverbose && path->device->serial_num_len > 0) { + if (path->device->serial_num_len > 0) { /* Don't wrap the screen - print only the first 60 chars */ printf("%s%d: Serial Number %.60s\n", periph->periph_name, periph->unit_number, path->device->serial_num); @@ -1071,6 +1072,37 @@ xpt_announce_quirks(struct cam_periph *p } } +void +xpt_denounce_periph(struct cam_periph *periph) +{ + struct cam_path *path = periph->path; + + mtx_assert(periph->sim->mtx, MA_OWNED); + printf("%s%d at %s%d bus %d scbus%d target %d lun %d\n", + periph->periph_name, periph->unit_number, + path->bus->sim->sim_name, + path->bus->sim->unit_number, + path->bus->sim->bus_id, + path->bus->path_id, + path->target->target_id, + path->device->lun_id); + printf("%s%d: ", periph->periph_name, periph->unit_number); + if (path->device->protocol == PROTO_SCSI) + scsi_print_inquiry_short(&path->device->inq_data); + else if (path->device->protocol == PROTO_ATA || + path->device->protocol == PROTO_SATAPM) + ata_print_ident_short(&path->device->ident_data); + else if (path->device->protocol == PROTO_SEMB) + semb_print_ident_short( + (struct sep_identify_data *)&path->device->ident_data); + else + printf("Unknown protocol device"); + if (path->device->serial_num_len > 0) + printf(" s/n %.60s", path->device->serial_num); + printf(" detached\n"); +} + + int xpt_getattr(char *buf, size_t len, const char *attr, struct cam_path *path) { Modified: user/andre/mbuf_staging/cam/cam_xpt_periph.h ============================================================================== --- user/andre/mbuf_staging/cam/cam_xpt_periph.h Sun Oct 20 09:51:36 2013 (r256780) +++ user/andre/mbuf_staging/cam/cam_xpt_periph.h Sun Oct 20 10:02:04 2013 (r256781) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Sun Oct 20 11:55:40 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 2AADC925; Sun, 20 Oct 2013 11:55:40 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1851B2498; Sun, 20 Oct 2013 11:55:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9KBtdlU075849; Sun, 20 Oct 2013 11:55:39 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9KBtdSY075847; Sun, 20 Oct 2013 11:55:39 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201310201155.r9KBtdSY075847@svn.freebsd.org> From: Andre Oppermann Date: Sun, 20 Oct 2013 11:55:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256783 - in user/andre/mbuf_staging: kern sys X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2013 11:55:40 -0000 Author: andre Date: Sun Oct 20 11:55:39 2013 New Revision: 256783 URL: http://svnweb.freebsd.org/changeset/base/256783 Log: Pimp m_print() to tell us everything about an mbuf, its headers and contents. Change m_print() to only print information about the one specified mbuf. Add m_printm() to print information on every mbuf in a chain. Modified: user/andre/mbuf_staging/kern/uipc_mbuf.c user/andre/mbuf_staging/sys/mbuf.h Modified: user/andre/mbuf_staging/kern/uipc_mbuf.c ============================================================================== --- user/andre/mbuf_staging/kern/uipc_mbuf.c Sun Oct 20 11:19:37 2013 (r256782) +++ user/andre/mbuf_staging/kern/uipc_mbuf.c Sun Oct 20 11:55:39 2013 (r256783) @@ -1216,40 +1216,74 @@ m_getptr(struct mbuf *m, int loc, int *o return (NULL); } +/* + * Print the mbuf header fields and contents. + * XXXAO: Add printing of interface name. + */ void m_print(const struct mbuf *m, int maxlen) { - int len; - int pdata; - const struct mbuf *m2; + struct m_tag *mt; +#define P printf - if (m == NULL) { - printf("mbuf: %p\n", m); - return; - } + P("mbuf: %p\n", m); + P(" m_next: %p, m_nextpkt: %p\n", m->m_next, m->m_nextpkt); + P(" m_data: %p, m_len: %i, m_type: %#2x\n", m->m_data, m->m_len, + m->m_type); + P(" m_flags: %b\n", m->m_flags, M_FLAG_PRINTF); + + if (m->m_flags & M_PKTHDR) { + P(" m_pkthdr:\n"); + P(" rcvif: %p, len: %i, fibnum: %#4hx\n", m->m_pkthdr.rcvif, + m->m_pkthdr.len, m->m_pkthdr.fibnum); + P(" flowid: %#x, rsstype: %#2hhx, cosqos: %#2hhx\n", + m->m_pkthdr.flowid, m->m_pkthdr.rsstype, m->m_pkthdr.cosqos); + P(" csum_flags: %b\n", (int)m->m_pkthdr.csum_flags, CSUM_BITS); + P(" l2hlen: %hhu, l3hlen: %hhu, l4hlen: %hhu, l5hlen: %hhu\n", + m->m_pkthdr.l2hlen, m->m_pkthdr.l3hlen, m->m_pkthdr.l4hlen, + m->m_pkthdr.l5hlen); + P(" PH_per: %p, PH_loc: %p\n", m->m_pkthdr.PH_per.ptr, + m->m_pkthdr.PH_loc.ptr); + P(" ether_vtag: %#4hx, tso_segsz: %i, csum_phsum: %#4hx\n", + m->m_pkthdr.ether_vtag, m->m_pkthdr.tso_segsz, + m->m_pkthdr.csum_phsum); + SLIST_FOREACH(mt, &m->m_pkthdr.tags, m_tag_link) { + P(" m_tag: %p\n", mt); + P(" m_tag_id: %#4hx, m_tag_len: %hu, m_tag_cookie: %#8x, m_tag_free: %p\n", + mt->m_tag_id, mt->m_tag_len, mt->m_tag_cookie, mt->m_tag_free); + } /* SLIST_FOREACH */ + } /* M_PKTHDR */ - if (m->m_flags & M_PKTHDR) - len = m->m_pkthdr.len; - else - len = -1; - m2 = m; - while (m2 != NULL && (len == -1 || len)) { - pdata = m2->m_len; - if (maxlen != -1 && pdata > maxlen) - pdata = maxlen; - printf("mbuf: %p len: %d, next: %p, %b%s", m2, m2->m_len, - m2->m_next, m2->m_flags, "\20\20freelist\17skipfw" - "\11proto5\10proto4\7proto3\6proto2\5proto1\4rdonly" - "\3eor\2pkthdr\1ext", pdata ? "" : "\n"); - if (pdata) - printf(", %*D\n", pdata, (u_char *)m2->m_data, "-"); - if (len != -1) - len -= m2->m_len; - m2 = m2->m_next; + if (m->m_flags & M_EXT) { + P(" m_ext:\n"); + P(" ext_buf: %p, ext_size: %i, ext_type: %#2x\n", m->m_ext.ext_buf, + m->m_ext.ext_size, m->m_ext.ext_type); + P(" ext_flags: %b\n", m->m_ext.ext_flags, EXT_FLAG_BITS); + P(" ref_cnt: %p, *ref_cnt: %u\n", m->m_ext.ref_cnt, + (m->m_ext.ref_cnt ? *(m->m_ext.ref_cnt) : 0)); + P(" ext_free: %p, ext_arg1: %p, ext_arg2: %p\n", m->m_ext.ext_free, + m->m_ext.ext_arg1, m->m_ext.ext_arg2); + } /* M_EXT */ + + maxlen = imin(maxlen, m->m_len); + if (maxlen > 0) { + P("\n m_data:\n"); + P("%*D\n", maxlen, (u_char *)m->m_data, "-"); } - if (len > 0) - printf("%d bytes unaccounted for.\n", len); - return; + + P("\n"); +#undef P +} + +/* + * Print the mbuf header fields and contents for entire chain of mbufs. + */ +void +m_printm(const struct mbuf *m, int maxlen) +{ + + for (; m != NULL; maxlen -= m->m_len, m = m->m_next) + m_print(m, maxlen); } u_int Modified: user/andre/mbuf_staging/sys/mbuf.h ============================================================================== --- user/andre/mbuf_staging/sys/mbuf.h Sun Oct 20 11:19:37 2013 (r256782) +++ user/andre/mbuf_staging/sys/mbuf.h Sun Oct 20 11:55:39 2013 (r256783) @@ -656,6 +656,7 @@ int m_mbuftouio(struct uio *, struct m void m_move_pkthdr(struct mbuf *, struct mbuf *); struct mbuf *m_prepend(struct mbuf *, int, int); void m_print(const struct mbuf *, int); +void m_printm(const struct mbuf *, int); struct mbuf *m_pulldown(struct mbuf *, int, int, int *); struct mbuf *m_pullup(struct mbuf *, int); int m_sanity(struct mbuf *, int); From owner-svn-src-user@FreeBSD.ORG Sun Oct 20 12:59:55 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 358F4B0E; Sun, 20 Oct 2013 12:59:55 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 225F42769; Sun, 20 Oct 2013 12:59:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9KCxt3A008885; Sun, 20 Oct 2013 12:59:55 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9KCxsxE008884; Sun, 20 Oct 2013 12:59:54 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201310201259.r9KCxsxE008884@svn.freebsd.org> From: Andre Oppermann Date: Sun, 20 Oct 2013 12:59:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256786 - user/andre/mbuf_staging/kern X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2013 12:59:55 -0000 Author: andre Date: Sun Oct 20 12:59:54 2013 New Revision: 256786 URL: http://svnweb.freebsd.org/changeset/base/256786 Log: anity() to reflect the updated realities. Modified: user/andre/mbuf_staging/kern/uipc_mbuf.c Modified: user/andre/mbuf_staging/kern/uipc_mbuf.c ============================================================================== --- user/andre/mbuf_staging/kern/uipc_mbuf.c Sun Oct 20 12:55:23 2013 (r256785) +++ user/andre/mbuf_staging/kern/uipc_mbuf.c Sun Oct 20 12:59:54 2013 (r256786) @@ -178,46 +178,92 @@ m_sanity(struct mbuf *m0, int sanitize) if ((caddr_t)m->m_data + m->m_len > b) M_SANITY_ACTION("m_data + m_len exeeds mbuf space"); - /* m->m_nextpkt may only be set on first mbuf in chain. */ - if (m != m0 && m->m_nextpkt != NULL) { - if (sanitize) { - m_freem(m->m_nextpkt); - m->m_nextpkt = (struct mbuf *)0xDEADC0DE; - } else - M_SANITY_ACTION("m->m_nextpkt on in-chain mbuf"); - } + /* + * Empty mbufs should not appear in a chain. + */ + if (m->m_len == 0) + M_SANITY_ACTION("empty mbuf in chain"); - /* packet length (not mbuf length!) calculation */ - if (m0->m_flags & M_PKTHDR) - pktlen += m->m_len; + /* + * M_PKTHDR may only be set on first mbuf in chain. + */ + if (m != m0 && m->m_flags & M_PKTHDR) + M_SANITY_ACTION("M_PKTHDR on in-chain mbuf"); - /* m_tags may only be attached to first mbuf in chain. */ + /* + * m->m_nextpkt may only be set on first mbuf in chain. + */ + if (m != m0 && m->m_nextpkt != NULL) + M_SANITY_ACTION("m->m_nextpkt on in-chain mbuf"); + + /* + * m_tags may only be attached to first mbuf in chain. + */ if (m != m0 && m->m_flags & M_PKTHDR && - !SLIST_EMPTY(&m->m_pkthdr.tags)) { - if (sanitize) { - m_tag_delete_chain(m, NULL); - /* put in 0xDEADC0DE perhaps? */ - } else - M_SANITY_ACTION("m_tags on in-chain mbuf"); - } - - /* M_PKTHDR may only be set on first mbuf in chain */ - if (m != m0 && m->m_flags & M_PKTHDR) { - if (sanitize) { - bzero(&m->m_pkthdr, sizeof(m->m_pkthdr)); - m->m_flags &= ~M_PKTHDR; - /* put in 0xDEADCODE and leave hdr flag in */ - } else - M_SANITY_ACTION("M_PKTHDR on in-chain mbuf"); + !SLIST_EMPTY(&m->m_pkthdr.tags)) + M_SANITY_ACTION("m_tags on in-chain mbuf"); + + /* + * Validate m_flags that require m_pkthdr. + */ + if ((m->m_flags & M_PKTHDR) == 0 && + (m->m_flags & (M_BCAST|M_MCAST|M_PROMISC|M_VLANTAG|M_FLOWID))) + M_SANITY_ACTION("m_flags that require M_PKTHDR"); + + /* + * Sum of l[2-5]hlen) is an offset and must be inside this mbuf. + */ + if ((m->m_flags & M_PKTHDR) && + m->m_pkthdr.l2hlen + m->m_pkthdr.l3hlen + + m->m_pkthdr.l4hlen + m->m_pkthdr.l5hlen > m->m_len) + M_SANITY_ACTION("l[2-5]hlen exceeds first mbuf"); + + /* + * Close down on M_EXT. + */ + if (m->m_flags & M_EXT) { + /* + * Unless normal type ext_free may not be empty. + */ + switch (m->m_ext.ext_type) { + case EXT_CLUSTER: + case EXT_JUMBOP: + case EXT_JUMBO9: + case EXT_JUMBO16: + case EXT_PACKET: + break; + default: + if (m->m_ext.ext_free == NULL) + M_SANITY_ACTION("ext_free not set"); + } + + /* + * Ref_cnt may be not empty. + */ + if (m->m_ext.ref_cnt == NULL) + M_SANITY_ACTION("ext_free not set"); + + /* + * Refcount must be >= 1. + */ + if (*(m->m_ext.ref_cnt) < 1) + M_SANITY_ACTION("ref_cnt is < 1"); + + /* ext_size must be >= 1. */ + if (m->m_ext.ext_size < 1) + M_SANITY_ACTION("ext_size is < 1"); } + + /* + * Packet length (not mbuf length!) calculation. + */ + if (m0->m_flags & M_PKTHDR) + pktlen += m->m_len; } m = m0; - if (pktlen && pktlen != m->m_pkthdr.len) { - if (sanitize) - m->m_pkthdr.len = 0; - else - M_SANITY_ACTION("m_pkthdr.len != mbuf chain length"); - } + if (pktlen > 0 && pktlen != m->m_pkthdr.len) + M_SANITY_ACTION("m_pkthdr.len != mbuf chain length"); + return 1; #undef M_SANITY_ACTION From owner-svn-src-user@FreeBSD.ORG Sun Oct 20 16:52:28 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 686F2371; Sun, 20 Oct 2013 16:52:28 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 540F8226C; Sun, 20 Oct 2013 16:52:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9KGqS2J036449; Sun, 20 Oct 2013 16:52:28 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9KGqS1A036448; Sun, 20 Oct 2013 16:52:28 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201310201652.r9KGqS1A036448@svn.freebsd.org> From: Andre Oppermann Date: Sun, 20 Oct 2013 16:52:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256795 - user/andre/mbuf_staging/dev/bce X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2013 16:52:28 -0000 Author: andre Date: Sun Oct 20 16:52:27 2013 New Revision: 256795 URL: http://svnweb.freebsd.org/changeset/base/256795 Log: Replace bce_dump_mbuf() with m_printm(). Modified: user/andre/mbuf_staging/dev/bce/if_bce.c Modified: user/andre/mbuf_staging/dev/bce/if_bce.c ============================================================================== --- user/andre/mbuf_staging/dev/bce/if_bce.c Sun Oct 20 16:45:01 2013 (r256794) +++ user/andre/mbuf_staging/dev/bce/if_bce.c Sun Oct 20 16:52:27 2013 (r256795) @@ -9798,72 +9798,6 @@ bce_dump_enet(struct bce_softc *sc, stru /****************************************************************************/ -/* Prints out information about an mbuf. */ -/* */ -/* Returns: */ -/* Nothing. */ -/****************************************************************************/ -static __attribute__ ((noinline)) void -bce_dump_mbuf(struct bce_softc *sc, struct mbuf *m) -{ - struct mbuf *mp = m; - - if (m == NULL) { - BCE_PRINTF("mbuf: null pointer\n"); - return; - } - - while (mp) { - BCE_PRINTF("mbuf: %p, m_len = %d, m_flags = 0x%b, " - "m_data = %p\n", mp, mp->m_len, mp->m_flags, - "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY", mp->m_data); - - if (mp->m_flags & M_PKTHDR) { - BCE_PRINTF("- m_pkthdr: len = %d, flags = 0x%b, " - "csum_flags = %b\n", mp->m_pkthdr.len, - mp->m_flags, M_FLAG_PRINTF, - mp->m_pkthdr.csum_flags, - "\20\1CSUM_IP\2CSUM_TCP\3CSUM_UDP" - "\5CSUM_FRAGMENT\6CSUM_TSO\11CSUM_IP_CHECKED" - "\12CSUM_IP_VALID\13CSUM_DATA_VALID" - "\14CSUM_PSEUDO_HDR"); - } - - if (mp->m_flags & M_EXT) { - BCE_PRINTF("- m_ext: %p, ext_size = %d, type = ", - mp->m_ext.ext_buf, mp->m_ext.ext_size); - switch (mp->m_ext.ext_type) { - case EXT_CLUSTER: - printf("EXT_CLUSTER\n"); break; - case EXT_SFBUF: - printf("EXT_SFBUF\n"); break; - case EXT_JUMBO9: - printf("EXT_JUMBO9\n"); break; - case EXT_JUMBO16: - printf("EXT_JUMBO16\n"); break; - case EXT_PACKET: - printf("EXT_PACKET\n"); break; - case EXT_MBUF: - printf("EXT_MBUF\n"); break; - case EXT_NET_DRV: - printf("EXT_NET_DRV\n"); break; - case EXT_MOD_TYPE: - printf("EXT_MDD_TYPE\n"); break; - case EXT_DISPOSABLE: - printf("EXT_DISPOSABLE\n"); break; - case EXT_EXTREF: - printf("EXT_EXTREF\n"); break; - default: - printf("UNKNOWN\n"); - } - } - - mp = mp->m_next; - } -} - - -/****************************************************************************/ /* Prints out the mbufs in the TX mbuf chain. */ /* */ /* Returns: */ @@ -9882,7 +9816,7 @@ bce_dump_tx_mbuf_chain(struct bce_softc for (int i = 0; i < count; i++) { m = sc->tx_mbuf_ptr[chain_prod]; BCE_PRINTF("txmbuf[0x%04X]\n", chain_prod); - bce_dump_mbuf(sc, m); + m_printm(m, 0); chain_prod = TX_CHAIN_IDX(NEXT_TX_BD(chain_prod)); } @@ -9912,7 +9846,7 @@ bce_dump_rx_mbuf_chain(struct bce_softc for (int i = 0; i < count; i++) { m = sc->rx_mbuf_ptr[chain_prod]; BCE_PRINTF("rxmbuf[0x%04X]\n", chain_prod); - bce_dump_mbuf(sc, m); + m_printm(m, 0); chain_prod = RX_CHAIN_IDX(NEXT_RX_BD(chain_prod)); } From owner-svn-src-user@FreeBSD.ORG Sun Oct 20 17:47:41 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 5B9E930F; Sun, 20 Oct 2013 17:47:41 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 39F26254E; Sun, 20 Oct 2013 17:47:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9KHlfPc064892; Sun, 20 Oct 2013 17:47:41 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9KHlePv064890; Sun, 20 Oct 2013 17:47:40 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201310201747.r9KHlePv064890@svn.freebsd.org> From: Andre Oppermann Date: Sun, 20 Oct 2013 17:47:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256796 - user/andre/mbuf_staging/dev/lge X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2013 17:47:41 -0000 Author: andre Date: Sun Oct 20 17:47:40 2013 New Revision: 256796 URL: http://svnweb.freebsd.org/changeset/base/256796 Log: Change lge(4) driver from managing its own jumbo mbuf pool to the generic MJUM9BYTES jumbo buffers provided by the kernel. NB: The driver always uses jumbo mbufs, even when the MTU is the normal 1500. That issue is not fixed. Untested due to lack of hardware. Modified: user/andre/mbuf_staging/dev/lge/if_lge.c user/andre/mbuf_staging/dev/lge/if_lgereg.h Modified: user/andre/mbuf_staging/dev/lge/if_lge.c ============================================================================== --- user/andre/mbuf_staging/dev/lge/if_lge.c Sun Oct 20 16:52:27 2013 (r256795) +++ user/andre/mbuf_staging/dev/lge/if_lge.c Sun Oct 20 17:47:40 2013 (r256796) @@ -119,11 +119,6 @@ static int lge_probe(device_t); static int lge_attach(device_t); static int lge_detach(device_t); -static int lge_alloc_jumbo_mem(struct lge_softc *); -static void lge_free_jumbo_mem(struct lge_softc *); -static void *lge_jalloc(struct lge_softc *); -static int lge_jfree(struct mbuf *, void *, void *, int); - static int lge_newbuf(struct lge_softc *, struct lge_rx_desc *, struct mbuf *); static int lge_encap(struct lge_softc *, struct mbuf *, u_int32_t *); static void lge_rxeof(struct lge_softc *, int); @@ -521,13 +516,6 @@ lge_attach(dev) goto fail; } - /* Try to allocate memory for jumbo buffers. */ - if (lge_alloc_jumbo_mem(sc)) { - device_printf(dev, "jumbo buffer allocation failed\n"); - error = ENXIO; - goto fail; - } - ifp = sc->lge_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) { device_printf(dev, "can not if_alloc()\n"); @@ -575,10 +563,6 @@ lge_attach(dev) return (0); fail: - lge_free_jumbo_mem(sc); - if (sc->lge_ldata) - contigfree(sc->lge_ldata, - sizeof(struct lge_list_data), M_DEVBUF); if (ifp) if_free(ifp); if (sc->lge_irq) @@ -615,7 +599,6 @@ lge_detach(dev) contigfree(sc->lge_ldata, sizeof(struct lge_list_data), M_DEVBUF); if_free(ifp); - lge_free_jumbo_mem(sc); mtx_destroy(&sc->lge_mtx); return(0); @@ -688,31 +671,14 @@ lge_newbuf(sc, c, m) struct mbuf *m; { struct mbuf *m_new = NULL; - caddr_t *buf = NULL; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + m_new = m_getjcl(M_NOWAIT, MT_DATA, 0, MJUM9BYTES); if (m_new == NULL) { device_printf(sc->lge_dev, "no memory for rx list " "-- packet dropped!\n"); return(ENOBUFS); } - - /* Allocate the jumbo buffer */ - buf = lge_jalloc(sc); - if (buf == NULL) { -#ifdef LGE_VERBOSE - device_printf(sc->lge_dev, "jumbo allocation failed " - "-- packet dropped!\n"); -#endif - m_freem(m_new); - return(ENOBUFS); - } - /* Attach the buffer to the mbuf */ - m_new->m_data = (void *)buf; - m_new->m_len = m_new->m_pkthdr.len = LGE_JUMBO_FRAMELEN; - MEXTADD(m_new, buf, LGE_JUMBO_FRAMELEN, lge_jfree, - buf, (struct lge_softc *)sc, 0, EXT_NET_DRV); } else { m_new = m; m_new->m_len = m_new->m_pkthdr.len = LGE_JUMBO_FRAMELEN; @@ -750,132 +716,6 @@ lge_newbuf(sc, c, m) return(0); } -static int -lge_alloc_jumbo_mem(sc) - struct lge_softc *sc; -{ - caddr_t ptr; - register int i; - struct lge_jpool_entry *entry; - - /* Grab a big chunk o' storage. */ - sc->lge_cdata.lge_jumbo_buf = contigmalloc(LGE_JMEM, M_DEVBUF, - M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0); - - if (sc->lge_cdata.lge_jumbo_buf == NULL) { - device_printf(sc->lge_dev, "no memory for jumbo buffers!\n"); - return(ENOBUFS); - } - - SLIST_INIT(&sc->lge_jfree_listhead); - SLIST_INIT(&sc->lge_jinuse_listhead); - - /* - * Now divide it up into 9K pieces and save the addresses - * in an array. - */ - ptr = sc->lge_cdata.lge_jumbo_buf; - for (i = 0; i < LGE_JSLOTS; i++) { - sc->lge_cdata.lge_jslots[i] = ptr; - ptr += LGE_JLEN; - entry = malloc(sizeof(struct lge_jpool_entry), - M_DEVBUF, M_NOWAIT); - if (entry == NULL) { - device_printf(sc->lge_dev, "no memory for jumbo " - "buffer queue!\n"); - return(ENOBUFS); - } - entry->slot = i; - SLIST_INSERT_HEAD(&sc->lge_jfree_listhead, - entry, jpool_entries); - } - - return(0); -} - -static void -lge_free_jumbo_mem(sc) - struct lge_softc *sc; -{ - struct lge_jpool_entry *entry; - - if (sc->lge_cdata.lge_jumbo_buf == NULL) - return; - - while ((entry = SLIST_FIRST(&sc->lge_jinuse_listhead))) { - device_printf(sc->lge_dev, - "asked to free buffer that is in use!\n"); - SLIST_REMOVE_HEAD(&sc->lge_jinuse_listhead, jpool_entries); - SLIST_INSERT_HEAD(&sc->lge_jfree_listhead, entry, - jpool_entries); - } - while (!SLIST_EMPTY(&sc->lge_jfree_listhead)) { - entry = SLIST_FIRST(&sc->lge_jfree_listhead); - SLIST_REMOVE_HEAD(&sc->lge_jfree_listhead, jpool_entries); - free(entry, M_DEVBUF); - } - - contigfree(sc->lge_cdata.lge_jumbo_buf, LGE_JMEM, M_DEVBUF); - - return; -} - -/* - * Allocate a jumbo buffer. - */ -static void * -lge_jalloc(sc) - struct lge_softc *sc; -{ - struct lge_jpool_entry *entry; - - entry = SLIST_FIRST(&sc->lge_jfree_listhead); - - if (entry == NULL) { -#ifdef LGE_VERBOSE - device_printf(sc->lge_dev, "no free jumbo buffers\n"); -#endif - return(NULL); - } - - SLIST_REMOVE_HEAD(&sc->lge_jfree_listhead, jpool_entries); - SLIST_INSERT_HEAD(&sc->lge_jinuse_listhead, entry, jpool_entries); - return(sc->lge_cdata.lge_jslots[entry->slot]); -} - -/* - * Release a jumbo buffer. - */ -static int -lge_jfree(struct mbuf *m, void *buf, void *args, int action) -{ - struct lge_softc *sc; - int i; - struct lge_jpool_entry *entry; - - /* Extract the softc struct pointer. */ - sc = args; - - if (sc == NULL) - panic("lge_jfree: can't find softc pointer!"); - - /* calculate the slot this buffer belongs to */ - i = ((vm_offset_t)buf - - (vm_offset_t)sc->lge_cdata.lge_jumbo_buf) / LGE_JLEN; - - if ((i < 0) || (i >= LGE_JSLOTS)) - panic("lge_jfree: asked to free buffer that we don't manage!"); - - entry = SLIST_FIRST(&sc->lge_jinuse_listhead); - if (entry == NULL) - panic("lge_jfree: buffer not in use!"); - entry->slot = i; - SLIST_REMOVE_HEAD(&sc->lge_jinuse_listhead, jpool_entries); - SLIST_INSERT_HEAD(&sc->lge_jfree_listhead, entry, jpool_entries); - - return (EXT_FREE_OK); -} - /* * A frame has been uploaded: pass the resulting mbuf chain up to * the higher level protocols. Modified: user/andre/mbuf_staging/dev/lge/if_lgereg.h ============================================================================== --- user/andre/mbuf_staging/dev/lge/if_lgereg.h Sun Oct 20 16:52:27 2013 (r256795) +++ user/andre/mbuf_staging/dev/lge/if_lgereg.h Sun Oct 20 17:47:40 2013 (r256796) @@ -480,28 +480,15 @@ struct lge_type { #define LGE_JUMBO_FRAMELEN 9018 #define LGE_JUMBO_MTU (LGE_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN) -#define LGE_JSLOTS 384 -#define LGE_JRAWLEN (LGE_JUMBO_FRAMELEN + ETHER_ALIGN) -#define LGE_JLEN (LGE_JRAWLEN + (sizeof(u_int64_t) - \ - (LGE_JRAWLEN % sizeof(u_int64_t)))) #define LGE_JPAGESZ PAGE_SIZE #define LGE_RESID (LGE_JPAGESZ - (LGE_JLEN * LGE_JSLOTS) % LGE_JPAGESZ) -#define LGE_JMEM ((LGE_JLEN * LGE_JSLOTS) + LGE_RESID) - -struct lge_jpool_entry { - int slot; - SLIST_ENTRY(lge_jpool_entry) jpool_entries; -}; struct lge_ring_data { int lge_rx_prod; int lge_rx_cons; int lge_tx_prod; int lge_tx_cons; - /* Stick the jumbo mem management stuff here too. */ - caddr_t lge_jslots[LGE_JSLOTS]; - void *lge_jumbo_buf; }; struct lge_softc { @@ -522,8 +509,6 @@ struct lge_softc { struct lge_ring_data lge_cdata; struct callout lge_stat_callout; struct mtx lge_mtx; - SLIST_HEAD(__lge_jfreehead, lge_jpool_entry) lge_jfree_listhead; - SLIST_HEAD(__lge_jinusehead, lge_jpool_entry) lge_jinuse_listhead; }; /* From owner-svn-src-user@FreeBSD.ORG Sun Oct 20 18:13:06 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id CA07DC5A; Sun, 20 Oct 2013 18:13:06 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B834B2787; Sun, 20 Oct 2013 18:13:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9KID6XU080190; Sun, 20 Oct 2013 18:13:06 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9KID6r8080189; Sun, 20 Oct 2013 18:13:06 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201310201813.r9KID6r8080189@svn.freebsd.org> From: Andre Oppermann Date: Sun, 20 Oct 2013 18:13:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256797 - user/andre/mbuf_staging/dev/wb X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2013 18:13:06 -0000 Author: andre Date: Sun Oct 20 18:13:06 2013 New Revision: 256797 URL: http://svnweb.freebsd.org/changeset/base/256797 Log: Sorta fix the wb(4) driver to allocate complete mbuf+cluster packets and remove the need for MEXTADD. I don't believe the driver was in working condition before. Untested due to lack of hardware. Modified: user/andre/mbuf_staging/dev/wb/if_wb.c Modified: user/andre/mbuf_staging/dev/wb/if_wb.c ============================================================================== --- user/andre/mbuf_staging/dev/wb/if_wb.c Sun Oct 20 17:47:40 2013 (r256796) +++ user/andre/mbuf_staging/dev/wb/if_wb.c Sun Oct 20 18:13:06 2013 (r256797) @@ -142,7 +142,6 @@ static int wb_probe(device_t); static int wb_attach(device_t); static int wb_detach(device_t); -static int wb_bfree(struct mbuf *, void *addr, void *args, int action); static int wb_newbuf(struct wb_softc *, struct wb_chain_onefrag *, struct mbuf *); static int wb_encap(struct wb_softc *, struct wb_chain *, struct mbuf *); @@ -822,13 +821,6 @@ wb_list_rx_init(sc) return(0); } -static int -wb_bfree(struct mbuf *m, void *buf, void *args, int action) -{ - - return (EXT_FREE_OK); -} - /* * Initialize an RX descriptor and attach an MBUF cluster. */ @@ -841,13 +833,10 @@ wb_newbuf(sc, c, m) struct mbuf *m_new = NULL; if (m == NULL) { - MGETHDR(m_new, M_NOWAIT, MT_DATA); + m_new = m_getcl(M_NOWAIT, MT_DATA, 0); if (m_new == NULL) return(ENOBUFS); - m_new->m_data = c->wb_buf; m_new->m_pkthdr.len = m_new->m_len = WB_BUFBYTES; - MEXTADD(m_new, c->wb_buf, WB_BUFBYTES, wb_bfree, c->wb_buf, - NULL, 0, EXT_NET_DRV); } else { m_new = m; m_new->m_len = m_new->m_pkthdr.len = WB_BUFBYTES; From owner-svn-src-user@FreeBSD.ORG Sun Oct 20 21:23:53 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7A091AA2; Sun, 20 Oct 2013 21:23:53 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6840D2128; Sun, 20 Oct 2013 21:23:53 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9KLNrrL082862; Sun, 20 Oct 2013 21:23:53 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9KLNrkW082861; Sun, 20 Oct 2013 21:23:53 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310202123.r9KLNrkW082861@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Sun, 20 Oct 2013 21:23:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256811 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2013 21:23:53 -0000 Author: ae Date: Sun Oct 20 21:23:52 2013 New Revision: 256811 URL: http://svnweb.freebsd.org/changeset/base/256811 Log: * Initialize sin6_scope_id using specified ifnet. * Don't add loopback routes for link-local addresses. Modified: user/ae/inet6/sys/netinet6/in6.c Modified: user/ae/inet6/sys/netinet6/in6.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6.c Sun Oct 20 21:21:50 2013 (r256810) +++ user/ae/inet6/sys/netinet6/in6.c Sun Oct 20 21:23:52 2013 (r256811) @@ -1684,7 +1684,11 @@ in6_ifinit(struct ifnet *ifp, struct in6 IF_ADDR_RUNLOCK(ifp); ia->ia_addr = *sin6; - + /* + * Initialize sin6_scope_id using specified ifnet. + */ + ia->ia_addr.sin6_scope_id = in6_getscopezone(ifp, + in6_addrscope(&sin6->sin6_addr)); if (ifacount <= 1 && ifp->if_ioctl) { error = (*ifp->if_ioctl)(ifp, SIOCSIFADDR, (caddr_t)ia); if (error) @@ -1707,6 +1711,7 @@ in6_ifinit(struct ifnet *ifp, struct in6 if (!(ia->ia_flags & IFA_ROUTE) && plen == 128 && ia->ia_dstaddr.sin6_family == AF_INET6) { int rtflags = RTF_UP | RTF_HOST; + /* XXX: link-local destinations */ error = rtinit(&ia->ia_ifa, RTM_ADD, ia->ia_flags | rtflags); if (error) return (error); @@ -1721,7 +1726,8 @@ in6_ifinit(struct ifnet *ifp, struct in6 /* * add a loopback route to self */ - if (!(ia->ia_flags & IFA_RTSELF) && V_nd6_useloopback) { + if (!IN6_IS_ADDR_LINKLOCAL(&ia->ia_addr.sin6_addr) && + (ia->ia_flags & IFA_RTSELF) == 0 && V_nd6_useloopback) { error = ifa_add_loopback_route((struct ifaddr *)ia, (struct sockaddr *)&ia->ia_addr); if (error == 0) From owner-svn-src-user@FreeBSD.ORG Mon Oct 21 06:55:07 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B90AE33F; Mon, 21 Oct 2013 06:55:07 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 979602ED8; Mon, 21 Oct 2013 06:55:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9L6t7sA090768; Mon, 21 Oct 2013 06:55:07 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9L6t7PW090766; Mon, 21 Oct 2013 06:55:07 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201310210655.r9L6t7PW090766@svn.freebsd.org> From: Peter Holm Date: Mon, 21 Oct 2013 06:55:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256831 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2013 06:55:07 -0000 Author: pho Date: Mon Oct 21 06:55:07 2013 New Revision: 256831 URL: http://svnweb.freebsd.org/changeset/base/256831 Log: Added test scenario for per-filesystem soft-updates lock. Sponsored by: EMC / Isilon storage division Added: user/pho/stress2/misc/pfl.sh (contents, props changed) Added: user/pho/stress2/misc/pfl.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/pfl.sh Mon Oct 21 06:55:07 2013 (r256831) @@ -0,0 +1,167 @@ +#!/bin/sh + +# +# Copyright (c) 2013 EMC Corp. +# 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$ +# + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +# Test scenario for the change of a global SU lock to a per filesystem lock. + +. ../default.cfg + +here=`pwd` +cd /tmp +sed '1,/^EOF/d' < $here/$0 > pfl.c +cc -o pfl -Wall -Wextra pfl.c || exit 1 +rm -f pfl.c +cd $here + +mp1=$mntpoint +mp2=${mntpoint}2 +[ -d $mp2 ] || mkdir -p $mp2 +md1=$mdstart +md2=$((mdstart + 1)) + +opt=$([ $((`date '+%s'` % 2)) -eq 0 ] && echo "-j" || echo "-U") +mount | grep $mp1 | grep -q /dev/md && umount -f $mp1 +mdconfig -l | grep -q md$md1 && mdconfig -d -u $md1 +mdconfig -a -t swap -s 2g -u $md1 +bsdlabel -w md$md1 auto +newfs $opt md${md1}$part > /dev/null +mount /dev/md${md1}$part $mp1 +chmod 777 $mp1 + +mount | grep $mp2 | grep -q /dev/md && umount -f $mp2 +mdconfig -l | grep -q md$md2 && mdconfig -d -u $md2 +mdconfig -a -t swap -s 2g -u $md2 +bsdlabel -w md$md2 auto +newfs $opt md${md2}$part > /dev/null +mount /dev/md${md2}$part $mp2 +chmod 777 $mp2 + +su ${testuser} -c "cd $mp1; /tmp/pfl" & +su ${testuser} -c "cd $mp2; /tmp/pfl" & +wait; wait + +while mount | grep "$mp2 " | grep -q /dev/md; do + umount $mp2 || sleep 1 +done +mdconfig -d -u $md2 +while mount | grep "$mp1 " | grep -q /dev/md; do + umount $mp1 || sleep 1 +done +mdconfig -d -u $md1 +exit + +EOF +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PARALLEL 10 +static int size = 10000; + +void +test(void) +{ + int fd, i, j; + pid_t pid; + char file[128]; + + pid = getpid(); + sprintf(file,"d%05d", pid); + if (mkdir(file, 0740) == -1) + err(1, "mkdir(%s)", file); + chdir(file); + for (j = 0; j < size; j++) { + sprintf(file,"p%05d.%05d", pid, j); + if ((fd = open(file, O_CREAT | O_TRUNC | O_WRONLY, 0644)) == -1) { + if (errno != EINTR) { + warn("mkdir(%s). %s:%d", file, __FILE__, __LINE__); + unlink("continue"); + break; + } + } + if (arc4random() % 100 < 10) + if (write(fd, "1", 1) != 1) + err(1, "write()"); + close(fd); + + } + sleep(3); + + for (i = --j; i >= 0; i--) { + sprintf(file,"p%05d.%05d", pid, i); + if (unlink(file) == -1) + err(3, "unlink(%s)", file); + + } + chdir(".."); + sprintf(file,"d%05d", pid); + if (rmdir(file) == -1) + err(3, "unlink(%s)", file); +} + +int +main(void) +{ + int fd, i, j, k; + + umask(0); + if ((fd = open("continue", O_CREAT, 0644)) == -1) + err(1, "open()"); + close(fd); + for (i = 0; i < 1; i++) { + for (j = 0; j < PARALLEL; j++) { + if (fork() == 0) { + for (k = 0; k < 50; k++) + test(); + exit(0); + } + } + + for (j = 0; j < PARALLEL; j++) + wait(NULL); + + if (access("continue", R_OK) == -1) { + fprintf(stderr, "Loop #%d\n", i + 1); fflush(stderr); + break; + } + } + unlink("continue"); + + return (0); +} From owner-svn-src-user@FreeBSD.ORG Mon Oct 21 19:21:37 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 6D75EA8F; Mon, 21 Oct 2013 19:21:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5976B2F28; Mon, 21 Oct 2013 19:21:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9LJLbqK098896; Mon, 21 Oct 2013 19:21:37 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9LJLbxn098894; Mon, 21 Oct 2013 19:21:37 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201310211921.r9LJLbxn098894@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 21 Oct 2013 19:21:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256858 - user/glebius/course/05.memory X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2013 19:21:37 -0000 Author: glebius Date: Mon Oct 21 19:21:36 2013 New Revision: 256858 URL: http://svnweb.freebsd.org/changeset/base/256858 Log: Start lection on memory management. Added: user/glebius/course/05.memory/ user/glebius/course/05.memory/Makefile - copied unchanged from r256831, user/glebius/course/04.synchronisation/Makefile user/glebius/course/05.memory/lection.tex Copied: user/glebius/course/05.memory/Makefile (from r256831, user/glebius/course/04.synchronisation/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/glebius/course/05.memory/Makefile Mon Oct 21 19:21:36 2013 (r256858, copy of r256831, user/glebius/course/04.synchronisation/Makefile) @@ -0,0 +1,13 @@ +NAME?= lection + +TMP= $(NAME).aux $(NAME).log $(NAME).nav $(NAME).out $(NAME).snm \ + $(NAME).toc $(NAME).vrb + +.MAIN: $(NAME).pdf + +.SUFFIXES: .pdf .tex +.tex.pdf: + pdflatex -file-line-error -halt-on-error ${.IMPSRC} + +clean: + rm -f -- $(TMP) texput.log Added: user/glebius/course/05.memory/lection.tex ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/glebius/course/05.memory/lection.tex Mon Oct 21 19:21:36 2013 (r256858) @@ -0,0 +1,448 @@ +\documentclass{beamer} + +\usepackage[utf8]{inputenc} +\usepackage[russian]{babel} +\usepackage{tikz} +\usepackage{url} +\usepackage{xcolor} +\usepackage{listings} +\usepackage{verbatim} +\usepackage{ifthen} +\usepackage{bytefield} +\usepackage{wasysym} + +\usetikzlibrary{positioning} +\usetikzlibrary{shapes} +\usetikzlibrary{arrows} +\usetikzlibrary{decorations.text} +\usetikzlibrary{chains} +\usetikzlibrary{calc} + +\input{../course.tex} + +\title{Memory management in FreeBSD} + +\begin{document} + +\begin{frame} +\titlepage +\end{frame} + + +\begin{frame} +\frametitle{Process (static) address space} +\begin{figure} +\begin{tikzpicture}[start chain=going below, node distance=0mm] + \tikzset { + entry/.style={draw, thick, on chain, text width=.25\paperwidth, + align=center}, + large/.style={entry, minimum height=.15\paperheight}, + noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, + nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, + } + \node [name=kernel, nolarge] { kernel }; + \node [name=argv, entry] { argv, envp }; + \node [name=stack, large] { stack }; + \node [name=unmap, nolarge] { not mapped memory }; + \node [name=heap, large] { heap }; + \node [name=data, entry] { initialized data }; + \node [name=text, entry] { program text }; + \node [name=null, noentry] { }; + + \draw [<-] (kernel.north west) -- + node [below] {\scriptsize{0xff \ldots ff}} +(-1.5cm, 0); + \draw [<-] (null.south west) -- + node [above] {\scriptsize{0x00}} +(-1.5cm, 0); +\end{tikzpicture} +\end{figure} +\end{frame} + +\FootReferences{procstat(1)}{} +\begin{frame} +\frametitle{Process (static) address space} +Try this out: +\shellcmd{% +\# /rescue/cat \&\\ +\lbrack1\rbrack 48141\\ +\# procstat -v \$!\\ +\begin{tabular}{rrrrrrrrrrr} + PID & START & END & PRT & RES & PRES & REF & SHD & FL & TP & PATH \\ +48141 & 0x400000 & 0x96d000 & r-x & 677 & 0 & 4 & 2 & CN-- & vn & /rescue/chio \\ +48141 & 0xb6d000 & 0xb94000 & rw- & 38 & 0 & 1 & 0 & C--- & vn & /rescue/chio \\ +48141 & 0xb94000 & 0xdc8000 & rw- & 21 & 0 & 1 & 0 & ---- & df & \\ +48141 & 0x800c00000 & 0x801400000 & rw- & 81 & 0 & 1 & 0 & ---- & df & \\ +48141 & 0x7fffffbfe000 & 0x7fffffbff000 & --- & 0 & 0 & 0 & 0 & ---- & -- & \\ +48141 & 0x7ffffffdf000 & 0x7ffffffff000 & rw- & 4 & 0 & 1 & 0 & ---D & df & \\ +48141 & 0x7ffffffff000 & 0x800000000000 & r-x & 0 & 0 & 67 & 0 & ---- & ph & \\ +\end{tabular} +} +\end{frame} + + +\FootReferences{}{} +\begin{frame} +\frametitle{Stack grows implicitly} +\begin{columns} +\begin{column}{.4\paperwidth} + \begin{figure} + \begin{tikzpicture}[start chain=going below, node distance=0mm] + \tikzset { + entry/.style={draw, thick, on chain, text width=.25\paperwidth, + align=center}, + large/.style={entry, minimum height=.15\paperheight}, + noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, + nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, + } + \node [name=argv, entry] { argv, envp }; + \node [name=stack, large] { stack }; + \node [name=unmap, nolarge] { not mapped memory }; + \node [name=heap, large] { heap }; + \node [name=data, entry] { initialized data }; + \node [name=text, entry] { program text }; + \node [name=null, noentry] { }; + + \draw (stack.south west) ++(0cm, -2mm) [<-] -- + node [above] {\scriptsize{deref!}} +(-1.5cm, 0); + \end{tikzpicture} + \end{figure} +\end{column} +\begin{column}{.2\paperwidth} + \begin{tikzpicture} + \draw [->, thick] (0,0) -- node [above] {\small{page fault}} + +(.2\paperwidth,0); + \end{tikzpicture} +\end{column} +\begin{column}{.4\paperwidth} + \begin{figure} + \begin{tikzpicture}[start chain=going below, node distance=0mm] + \tikzset { + entry/.style={draw, thick, on chain, text width=.25\paperwidth, + align=center}, + large/.style={entry, minimum height=.15\paperheight}, + noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, + nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, + } + \node [name=argv, entry] { argv, envp }; + \node [name=stack, large, minimum height=.20\paperheight] { stack }; + \node [name=unmap, nolarge, minimum height=.10\paperheight] + { not mapped memory }; + \node [name=heap, large] { heap }; + \node [name=data, entry] { initialized data }; + \node [name=text, entry] { program text }; + \node [name=null, noentry] { }; + + \draw [thick] (stack.center) ++(-1cm,0) node (mark1) {} + [->] -- (mark1 |- stack.south); + \draw [thick] (stack.center) ++(1cm,0) node (mark2) {} + [->] -- (mark2 |- stack.south); + \end{tikzpicture} + \end{figure} +\end{column} +\end{columns} +\end{frame} + + +\FootReferences{sbrk(2)}{} +\begin{frame} +\frametitle{Heap grows explicitly (used to grow \smiley )} +\begin{columns} +\begin{column}{.4\paperwidth} + \begin{figure} + \begin{tikzpicture}[start chain=going below, node distance=0mm] + \tikzset { + entry/.style={draw, thick, on chain, text width=.25\paperwidth, + align=center}, + large/.style={entry, minimum height=.15\paperheight}, + noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, + nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, + } + \node [name=argv, entry] { argv, envp }; + \node [name=stack, large] { stack }; + \node [name=unmap, nolarge] { not mapped memory }; + \node [name=heap, large] { heap }; + \node [name=data, entry] { initialized data }; + \node [name=text, entry] { program text }; + \node [name=null, noentry] { }; + \end{tikzpicture} + \end{figure} +\end{column} +\begin{column}{.2\paperwidth} + \begin{tikzpicture} + \draw [->, thick] (0,0) -- node [above] {\small{sbrk(2)}} + +(.2\paperwidth,0); + \end{tikzpicture} +\end{column} +\begin{column}{.4\paperwidth} + \begin{figure} + \begin{tikzpicture}[start chain=going below, node distance=0mm] + \tikzset { + entry/.style={draw, thick, on chain, text width=.25\paperwidth, + align=center}, + large/.style={entry, minimum height=.15\paperheight}, + noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, + nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, + } + \node [name=argv, entry] { argv, envp }; + \node [name=stack, large] { stack }; + \node [name=unmap, nolarge, minimum height=.10\paperheight] + { not mapped memory }; + \node [name=heap, large, minimum height=.20\paperheight] { heap }; + \node [name=data, entry] { initialized data }; + \node [name=text, entry] { program text }; + \node [name=null, noentry] { }; + + \draw [thick] (heap.center) ++(-1cm,0) node (mark1) {} + [->] -- (mark1 |- heap.north); + \draw [thick] (heap.center) ++(1cm,0) node (mark2) {} + [->] -- (mark2 |- heap.north); + \end{tikzpicture} + \end{figure} +\end{column} +\end{columns} +\end{frame} + + +\FootReferences{mmap(2)}{} +\begin{frame} +\frametitle{Mapping more on heap} +\begin{columns} +\begin{column}{.4\paperwidth} + \begin{figure} + \begin{tikzpicture}[start chain=going below, node distance=0mm] + \tikzset { + entry/.style={draw, thick, on chain, text width=.25\paperwidth, + align=center}, + large/.style={entry, minimum height=.15\paperheight}, + noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, + nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, + } + \node [name=argv, entry] { argv, envp }; + \node [name=stack, large] { stack }; + \node [name=unmap, nolarge] { not mapped memory }; + \node [name=heap, large] { heap }; + \node [name=data, entry] { initialized data }; + \node [name=text, entry] { program text }; + \node [name=null, noentry] { }; + \end{tikzpicture} + \end{figure} +\end{column} +\begin{column}{.2\paperwidth} + \begin{tikzpicture} + \draw [->, thick] (0,0) -- node [above] {\small{mmap(2)}} + +(.2\paperwidth,0); + \end{tikzpicture} +\end{column} +\begin{column}{.4\paperwidth} + \begin{figure} + \begin{tikzpicture}[start chain=going below, node distance=0mm] + \tikzset { + entry/.style={draw, thick, on chain, text width=.25\paperwidth, + align=center}, + large/.style={entry, minimum height=.15\paperheight}, + noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, + nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, + } + \node [name=argv, entry] { argv, envp }; + \node [name=stack, large] { stack }; + \node [name=unmap1, nolarge, minimum height=.05\paperheight] + { not mapped }; + \node [name=mmap, large, minimum height=.05\paperheight] + { more heap }; + \node [name=unmap2, nolarge, minimum height=.05\paperheight] + { not mapped }; + \node [name=heap, large] { heap }; + \node [name=data, entry] { initialized data }; + \node [name=text, entry] { program text }; + \node [name=null, noentry] { }; + \end{tikzpicture} + \end{figure} +\end{column} +\end{columns} +\end{frame} + + +\FootReferences{mmap(2), malloc(3), rtld(1)}{} +\begin{frame} +\frametitle{Modern process memory map} +\begin{columns} +\begin{column}{.5\paperwidth} + \begin{figure} + \begin{tikzpicture}[start chain=going below, node distance=0mm] + \tikzset { + entry/.style={draw, thick, on chain, text width=.25\paperwidth, + align=center}, + large/.style={entry, minimum height=.1\paperheight}, + noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, + nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, + } + \node [name=argv, entry] { argv, envp }; + \node [name=stack, entry] { stack }; + \node [name=unmap1, nolarge] { not mapped }; + \node [name=mmap, entry] { malloc arena }; + \node [name=unmap2, nolarge] { not mapped }; + \node [name=lib, entry] { library }; + \node [name=unmap3, nolarge] { not mapped }; + \node [name=heap, entry] { ld-elf }; + \node [name=data, entry] { initialized data }; + \node [name=text, entry] { program text }; + \node [name=null, noentry] { }; + \end{tikzpicture} + \end{figure} +\end{column} +\begin{column}{.5\paperwidth} +\begin{itemize} + \item{program itself via mmap(2)} + \item{dynamic libraries via mmap(2)} + \item{malloc(3) arenas via mmap(2)} +\end{itemize} +\onslide<2-> { + Try this out: + \shellcmd{% + \# /bin/cat \&\\ + \# procstat -v \$!\\ + } + Or this: + \shellcmd{% + \# procstat -v \$\$\\ + } +} +\end{column} +\end{columns} +\end{frame} + + +\FootReferences{}{} +\begin{frame} +\frametitle{VM space} +\begin{figure} +\begin{tikzpicture}[start chain=going below, node distance=0mm] + \tikzset { + entry/.style={draw, thick, on chain, text width=.25\paperwidth, + align=center}, + large/.style={entry, minimum height=.1\paperheight}, + noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, + nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, + } + \node [name=argv, entry] { argv, envp }; + \node [name=stack, entry] { stack }; + \node [name=unmap1, nolarge] { not mapped }; + \node [name=mmap, entry] { malloc arena }; + \node [name=unmap2, nolarge] { not mapped }; + \node [name=lib, entry] { library }; + \node [name=unmap3, nolarge] { not mapped }; + \node [name=heap, entry] { ld-elf }; + \node [name=data, entry] { initialized data }; + \node [name=text, entry] { program text }; + \node [name=null, noentry] { }; + + \node [name=vmspace, draw, thick, color=red, ellipse, + minimum width=.35\paperwidth, + minimum height=.8\paperheight] at (lib.north) {}; + \node [ellipse callout, draw, color=red, + callout absolute pointer={(node cs:name=vmspace, angle=40)}, + node distance=5mm, right=of stack] { vm\_map }; + + \node [name=vmentry, draw, thick, color=red, ellipse, + minimum width=.30\paperwidth, + minimum height=2em] at (lib.center) {}; + \node [ellipse callout, draw, color=red, + callout absolute pointer={(node cs:name=vmentry, angle=2)}, + node distance=7mm, right=of unmap2] { vm\_map\_entry }; +\end{tikzpicture} +\end{figure} +\end{frame} + + +\FootReferences{}{sys/vm/vm\_map.h} +\begin{frame} +\frametitle{Kernel representation of VM space} +\begin{figure} +\small\begin{tikzpicture} + \node [name=vmspace, struct, rectangle split parts=3] { + \textbf{struct vmspace} + \nodepart{two} struct vm\_map + \nodepart{three} struct vm\_pmap + }; + \node [name=vmmap, struct, right=of vmspace, rectangle split parts=4] { + \textbf{struct vm\_map} + \nodepart{two} struct vm\_map\_entry header + \nodepart{three} struct vm\_map\_entry \*tree + \nodepart{four} \ldots + }; + \node [name=entry1, struct, below=of vmspace, rectangle split parts=5] { + \textbf{struct vm\_map\_entry} + \nodepart{two} struct vm\_map\_entry *next + \nodepart{three} vm\_offset\_t start + \nodepart{four} vm\_offset\_t end + \nodepart{five} \ldots + }; + \node [name=entry2, struct, right=of entry1, rectangle split parts=5] { + \textbf{struct vm\_map\_entry} + \nodepart{two} struct vm\_map\_entry *next + \nodepart{three} vm\_offset\_t start + \nodepart{four} vm\_offset\_t end + \nodepart{five} \ldots + }; + + \node [name=mark, node distance=5mm, above left=of entry1] {}; + \draw [->, thick, rounded corners] (vmmap.two east) -- ++(5mm,0) + |- (mark.center) |- (entry1.one west); + + \draw [->, thick] (entry1.two east) to [out=0, in=180] (entry2.one west); + \draw [->, thick, rounded corners] (entry2.two east) -- + ++(5mm,0) -- ++(0,-1cm); +\end{tikzpicture} +\end{figure} +\end{frame} + + +\FootReferences{}{sys/vm/vm\_map.h, sys/vm/vm\_object.h} +\begin{frame} +\frametitle{A VM map entry is backed by an object} +\begin{figure} +\begin{tikzpicture} + \tikzset { + page/.style={draw, thick, node distance=3mm}, + } + \node [name=entry, struct, rectangle split parts=4] { + \textbf{struct vm\_map\_entry} + \nodepart{two} \ldots + \nodepart{three} struct vm\_object *object + \nodepart{four} \ldots + }; + \node [name=object, struct, right=of entry, rectangle split parts=3] { + \textbf{struct vm\_object} + \nodepart{two} struct vm\_radix head + \nodepart{three} union *pager + }; + + \draw [->, thick] (entry.three east) to [out=0, in=180] (object.one west); + + \node [name=page1, page, below=of object] { vm\_page }; + \draw [->, thick, rounded corners] (object.two east) -- ++(1cm,0) + |- (page1.east); + + \node [name=page2, page, below right=of page1] { vm\_page }; + \node [name=page3, page, below left=of page1] { vm\_page }; + \draw [->,thick] (page1.south) to [out=290, in=180] (page2.west); + \draw [->,thick] (page1.south) to [out=250, in=0] (page3.east); + + \node [name=page4, page, below right=of page3] { vm\_page }; + \node [name=page5, page, below left=of page3] { vm\_page }; + \draw [->,thick] (page3.south) to [out=290, in=180] (page4.west); + \draw [->,thick] (page3.south) to [out=250, in=0] (page5.east); + + \node [name=page6, page, below right=of page5] { vm\_page }; + \node [name=page7, page, below left=of page5] { vm\_page }; + \draw [->,thick] (page5.south) to [out=290, in=180] (page6.west); + \draw [->,thick] (page5.south) to [out=250, in=0] (page7.east); + + \node [name=page8, page, below right=of page4] { vm\_page }; + \draw [->,thick] (page4.south) to [out=290, in=180] (page8.west); + +\end{tikzpicture} +\end{figure} +\end{frame} + + +\end{document} From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 05:22:26 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 705DFD92; Tue, 22 Oct 2013 05:22:26 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5D90D2E86; Tue, 22 Oct 2013 05:22:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9M5MPQY035341; Tue, 22 Oct 2013 05:22:25 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9M5MPqI035340; Tue, 22 Oct 2013 05:22:25 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201310220522.r9M5MPqI035340@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 22 Oct 2013 05:22:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256872 - user/glebius/course/02.entering_kernel X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 05:22:26 -0000 Author: glebius Date: Tue Oct 22 05:22:25 2013 New Revision: 256872 URL: http://svnweb.freebsd.org/changeset/base/256872 Log: Fix build. Modified: user/glebius/course/02.entering_kernel/lection.tex Modified: user/glebius/course/02.entering_kernel/lection.tex ============================================================================== --- user/glebius/course/02.entering_kernel/lection.tex Tue Oct 22 05:19:42 2013 (r256871) +++ user/glebius/course/02.entering_kernel/lection.tex Tue Oct 22 05:22:25 2013 (r256872) @@ -9,6 +9,7 @@ \usepackage{xcolor} \usepackage{listings} \usepackage{verbatim} +\usepackage{ifthen} \usetikzlibrary{positioning} \usetikzlibrary{shapes.arrows} From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 07:16:21 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 27ABD74; Tue, 22 Oct 2013 07:16:21 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1491723CA; Tue, 22 Oct 2013 07:16:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9M7GKUn094762; Tue, 22 Oct 2013 07:16:20 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9M7GKZD094760; Tue, 22 Oct 2013 07:16:20 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201310220716.r9M7GKZD094760@svn.freebsd.org> From: Peter Holm Date: Tue, 22 Oct 2013 07:16:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256876 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 07:16:21 -0000 Author: pho Date: Tue Oct 22 07:16:20 2013 New Revision: 256876 URL: http://svnweb.freebsd.org/changeset/base/256876 Log: Added a regression test. Sponsored by: EMC / Isilon storage division Added: user/pho/stress2/misc/killpg.sh (contents, props changed) Added: user/pho/stress2/misc/killpg.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/pho/stress2/misc/killpg.sh Tue Oct 22 07:16:20 2013 (r256876) @@ -0,0 +1,161 @@ +#!/bin/sh + +# +# Copyright (c) 2013 EMC Corp. +# 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$ +# + +# Regression test for r241859: +# Return EPERM if processes were found but they were unable to be signaled. + +[ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1 + +here=`pwd` +cd /tmp +sed '1,/^EOF/d' < $here/$0 > killpg.c +cc -o killpg -Wall -Wextra killpg.c +rm -f killpg.c + +/tmp/killpg + +rm -f /tmp/killpg +exit 0 +EOF +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +pid_t gid, pid; + +#define LOOPS 100 + +static void +hand(int i __unused) { /* handler */ + _exit(0); +} + +void +nlooper(void) +{ + int i; + + setproctitle("nlooper"); + setpgrp(0, getpid()); + for (i = 0; i < LOOPS; i++) { + if ((pid = fork()) == 0) { + signal(SIGINFO, hand); + if (arc4random() % 100 < 10) + usleep(arc4random() % 100); + _exit(0); + } + wait(NULL); + } + _exit(0); +} + +void +looper(void) +{ + int i; + + setproctitle("looper"); + setpgrp(0, getpid()); + for (i = 0; i < LOOPS; i++) { + if ((pid = fork()) == 0) { + signal(SIGINFO, hand); + if (arc4random() % 100 < 10) + usleep(arc4random() % 100); + _exit(0); + } + wait(NULL); + } + unlink("cont"); + _exit(0); +} + +void +killer(void) +{ + struct passwd *pw; + int i; + + setproctitle("killer"); + if ((pw = getpwnam("nobody")) == NULL) + err(1, "no such user: nobody"); + + if (setgroups(1, &pw->pw_gid) || + setegid(pw->pw_gid) || setgid(pw->pw_gid) || + seteuid(pw->pw_uid) || setuid(pw->pw_uid)) + err(1, "Can't drop privileges to \"nobody\""); + endpwent(); + + if ((gid = fork()) == 0) + nlooper(); /* nobody looper */ + + usleep(200); + i = 0; + for (;;) { + if (i++ > 1000) { + if (access("cont", R_OK) == -1) + break; + i = 0; + } + if (killpg(gid, SIGINFO) == -1) { + if (errno == EPERM) + continue; + warn("FAIL killpg"); + } + } + _exit(0); +} + +int +main(void) +{ + int fd; + + if ((fd = open("cont", O_RDWR | O_CREAT, 0666)) == -1) + err(1, "creat"); + close(fd); + signal(SIGINFO, SIG_IGN); + + if ((gid = fork()) == 0) + looper(); + if (fork() == 0) + killer(); + + wait(NULL); + wait(NULL); + + return (0); +} From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 07:17:23 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 79D0F178; Tue, 22 Oct 2013 07:17:23 +0000 (UTC) (envelope-from pho@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4EAE623CD; Tue, 22 Oct 2013 07:17:23 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9M7HNRN095003; Tue, 22 Oct 2013 07:17:23 GMT (envelope-from pho@svn.freebsd.org) Received: (from pho@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9M7HNVY095002; Tue, 22 Oct 2013 07:17:23 GMT (envelope-from pho@svn.freebsd.org) Message-Id: <201310220717.r9M7HNVY095002@svn.freebsd.org> From: Peter Holm Date: Tue, 22 Oct 2013 07:17:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256877 - user/pho/stress2/misc X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 07:17:23 -0000 Author: pho Date: Tue Oct 22 07:17:22 2013 New Revision: 256877 URL: http://svnweb.freebsd.org/changeset/base/256877 Log: Fix compiler warning. Sponsored by: EMC / Isilon storage division Modified: user/pho/stress2/misc/setuid.sh Modified: user/pho/stress2/misc/setuid.sh ============================================================================== --- user/pho/stress2/misc/setuid.sh Tue Oct 22 07:16:20 2013 (r256876) +++ user/pho/stress2/misc/setuid.sh Tue Oct 22 07:17:22 2013 (r256877) @@ -82,7 +82,7 @@ EOF int main(int argc, char **argv) { - char *av[3]; + char *av[4]; int fd; if (argc == 1) From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 07:59:15 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 954F53A3; Tue, 22 Oct 2013 07:59:15 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 683EF2621; Tue, 22 Oct 2013 07:59:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9M7xFFV017407; Tue, 22 Oct 2013 07:59:15 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9M7xFDa017406; Tue, 22 Oct 2013 07:59:15 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201310220759.r9M7xFDa017406@svn.freebsd.org> From: Andre Oppermann Date: Tue, 22 Oct 2013 07:59:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256879 - user/andre/mbuf_staging/netinet X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 07:59:15 -0000 Author: andre Date: Tue Oct 22 07:59:14 2013 New Revision: 256879 URL: http://svnweb.freebsd.org/changeset/base/256879 Log: The TCP delayed ACK logic isn't aware of LRO passing up large aggregated segments thinking it received only one segment. This causes it to enable the delay the ACK for 100ms to wait for another segment which may never come because all the data was received already. Doing delayed ACK for LRO segments is bogus for two reasons: a) it pushes us further away from acking every other packet; b) it introduces additional delay in responding to the sender. The latter is especially bad because it is in the nature of LRO to aggregated all segments of a burst with no more coming until an ACK is sent back. Change the delayed ACK logic to detect LRO segments by being larger than the MSS for this connection and issuing an immediate ACK for them to keep the ACK clock ticking without interruption. Reported by: julian, cperciva Tested by: cperciva Reviewed by: (pending) Modified: user/andre/mbuf_staging/netinet/tcp_input.c Modified: user/andre/mbuf_staging/netinet/tcp_input.c ============================================================================== --- user/andre/mbuf_staging/netinet/tcp_input.c Tue Oct 22 07:44:26 2013 (r256878) +++ user/andre/mbuf_staging/netinet/tcp_input.c Tue Oct 22 07:59:14 2013 (r256879) @@ -508,10 +508,13 @@ do { \ * the ack that opens up a 0-sized window and * - delayed acks are enabled or * - this is a half-synchronized T/TCP connection. + * - the segment size is not larger than the MSS and LRO wasn't used + * for this segment. */ -#define DELAY_ACK(tp) \ +#define DELAY_ACK(tp, tlen) \ ((!tcp_timer_active(tp, TT_DELACK) && \ (tp->t_flags & TF_RXWIN0SENT) == 0) && \ + (tlen <= tp->t_maxopd) && \ (V_tcp_delack_enabled || (tp->t_flags & TF_NEEDSYN))) /* @@ -1863,7 +1866,7 @@ tcp_do_segment(struct mbuf *m, struct tc } /* NB: sorwakeup_locked() does an implicit unlock. */ sorwakeup_locked(so); - if (DELAY_ACK(tp)) { + if (DELAY_ACK(tp, tlen)) { tp->t_flags |= TF_DELACK; } else { tp->t_flags |= TF_ACKNOW; @@ -1954,7 +1957,7 @@ tcp_do_segment(struct mbuf *m, struct tc * If there's data, delay ACK; if there's also a FIN * ACKNOW will be turned on later. */ - if (DELAY_ACK(tp) && tlen != 0) + if (DELAY_ACK(tp, tlen) && tlen != 0) tcp_timer_activate(tp, TT_DELACK, tcp_delacktime); else @@ -2926,7 +2929,7 @@ dodata: /* XXX */ if (th->th_seq == tp->rcv_nxt && LIST_EMPTY(&tp->t_segq) && TCPS_HAVEESTABLISHED(tp->t_state)) { - if (DELAY_ACK(tp)) + if (DELAY_ACK(tp, tlen)) tp->t_flags |= TF_DELACK; else tp->t_flags |= TF_ACKNOW; From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 10:10:41 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8565CEAA; Tue, 22 Oct 2013 10:10:41 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6E56B2DE1; Tue, 22 Oct 2013 10:10:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MAAfaV090383; Tue, 22 Oct 2013 10:10:41 GMT (envelope-from dchagin@svn.freebsd.org) Received: (from dchagin@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MAAa75090343; Tue, 22 Oct 2013 10:10:36 GMT (envelope-from dchagin@svn.freebsd.org) Message-Id: <201310221010.r9MAAa75090343@svn.freebsd.org> From: Dmitry Chagin Date: Tue, 22 Oct 2013 10:10:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256883 - in user/dchagin/lemul: . bin/ps bin/sh cddl/contrib/opensolaris/lib/libdtrace/common cddl/contrib/opensolaris/lib/libdtrace/powerpc cddl/lib/libdtrace contrib/binutils/gas con... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 10:10:41 -0000 Author: dchagin Date: Tue Oct 22 10:10:34 2013 New Revision: 256883 URL: http://svnweb.freebsd.org/changeset/base/256883 Log: Sync with HEAD. Added: user/dchagin/lemul/share/man/man4/altera_atse.4 - copied unchanged from r256882, head/share/man/man4/altera_atse.4 user/dchagin/lemul/sys/arm/conf/IMX53-QSB - copied unchanged from r256882, head/sys/arm/conf/IMX53-QSB user/dchagin/lemul/sys/boot/fdt/dts/imx53-qsb.dts - copied unchanged from r256882, head/sys/boot/fdt/dts/imx53-qsb.dts user/dchagin/lemul/sys/dev/altera/atse/ - copied from r256882, head/sys/dev/altera/atse/ user/dchagin/lemul/sys/dev/cxgbe/firmware/t4fw-1.9.12.0.bin.uu - copied unchanged from r256882, head/sys/dev/cxgbe/firmware/t4fw-1.9.12.0.bin.uu user/dchagin/lemul/sys/dev/cxgbe/firmware/t5fw-1.9.12.0.bin.uu - copied unchanged from r256882, head/sys/dev/cxgbe/firmware/t5fw-1.9.12.0.bin.uu user/dchagin/lemul/sys/dev/cxgbe/iw_cxgbe/ - copied from r256882, head/sys/dev/cxgbe/iw_cxgbe/ user/dchagin/lemul/sys/dev/etherswitch/arswitch/arswitch_9340.c - copied unchanged from r256882, head/sys/dev/etherswitch/arswitch/arswitch_9340.c user/dchagin/lemul/sys/dev/etherswitch/arswitch/arswitch_9340.h - copied unchanged from r256882, head/sys/dev/etherswitch/arswitch/arswitch_9340.h - copied unchanged from r256882, head/sys/dev/fdt/fdt_ic_if.m user/dchagin/lemul/sys/dev/ffec/ - copied from r256882, head/sys/dev/ffec/ user/dchagin/lemul/sys/dev/random/dummy_rng.c - copied unchanged from r256882, head/sys/dev/random/dummy_rng.c user/dchagin/lemul/sys/dev/random/live_entropy_sources.c - copied unchanged from r256882, head/sys/dev/random/live_entropy_sources.c user/dchagin/lemul/sys/dev/random/live_entropy_sources.h - copied unchanged from r256882, head/sys/dev/random/live_entropy_sources.h user/dchagin/lemul/sys/dev/random/rwfile.c - copied unchanged from r256882, head/sys/dev/random/rwfile.c user/dchagin/lemul/sys/dev/random/rwfile.h - copied unchanged from r256882, head/sys/dev/random/rwfile.h user/dchagin/lemul/sys/dev/usb/controller/dwc_otg_fdt.c - copied unchanged from r256882, head/sys/dev/usb/controller/dwc_otg_fdt.c user/dchagin/lemul/sys/modules/cxgbe/iw_cxgbe/ - copied from r256882, head/sys/modules/cxgbe/iw_cxgbe/ user/dchagin/lemul/sys/powerpc/powerpc/clock.c - copied unchanged from r256882, head/sys/powerpc/powerpc/clock.c user/dchagin/lemul/sys/powerpc/powerpc/nexus.c - copied unchanged from r256882, head/sys/powerpc/powerpc/nexus.c user/dchagin/lemul/sys/powerpc/powerpc/vm_machdep.c - copied unchanged from r256882, head/sys/powerpc/powerpc/vm_machdep.c user/dchagin/lemul/sys/powerpc/pseries/phyp_llan.c - copied unchanged from r256882, head/sys/powerpc/pseries/phyp_llan.c Directory Properties: user/dchagin/lemul/sys/dev/fdt/fdt_ic_if.m (props changed) Deleted: user/dchagin/lemul/lib/libyaml/libbsdyml.3 user/dchagin/lemul/share/man/man4/isf.4 user/dchagin/lemul/sys/arm/broadcom/bcm2835/dwc_otg_brcm.c user/dchagin/lemul/sys/contrib/rdma/core_priv.h user/dchagin/lemul/sys/contrib/rdma/ib_addr.h user/dchagin/lemul/sys/contrib/rdma/ib_cache.h user/dchagin/lemul/sys/contrib/rdma/ib_cm.h user/dchagin/lemul/sys/contrib/rdma/ib_fmr_pool.h user/dchagin/lemul/sys/contrib/rdma/ib_mad.h user/dchagin/lemul/sys/contrib/rdma/ib_marshall.h user/dchagin/lemul/sys/contrib/rdma/ib_pack.h user/dchagin/lemul/sys/contrib/rdma/ib_sa.h user/dchagin/lemul/sys/contrib/rdma/ib_smi.h user/dchagin/lemul/sys/contrib/rdma/ib_umem.h user/dchagin/lemul/sys/contrib/rdma/ib_user_cm.h user/dchagin/lemul/sys/contrib/rdma/ib_user_mad.h user/dchagin/lemul/sys/contrib/rdma/ib_user_sa.h user/dchagin/lemul/sys/contrib/rdma/ib_user_verbs.h user/dchagin/lemul/sys/contrib/rdma/ib_verbs.h user/dchagin/lemul/sys/contrib/rdma/iw_cm.h user/dchagin/lemul/sys/contrib/rdma/rdma_addr.c user/dchagin/lemul/sys/contrib/rdma/rdma_cache.c user/dchagin/lemul/sys/contrib/rdma/rdma_cm.h user/dchagin/lemul/sys/contrib/rdma/rdma_cm_ib.h user/dchagin/lemul/sys/contrib/rdma/rdma_cma.c user/dchagin/lemul/sys/contrib/rdma/rdma_device.c user/dchagin/lemul/sys/contrib/rdma/rdma_iwcm.c user/dchagin/lemul/sys/contrib/rdma/rdma_user_cm.h user/dchagin/lemul/sys/contrib/rdma/rdma_verbs.c user/dchagin/lemul/sys/contrib/rdma/types.h user/dchagin/lemul/sys/dev/cxgbe/firmware/t4fw-1.8.11.0.bin.uu user/dchagin/lemul/sys/dev/cxgbe/firmware/t5fw-1.8.22.0.bin.uu user/dchagin/lemul/sys/dev/isf/ user/dchagin/lemul/sys/dev/random/pseudo_rng.c user/dchagin/lemul/sys/modules/rdma/addr/ user/dchagin/lemul/sys/modules/rdma/cma/ user/dchagin/lemul/sys/modules/rdma/core/ user/dchagin/lemul/sys/modules/rdma/iwcm/ user/dchagin/lemul/sys/powerpc/aim/clock.c user/dchagin/lemul/sys/powerpc/aim/nexus.c user/dchagin/lemul/sys/powerpc/aim/vm_machdep.c user/dchagin/lemul/sys/powerpc/booke/clock.c user/dchagin/lemul/sys/powerpc/booke/vm_machdep.c user/dchagin/lemul/sys/powerpc/mpc85xx/nexus.c user/dchagin/lemul/usr.sbin/isfctl/ Modified: user/dchagin/lemul/Makefile.inc1 user/dchagin/lemul/ObsoleteFiles.inc user/dchagin/lemul/UPDATING user/dchagin/lemul/bin/ps/print.c user/dchagin/lemul/bin/sh/jobs.c user/dchagin/lemul/bin/sh/miscbltin.c user/dchagin/lemul/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c user/dchagin/lemul/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c user/dchagin/lemul/cddl/contrib/opensolaris/lib/libdtrace/powerpc/dt_isadep.c user/dchagin/lemul/cddl/lib/libdtrace/psinfo.d user/dchagin/lemul/contrib/binutils/gas/config/tc-arm.c user/dchagin/lemul/contrib/binutils/gas/config/tc-mips.c user/dchagin/lemul/contrib/binutils/gas/config/tc-mips.h user/dchagin/lemul/contrib/binutils/gas/dwarf2dbg.c user/dchagin/lemul/contrib/bsnmp/lib/snmp.c user/dchagin/lemul/contrib/bsnmp/lib/snmp.h user/dchagin/lemul/contrib/bsnmp/lib/snmpagent.c user/dchagin/lemul/contrib/gcclibs/libssp/ssp.c user/dchagin/lemul/contrib/ipfilter/ipf.h user/dchagin/lemul/contrib/jemalloc/ChangeLog user/dchagin/lemul/contrib/jemalloc/FREEBSD-diffs user/dchagin/lemul/contrib/jemalloc/FREEBSD-upgrade user/dchagin/lemul/contrib/jemalloc/VERSION user/dchagin/lemul/contrib/jemalloc/doc/jemalloc.3 user/dchagin/lemul/contrib/jemalloc/include/jemalloc/internal/arena.h user/dchagin/lemul/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h user/dchagin/lemul/contrib/jemalloc/include/jemalloc/internal/private_namespace.h user/dchagin/lemul/contrib/jemalloc/include/jemalloc/internal/tcache.h user/dchagin/lemul/contrib/jemalloc/include/jemalloc/jemalloc.h user/dchagin/lemul/contrib/jemalloc/src/arena.c user/dchagin/lemul/contrib/jemalloc/src/chunk.c user/dchagin/lemul/contrib/jemalloc/src/ctl.c user/dchagin/lemul/contrib/jemalloc/src/jemalloc.c user/dchagin/lemul/contrib/libcxxrt/typeinfo.cc user/dchagin/lemul/contrib/mtree/compare.c user/dchagin/lemul/contrib/mtree/create.c user/dchagin/lemul/contrib/mtree/getid.c user/dchagin/lemul/contrib/mtree/spec.c user/dchagin/lemul/etc/defaults/rc.conf user/dchagin/lemul/etc/login.conf user/dchagin/lemul/etc/mtree/BSD.usr.dist user/dchagin/lemul/etc/netstart user/dchagin/lemul/etc/rc user/dchagin/lemul/etc/rc.d/initrandom user/dchagin/lemul/etc/rc.d/jail user/dchagin/lemul/etc/rc.d/rtadvd user/dchagin/lemul/etc/rc.d/sendmail user/dchagin/lemul/etc/sendmail/freebsd.mc user/dchagin/lemul/lib/libc/gen/getutxent.c user/dchagin/lemul/lib/libc/gen/popen.c user/dchagin/lemul/lib/libc/gen/syslog.c user/dchagin/lemul/lib/libc/iconv/citrus_mapper.c user/dchagin/lemul/lib/libc/sys/getrlimit.2 user/dchagin/lemul/lib/libcrypt/tests/Makefile user/dchagin/lemul/lib/libproc/_libproc.h user/dchagin/lemul/lib/libutil/login_class.3 user/dchagin/lemul/lib/libutil/login_class.c user/dchagin/lemul/lib/libvmmapi/vmmapi.c user/dchagin/lemul/lib/libyaml/Makefile user/dchagin/lemul/lib/libz/zopen.c user/dchagin/lemul/release/Makefile user/dchagin/lemul/release/picobsd/build/picobsd user/dchagin/lemul/release/picobsd/floppy.tree/etc/rc1 user/dchagin/lemul/release/picobsd/floppy.tree/etc/ssh/sshd_config user/dchagin/lemul/sbin/gvinum/gvinum.c user/dchagin/lemul/sbin/ifconfig/ifconfig.8 user/dchagin/lemul/sbin/ifconfig/ifgroup.c user/dchagin/lemul/sbin/iscontrol/fsm.c user/dchagin/lemul/sbin/nos-tun/nos-tun.c user/dchagin/lemul/sbin/route/keywords user/dchagin/lemul/sbin/route/route.8 user/dchagin/lemul/sbin/route/route.c user/dchagin/lemul/share/examples/bhyve/vmrun.sh user/dchagin/lemul/share/examples/kld/random_adaptor/random_adaptor_example.c user/dchagin/lemul/share/man/man4/Makefile user/dchagin/lemul/share/man/man4/random.4 user/dchagin/lemul/share/man/man5/rc.conf.5 user/dchagin/lemul/share/man/man8/rc.8 user/dchagin/lemul/share/man/man8/rc.sendmail.8 user/dchagin/lemul/share/man/man9/rtentry.9 user/dchagin/lemul/share/mk/atf.test.mk user/dchagin/lemul/share/mk/bsd.libnames.mk user/dchagin/lemul/share/mk/bsd.test.mk user/dchagin/lemul/sys/amd64/amd64/pmap.c user/dchagin/lemul/sys/amd64/include/vmm.h (contents, props changed) user/dchagin/lemul/sys/amd64/vmm/intel/vmx.c user/dchagin/lemul/sys/amd64/vmm/intel/vmx.h user/dchagin/lemul/sys/amd64/vmm/intel/vmx_controls.h user/dchagin/lemul/sys/amd64/vmm/vmm_dev.c user/dchagin/lemul/sys/amd64/vmm/x86.c user/dchagin/lemul/sys/arm/allwinner/a10_wdog.c user/dchagin/lemul/sys/arm/arm/busdma_machdep-v6.c user/dchagin/lemul/sys/arm/arm/cpufunc.c user/dchagin/lemul/sys/arm/arm/cpufunc_asm_armv7.S user/dchagin/lemul/sys/arm/arm/fusu.S user/dchagin/lemul/sys/arm/arm/identcpu.c user/dchagin/lemul/sys/arm/arm/locore.S user/dchagin/lemul/sys/arm/arm/machdep.c user/dchagin/lemul/sys/arm/arm/pl310.c user/dchagin/lemul/sys/arm/arm/pmap-v6.c user/dchagin/lemul/sys/arm/broadcom/bcm2835/bcm2835_wdog.c user/dchagin/lemul/sys/arm/broadcom/bcm2835/files.bcm2835 user/dchagin/lemul/sys/arm/freescale/imx/files.imx53 user/dchagin/lemul/sys/arm/freescale/imx/imx51_ccm.c user/dchagin/lemul/sys/arm/include/armreg.h user/dchagin/lemul/sys/arm/include/pmap.h user/dchagin/lemul/sys/arm/mv/common.c user/dchagin/lemul/sys/arm/mv/mv_localbus.c user/dchagin/lemul/sys/arm/mv/mvreg.h user/dchagin/lemul/sys/arm/xscale/i80321/ep80219_machdep.c user/dchagin/lemul/sys/arm/xscale/i80321/iq31244_machdep.c user/dchagin/lemul/sys/arm/xscale/i8134x/crb_machdep.c user/dchagin/lemul/sys/arm/xscale/ixp425/avila_machdep.c user/dchagin/lemul/sys/arm/xscale/pxa/pxa_machdep.c user/dchagin/lemul/sys/boot/fdt/dts/digi-ccwmx53.dts user/dchagin/lemul/sys/boot/forth/loader.conf user/dchagin/lemul/sys/cam/ata/ata_all.c user/dchagin/lemul/sys/cam/ata/ata_all.h user/dchagin/lemul/sys/cam/ata/ata_da.c user/dchagin/lemul/sys/cam/ata/ata_pmp.c user/dchagin/lemul/sys/cam/ata/ata_xpt.c user/dchagin/lemul/sys/cam/cam_ccb.h user/dchagin/lemul/sys/cam/cam_periph.c user/dchagin/lemul/sys/cam/cam_periph.h user/dchagin/lemul/sys/cam/cam_queue.c user/dchagin/lemul/sys/cam/cam_queue.h user/dchagin/lemul/sys/cam/cam_sim.c user/dchagin/lemul/sys/cam/cam_sim.h user/dchagin/lemul/sys/cam/cam_xpt.c user/dchagin/lemul/sys/cam/cam_xpt.h user/dchagin/lemul/sys/cam/cam_xpt_internal.h user/dchagin/lemul/sys/cam/cam_xpt_periph.h user/dchagin/lemul/sys/cam/cam_xpt_sim.h user/dchagin/lemul/sys/cam/ctl/ctl_frontend_cam_sim.c user/dchagin/lemul/sys/cam/ctl/scsi_ctl.c user/dchagin/lemul/sys/cam/scsi/scsi_all.c user/dchagin/lemul/sys/cam/scsi/scsi_all.h user/dchagin/lemul/sys/cam/scsi/scsi_cd.c user/dchagin/lemul/sys/cam/scsi/scsi_ch.c user/dchagin/lemul/sys/cam/scsi/scsi_da.c user/dchagin/lemul/sys/cam/scsi/scsi_enc.c user/dchagin/lemul/sys/cam/scsi/scsi_enc_internal.h user/dchagin/lemul/sys/cam/scsi/scsi_enc_safte.c user/dchagin/lemul/sys/cam/scsi/scsi_enc_ses.c user/dchagin/lemul/sys/cam/scsi/scsi_pass.c user/dchagin/lemul/sys/cam/scsi/scsi_pt.c user/dchagin/lemul/sys/cam/scsi/scsi_sa.c user/dchagin/lemul/sys/cam/scsi/scsi_sg.c user/dchagin/lemul/sys/cam/scsi/scsi_targ_bh.c user/dchagin/lemul/sys/cam/scsi/scsi_target.c user/dchagin/lemul/sys/cam/scsi/scsi_xpt.c user/dchagin/lemul/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c user/dchagin/lemul/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c user/dchagin/lemul/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c user/dchagin/lemul/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h user/dchagin/lemul/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c user/dchagin/lemul/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c user/dchagin/lemul/sys/cddl/contrib/opensolaris/uts/powerpc/sys/fasttrap_isa.h user/dchagin/lemul/sys/cddl/dev/dtrace/amd64/dtrace_isa.c user/dchagin/lemul/sys/cddl/dev/dtrace/dtrace_sysctl.c user/dchagin/lemul/sys/conf/NOTES user/dchagin/lemul/sys/conf/files user/dchagin/lemul/sys/conf/files.amd64 user/dchagin/lemul/sys/conf/files.i386 user/dchagin/lemul/sys/conf/files.powerpc user/dchagin/lemul/sys/conf/kmod.mk user/dchagin/lemul/sys/conf/newvers.sh user/dchagin/lemul/sys/conf/options user/dchagin/lemul/sys/contrib/dev/run/rt2870.fw.uu user/dchagin/lemul/sys/contrib/rdma/krping/getopt.c user/dchagin/lemul/sys/contrib/rdma/krping/krping.c user/dchagin/lemul/sys/contrib/rdma/krping/krping.h user/dchagin/lemul/sys/contrib/rdma/krping/krping_dev.c user/dchagin/lemul/sys/dev/ahci/ahci.c user/dchagin/lemul/sys/dev/ahci/ahci.h user/dchagin/lemul/sys/dev/aic7xxx/aic79xx.c user/dchagin/lemul/sys/dev/aic7xxx/aic7xxx.c user/dchagin/lemul/sys/dev/altera/sdcard/altera_sdcard.c user/dchagin/lemul/sys/dev/altera/sdcard/altera_sdcard_io.c user/dchagin/lemul/sys/dev/ata/ata-all.c user/dchagin/lemul/sys/dev/ath/if_ath.c user/dchagin/lemul/sys/dev/ath/if_ath_tx.c user/dchagin/lemul/sys/dev/cfi/cfi_core.c user/dchagin/lemul/sys/dev/cxgbe/adapter.h user/dchagin/lemul/sys/dev/cxgbe/common/common.h user/dchagin/lemul/sys/dev/cxgbe/firmware/t4fw_cfg.txt user/dchagin/lemul/sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt user/dchagin/lemul/sys/dev/cxgbe/firmware/t4fw_interface.h user/dchagin/lemul/sys/dev/cxgbe/firmware/t5fw_cfg.txt user/dchagin/lemul/sys/dev/cxgbe/firmware/t5fw_cfg_uwire.txt user/dchagin/lemul/sys/dev/cxgbe/t4_main.c user/dchagin/lemul/sys/dev/cxgbe/t4_sge.c user/dchagin/lemul/sys/dev/cxgbe/tom/t4_cpl_io.c user/dchagin/lemul/sys/dev/drm2/i915/i915_drv.c user/dchagin/lemul/sys/dev/drm2/radeon/radeon_drv.c user/dchagin/lemul/sys/dev/etherswitch/arswitch/arswitch.c user/dchagin/lemul/sys/dev/etherswitch/arswitch/arswitch_vlans.c user/dchagin/lemul/sys/dev/etherswitch/arswitch/arswitchreg.h user/dchagin/lemul/sys/dev/etherswitch/arswitch/arswitchvar.h user/dchagin/lemul/sys/dev/fdt/fdt_common.c user/dchagin/lemul/sys/dev/fdt/fdt_common.h user/dchagin/lemul/sys/dev/fdt/fdtbus.c user/dchagin/lemul/sys/dev/fdt/simplebus.c user/dchagin/lemul/sys/dev/firewire/sbp_targ.c user/dchagin/lemul/sys/dev/glxsb/glxsb.c user/dchagin/lemul/sys/dev/hifn/hifn7751.c user/dchagin/lemul/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c user/dchagin/lemul/sys/dev/hyperv/vmbus/hv_hv.c user/dchagin/lemul/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c user/dchagin/lemul/sys/dev/isp/isp.c user/dchagin/lemul/sys/dev/isp/isp_freebsd.c user/dchagin/lemul/sys/dev/isp/isp_freebsd.h user/dchagin/lemul/sys/dev/isp/ispvar.h user/dchagin/lemul/sys/dev/md/md.c user/dchagin/lemul/sys/dev/mpt/mpt_cam.c user/dchagin/lemul/sys/dev/mvs/mvs.c user/dchagin/lemul/sys/dev/ofw/ofw_bus_subr.c user/dchagin/lemul/sys/dev/ofw/ofw_fdt.c user/dchagin/lemul/sys/dev/random/harvest.c user/dchagin/lemul/sys/dev/random/hash.h user/dchagin/lemul/sys/dev/random/ivy.c user/dchagin/lemul/sys/dev/random/nehemiah.c user/dchagin/lemul/sys/dev/random/random_adaptors.c user/dchagin/lemul/sys/dev/random/random_adaptors.h user/dchagin/lemul/sys/dev/random/random_harvestq.c user/dchagin/lemul/sys/dev/random/random_harvestq.h user/dchagin/lemul/sys/dev/random/randomdev.c user/dchagin/lemul/sys/dev/random/randomdev.h user/dchagin/lemul/sys/dev/random/randomdev_soft.c user/dchagin/lemul/sys/dev/random/randomdev_soft.h user/dchagin/lemul/sys/dev/random/yarrow.c user/dchagin/lemul/sys/dev/random/yarrow.h user/dchagin/lemul/sys/dev/re/if_re.c user/dchagin/lemul/sys/dev/rndtest/rndtest.c user/dchagin/lemul/sys/dev/safe/safe.c user/dchagin/lemul/sys/dev/siis/siis.c user/dchagin/lemul/sys/dev/syscons/scmouse.c user/dchagin/lemul/sys/dev/syscons/syscons.c user/dchagin/lemul/sys/dev/uart/uart_dev_pl011.c user/dchagin/lemul/sys/dev/ubsec/ubsec.c user/dchagin/lemul/sys/dev/usb/controller/musb_otg.c user/dchagin/lemul/sys/dev/usb/controller/musb_otg.h user/dchagin/lemul/sys/dev/usb/controller/xhci.c user/dchagin/lemul/sys/dev/usb/serial/uslcom.c user/dchagin/lemul/sys/dev/usb/usbdevs user/dchagin/lemul/sys/dev/usb/wlan/if_run.c user/dchagin/lemul/sys/dev/usb/wlan/if_runreg.h user/dchagin/lemul/sys/dev/xen/blkfront/blkfront.c user/dchagin/lemul/sys/dev/xen/netback/netback.c user/dchagin/lemul/sys/fs/devfs/devfs_vnops.c user/dchagin/lemul/sys/geom/concat/g_concat.c user/dchagin/lemul/sys/geom/concat/g_concat.h user/dchagin/lemul/sys/geom/gate/g_gate.c user/dchagin/lemul/sys/geom/geom.h user/dchagin/lemul/sys/geom/geom_dev.c user/dchagin/lemul/sys/geom/geom_disk.c user/dchagin/lemul/sys/geom/geom_disk.h user/dchagin/lemul/sys/geom/geom_int.h user/dchagin/lemul/sys/geom/geom_io.c user/dchagin/lemul/sys/geom/geom_kern.c user/dchagin/lemul/sys/geom/geom_slice.c user/dchagin/lemul/sys/geom/geom_vfs.c user/dchagin/lemul/sys/geom/label/g_label.c user/dchagin/lemul/sys/geom/mirror/g_mirror.c user/dchagin/lemul/sys/geom/mirror/g_mirror.h user/dchagin/lemul/sys/geom/multipath/g_multipath.c user/dchagin/lemul/sys/geom/nop/g_nop.c user/dchagin/lemul/sys/geom/nop/g_nop.h user/dchagin/lemul/sys/geom/part/g_part.c user/dchagin/lemul/sys/geom/part/g_part_apm.c user/dchagin/lemul/sys/geom/part/g_part_bsd.c user/dchagin/lemul/sys/geom/part/g_part_ebr.c user/dchagin/lemul/sys/geom/part/g_part_gpt.c user/dchagin/lemul/sys/geom/part/g_part_mbr.c user/dchagin/lemul/sys/geom/part/g_part_pc98.c user/dchagin/lemul/sys/geom/part/g_part_vtoc8.c user/dchagin/lemul/sys/geom/raid/g_raid.c user/dchagin/lemul/sys/geom/raid/g_raid.h user/dchagin/lemul/sys/geom/raid/md_ddf.c user/dchagin/lemul/sys/geom/raid/md_intel.c user/dchagin/lemul/sys/geom/raid/md_jmicron.c user/dchagin/lemul/sys/geom/raid/md_nvidia.c user/dchagin/lemul/sys/geom/raid/md_promise.c user/dchagin/lemul/sys/geom/raid/md_sii.c user/dchagin/lemul/sys/geom/raid/tr_concat.c user/dchagin/lemul/sys/geom/raid/tr_raid0.c user/dchagin/lemul/sys/geom/raid/tr_raid1.c user/dchagin/lemul/sys/geom/raid/tr_raid1e.c user/dchagin/lemul/sys/geom/raid/tr_raid5.c user/dchagin/lemul/sys/geom/stripe/g_stripe.c user/dchagin/lemul/sys/geom/stripe/g_stripe.h user/dchagin/lemul/sys/geom/zero/g_zero.c user/dchagin/lemul/sys/kern/kern_event.c user/dchagin/lemul/sys/kern/kern_exec.c user/dchagin/lemul/sys/kern/kern_intr.c user/dchagin/lemul/sys/kern/kern_resource.c user/dchagin/lemul/sys/kern/makesyscalls.sh user/dchagin/lemul/sys/kern/subr_bus.c user/dchagin/lemul/sys/kern/subr_devstat.c user/dchagin/lemul/sys/kern/subr_taskqueue.c user/dchagin/lemul/sys/kern/sys_generic.c user/dchagin/lemul/sys/kern/uipc_syscalls.c user/dchagin/lemul/sys/kern/vfs_bio.c user/dchagin/lemul/sys/mips/atheros/ar71xx_chip.c user/dchagin/lemul/sys/mips/atheros/ar71xx_cpudef.h user/dchagin/lemul/sys/mips/atheros/ar71xx_machdep.c user/dchagin/lemul/sys/mips/atheros/ar71xx_spi.c user/dchagin/lemul/sys/mips/atheros/ar724x_chip.c user/dchagin/lemul/sys/mips/atheros/ar91xx_chip.c user/dchagin/lemul/sys/mips/atheros/ar933x_chip.c user/dchagin/lemul/sys/mips/atheros/ar933xreg.h user/dchagin/lemul/sys/mips/atheros/ar934x_chip.c user/dchagin/lemul/sys/mips/atheros/ar934xreg.h user/dchagin/lemul/sys/mips/atheros/if_arge.c user/dchagin/lemul/sys/mips/atheros/if_argevar.h user/dchagin/lemul/sys/mips/beri/beri_machdep.c user/dchagin/lemul/sys/mips/beri/files.beri user/dchagin/lemul/sys/mips/cavium/octeon_rnd.c user/dchagin/lemul/sys/mips/conf/BERI_DE4.hints user/dchagin/lemul/sys/mips/conf/BERI_DE4_MDROOT user/dchagin/lemul/sys/mips/conf/BERI_DE4_SDROOT user/dchagin/lemul/sys/mips/conf/DB120 user/dchagin/lemul/sys/mips/conf/DB120.hints user/dchagin/lemul/sys/mips/include/asm.h user/dchagin/lemul/sys/mips/include/pcb.h user/dchagin/lemul/sys/mips/mips/bcopy.S user/dchagin/lemul/sys/mips/mips/exception.S user/dchagin/lemul/sys/mips/mips/fp.S user/dchagin/lemul/sys/mips/mips/support.S user/dchagin/lemul/sys/mips/mips/swtch.S user/dchagin/lemul/sys/modules/Makefile user/dchagin/lemul/sys/modules/cxgb/Makefile user/dchagin/lemul/sys/modules/cxgbe/Makefile user/dchagin/lemul/sys/modules/cxgbe/t4_firmware/Makefile user/dchagin/lemul/sys/modules/cxgbe/t5_firmware/Makefile user/dchagin/lemul/sys/modules/dtrace/Makefile user/dchagin/lemul/sys/modules/dtrace/fasttrap/Makefile user/dchagin/lemul/sys/modules/random/Makefile user/dchagin/lemul/sys/modules/rdma/Makefile user/dchagin/lemul/sys/net/flowtable.c user/dchagin/lemul/sys/net/ieee8023ad_lacp.c user/dchagin/lemul/sys/net/if.c user/dchagin/lemul/sys/net/if_ethersubr.c user/dchagin/lemul/sys/net/if_media.h user/dchagin/lemul/sys/net/if_tun.c user/dchagin/lemul/sys/net/if_var.h user/dchagin/lemul/sys/net/radix.c user/dchagin/lemul/sys/net/radix.h user/dchagin/lemul/sys/net/route.c user/dchagin/lemul/sys/net/rtsock.c user/dchagin/lemul/sys/netatalk/at_control.c user/dchagin/lemul/sys/netgraph/ng_base.c user/dchagin/lemul/sys/netgraph/ng_iface.c user/dchagin/lemul/sys/netinet/in.c user/dchagin/lemul/sys/netinet/in.h user/dchagin/lemul/sys/netinet/in_var.h user/dchagin/lemul/sys/netinet/ip_input.c user/dchagin/lemul/sys/netinet/ip_output.c user/dchagin/lemul/sys/netinet/sctp_constants.h user/dchagin/lemul/sys/netinet/sctp_usrreq.c user/dchagin/lemul/sys/netinet6/in6.c user/dchagin/lemul/sys/netinet6/in6_var.h user/dchagin/lemul/sys/netinet6/ip6_input.c user/dchagin/lemul/sys/netinet6/ip6_output.c user/dchagin/lemul/sys/netipx/ipx.c user/dchagin/lemul/sys/netipx/ipx_if.h user/dchagin/lemul/sys/ofed/drivers/net/mlx4/en_netdev.c user/dchagin/lemul/sys/ofed/include/linux/gfp.h user/dchagin/lemul/sys/pci/if_rlreg.h user/dchagin/lemul/sys/powerpc/aim/interrupt.c user/dchagin/lemul/sys/powerpc/aim/machdep.c user/dchagin/lemul/sys/powerpc/aim/trap.c user/dchagin/lemul/sys/powerpc/booke/machdep.c user/dchagin/lemul/sys/powerpc/booke/pmap.c user/dchagin/lemul/sys/powerpc/conf/GENERIC64 user/dchagin/lemul/sys/powerpc/ofw/ofw_pci.c user/dchagin/lemul/sys/powerpc/ofw/ofw_pci.h user/dchagin/lemul/sys/powerpc/ofw/ofw_pcib_pci.c user/dchagin/lemul/sys/powerpc/ofw/ofw_pcibus.c user/dchagin/lemul/sys/powerpc/powermac/ata_kauai.c user/dchagin/lemul/sys/powerpc/powermac/ata_macio.c user/dchagin/lemul/sys/powerpc/pseries/phyp-hvcall.S user/dchagin/lemul/sys/sys/counter.h user/dchagin/lemul/sys/sys/devicestat.h user/dchagin/lemul/sys/sys/eventvar.h user/dchagin/lemul/sys/sys/param.h user/dchagin/lemul/sys/sys/proc.h user/dchagin/lemul/sys/sys/random.h user/dchagin/lemul/sys/sys/resource.h user/dchagin/lemul/sys/sys/resourcevar.h user/dchagin/lemul/sys/sys/systm.h user/dchagin/lemul/sys/ufs/ffs/ffs_extern.h user/dchagin/lemul/sys/ufs/ffs/ffs_softdep.c user/dchagin/lemul/sys/ufs/ffs/ffs_vfsops.c user/dchagin/lemul/sys/ufs/ffs/softdep.h user/dchagin/lemul/sys/ufs/ufs/dinode.h user/dchagin/lemul/sys/ufs/ufs/ufs_extern.h user/dchagin/lemul/sys/ufs/ufs/ufsmount.h user/dchagin/lemul/sys/xen/xen-os.h user/dchagin/lemul/tools/build/mk/OptionalObsoleteFiles.inc user/dchagin/lemul/tools/make_libdeps.sh user/dchagin/lemul/usr.bin/limits/limits.c user/dchagin/lemul/usr.bin/netstat/if.c user/dchagin/lemul/usr.bin/netstat/main.c user/dchagin/lemul/usr.bin/netstat/mbuf.c user/dchagin/lemul/usr.bin/netstat/netstat.h user/dchagin/lemul/usr.bin/netstat/route.c user/dchagin/lemul/usr.bin/pathchk/pathchk.c user/dchagin/lemul/usr.bin/procstat/procstat_rlimit.c user/dchagin/lemul/usr.bin/rpcinfo/rpcinfo.c user/dchagin/lemul/usr.bin/systat/netcmds.c user/dchagin/lemul/usr.bin/uname/uname.1 user/dchagin/lemul/usr.bin/uname/uname.c user/dchagin/lemul/usr.sbin/Makefile user/dchagin/lemul/usr.sbin/bhyve/bhyverun.c user/dchagin/lemul/usr.sbin/bhyve/bhyverun.h user/dchagin/lemul/usr.sbin/bhyve/mptbl.c user/dchagin/lemul/usr.sbin/bhyve/pci_ahci.c user/dchagin/lemul/usr.sbin/bhyve/pci_hostbridge.c user/dchagin/lemul/usr.sbin/bhyve/pci_virtio_block.c user/dchagin/lemul/usr.sbin/bhyve/pci_virtio_net.c user/dchagin/lemul/usr.sbin/bhyve/rtc.c user/dchagin/lemul/usr.sbin/bhyve/spinup_ap.c user/dchagin/lemul/usr.sbin/bhyvectl/bhyvectl.c user/dchagin/lemul/usr.sbin/bhyveload/bhyveload.8 user/dchagin/lemul/usr.sbin/bhyveload/bhyveload.c user/dchagin/lemul/usr.sbin/bootparamd/bootparamd/main.c user/dchagin/lemul/usr.sbin/bootparamd/callbootd/callbootd.c user/dchagin/lemul/usr.sbin/bsdconfig/share/strings.subr user/dchagin/lemul/usr.sbin/bsdinstall/bsdinstall.8 user/dchagin/lemul/usr.sbin/bsdinstall/scripts/zfsboot user/dchagin/lemul/usr.sbin/freebsd-update/freebsd-update.sh user/dchagin/lemul/usr.sbin/ifmcstat/ifmcstat.c user/dchagin/lemul/usr.sbin/jail/command.c user/dchagin/lemul/usr.sbin/jail/config.c user/dchagin/lemul/usr.sbin/jail/jail.8 user/dchagin/lemul/usr.sbin/jail/jail.c user/dchagin/lemul/usr.sbin/jail/jailp.h user/dchagin/lemul/usr.sbin/kldxref/kldxref.c user/dchagin/lemul/usr.sbin/pkg/Makefile user/dchagin/lemul/usr.sbin/pkg/config.c user/dchagin/lemul/usr.sbin/pkg/pkg.c user/dchagin/lemul/usr.sbin/ppp/mppe.c user/dchagin/lemul/usr.sbin/ypset/ypset.c Directory Properties: user/dchagin/lemul/ (props changed) user/dchagin/lemul/cddl/ (props changed) user/dchagin/lemul/cddl/contrib/opensolaris/ (props changed) user/dchagin/lemul/contrib/binutils/ (props changed) user/dchagin/lemul/contrib/ipfilter/ (props changed) user/dchagin/lemul/contrib/libcxxrt/ (props changed) user/dchagin/lemul/contrib/mtree/ (props changed) user/dchagin/lemul/lib/libc/ (props changed) user/dchagin/lemul/lib/libutil/ (props changed) user/dchagin/lemul/lib/libvmmapi/ (props changed) user/dchagin/lemul/lib/libz/ (props changed) user/dchagin/lemul/sbin/ (props changed) user/dchagin/lemul/share/man/man4/ (props changed) user/dchagin/lemul/sys/ (props changed) user/dchagin/lemul/sys/amd64/vmm/ (props changed) user/dchagin/lemul/sys/boot/ (props changed) user/dchagin/lemul/sys/cddl/contrib/opensolaris/ (props changed) user/dchagin/lemul/sys/conf/ (props changed) user/dchagin/lemul/sys/dev/hyperv/ (props changed) user/dchagin/lemul/usr.bin/procstat/ (props changed) user/dchagin/lemul/usr.sbin/bhyve/ (props changed) user/dchagin/lemul/usr.sbin/bhyvectl/ (props changed) user/dchagin/lemul/usr.sbin/bhyveload/ (props changed) user/dchagin/lemul/usr.sbin/bsdinstall/scripts/docsinstall (props changed) user/dchagin/lemul/usr.sbin/bsdinstall/scripts/entropy (props changed) user/dchagin/lemul/usr.sbin/jail/ (props changed) Modified: user/dchagin/lemul/Makefile.inc1 ============================================================================== --- user/dchagin/lemul/Makefile.inc1 Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/Makefile.inc1 Tue Oct 22 10:10:34 2013 (r256883) @@ -1722,6 +1722,13 @@ delete-old-libs: chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ fi; \ + for ext in debug symbols; do \ + if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ + "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ + rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ + <&3; \ + fi; \ + done; \ done @echo ">>> Old libraries removed" @@ -1733,6 +1740,11 @@ check-old-libs: if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ echo "${DESTDIR}/$${file}"; \ fi; \ + for ext in debug symbols; do \ + if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ + echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ + fi; \ + done; \ done delete-old-dirs: @@ -1830,7 +1842,7 @@ NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOU CPUTYPE=${XDEV_CPUTYPE} XDDIR=${XDEV_ARCH}-freebsd -XDTP=/usr/${XDDIR} +XDTP=usr/${XDDIR} CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \ INSTALL="sh ${.CURDIR}/tools/install.sh" CDENV= ${CDBENV} \ @@ -1843,8 +1855,8 @@ CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN} -CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN} -XDDESTDIR=${DESTDIR}${XDTP} +CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN} +XDDESTDIR=${DESTDIR}/${XDTP} .if !defined(OSREL) OSREL!= uname -r | sed -e 's/[-(].*//' .endif @@ -1924,6 +1936,7 @@ _xi-libraries: _xi-links: ${_+_}cd ${XDDESTDIR}/usr/bin; \ + mkdir -p ../../../../usr/bin; \ for i in *; do \ ln -sf ../../${XDTP}/usr/bin/$$i \ ../../../../usr/bin/${XDDIR}-$$i; \ Modified: user/dchagin/lemul/ObsoleteFiles.inc ============================================================================== --- user/dchagin/lemul/ObsoleteFiles.inc Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/ObsoleteFiles.inc Tue Oct 22 10:10:34 2013 (r256883) @@ -38,6 +38,17 @@ # xargs -n1 | sort | uniq -d; # done +# 20131014: libbsdyml becomes private +OLD_FILES+=usr/lib/libbsdyml.a +OLD_FILES+=usr/lib/libbsdyml.so +OLD_LIBS+=usr/lib/libbsdyml.so.0 +OLD_FILES+=usr/lib/libbsdyml_p.a +OLD_FILES+=usr/lib32/libbsdyml.a +OLD_FILES+=usr/lib32/libbsdyml.so +OLD_LIBS+=usr/lib32/libbsdyml.so.0 +OLD_FILES+=usr/lib32/libbsdyml_p.a +OLD_FILES+=usr/share/man/man3/libbsdyml.3.gz +OLD_FILES+=usr/include/bsdyml.h # 20131013: Removal of the ATF tools OLD_FILES+=etc/atf/FreeBSD.conf OLD_FILES+=etc/atf/atf-run.hooks @@ -86,7 +97,7 @@ OLD_FILES+=usr/include/lwres/result.h OLD_FILES+=usr/include/lwres/version.h OLD_FILES+=usr/lib/liblwres.a OLD_FILES+=usr/lib/liblwres.so -OLD_LIBS+=usr/lib/liblwres.so.50 +OLD_LIBS+=usr/lib/liblwres.so.90 OLD_FILES+=usr/lib/liblwres_p.a OLD_FILES+=usr/sbin/arpaname OLD_FILES+=usr/sbin/ddns-confgen @@ -96,6 +107,7 @@ OLD_FILES+=usr/sbin/dnssec-keygen OLD_FILES+=usr/sbin/dnssec-revoke OLD_FILES+=usr/sbin/dnssec-settime OLD_FILES+=usr/sbin/dnssec-signzone +OLD_FILES+=usr/sbin/dnssec-verify OLD_FILES+=usr/sbin/genrandom OLD_FILES+=usr/sbin/isc-hmac-fixup OLD_FILES+=usr/sbin/lwresd @@ -259,6 +271,7 @@ OLD_FILES+=usr/share/man/man8/dnssec-key OLD_FILES+=usr/share/man/man8/dnssec-revoke.8.gz OLD_FILES+=usr/share/man/man8/dnssec-settime.8.gz OLD_FILES+=usr/share/man/man8/dnssec-signzone.8.gz +OLD_FILES+=usr/share/man/man8/dnssec-verify.8.gz OLD_FILES+=usr/share/man/man8/genrandom.8.gz OLD_FILES+=usr/share/man/man8/isc-hmac-fixup.8.gz OLD_FILES+=usr/share/man/man8/lwresd.8.gz @@ -293,6 +306,8 @@ OLD_DIRS+=var/named/var/run OLD_DIRS+=var/named/var/run/named OLD_DIRS+=var/named/var/stats OLD_DIRS+=var/run/named +# 20130923: example moved +OLD_FILES+=usr/share/examples/bsdconfig/browse_packages.sh # 20130908: libssh becomes private OLD_FILES+=usr/lib/libssh.a OLD_FILES+=usr/lib/libssh.so Modified: user/dchagin/lemul/UPDATING ============================================================================== --- user/dchagin/lemul/UPDATING Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/UPDATING Tue Oct 22 10:10:34 2013 (r256883) @@ -31,6 +31,15 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20131014: + libbsdyml has been renamed to libyaml and moved to /usr/lib/private. + This will break ports-mgmt/pkg. Rebuild the port, or upgrade to pkg + 1.1.4_8 and verify bsdyml not linked in, before running "make + delete-old-libs": + # make -C /usr/ports/ports-mgmt/pkg build deinstall install clean + or + # pkg install pkg; ldd /usr/local/sbin/pkg | grep bsdyml + 20131010: The rc.d/jail script has been updated to support jail(8) configuration file. The "jail__*" rc.conf(5) variables Modified: user/dchagin/lemul/bin/ps/print.c ============================================================================== --- user/dchagin/lemul/bin/ps/print.c Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/bin/ps/print.c Tue Oct 22 10:10:34 2013 (r256883) @@ -797,8 +797,6 @@ char * emulname(KINFO *k, VARENT *ve __unused) { - if (k->ki_p->ki_emul == NULL) - return (NULL); return (strdup(k->ki_p->ki_emul)); } @@ -827,7 +825,6 @@ out: char * loginclass(KINFO *k, VARENT *ve __unused) { - char *s; /* * Don't display login class for system processes; @@ -837,8 +834,5 @@ loginclass(KINFO *k, VARENT *ve __unused if (k->ki_p->ki_flag & P_SYSTEM) { return (strdup("-")); } - s = k->ki_p->ki_loginclass; - if (s == NULL) - return (NULL); - return (strdup(s)); + return (strdup(k->ki_p->ki_loginclass)); } Modified: user/dchagin/lemul/bin/sh/jobs.c ============================================================================== --- user/dchagin/lemul/bin/sh/jobs.c Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/bin/sh/jobs.c Tue Oct 22 10:10:34 2013 (r256883) @@ -978,7 +978,6 @@ int waitforjob(struct job *jp, int *origstatus) { #if JOBS - pid_t mypgrp = getpgrp(); int propagate_int = jp->jobctl && jp->foreground; #endif int status; @@ -992,7 +991,7 @@ waitforjob(struct job *jp, int *origstat dotrap(); #if JOBS if (jp->jobctl) { - if (tcsetpgrp(ttyfd, mypgrp) < 0) + if (tcsetpgrp(ttyfd, rootpid) < 0) error("tcsetpgrp failed, errno=%d\n", errno); } if (jp->state == JOBSTOPPED) Modified: user/dchagin/lemul/bin/sh/miscbltin.c ============================================================================== --- user/dchagin/lemul/bin/sh/miscbltin.c Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/bin/sh/miscbltin.c Tue Oct 22 10:10:34 2013 (r256883) @@ -405,6 +405,9 @@ static const struct limits limits[] = { #ifdef RLIMIT_NPTS { "pseudo-terminals", (char *)0, RLIMIT_NPTS, 1, 'p' }, #endif +#ifdef RLIMIT_KQUEUES + { "kqueues", (char *)0, RLIMIT_KQUEUES, 1, 'k' }, +#endif { (char *) 0, (char *)0, 0, 0, '\0' } }; @@ -421,7 +424,7 @@ ulimitcmd(int argc __unused, char **argv struct rlimit limit; what = 'f'; - while ((optc = nextopt("HSatfdsmcnuvlbpw")) != '\0') + while ((optc = nextopt("HSatfdsmcnuvlbpwk")) != '\0') switch (optc) { case 'H': how = HARD; Modified: user/dchagin/lemul/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c ============================================================================== --- user/dchagin/lemul/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c Tue Oct 22 10:10:34 2013 (r256883) @@ -242,8 +242,14 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION_ /* XXX */ printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); #elif defined(__powerpc__) -/* XXX */ -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + /* + * Add 4 bytes to hit the low half of this 64-bit + * big-endian address. + */ + rel->r_offset = s->dofs_offset + + dofr[j].dofr_offset + 4; + rel->r_info = ELF32_R_INFO(count + dep->de_global, + R_PPC_REL32); #elif defined(__sparc) /* * Add 4 bytes to hit the low half of this 64-bit @@ -423,7 +429,10 @@ prepare_elf64(dtrace_hdl_t *dtp, const d #elif defined(__mips__) /* XXX */ #elif defined(__powerpc__) -/* XXX */ + rel->r_offset = s->dofs_offset + + dofr[j].dofr_offset; + rel->r_info = ELF64_R_INFO(count + dep->de_global, + R_PPC64_REL64); #elif defined(__i386) || defined(__amd64) rel->r_offset = s->dofs_offset + dofr[j].dofr_offset; @@ -824,12 +833,84 @@ printf("%s:%s(%d): DOODAD\n",__FUNCTION_ return (0); } #elif defined(__powerpc__) +/* The sentinel is 'xor r3,r3,r3'. */ +#define DT_OP_XOR_R3 0x7c631a78 + +#define DT_OP_NOP 0x60000000 +#define DT_OP_BLR 0x4e800020 + +/* This captures all forms of branching to address. */ +#define DT_IS_BRANCH(inst) ((inst & 0xfc000000) == 0x48000000) +#define DT_IS_BL(inst) (DT_IS_BRANCH(inst) && (inst & 0x01)) + /* XXX */ static int dt_modtext(dtrace_hdl_t *dtp, char *p, int isenabled, GElf_Rela *rela, uint32_t *off) { -printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__); + uint32_t *ip; + + if ((rela->r_offset & (sizeof (uint32_t) - 1)) != 0) + return (-1); + + /*LINTED*/ + ip = (uint32_t *)(p + rela->r_offset); + + /* + * We only know about some specific relocation types. + */ + if (GELF_R_TYPE(rela->r_info) != R_PPC_REL24 && + GELF_R_TYPE(rela->r_info) != R_PPC_PLTREL24) + return (-1); + + /* + * We may have already processed this object file in an earlier linker + * invocation. Check to see if the present instruction sequence matches + * the one we would install below. + */ + if (isenabled) { + if (ip[0] == DT_OP_XOR_R3) { + (*off) += sizeof (ip[0]); + return (0); + } + } else { + if (ip[0] == DT_OP_NOP) { + (*off) += sizeof (ip[0]); + return (0); + } + } + + /* + * We only expect branch to address instructions. + */ + if (!DT_IS_BRANCH(ip[0])) { + dt_dprintf("found %x instead of a branch instruction at %llx\n", + ip[0], (u_longlong_t)rela->r_offset); + return (-1); + } + + if (isenabled) { + /* + * It would necessarily indicate incorrect usage if an is- + * enabled probe were tail-called so flag that as an error. + * It's also potentially (very) tricky to handle gracefully, + * but could be done if this were a desired use scenario. + */ + if (!DT_IS_BL(ip[0])) { + dt_dprintf("tail call to is-enabled probe at %llx\n", + (u_longlong_t)rela->r_offset); + return (-1); + } + + ip[0] = DT_OP_XOR_R3; + (*off) += sizeof (ip[0]); + } else { + if (DT_IS_BL(ip[0])) + ip[0] = DT_OP_NOP; + else + ip[0] = DT_OP_BLR; + } + return (0); } Modified: user/dchagin/lemul/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c ============================================================================== --- user/dchagin/lemul/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c Tue Oct 22 10:10:34 2013 (r256883) @@ -311,6 +311,10 @@ static const dt_ident_t _dtrace_globals[ &dt_idops_func, "void(@)" }, { "memref", DT_IDENT_FUNC, 0, DIF_SUBR_MEMREF, DT_ATTR_STABCMN, DT_VERS_1_1, &dt_idops_func, "uintptr_t *(void *, size_t)" }, +#if !defined(sun) +{ "memstr", DT_IDENT_FUNC, 0, DIF_SUBR_MEMSTR, DT_ATTR_STABCMN, DT_VERS_1_0, + &dt_idops_func, "string(void *, char, size_t)" }, +#endif { "min", DT_IDENT_AGGFUNC, 0, DTRACEAGG_MIN, DT_ATTR_STABCMN, DT_VERS_1_0, &dt_idops_func, "void(@)" }, { "mod", DT_IDENT_ACTFUNC, 0, DT_ACT_MOD, DT_ATTR_STABCMN, Modified: user/dchagin/lemul/cddl/contrib/opensolaris/lib/libdtrace/powerpc/dt_isadep.c ============================================================================== --- user/dchagin/lemul/cddl/contrib/opensolaris/lib/libdtrace/powerpc/dt_isadep.c Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/cddl/contrib/opensolaris/lib/libdtrace/powerpc/dt_isadep.c Tue Oct 22 10:10:34 2013 (r256883) @@ -35,14 +35,26 @@ #include #include +#include + /*ARGSUSED*/ int dt_pid_create_entry_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp, fasttrap_probe_spec_t *ftp, const GElf_Sym *symp) { + ftp->ftps_type = DTFTP_ENTRY; + ftp->ftps_pc = (uintptr_t)symp->st_value; + ftp->ftps_size = (size_t)symp->st_size; + ftp->ftps_noffs = 1; + ftp->ftps_offs[0] = 0; + + if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) { + dt_dprintf("fasttrap probe creation ioctl failed: %s\n", + strerror(errno)); + return (dt_set_errno(dtp, errno)); + } - dt_dprintf("%s: unimplemented\n", __func__); - return (DT_PROC_ERR); + return (1); } int @@ -50,8 +62,74 @@ dt_pid_create_return_probe(struct ps_pro fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, uint64_t *stret) { - dt_dprintf("%s: unimplemented\n", __func__); - return (DT_PROC_ERR); + uintptr_t temp; + uint32_t *text; + int i; + int srdepth = 0; + + if ((text = malloc(symp->st_size + 4)) == NULL) { + dt_dprintf("mr sparkle: malloc() failed\n"); + return (DT_PROC_ERR); + } + + if (Pread(P, text, symp->st_size, symp->st_value) != symp->st_size) { + dt_dprintf("mr sparkle: Pread() failed\n"); + free(text); + return (DT_PROC_ERR); + } + + /* + * Leave a dummy instruction in the last slot to simplify edge + * conditions. + */ + text[symp->st_size / 4] = 0; + + ftp->ftps_type = DTFTP_RETURN; + ftp->ftps_pc = symp->st_value; + ftp->ftps_size = symp->st_size; + ftp->ftps_noffs = 0; + + for (i = 0; i < symp->st_size / 4; i++) { + + if ((text[i] & 0xfc000001) != 0x48000000 && + text[i] != 0x4e800020) + continue; + + /* + * Check for a jump within this function. If it's outside this + * function then it's a tail-call, so a return point. + */ + if ((text[i] & 0xfc000000) == 0x48000000) { + temp = (text[i] & 0x03fffffc); + /* Bit 30 denotes an absolute address. */ + if (!(text[i] & 0x02)) { + temp += symp->st_value + i * 4; + } + else { + /* Sign extend the absolute address. */ + if (temp & 0x02000000) { + temp |= (UINTPTR_MAX - 0x03ffffff); + } + } + if (temp >= symp->st_value && + temp <= (symp->st_value + symp->st_size)) + continue; + } + dt_dprintf("return at offset %x\n", i * 4); + ftp->ftps_offs[ftp->ftps_noffs++] = i * 4; + } + + free(text); + if (ftp->ftps_noffs > 0) { + if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) { + dt_dprintf("fasttrap probe creation ioctl failed: %s\n", + strerror(errno)); + return (dt_set_errno(dtp, errno)); + } + } + + + return (ftp->ftps_noffs); } /*ARGSUSED*/ @@ -59,9 +137,22 @@ int dt_pid_create_offset_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp, fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, ulong_t off) { + if (off & 0x3) + return (DT_PROC_ALIGN); - dt_dprintf("%s: unimplemented\n", __func__); - return (DT_PROC_ERR); + ftp->ftps_type = DTFTP_OFFSETS; + ftp->ftps_pc = (uintptr_t)symp->st_value; + ftp->ftps_size = (size_t)symp->st_size; + ftp->ftps_noffs = 1; + ftp->ftps_offs[0] = off; + + if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) { + dt_dprintf("fasttrap probe creation ioctl failed: %s\n", + strerror(errno)); + return (dt_set_errno(dtp, errno)); + } + + return (1); } /*ARGSUSED*/ @@ -69,7 +160,38 @@ int dt_pid_create_glob_offset_probes(struct ps_prochandle *P, dtrace_hdl_t *dtp, fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, const char *pattern) { + ulong_t i; + + ftp->ftps_type = DTFTP_OFFSETS; + ftp->ftps_pc = (uintptr_t)symp->st_value; + ftp->ftps_size = (size_t)symp->st_size; + ftp->ftps_noffs = 0; + + /* + * If we're matching against everything, just iterate through each + * instruction in the function, otherwise look for matching offset + * names by constructing the string and comparing it against the + * pattern. + */ + if (strcmp("*", pattern) == 0) { + for (i = 0; i < symp->st_size; i += 4) { + ftp->ftps_offs[ftp->ftps_noffs++] = i; + } + } else { + char name[sizeof (i) * 2 + 1]; + + for (i = 0; i < symp->st_size; i += 4) { + (void) sprintf(name, "%lx", i); + if (gmatch(name, pattern)) + ftp->ftps_offs[ftp->ftps_noffs++] = i; + } + } + + if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) { + dt_dprintf("fasttrap probe creation ioctl failed: %s\n", + strerror(errno)); + return (dt_set_errno(dtp, errno)); + } - dt_dprintf("%s: unimplemented\n", __func__); - return (DT_PROC_ERR); + return (ftp->ftps_noffs); } Modified: user/dchagin/lemul/cddl/lib/libdtrace/psinfo.d ============================================================================== --- user/dchagin/lemul/cddl/lib/libdtrace/psinfo.d Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/cddl/lib/libdtrace/psinfo.d Tue Oct 22 10:10:34 2013 (r256883) @@ -57,7 +57,8 @@ translator psinfo_t < struct proc *T > { pr_gid = T->p_ucred->cr_rgid; pr_egid = T->p_ucred->cr_groups[0]; pr_addr = 0; - pr_psargs = stringof(T->p_args->ar_args); + pr_psargs = (T->p_args->ar_args == 0) ? "" : + memstr(T->p_args->ar_args, ' ', T->p_args->ar_length); pr_arglen = T->p_args->ar_length; pr_jailid = T->p_ucred->cr_prison->pr_id; }; Modified: user/dchagin/lemul/contrib/binutils/gas/config/tc-arm.c ============================================================================== --- user/dchagin/lemul/contrib/binutils/gas/config/tc-arm.c Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/contrib/binutils/gas/config/tc-arm.c Tue Oct 22 10:10:34 2013 (r256883) @@ -12660,14 +12660,14 @@ do_vfp_nsyn_cvt (enum neon_shape rs, int /* Conversions without bitshift. */ const char *enc[] = { - "ftosis", - "ftouis", + "ftosizs", + "ftouizs", "fsitos", "fuitos", "fcvtsd", "fcvtds", - "ftosid", - "ftouid", + "ftosizd", + "ftouizd", "fsitod", "fuitod" }; Modified: user/dchagin/lemul/contrib/binutils/gas/config/tc-mips.c ============================================================================== --- user/dchagin/lemul/contrib/binutils/gas/config/tc-mips.c Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/contrib/binutils/gas/config/tc-mips.c Tue Oct 22 10:10:34 2013 (r256883) @@ -15420,21 +15420,6 @@ MIPS options:\n\ -mno-octeon-useun generate MIPS unaligned load/store instructions\n")); } -enum dwarf2_format -mips_dwarf2_format (void) -{ - if (HAVE_64BIT_SYMBOLS) - { -#ifdef TE_IRIX - return dwarf2_format_64bit_irix; -#else - return dwarf2_format_64bit; -#endif - } - else - return dwarf2_format_32bit; -} - int mips_dwarf2_addr_size (void) { Modified: user/dchagin/lemul/contrib/binutils/gas/config/tc-mips.h ============================================================================== --- user/dchagin/lemul/contrib/binutils/gas/config/tc-mips.h Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/contrib/binutils/gas/config/tc-mips.h Tue Oct 22 10:10:34 2013 (r256883) @@ -155,10 +155,6 @@ extern void mips_emit_delays (void); extern void mips_enable_auto_align (void); #define md_elf_section_change_hook() mips_enable_auto_align() -enum dwarf2_format; -extern enum dwarf2_format mips_dwarf2_format (void); -#define DWARF2_FORMAT() mips_dwarf2_format () - extern int mips_dwarf2_addr_size (void); #define DWARF2_ADDR_SIZE(bfd) mips_dwarf2_addr_size () Modified: user/dchagin/lemul/contrib/binutils/gas/dwarf2dbg.c ============================================================================== --- user/dchagin/lemul/contrib/binutils/gas/dwarf2dbg.c Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/contrib/binutils/gas/dwarf2dbg.c Tue Oct 22 10:10:34 2013 (r256883) @@ -1271,6 +1271,7 @@ out_debug_line (segT line_seg) symbolS *line_end; struct line_seg *s; enum dwarf2_format d2f; + int sizeof_initial_length; int sizeof_offset; subseg_set (line_seg, 0); @@ -1287,27 +1288,24 @@ out_debug_line (segT line_seg) d2f = DWARF2_FORMAT (); if (d2f == dwarf2_format_32bit) { - expr.X_add_number = -4; - emit_expr (&expr, 4); - sizeof_offset = 4; + sizeof_initial_length = sizeof_offset = 4; } else if (d2f == dwarf2_format_64bit) { - expr.X_add_number = -12; - out_four (-1); - emit_expr (&expr, 8); + sizeof_initial_length = 12; sizeof_offset = 8; + out_four (-1); } else if (d2f == dwarf2_format_64bit_irix) { - expr.X_add_number = -8; - emit_expr (&expr, 8); - sizeof_offset = 8; + sizeof_initial_length = sizeof_offset = 8; } else { as_fatal (_("internal error: unknown dwarf2 format")); } + expr.X_add_number = -sizeof_initial_length; + emit_expr (&expr, sizeof_offset); /* Version. */ out_two (2); @@ -1316,7 +1314,7 @@ out_debug_line (segT line_seg) expr.X_op = O_subtract; expr.X_add_symbol = prologue_end; expr.X_op_symbol = line_start; - expr.X_add_number = - (4 + 2 + 4); + expr.X_add_number = - (sizeof_initial_length + 2 + sizeof_offset); emit_expr (&expr, sizeof_offset); /* Parameters of the state machine. */ Modified: user/dchagin/lemul/contrib/bsnmp/lib/snmp.c ============================================================================== --- user/dchagin/lemul/contrib/bsnmp/lib/snmp.c Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/contrib/bsnmp/lib/snmp.c Tue Oct 22 10:10:34 2013 (r256883) @@ -288,11 +288,13 @@ parse_secparams(struct asn_buf *b, struc memset(buf, 0, 256); tb.asn_ptr = buf; tb.asn_len = 256; + u_int len; - if (asn_get_octetstring(b, buf, &tb.asn_len) != ASN_ERR_OK) { + if (asn_get_octetstring(b, buf, &len) != ASN_ERR_OK) { snmp_error("cannot parse usm header"); return (ASN_ERR_FAILED); } + tb.asn_len = len; if (asn_get_sequence(&tb, &octs_len) != ASN_ERR_OK) { snmp_error("cannot decode usm header"); @@ -864,7 +866,7 @@ snmp_fix_encoding(struct asn_buf *b, str return (SNMP_CODE_FAILED); pdu->scoped_len = b->asn_ptr - pdu->scoped_ptr; - if ((code = snmp_pdu_fix_padd(b, pdu))!= ASN_ERR_OK) + if (snmp_pdu_fix_padd(b, pdu) != ASN_ERR_OK) return (SNMP_CODE_FAILED); if (pdu->security_model != SNMP_SECMODEL_USM) @@ -997,7 +999,7 @@ snmp_pdu_encode(struct snmp_pdu *pdu, st if ((err = snmp_pdu_encode_header(resp_b, pdu)) != SNMP_CODE_OK) return (err); for (idx = 0; idx < pdu->nbindings; idx++) - if ((err = snmp_binding_encode(resp_b, &pdu->bindings[idx])) + if (snmp_binding_encode(resp_b, &pdu->bindings[idx]) != ASN_ERR_OK) return (SNMP_CODE_FAILED); Modified: user/dchagin/lemul/contrib/bsnmp/lib/snmp.h ============================================================================== --- user/dchagin/lemul/contrib/bsnmp/lib/snmp.h Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/contrib/bsnmp/lib/snmp.h Tue Oct 22 10:10:34 2013 (r256883) @@ -182,7 +182,7 @@ struct snmp_pdu { /* fixes for encoding */ size_t outer_len; - size_t scoped_len; + asn_len_t scoped_len; u_char *outer_ptr; u_char *digest_ptr; u_char *encrypted_ptr; Modified: user/dchagin/lemul/contrib/bsnmp/lib/snmpagent.c ============================================================================== --- user/dchagin/lemul/contrib/bsnmp/lib/snmpagent.c Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/contrib/bsnmp/lib/snmpagent.c Tue Oct 22 10:10:34 2013 (r256883) @@ -166,7 +166,7 @@ find_subnode(const struct snmp_value *va } static void -snmp_pdu_create_response(struct snmp_pdu *pdu, struct snmp_pdu *resp) +snmp_pdu_create_response(const struct snmp_pdu *pdu, struct snmp_pdu *resp) { memset(resp, 0, sizeof(*resp)); strcpy(resp->community, pdu->community); @@ -276,7 +276,12 @@ snmp_get(struct snmp_pdu *pdu, struct as } } - return (snmp_fix_encoding(resp_b, resp)); + if (snmp_fix_encoding(resp_b, resp) != SNMP_CODE_OK) { + snmp_debug("get: failed to encode PDU"); + return (SNMP_RET_ERR); + } + + return (SNMP_RET_OK); } static struct snmp_node * @@ -438,7 +443,13 @@ snmp_getnext(struct snmp_pdu *pdu, struc return (SNMP_RET_ERR); } } - return (snmp_fix_encoding(resp_b, resp)); + + if (snmp_fix_encoding(resp_b, resp) != SNMP_CODE_OK) { + snmp_debug("getnext: failed to encode PDU"); + return (SNMP_RET_ERR); + } + + return (SNMP_RET_OK); } enum snmp_ret @@ -537,7 +548,12 @@ snmp_getbulk(struct snmp_pdu *pdu, struc } done: - return (snmp_fix_encoding(resp_b, resp)); + if (snmp_fix_encoding(resp_b, resp) != SNMP_CODE_OK) { + snmp_debug("getnext: failed to encode PDU"); + return (SNMP_RET_ERR); + } + + return (SNMP_RET_OK); } /* @@ -952,18 +968,57 @@ enum snmp_ret snmp_make_errresp(const struct snmp_pdu *pdu, struct asn_buf *pdu_b, struct asn_buf *resp_b) { + u_char type; asn_len_t len; struct snmp_pdu resp; enum asn_err err; enum snmp_code code; - memset(&resp, 0, sizeof(resp)); + snmp_pdu_create_response(pdu, &resp); + if ((code = snmp_pdu_decode_header(pdu_b, &resp)) != SNMP_CODE_OK) return (SNMP_RET_IGN); - if (pdu_b->asn_len < len) + if (pdu->version == SNMP_V3) { + if (resp.user.priv_proto != SNMP_PRIV_NOPRIV && + (asn_get_header(pdu_b, &type, &resp.scoped_len) != ASN_ERR_OK + || type != ASN_TYPE_OCTETSTRING)) { + snmp_error("cannot decode encrypted pdu"); + return (SNMP_RET_IGN); + } + + if (asn_get_sequence(pdu_b, &len) != ASN_ERR_OK) { + snmp_error("cannot decode scoped pdu header"); + return (SNMP_RET_IGN); + } + + len = SNMP_ENGINE_ID_SIZ; + if (asn_get_octetstring(pdu_b, (u_char *)resp.context_engine, + &len) != ASN_ERR_OK) { + snmp_error("cannot decode msg context engine"); + return (SNMP_RET_IGN); + } + resp.context_engine_len = len; + len = SNMP_CONTEXT_NAME_SIZ; + if (asn_get_octetstring(pdu_b, (u_char *)resp.context_name, + &len) != ASN_ERR_OK) { + snmp_error("cannot decode msg context name"); + return (SNMP_RET_IGN); + } + resp.context_name[len] = '\0'; + } + + + if (asn_get_header(pdu_b, &type, &len) != ASN_ERR_OK) { + snmp_error("cannot get pdu header"); return (SNMP_RET_IGN); - pdu_b->asn_len = len; + } + + if ((type & ~ASN_TYPE_MASK) != + (ASN_TYPE_CONSTRUCTED | ASN_CLASS_CONTEXT)) { + snmp_error("bad pdu header tag"); + return (SNMP_RET_IGN); + } err = snmp_parse_pdus_hdr(pdu_b, &resp, &len); if (ASN_ERR_STOPPED(err)) Modified: user/dchagin/lemul/contrib/gcclibs/libssp/ssp.c ============================================================================== --- user/dchagin/lemul/contrib/gcclibs/libssp/ssp.c Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/contrib/gcclibs/libssp/ssp.c Tue Oct 22 10:10:34 2013 (r256883) @@ -128,7 +128,7 @@ fail (const char *msg1, size_t msg1len, #ifdef HAVE_SYSLOG_H /* Only send the error to syslog if there was no tty available. */ else - syslog (LOG_CRIT, msg3); + syslog (LOG_CRIT, "%s", msg3); #endif /* HAVE_SYSLOG_H */ /* Try very hard to exit. Note that signals may be blocked preventing Modified: user/dchagin/lemul/contrib/ipfilter/ipf.h ============================================================================== --- user/dchagin/lemul/contrib/ipfilter/ipf.h Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/contrib/ipfilter/ipf.h Tue Oct 22 10:10:34 2013 (r256883) @@ -42,9 +42,10 @@ struct file; #include #include #include -#if __FreeBSD_version >= 300000 -# include -#endif + +#define _WANT_IFADDR +#include + #include #include #include Modified: user/dchagin/lemul/contrib/jemalloc/ChangeLog ============================================================================== --- user/dchagin/lemul/contrib/jemalloc/ChangeLog Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/contrib/jemalloc/ChangeLog Tue Oct 22 10:10:34 2013 (r256883) @@ -6,6 +6,21 @@ found in the git revision history: http://www.canonware.com/cgi-bin/gitweb.cgi?p=jemalloc.git git://canonware.com/jemalloc.git +* 3.4.1 (October 20, 2013) + + Bug fixes: + - Fix a race in the "arenas.extend" mallctl that could cause memory corruption + of internal data structures and subsequent crashes. + - Fix Valgrind integration flaws that caused Valgrind warnings about reads of + uninitialized memory in: + + arena chunk headers + + internal zero-initialized data structures (relevant to tcache and prof + code) + - Preserve errno during the first allocation. A readlink(2) call during + initialization fails unless /etc/malloc.conf exists, so errno was typically + set during the first allocation prior to this fix. + - Fix compilation warnings reported by gcc 4.8.1. + * 3.4.0 (June 2, 2013) This version is essentially a small bugfix release, but the addition of @@ -60,7 +75,7 @@ found in the git revision history: Bug fixes: - Fix "arenas.extend" mallctl to output the number of arenas. - - Fix chunk_recycyle() to unconditionally inform Valgrind that returned memory + - Fix chunk_recycle() to unconditionally inform Valgrind that returned memory is undefined. - Fix build break on FreeBSD related to alloca.h. Modified: user/dchagin/lemul/contrib/jemalloc/FREEBSD-diffs ============================================================================== --- user/dchagin/lemul/contrib/jemalloc/FREEBSD-diffs Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/contrib/jemalloc/FREEBSD-diffs Tue Oct 22 10:10:34 2013 (r256883) @@ -45,7 +45,7 @@ index abd5e6f..1d7491a 100644 + diff --git a/include/jemalloc/internal/jemalloc_internal.h.in b/include/jemalloc/internal/jemalloc_internal.h.in -index e46ac54..527449d 100644 +index 53c135c..c547339 100644 --- a/include/jemalloc/internal/jemalloc_internal.h.in +++ b/include/jemalloc/internal/jemalloc_internal.h.in @@ -1,5 +1,8 @@ @@ -97,10 +97,10 @@ index de44e14..564d604 100644 bool malloc_mutex_init(malloc_mutex_t *mutex); diff --git a/include/jemalloc/internal/private_namespace.h b/include/jemalloc/internal/private_namespace.h -index 65de316..366676b 100644 +index cdb0b0e..2a98d1f 100644 --- a/include/jemalloc/internal/private_namespace.h +++ b/include/jemalloc/internal/private_namespace.h -@@ -216,7 +216,6 @@ +@@ -218,7 +218,6 @@ #define iralloc JEMALLOC_N(iralloc) #define irallocx JEMALLOC_N(irallocx) #define isalloc JEMALLOC_N(isalloc) @@ -244,7 +244,7 @@ index 0000000..e6c8407 +#endif + diff --git a/src/jemalloc.c b/src/jemalloc.c -index bc350ed..352c98e 100644 +index ae56db6..1412a5e 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -8,6 +8,10 @@ malloc_tsd_data(, arenas, arena_t *, NULL) Modified: user/dchagin/lemul/contrib/jemalloc/FREEBSD-upgrade ============================================================================== --- user/dchagin/lemul/contrib/jemalloc/FREEBSD-upgrade Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/contrib/jemalloc/FREEBSD-upgrade Tue Oct 22 10:10:34 2013 (r256883) @@ -60,7 +60,7 @@ do_extract() { local rev=$1 # Clone. rm -rf ${work} - git clone git://canonware.com/jemalloc.git ${work} + git clone https://github.com/jemalloc/jemalloc.git ${work} ( cd ${work} if [ "x${rev}" != "x" ] ; then Modified: user/dchagin/lemul/contrib/jemalloc/VERSION ============================================================================== --- user/dchagin/lemul/contrib/jemalloc/VERSION Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/contrib/jemalloc/VERSION Tue Oct 22 10:10:34 2013 (r256883) @@ -1 +1 @@ -3.4.0-0-g0ed518e5dab789ad2171bb38977a8927e2a26775 +3.4.1-0-g0135fb806e4137dc9cdf152541926a2bc95e33f0 Modified: user/dchagin/lemul/contrib/jemalloc/doc/jemalloc.3 ============================================================================== --- user/dchagin/lemul/contrib/jemalloc/doc/jemalloc.3 Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/contrib/jemalloc/doc/jemalloc.3 Tue Oct 22 10:10:34 2013 (r256883) @@ -2,12 +2,12 @@ .\" Title: JEMALLOC .\" Author: Jason Evans .\" Generator: DocBook XSL Stylesheets v1.76.1 -.\" Date: 06/02/2013 +.\" Date: 10/20/2013 .\" Manual: User Manual -.\" Source: jemalloc 3.4.0-0-g0ed518e5dab789ad2171bb38977a8927e2a26775 +.\" Source: jemalloc 3.4.1-0-g0135fb806e4137dc9cdf152541926a2bc95e33f0 .\" Language: English .\" -.TH "JEMALLOC" "3" "06/02/2013" "jemalloc 3.4.0-0-g0ed518e5dab7" "User Manual" +.TH "JEMALLOC" "3" "10/20/2013" "jemalloc 3.4.1-0-g0135fb806e41" "User Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -31,7 +31,7 @@ jemalloc \- general purpose memory allocation functions .SH "LIBRARY" .PP -This manual describes jemalloc 3\&.4\&.0\-0\-g0ed518e5dab789ad2171bb38977a8927e2a26775\&. More information can be found at the +This manual describes jemalloc 3\&.4\&.1\-0\-g0135fb806e4137dc9cdf152541926a2bc95e33f0\&. More information can be found at the \m[blue]\fBjemalloc website\fR\m[]\&\s-2\u[1]\d\s+2\&. .PP The following configuration options are enabled in libc\*(Aqs built\-in jemalloc: Modified: user/dchagin/lemul/contrib/jemalloc/include/jemalloc/internal/arena.h ============================================================================== --- user/dchagin/lemul/contrib/jemalloc/include/jemalloc/internal/arena.h Tue Oct 22 09:58:31 2013 (r256882) +++ user/dchagin/lemul/contrib/jemalloc/include/jemalloc/internal/arena.h Tue Oct 22 10:10:34 2013 (r256883) @@ -441,6 +441,7 @@ void arena_postfork_child(arena_t *arena #ifndef JEMALLOC_ENABLE_INLINE arena_chunk_map_t *arena_mapp_get(arena_chunk_t *chunk, size_t pageind); size_t *arena_mapbitsp_get(arena_chunk_t *chunk, size_t pageind); +size_t arena_mapbitsp_read(size_t *mapbitsp); size_t arena_mapbits_get(arena_chunk_t *chunk, size_t pageind); size_t arena_mapbits_unallocated_size_get(arena_chunk_t *chunk, size_t pageind); @@ -451,6 +452,7 @@ size_t arena_mapbits_dirty_get(arena_chu size_t arena_mapbits_unzeroed_get(arena_chunk_t *chunk, size_t pageind); size_t arena_mapbits_large_get(arena_chunk_t *chunk, size_t pageind); size_t arena_mapbits_allocated_get(arena_chunk_t *chunk, size_t pageind); +void arena_mapbitsp_write(size_t *mapbitsp, size_t mapbits); void arena_mapbits_unallocated_set(arena_chunk_t *chunk, size_t pageind, size_t size, size_t flags); void arena_mapbits_unallocated_size_set(arena_chunk_t *chunk, size_t pageind, @@ -498,10 +500,17 @@ arena_mapbitsp_get(arena_chunk_t *chunk, } JEMALLOC_ALWAYS_INLINE size_t +arena_mapbitsp_read(size_t *mapbitsp) +{ + + return (*mapbitsp); +} + +JEMALLOC_ALWAYS_INLINE size_t arena_mapbits_get(arena_chunk_t *chunk, size_t pageind) { - return (*arena_mapbitsp_get(chunk, pageind)); + return (arena_mapbitsp_read(arena_mapbitsp_get(chunk, pageind))); } JEMALLOC_ALWAYS_INLINE size_t @@ -585,82 +594,89 @@ arena_mapbits_allocated_get(arena_chunk_ } JEMALLOC_ALWAYS_INLINE void +arena_mapbitsp_write(size_t *mapbitsp, size_t mapbits) +{ + + *mapbitsp = mapbits; +} + +JEMALLOC_ALWAYS_INLINE void arena_mapbits_unallocated_set(arena_chunk_t *chunk, size_t pageind, size_t size, size_t flags) { - size_t *mapbitsp; + size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind); - mapbitsp = arena_mapbitsp_get(chunk, pageind); assert((size & PAGE_MASK) == 0); assert((flags & ~CHUNK_MAP_FLAGS_MASK) == 0); assert((flags & (CHUNK_MAP_DIRTY|CHUNK_MAP_UNZEROED)) == flags); - *mapbitsp = size | CHUNK_MAP_BININD_INVALID | flags; + arena_mapbitsp_write(mapbitsp, size | CHUNK_MAP_BININD_INVALID | flags); } JEMALLOC_ALWAYS_INLINE void arena_mapbits_unallocated_size_set(arena_chunk_t *chunk, size_t pageind, size_t size) { - size_t *mapbitsp; + size_t *mapbitsp = arena_mapbitsp_get(chunk, pageind); + size_t mapbits = arena_mapbitsp_read(mapbitsp); - mapbitsp = arena_mapbitsp_get(chunk, pageind); assert((size & PAGE_MASK) == 0); - assert((*mapbitsp & (CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED)) == 0); - *mapbitsp = size | (*mapbitsp & PAGE_MASK); + assert((mapbits & (CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED)) == 0); + arena_mapbitsp_write(mapbitsp, size | (mapbits & PAGE_MASK)); } JEMALLOC_ALWAYS_INLINE void *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 13:45:04 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0BAD65DC; Tue, 22 Oct 2013 13:45:04 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id ED2C02C73; Tue, 22 Oct 2013 13:45:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MDj3gq005689; Tue, 22 Oct 2013 13:45:03 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MDj3Ca005688; Tue, 22 Oct 2013 13:45:03 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201310221345.r9MDj3Ca005688@svn.freebsd.org> From: Andre Oppermann Date: Tue, 22 Oct 2013 13:45:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256890 - user/andre/mbuf_staging/netinet X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 13:45:04 -0000 Author: andre Date: Tue Oct 22 13:45:03 2013 New Revision: 256890 URL: http://svnweb.freebsd.org/changeset/base/256890 Log: Add gross proof of concept hack to bypass the entire lower stack for outbound tcp sends for certain very high performance uses. Bypassing means packets going directly to the wire and skip over all firewalls or other processing done in ip_output() and ether_output(). This very first version only does one interface and MAC address lookup at the beginning of a connection. It doesn't detect any changes afterwards and will grind into a void if it has to. On certain errors it also leaks a bit of memory. The point of this patch is to allow for performance analysis of a) the normal vs. bypass path; b) to profile and optimize the normal path to bring it as close as possible to the bypass path. This patch is not intended to be merged to HEAD in its current form (or at all). Modified: user/andre/mbuf_staging/netinet/tcp_output.c Modified: user/andre/mbuf_staging/netinet/tcp_output.c ============================================================================== --- user/andre/mbuf_staging/netinet/tcp_output.c Tue Oct 22 13:31:36 2013 (r256889) +++ user/andre/mbuf_staging/netinet/tcp_output.c Tue Oct 22 13:45:03 2013 (r256890) @@ -129,6 +129,14 @@ static void inline hhook_run_tcp_est_out long len, int tso); static void inline cc_after_idle(struct tcpcb *tp); +#ifdef TCP_IFTRANSMIT +static int tcp_l2hdr(struct tcpcb *tp, struct in_conninfo *inc); +static int tcp_ifsend(struct tcpcb *tp, struct mbuf *m); + +#define t_ifp t_pspare2[0] +#define t_l2h t_pspare2[1] +#endif + /* * Wrapper for the TCP established output helper hook. */ @@ -1228,6 +1236,13 @@ send: TCP_PROBE5(send, NULL, tp, ip, tp, th); +#ifdef TCP_IFTRANSMIT + if (tp->t_l2h == NULL) + (void)tcp_l2hdr(tp, &tp->t_inpcb->inp_inc); + if (tp->t_ifp != NULL) { + tcp_ifsend(tp, m); + } else +#endif error = ip_output(m, tp->t_inpcb->inp_options, &ro, ((so->so_options & SO_DONTROUTE) ? IP_ROUTETOIF : 0), 0, tp->t_inpcb); @@ -1424,6 +1439,71 @@ tcp_setpersist(struct tcpcb *tp) tp->t_rxtshift++; } +#ifdef TCP_IFTRANSMIT +#include +#include +#include +#include +#include +#include +#include +#include + +static int +tcp_l2hdr(struct tcpcb *tp, struct in_conninfo *inc) +{ + struct route sro; + struct sockaddr_in *dst; + struct ifnet *ifp; + struct llentry *lle = NULL; + struct ether_header *eh; + + /* Look up destination interface. */ + bzero(&sro, sizeof(sro)); + if (inc->inc_faddr.s_addr == INADDR_ANY) + return (ENOBUFS); + dst = (struct sockaddr_in *)&sro.ro_dst; + dst->sin_family = AF_INET; + dst->sin_len = sizeof(*dst); + dst->sin_addr = inc->inc_faddr; + in_rtalloc_ign(&sro, 0, inc->inc_fibnum); + if (sro.ro_rt == NULL) + return (ENOBUFS); + ifp = sro.ro_rt->rt_ifp; + RO_RTFREE(&sro); + + if ((tp->t_l2h = malloc(ETHER_HDR_LEN, M_TEMP, M_NOWAIT)) == NULL) + return (ENOBUFS); + + eh = tp->t_l2h; + if (arpresolve(ifp, NULL, NULL, &sro.ro_dst, (u_char *)(&eh->ether_dhost), + &lle) != 0) + return (ENOBUFS); /* XXX leak */ + (void)memcpy(eh->ether_shost, IF_LLADDR(ifp), sizeof(eh->ether_shost)); + eh->ether_type = htons(ETHERTYPE_IP); + tp->t_ifp = ifp; + + return (0); +} + +static int +tcp_ifsend(struct tcpcb *tp, struct mbuf *m) +{ + struct ether_header *eh; + struct ifnet *ifp; + + M_PREPEND(m, ETHER_HDR_LEN, M_NOWAIT); + if (m == NULL) + return (ENOBUFS); + + ifp = tp->t_ifp; + eh = mtod(m, struct ether_header *); + (void)memcpy(eh, tp->t_l2h, ETHER_HDR_LEN); + + return ((ifp->if_transmit)(ifp, m)); +} +#endif /* TCP_IFTRANSMIT */ + /* * Insert TCP options according to the supplied parameters to the place * optp in a consistent way. Can handle unaligned destinations. From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 13:47:26 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 84ADD706; Tue, 22 Oct 2013 13:47:26 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 594402C8B; Tue, 22 Oct 2013 13:47:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MDlQ5Y006342; Tue, 22 Oct 2013 13:47:26 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MDlQx8006341; Tue, 22 Oct 2013 13:47:26 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310221347.r9MDlQx8006341@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 22 Oct 2013 13:47:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256891 - user/ed/newcons/sys/sys X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 13:47:26 -0000 Author: ray Date: Tue Oct 22 13:47:25 2013 New Revision: 256891 URL: http://svnweb.freebsd.org/changeset/base/256891 Log: o Add simplified structure describing framebuffer object. o Add EVENTHANDLER wrapper to register/unregister framebuffer w/o depend on new framebuffer methods. Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/sys/fbio.h Modified: user/ed/newcons/sys/sys/fbio.h ============================================================================== --- user/ed/newcons/sys/sys/fbio.h Tue Oct 22 13:45:03 2013 (r256890) +++ user/ed/newcons/sys/sys/fbio.h Tue Oct 22 13:47:25 2013 (r256891) @@ -40,6 +40,10 @@ #ifndef _KERNEL #include +#else +#include +#include +#include #endif #include @@ -101,6 +105,75 @@ struct fbtype { }; #define FBIOGTYPE _IOR('F', 0, struct fbtype) +#define FBTYPE_GET_STRIDE(_fb) ((_fb)->fb_size / (_fb)->fb_height) +#define FBTYPE_GET_BPP(_fb) ((_fb)->fb_bpp) +#define FBTYPE_GET_BYTESPP(_fb) ((_fb)->fb_bpp / 8) + +#ifdef _KERNEL + +struct fb_info; + +typedef int fb_enter_t(void *priv); +typedef int fb_leave_t(void *priv); +typedef int fb_write_t(void *priv, int offset, void *data, int size); +typedef int fb_read_t(void *priv, int offset, void *data, int size); + +/* XXX: should use priv instead of fb_info too. */ +typedef void fb_wr1_t(struct fb_info *sc, uint32_t offset, uint8_t value); +typedef void fb_wr2_t(struct fb_info *sc, uint32_t offset, uint16_t value); +typedef void fb_wr4_t(struct fb_info *sc, uint32_t offset, uint32_t value); + +struct fb_info { + /* Raw copy of fbtype. Do not change. */ + int fb_type; /* as defined above */ + int fb_height; /* in pixels */ + int fb_width; /* in pixels */ + int fb_depth; /* bits to define color */ + int fb_cmsize; /* size of color map (entries) */ + int fb_size; /* total size in bytes */ + + /* Methods. */ + fb_write_t *fb_write; /* if NULL, direct mem write. */ + fb_read_t *fb_read; /* if NULL, direct mem read. */ + + fb_wr1_t *wr1; + fb_wr2_t *wr2; + fb_wr4_t *wr4; + fb_enter_t *enter; + fb_leave_t *leave; + + intptr_t fb_pbase; /* For FB mmap. */ + intptr_t fb_vbase; /* if NULL, use fb_write/fb_read. */ + void *fb_priv; /* First argument for read/write. */ + const char *fb_name; + uint32_t fb_flags; + int fb_stride; + int fb_bpp; /* bits per pixel */ +#define FB_FLAG_NOMMAP 1 /* mmap unsupported. */ + uint32_t fb_cmap[16]; +}; + +int fbd_list(void); +int fbd_register(struct fb_info *); +int fbd_unregister(struct fb_info *); + +static inline int +register_framebuffer(struct fb_info *info) +{ + + EVENTHANDLER_INVOKE(register_framebuffer, info); + return (0); +} + +static inline int +unregister_framebuffer(struct fb_info *info) +{ + + EVENTHANDLER_INVOKE(unregister_framebuffer, info); + return (0); +} +#endif + #ifdef notdef /* * General purpose structure for passing info in and out of frame buffers From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 13:50:55 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 062979DA; Tue, 22 Oct 2013 13:50:55 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E68872CD5; Tue, 22 Oct 2013 13:50:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MDosPO010745; Tue, 22 Oct 2013 13:50:54 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MDostB010744; Tue, 22 Oct 2013 13:50:54 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310221350.r9MDostB010744@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 22 Oct 2013 13:50:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256892 - user/ed/newcons/sys/sys X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 13:50:55 -0000 Author: ray Date: Tue Oct 22 13:50:54 2013 New Revision: 256892 URL: http://svnweb.freebsd.org/changeset/base/256892 Log: Declare framebuffer's register/unregister EVENTHANDLERs. Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/sys/eventhandler.h Modified: user/ed/newcons/sys/sys/eventhandler.h ============================================================================== --- user/ed/newcons/sys/sys/eventhandler.h Tue Oct 22 13:47:25 2013 (r256891) +++ user/ed/newcons/sys/sys/eventhandler.h Tue Oct 22 13:50:54 2013 (r256892) @@ -275,4 +275,11 @@ EVENTHANDLER_DECLARE(kld_load, kld_load_ EVENTHANDLER_DECLARE(kld_unload, kld_unload_fn); EVENTHANDLER_DECLARE(kld_unload_try, kld_unload_try_fn); +/* Generic graphics framebuffer interface */ +struct fb_info; +typedef void (*register_framebuffer_fn)(void *, struct fb_info *); +typedef void (*unregister_framebuffer_fn)(void *, struct fb_info *); +EVENTHANDLER_DECLARE(register_framebuffer, register_framebuffer_fn); +EVENTHANDLER_DECLARE(unregister_framebuffer, unregister_framebuffer_fn); + #endif /* SYS_EVENTHANDLER_H */ From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 13:53:58 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 913BADD2; Tue, 22 Oct 2013 13:53:58 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7F2482CF1; Tue, 22 Oct 2013 13:53:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MDrwBL015128; Tue, 22 Oct 2013 13:53:58 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MDrwlA015127; Tue, 22 Oct 2013 13:53:58 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310221353.r9MDrwlA015127@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 22 Oct 2013 13:53:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256894 - user/ed/newcons/sys/dev/vt X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 13:53:58 -0000 Author: ray Date: Tue Oct 22 13:53:58 2013 New Revision: 256894 URL: http://svnweb.freebsd.org/changeset/base/256894 Log: Don't forget to clean terminal window memory. But colors makes more smiles. Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/dev/vt/vt_buf.c Modified: user/ed/newcons/sys/dev/vt/vt_buf.c ============================================================================== --- user/ed/newcons/sys/dev/vt/vt_buf.c Tue Oct 22 13:52:20 2013 (r256893) +++ user/ed/newcons/sys/dev/vt/vt_buf.c Tue Oct 22 13:53:58 2013 (r256894) @@ -336,10 +336,10 @@ vtbuf_init(struct vt_buf *vb, const term if ((vb->vb_flags & VBF_STATIC) == 0) { sz = vb->vb_history_size * p->tp_col * sizeof(term_char_t); - vb->vb_buffer = malloc(sz, M_VTBUF, M_WAITOK); + vb->vb_buffer = malloc(sz, M_VTBUF, M_WAITOK | M_ZERO); sz = vb->vb_history_size * sizeof(term_char_t *); - vb->vb_rows = malloc(sz, M_VTBUF, M_WAITOK); + vb->vb_rows = malloc(sz, M_VTBUF, M_WAITOK | M_ZERO); } vtbuf_init_early(vb); @@ -369,9 +369,9 @@ vtbuf_grow(struct vt_buf *vb, const term vb->vb_scr_size.tp_col) { /* Allocate new buffer. */ bufsize = history_size * p->tp_col * sizeof(term_char_t); - new = malloc(bufsize, M_VTBUF, M_WAITOK|M_ZERO); + new = malloc(bufsize, M_VTBUF, M_WAITOK | M_ZERO); rowssize = history_size * sizeof(term_pos_t *); - rows = malloc(rowssize, M_VTBUF, M_WAITOK|M_ZERO); + rows = malloc(rowssize, M_VTBUF, M_WAITOK | M_ZERO); /* Toggle it. */ VTBUF_LOCK(vb); From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 13:56:44 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id F2BEB204; Tue, 22 Oct 2013 13:56:43 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C5BAA2D10; Tue, 22 Oct 2013 13:56:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MDuhcq017896; Tue, 22 Oct 2013 13:56:43 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MDuhTD017891; Tue, 22 Oct 2013 13:56:43 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310221356.r9MDuhTD017891@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 22 Oct 2013 13:56:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256896 - in user/ed/newcons/sys/dev/vt/hw: intel ofwfb xboxfb X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 13:56:44 -0000 Author: ray Date: Tue Oct 22 13:56:42 2013 New Revision: 256896 URL: http://svnweb.freebsd.org/changeset/base/256896 Log: Hardware specific drivers have bigger priority (over VGA for example). Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/dev/vt/hw/intel/intel.c user/ed/newcons/sys/dev/vt/hw/ofwfb/ofwfb.c user/ed/newcons/sys/dev/vt/hw/xboxfb/xboxfb.c Modified: user/ed/newcons/sys/dev/vt/hw/intel/intel.c ============================================================================== --- user/ed/newcons/sys/dev/vt/hw/intel/intel.c Tue Oct 22 13:56:30 2013 (r256895) +++ user/ed/newcons/sys/dev/vt/hw/intel/intel.c Tue Oct 22 13:56:42 2013 (r256896) @@ -65,8 +65,8 @@ static vd_bitbltchr_t intel_vtbitbltchr; static struct vt_driver intel_vtops = { .vd_init = intel_vtinit, .vd_bitbltchr = intel_vtbitbltchr, - /* Prefer to use KMS, so GENERIC - 10 */ - .vd_priority = VD_PRIORITY_GENERIC - 10, + /* Prefer to use KMS, so GENERIC + 10 */ + .vd_priority = VD_PRIORITY_GENERIC + 10, }; struct intel_softc { Modified: user/ed/newcons/sys/dev/vt/hw/ofwfb/ofwfb.c ============================================================================== --- user/ed/newcons/sys/dev/vt/hw/ofwfb/ofwfb.c Tue Oct 22 13:56:30 2013 (r256895) +++ user/ed/newcons/sys/dev/vt/hw/ofwfb/ofwfb.c Tue Oct 22 13:56:42 2013 (r256896) @@ -66,7 +66,7 @@ static const struct vt_driver vt_ofwfb_d .vd_init = ofwfb_init, .vd_blank = ofwfb_blank, .vd_bitbltchr = ofwfb_bitbltchr, - .vd_priority = VD_PRIORITY_GENERIC, + .vd_priority = VD_PRIORITY_GENERIC+1, }; static struct ofwfb_softc ofwfb_conssoftc; Modified: user/ed/newcons/sys/dev/vt/hw/xboxfb/xboxfb.c ============================================================================== --- user/ed/newcons/sys/dev/vt/hw/xboxfb/xboxfb.c Tue Oct 22 13:56:30 2013 (r256895) +++ user/ed/newcons/sys/dev/vt/hw/xboxfb/xboxfb.c Tue Oct 22 13:56:42 2013 (r256896) @@ -67,7 +67,7 @@ static const struct vt_driver vt_xbox_dr .vd_init = xbox_init, .vd_blank = xbox_blank, .vd_bitbltchr = xbox_bitbltchr, - .vd_priority = VD_PRIORITY_GENERIC, + .vd_priority = VD_PRIORITY_GENERIC+1, }; static struct xbox_softc xbox_conssoftc; From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 14:00:47 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 719436B1; Tue, 22 Oct 2013 14:00:47 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 451112D5F; Tue, 22 Oct 2013 14:00:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9ME0lkL023740; Tue, 22 Oct 2013 14:00:47 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9ME0kX5023738; Tue, 22 Oct 2013 14:00:46 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310221400.r9ME0kX5023738@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 22 Oct 2013 14:00:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256897 - in user/ed/newcons/sys: kern sys X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 14:00:47 -0000 Author: ray Date: Tue Oct 22 14:00:46 2013 New Revision: 256897 URL: http://svnweb.freebsd.org/changeset/base/256897 Log: Add new terminal method terminal_set_winsize_blank. Same as terminal_set_winsize, but with optional blank. That will allow us to see early messages after attach more specific driver. Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/kern/subr_terminal.c user/ed/newcons/sys/sys/terminal.h Modified: user/ed/newcons/sys/kern/subr_terminal.c ============================================================================== --- user/ed/newcons/sys/kern/subr_terminal.c Tue Oct 22 13:56:42 2013 (r256896) +++ user/ed/newcons/sys/kern/subr_terminal.c Tue Oct 22 14:00:46 2013 (r256897) @@ -188,7 +188,8 @@ terminal_maketty(struct terminal *tm, co } void -terminal_set_winsize(struct terminal *tm, const struct winsize *size) +terminal_set_winsize_blank(struct terminal *tm, const struct winsize *size, + int blank) { term_rect_t r; @@ -201,14 +202,21 @@ terminal_set_winsize(struct terminal *tm TERMINAL_LOCK(tm); teken_set_winsize(&tm->tm_emulator, &r.tr_end); TERMINAL_UNLOCK(tm); - - /* Blank screen. */ - tm->tm_class->tc_fill(tm, &r, - TCHAR_CREATE((teken_char_t)' ', &default_message)); + + if (blank) + tm->tm_class->tc_fill(tm, &r, + TCHAR_CREATE((teken_char_t)' ', &default_message)); terminal_sync_ttysize(tm); } +void +terminal_set_winsize(struct terminal *tm, const struct winsize *size) +{ + + terminal_set_winsize_blank(tm, size, 1); +} + /* * XXX: This function is a kludge. Drivers like vt(4) need to * temporarily stop input when resizing, etc. This should ideally be Modified: user/ed/newcons/sys/sys/terminal.h ============================================================================== --- user/ed/newcons/sys/sys/terminal.h Tue Oct 22 13:56:42 2013 (r256896) +++ user/ed/newcons/sys/sys/terminal.h Tue Oct 22 14:00:46 2013 (r256897) @@ -135,6 +135,8 @@ struct terminal { struct terminal *terminal_alloc(const struct terminal_class *tc, void *softc); void terminal_maketty(struct terminal *tm, const char *fmt, ...); +void terminal_set_winsize_blank(struct terminal *tm, + const struct winsize *size, int blank); void terminal_set_winsize(struct terminal *tm, const struct winsize *size); void terminal_mute(struct terminal *tm, int yes); void terminal_input_char(struct terminal *tm, term_char_t c); From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 14:32:43 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9358039D; Tue, 22 Oct 2013 14:32:43 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 804162F3D; Tue, 22 Oct 2013 14:32:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MEWhY2044995; Tue, 22 Oct 2013 14:32:43 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MEWhrF044993; Tue, 22 Oct 2013 14:32:43 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310221432.r9MEWhrF044993@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 22 Oct 2013 14:32:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256902 - user/ed/newcons/sys/dev/vt X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 14:32:43 -0000 Author: ray Date: Tue Oct 22 14:32:42 2013 New Revision: 256902 URL: http://svnweb.freebsd.org/changeset/base/256902 Log: Reverse priority. Bigger now better. Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/dev/vt/vt.h Modified: user/ed/newcons/sys/dev/vt/vt.h ============================================================================== --- user/ed/newcons/sys/dev/vt/vt.h Tue Oct 22 14:11:16 2013 (r256901) +++ user/ed/newcons/sys/dev/vt/vt.h Tue Oct 22 14:32:42 2013 (r256902) @@ -234,9 +234,9 @@ struct vt_driver { /* Priority to know which one can override */ int vd_priority; -#define VD_PRIORITY_DUMB 10000 -#define VD_PRIORITY_GENERIC 1000 -#define VD_PRIORITY_SPECIFIC 100 +#define VD_PRIORITY_DUMB 10 +#define VD_PRIORITY_GENERIC 100 +#define VD_PRIORITY_SPECIFIC 1000 }; /* From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 14:37:21 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 4A1CB796; Tue, 22 Oct 2013 14:37:21 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1BA562F72; Tue, 22 Oct 2013 14:37:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MEbKa7046500; Tue, 22 Oct 2013 14:37:20 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MEbKCj046499; Tue, 22 Oct 2013 14:37:20 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310221437.r9MEbKCj046499@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 22 Oct 2013 14:37:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256903 - user/ed/newcons/sys/dev/vt X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 14:37:21 -0000 Author: ray Date: Tue Oct 22 14:37:20 2013 New Revision: 256903 URL: http://svnweb.freebsd.org/changeset/base/256903 Log: o Do not blank screen on window resize. o Force resize for first window (usually console). o Inform user on driver changes. o Reverse priority. Bigger now better. Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/dev/vt/vt_core.c Modified: user/ed/newcons/sys/dev/vt/vt_core.c ============================================================================== --- user/ed/newcons/sys/dev/vt/vt_core.c Tue Oct 22 14:32:42 2013 (r256902) +++ user/ed/newcons/sys/dev/vt/vt_core.c Tue Oct 22 14:37:20 2013 (r256903) @@ -640,8 +640,7 @@ vt_flush(struct vt_device *vd) continue; vt_bitblt_char(vd, vf, r[col], - VTBUF_ISCURSOR(&vw->vw_buf, row, col), - row, col); + VTBUF_ISCURSOR(&vw->vw_buf, row, col), row, col); } } } @@ -900,7 +899,7 @@ vt_change_font(struct vt_window *vw, str /* Grow the screen buffer and terminal. */ terminal_mute(tm, 1); vtbuf_grow(&vw->vw_buf, &size, vw->vw_buf.vb_history_size); - terminal_set_winsize(tm, &wsz); + terminal_set_winsize_blank(tm, &wsz, 0); terminal_mute(tm, 0); /* Actually apply the font to the current window. */ @@ -1381,17 +1380,23 @@ void vt_allocate(struct vt_driver *drv, void *softc) { struct vt_device *vd; + struct winsize wsz; if (main_vd == NULL) { main_vd = malloc(sizeof *vd, M_VT, M_WAITOK|M_ZERO); + printf("%s: VT initialize with new VT driver.\n", __func__); } else { /* * Check if have rights to replace current driver. For example: * it is bad idea to replace KMS driver with generic VGA one. */ - /* Lowest preferred. */ - if (drv->vd_priority >= main_vd->vd_driver->vd_priority) + if (drv->vd_priority <= main_vd->vd_driver->vd_priority) { + printf("%s: Driver priority %d too low. Current %d\n ", + __func__, drv->vd_priority, + main_vd->vd_driver->vd_priority); return; + } + printf("%s: Replace existing VT driver.\n", __func__); } vd = main_vd; @@ -1415,4 +1420,8 @@ vt_allocate(struct vt_driver *drv, void callout_schedule(&vd->vd_timer, hz / VT_TIMERFREQ); termcn_cnregister(vd->vd_windows[VT_CONSWINDOW]->vw_terminal); + + /* Update console window sizes to actual. */ + vt_winsize(vd, vd->vd_windows[VT_CONSWINDOW]->vw_font, &wsz); + terminal_set_winsize(vd->vd_windows[VT_CONSWINDOW]->vw_terminal, &wsz); } From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 14:39:33 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3987A895; Tue, 22 Oct 2013 14:39:33 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 17E982F7F; Tue, 22 Oct 2013 14:39:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MEdWeb046971; Tue, 22 Oct 2013 14:39:32 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MEdW9o046969; Tue, 22 Oct 2013 14:39:32 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310221439.r9MEdW9o046969@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 22 Oct 2013 14:39:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256904 - user/ed/newcons/sys/dev/vt/hw/fb X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 14:39:33 -0000 Author: ray Date: Tue Oct 22 14:39:32 2013 New Revision: 256904 URL: http://svnweb.freebsd.org/changeset/base/256904 Log: Add VT(9) driver for generic framebuffer. Sponsored by: The FreeBSD Foundation Added: user/ed/newcons/sys/dev/vt/hw/fb/ user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.c (contents, props changed) user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.h (contents, props changed) Added: user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.c Tue Oct 22 14:39:32 2013 (r256904) @@ -0,0 +1,217 @@ +/*- + * Copyright (c) 2013 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Aleksandr Rybalko 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$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +static vd_init_t vt_fb_init; +static vd_blank_t vt_fb_blank; +static vd_bitbltchr_t vt_fb_bitbltchr; +static vd_postswitch_t vt_fb_postswitch; + +static struct vt_driver vt_fb_driver = { + .vd_init = vt_fb_init, + .vd_blank = vt_fb_blank, + .vd_bitbltchr = vt_fb_bitbltchr, + .vd_postswitch = vt_fb_postswitch, + .vd_priority = VD_PRIORITY_GENERIC+10, +}; + +static void +vt_fb_blank(struct vt_device *vd, term_color_t color) +{ + struct fb_info *info; + uint32_t c; + u_int o; + + info = vd->vd_softc; + c = info->fb_cmap[color]; + switch (FBTYPE_GET_BYTESPP(info)) { + case 1: + for (o = 0; o < info->fb_stride; o++) + info->wr1(info, o, c); + break; + case 2: + for (o = 0; o < info->fb_stride; o += 2) + info->wr2(info, o, c); + break; + case 3: + /* line 0 */ + for (o = 0; o < info->fb_stride; o += 3) { + info->wr1(info, o, (c >> 16) & 0xff); + info->wr1(info, o + 1, (c >> 8) & 0xff); + info->wr1(info, o + 2, c & 0xff); + } + break; + case 4: + for (o = 0; o < info->fb_stride; o += 4) + info->wr4(info, o, c); + break; + default: + /* panic? */ + return; + } + /* Copy line0 to all other lines. */ + /* XXX will copy with borders. */ + for (o = 1; o < info->fb_height; o++) { + memmove((void *)(info->fb_vbase + o * info->fb_stride), + (void *)info->fb_vbase, info->fb_stride); + } +} + +static void +vt_fb_bitbltchr(struct vt_device *vd, const uint8_t *src, + vt_axis_t top, vt_axis_t left, unsigned int width, unsigned int height, + term_color_t fg, term_color_t bg) +{ + struct fb_info *info; + uint32_t fgc, bgc, cc, o; + int c, l, bpp; + u_long line; + uint8_t b; + + b = 0; + info = vd->vd_softc; + bpp = FBTYPE_GET_BYTESPP(info); + fgc = info->fb_cmap[fg]; + bgc = info->fb_cmap[bg]; + + line = (info->fb_stride * top) + (left * bpp); + for (l = 0; l < height; l++) { + for (c = 0; c < width; c++) { + if (c % 8 == 0) + b = *src++; + else + b <<= 1; + o = line + (c * bpp); + cc = b & 0x80 ? fgc : bgc; + + switch(bpp) { + case 1: + info->wr1(info, o, cc); + break; + case 2: + info->wr2(info, o, cc); + break; + case 3: + /* Packed mode, so unaligned. Byte access. */ + info->wr1(info, o, (cc >> 16) & 0xff); + info->wr1(info, o + 1, (cc >> 8) & 0xff); + info->wr1(info, o + 2, cc & 0xff); + break; + case 4: + info->wr4(info, o, cc); + break; + default: + /* panic? */ + break; + } + } + line += info->fb_stride; + } +} + +static void +vt_fb_postswitch(struct vt_device *vd) +{ + struct fb_info *info; + + info = vd->vd_softc; + + if (info->enter != NULL) + info->enter(info->fb_priv); +} + +static int +vt_fb_init_cmap(uint32_t *cmap, int depth) +{ + + switch (depth) { + case 8: + return (vt_generate_vga_palette(cmap, COLOR_FORMAT_RGB, + 0x7, 5, 0x7, 2, 0x3, 0)); + case 15: + return (vt_generate_vga_palette(cmap, COLOR_FORMAT_RGB, + 0x1f, 10, 0x1f, 5, 0x1f, 0)); + case 16: + return (vt_generate_vga_palette(cmap, COLOR_FORMAT_RGB, + 0x1f, 11, 0x3f, 5, 0x1f, 0)); + case 24: + case 32: /* Ignore alpha. */ + return (vt_generate_vga_palette(cmap, COLOR_FORMAT_RGB, + 0xff, 0, 0xff, 8, 0xff, 16)); + default: + return (1); + } +} + +static int +vt_fb_init(struct vt_device *vd) +{ + struct fb_info *info; + int err; + + info = vd->vd_softc; + vd->vd_height = info->fb_height; + vd->vd_width = info->fb_width; + + if (info->fb_cmsize <= 0) { + err = vt_fb_init_cmap(info->fb_cmap, FBTYPE_GET_BPP(info)); + if (err) + return (CN_DEAD); + info->fb_cmsize = 16; + } + + /* Clear the screen. */ + vt_fb_blank(vd, TC_BLACK); + + /* Wakeup screen. KMS need this. */ + vt_fb_postswitch(vd); + + return (CN_INTERNAL); +} + +int +vt_fb_attach(struct fb_info *info) +{ + + vt_allocate(&vt_fb_driver, info); + return (0); +} Added: user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.h Tue Oct 22 14:39:32 2013 (r256904) @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2013 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Aleksandr Rybalko 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$ + */ + +#ifndef _DEV_VT_HW_FB_VT_FB_H_ +#define _DEV_VT_HW_FB_VT_FB_H_ +/* Generic framebuffer interface call vt_fb_attach to init VT(9) */ +int vt_fb_attach(struct fb_info *info); + +#endif /* _DEV_VT_HW_FB_VT_FB_H_ */ From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 14:45:35 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D92E3BB0; Tue, 22 Oct 2013 14:45:35 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B6F812FE2; Tue, 22 Oct 2013 14:45:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MEjZxW050981; Tue, 22 Oct 2013 14:45:35 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MEjZrP050980; Tue, 22 Oct 2013 14:45:35 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310221445.r9MEjZrP050980@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 22 Oct 2013 14:45:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256905 - user/ed/newcons/sys/dev/fb X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 14:45:35 -0000 Author: ray Date: Tue Oct 22 14:45:35 2013 New Revision: 256905 URL: http://svnweb.freebsd.org/changeset/base/256905 Log: Add generic/simple framebuffer. Sponsored by: The FreeBSD Foundation Added: user/ed/newcons/sys/dev/fb/fbd.c (contents, props changed) Added: user/ed/newcons/sys/dev/fb/fbd.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ed/newcons/sys/dev/fb/fbd.c Tue Oct 22 14:45:35 2013 (r256905) @@ -0,0 +1,324 @@ +/*- + * Copyright (c) 2013 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Aleksandr Rybalko 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$ + */ + +/* Generic framebuffer */ +/* TODO unlink from VT(9) */ +/* TODO done normal /dev/fb methods */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +LIST_HEAD(fb_list_head_t, fb_list_entry) fb_list_head = + LIST_HEAD_INITIALIZER(fb_list_head); +struct fb_list_entry { + struct fb_info *fb_info; + struct cdev *fb_si; + LIST_ENTRY(fb_list_entry) fb_list; +}; + +static void fbd_evh_init(void *); +/* SI_ORDER_SECOND, just after EVENTHANDLERs initialized. */ +SYSINIT(fbd_evh_init, SI_SUB_CONFIGURE, SI_ORDER_SECOND, fbd_evh_init, NULL); + +static d_open_t fb_open; +static d_close_t fb_close; +static d_read_t fb_read; +static d_write_t fb_write; +static d_ioctl_t fb_ioctl; +static d_mmap_t fb_mmap; + +static struct cdevsw fb_cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT, + .d_open = fb_open, + .d_close = fb_close, + .d_read = fb_read, + .d_write = fb_write, + .d_ioctl = fb_ioctl, + .d_mmap = fb_mmap, + .d_name = "fb", +}; + +static int framebuffer_dev_unit = 0; + +static int +fb_open(struct cdev *dev, int oflags, int devtype, struct thread *td) +{ + + return (0); +} + +static int +fb_close(struct cdev *dev, int fflag, int devtype, struct thread *td) +{ + + return (0); +} + +static int +fb_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, + struct thread *td) +{ + + return (0); +} + +static int +fb_read(struct cdev *dev, struct uio *uio, int ioflag) +{ + + return (0); /* XXX nothing to read, yet */ +} + +static int +fb_write(struct cdev *dev, struct uio *uio, int ioflag) +{ + + return (0); /* XXX nothing written */ +} + +static int +fb_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, + vm_memattr_t *memattr) +{ + struct fb_info *info; + + info = dev->si_drv1; + if (offset < info->fb_size) { + *paddr = info->fb_pbase + offset; + return (0); + } + return (EINVAL); +} + + +static void +vt_fb_mem_wr1(struct fb_info *sc, uint32_t o, uint8_t v) +{ + + KASSERT((o < sc->fb_size), ("Offset %#08x out of fb size", o)); + *(uint8_t *)(sc->fb_vbase + o) = v; +} + +static void +vt_fb_mem_wr2(struct fb_info *sc, uint32_t o, uint16_t v) +{ + + KASSERT((o < sc->fb_size), ("Offset %#08x out of fb size", o)); + *(uint16_t *)(sc->fb_vbase + o) = v; +} + +static void +vt_fb_mem_wr4(struct fb_info *sc, uint32_t o, uint32_t v) +{ + + KASSERT((o < sc->fb_size), ("Offset %#08x out of fb size", o)); + *(uint32_t *)(sc->fb_vbase + o) = v; +} + +static void +vt_fb_indir_wr1(struct fb_info *sc, uint32_t o, uint8_t v) +{ + + KASSERT((o < sc->fb_size), ("Offset %#08x out of fb size", o)); + sc->fb_write(sc->fb_priv, o, &v, 1); +} + +static void +vt_fb_indir_wr2(struct fb_info *sc, uint32_t o, uint16_t v) +{ + + KASSERT((o < sc->fb_size), ("Offset %#08x out of fb size", o)); + sc->fb_write(sc->fb_priv, o, &v, 2); +} + +static void +vt_fb_indir_wr4(struct fb_info *sc, uint32_t o, uint32_t v) +{ + + KASSERT((o < sc->fb_size), ("Offset %#08x out of fb size", o)); + sc->fb_write(sc->fb_priv, o, &v, 4); +} + +static int +fb_probe(struct fb_info *info) +{ + + if (info->fb_size == 0) + return (ENXIO); + + if (info->fb_write != NULL) { + if (info->fb_write == NULL) { + return (EINVAL); + } + info->fb_flags |= FB_FLAG_NOMMAP; + info->wr1 = &vt_fb_indir_wr1; + info->wr2 = &vt_fb_indir_wr2; + info->wr4 = &vt_fb_indir_wr4; + } else if (info->fb_vbase != 0) { + if (info->fb_pbase == 0) + info->fb_flags |= FB_FLAG_NOMMAP; + info->wr1 = &vt_fb_mem_wr1; + info->wr2 = &vt_fb_mem_wr2; + info->wr4 = &vt_fb_mem_wr4; + } else + return (ENXIO); + + return (0); +} + + +static int +fb_init(struct fb_list_entry *entry, int unit) +{ + struct fb_info *info; + + info = entry->fb_info; + entry->fb_si = make_dev(&fb_cdevsw, unit, UID_ROOT, GID_WHEEL, + 0600, "fb%d", unit); + entry->fb_si->si_drv1 = info; + + return (0); +} + +int +fbd_list() +{ + struct fb_list_entry *entry; + + if (LIST_EMPTY(&fb_list_head)) + return (ENOENT); + + LIST_FOREACH(entry, &fb_list_head, fb_list) { + printf("FB %s @%p\n", entry->fb_info->fb_name, + (void *)entry->fb_info->fb_pbase); + } + + return (0); +} + +static struct fb_list_entry * +fbd_find(struct fb_info* info) +{ + struct fb_list_entry *entry, *tmp; + + LIST_FOREACH_SAFE(entry, &fb_list_head, fb_list, tmp) { + if (entry->fb_info == info) { + return (entry); + } + } + + return (NULL); +} + +int +fbd_register(struct fb_info* info) +{ + struct fb_list_entry *entry; + int err, first; + + first = 0; + if (LIST_EMPTY(&fb_list_head)) + first++; + + entry = fbd_find(info); + if (entry != NULL) { + /* XXX Update framebuffer params */ + return (0); + } + + err = fb_probe(info); + if (err) + return (err); + + entry = malloc(sizeof(struct fb_list_entry), M_DEVBUF, M_WAITOK|M_ZERO); + entry->fb_info = info; + + LIST_INSERT_HEAD(&fb_list_head, entry, fb_list); + + err = fb_init(entry, framebuffer_dev_unit++); + if (err) + return (err); + + if (first) + vt_fb_attach(info); + + return (0); +} + +int +fbd_unregister(struct fb_info* info) +{ + struct fb_list_entry *entry, *tmp; + + LIST_FOREACH_SAFE(entry, &fb_list_head, fb_list, tmp) { + if (entry->fb_info == info) { + LIST_REMOVE(entry, fb_list); + free(entry, M_DEVBUF); + return (0); + } + } + + return (ENOENT); +} + +static void +register_fb_wrap(void *arg, void *ptr) +{ + + fbd_register((struct fb_info *)ptr); +} + +static void +unregister_fb_wrap(void *arg, void *ptr) +{ + + fbd_unregister((struct fb_info *)ptr); +} + +static void +fbd_evh_init(void *ctx) +{ + + EVENTHANDLER_REGISTER(register_framebuffer, register_fb_wrap, NULL, + EVENTHANDLER_PRI_ANY); + EVENTHANDLER_REGISTER(unregister_framebuffer, unregister_fb_wrap, NULL, + EVENTHANDLER_PRI_ANY); +} From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 14:47:09 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id EDCE7CCD; Tue, 22 Oct 2013 14:47:09 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DB3D92FEE; Tue, 22 Oct 2013 14:47:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MEl9jm051482; Tue, 22 Oct 2013 14:47:09 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MEl9Eu051481; Tue, 22 Oct 2013 14:47:09 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310221447.r9MEl9Eu051481@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 22 Oct 2013 14:47:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256906 - user/ed/newcons/sys/conf X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 14:47:10 -0000 Author: ray Date: Tue Oct 22 14:47:09 2013 New Revision: 256906 URL: http://svnweb.freebsd.org/changeset/base/256906 Log: Enable to build vt_fb driver and generic framebuffer. Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/conf/files Modified: user/ed/newcons/sys/conf/files ============================================================================== --- user/ed/newcons/sys/conf/files Tue Oct 22 14:45:35 2013 (r256905) +++ user/ed/newcons/sys/conf/files Tue Oct 22 14:47:09 2013 (r256906) @@ -1398,6 +1398,7 @@ dev/ex/if_ex_isa.c optional ex isa dev/ex/if_ex_pccard.c optional ex pccard dev/exca/exca.c optional cbb dev/fatm/if_fatm.c optional fatm pci +dev/fb/fbd.c optional fbd | vt dev/fb/splash.c optional splash dev/fdt/fdt_common.c optional fdt dev/fdt/fdt_pci.c optional fdt pci @@ -2459,6 +2460,7 @@ dev/vkbd/vkbd.c optional vkbd dev/vr/if_vr.c optional vr pci dev/vt/colors/vt_termcolors.c optional vt dev/vt/font/font_default.c optional vt +dev/vt/hw/fb/vt_fb.c optional vt dev/vt/hw/intel/intel.c optional vt vt_intel dev/vt/hw/vga/vga.c optional vt vt_vga dev/vt/logo/logo_freebsd.c optional vt From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 14:50:29 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 62E43DC9; Tue, 22 Oct 2013 14:50:29 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 414522FFF; Tue, 22 Oct 2013 14:50:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MEoTTw053723; Tue, 22 Oct 2013 14:50:29 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MEoT4Z053722; Tue, 22 Oct 2013 14:50:29 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310221450.r9MEoT4Z053722@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 22 Oct 2013 14:50:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256907 - user/ed/newcons/sys/arm/freescale/imx X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 14:50:29 -0000 Author: ray Date: Tue Oct 22 14:50:28 2013 New Revision: 256907 URL: http://svnweb.freebsd.org/changeset/base/256907 Log: Turn imx51_ipuv3 into simple frambuffer provider. Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/arm/freescale/imx/imx51_ipuv3_newcons.c Modified: user/ed/newcons/sys/arm/freescale/imx/imx51_ipuv3_newcons.c ============================================================================== --- user/ed/newcons/sys/arm/freescale/imx/imx51_ipuv3_newcons.c Tue Oct 22 14:47:09 2013 (r256906) +++ user/ed/newcons/sys/arm/freescale/imx/imx51_ipuv3_newcons.c Tue Oct 22 14:50:28 2013 (r256907) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -76,17 +77,7 @@ __FBSDID("$FreeBSD$"); struct ipu3sc_softc { device_t dev; - - intptr_t sc_paddr; - intptr_t sc_vaddr; - size_t sc_fb_size; - int sc_depth; - /* Storage for one pixel maybe bigger than color depth. */ - int sc_bpp; - int sc_stride; - int sc_width; - int sc_height; - uint32_t sc_cmap[16]; + struct fb_info sc_info; bus_space_tag_t iot; bus_space_handle_t ioh; @@ -103,16 +94,6 @@ struct ipu3sc_softc { static struct ipu3sc_softc *ipu3sc_softc; -static vd_init_t vt_imx_init; -static vd_blank_t vt_imx_blank; -static vd_bitbltchr_t vt_imx_bitbltchr; - -static struct vt_driver vt_imx_driver = { - .vd_init = vt_imx_init, - .vd_blank = vt_imx_blank, - .vd_bitbltchr = vt_imx_bitbltchr, -}; - #define IPUV3_READ(ipuv3, module, reg) \ bus_space_read_4((ipuv3)->iot, (ipuv3)->module##_ioh, (reg)) #define IPUV3_WRITE(ipuv3, module, reg, val) \ @@ -156,17 +137,6 @@ int ipuv3_debug = IPUV3_DEBUG; static int ipu3_fb_probe(device_t); static int ipu3_fb_attach(device_t); -static int -ipu3_fb_malloc(struct ipu3sc_softc *sc, size_t size) -{ - - sc->sc_vaddr = (intptr_t)contigmalloc(size, M_DEVBUF, M_ZERO, 0, ~0, - PAGE_SIZE, 0); - sc->sc_paddr = (intptr_t)vtophys(sc->sc_vaddr); - - return (0); -} - static void ipu3_fb_init(struct ipu3sc_softc *sc) { @@ -179,29 +149,56 @@ ipu3_fb_init(struct ipu3sc_softc *sc) w0sh96 <<= 32; w0sh96 |= IPUV3_READ(sc, cpmem, CPMEM_OFFSET(IMX_IPU_DP1, 23, 0, 12)); - sc->sc_width = ((w0sh96 >> 29) & 0x1fff) + 1; - sc->sc_height = ((w0sh96 >> 42) & 0x0fff) + 1; + sc->sc_info.fb_width = ((w0sh96 >> 29) & 0x1fff) + 1; + sc->sc_info.fb_height = ((w0sh96 >> 42) & 0x0fff) + 1; /* SLY W1[115:102] - 96 = [19:6] */ w1sh96 = IPUV3_READ(sc, cpmem, CPMEM_OFFSET(IMX_IPU_DP1, 23, 1, 12)); - sc->sc_stride = ((w1sh96 >> 6) & 0x3fff) + 1; + sc->sc_info.fb_stride = ((w1sh96 >> 6) & 0x3fff) + 1; - printf("%dx%d [%d]\n", sc->sc_width, sc->sc_height, sc->sc_stride); - sc->sc_fb_size = sc->sc_height * sc->sc_stride; - - ipu3_fb_malloc(sc, sc->sc_fb_size); + printf("%dx%d [%d]\n", sc->sc_info.fb_width, sc->sc_info.fb_height, + sc->sc_info.fb_stride); + sc->sc_info.fb_size = sc->sc_info.fb_height * sc->sc_info.fb_stride; + + sc->sc_info.fb_vbase = (intptr_t)contigmalloc(sc->sc_info.fb_size, + M_DEVBUF, M_ZERO, 0, ~0, PAGE_SIZE, 0); + sc->sc_info.fb_pbase = (intptr_t)vtophys(sc->sc_info.fb_vbase); /* DP1 + config_ch_23 + word_2 */ IPUV3_WRITE(sc, cpmem, CPMEM_OFFSET(IMX_IPU_DP1, 23, 1, 0), - (((uint32_t)sc->sc_paddr >> 3) | - (((uint32_t)sc->sc_paddr >> 3) << 29)) & 0xffffffff); + (((uint32_t)sc->sc_info.fb_pbase >> 3) | + (((uint32_t)sc->sc_info.fb_pbase >> 3) << 29)) & 0xffffffff); IPUV3_WRITE(sc, cpmem, CPMEM_OFFSET(IMX_IPU_DP1, 23, 1, 4), - (((uint32_t)sc->sc_paddr >> 3) >> 3) & 0xffffffff); + (((uint32_t)sc->sc_info.fb_pbase >> 3) >> 3) & 0xffffffff); /* XXX: fetch or set it from/to IPU. */ - sc->sc_depth = sc->sc_stride / sc->sc_width * 8; - sc->sc_bpp = sc->sc_stride / sc->sc_width; + sc->sc_info.fb_bpp = sc->sc_info.fb_depth = sc->sc_info.fb_stride / + sc->sc_info.fb_width * 8; +} + +/* Use own color map, because of different RGB offset. */ +static int +ipu3_fb_init_cmap(uint32_t *cmap, int bytespp) +{ + + switch (bytespp) { + case 8: + return (vt_generate_vga_palette(cmap, COLOR_FORMAT_RGB, + 0x7, 5, 0x7, 2, 0x3, 0)); + case 15: + return (vt_generate_vga_palette(cmap, COLOR_FORMAT_RGB, + 0x1f, 10, 0x1f, 5, 0x1f, 0)); + case 16: + return (vt_generate_vga_palette(cmap, COLOR_FORMAT_RGB, + 0x1f, 11, 0x3f, 5, 0x1f, 0)); + case 24: + case 32: /* Ignore alpha. */ + return (vt_generate_vga_palette(cmap, COLOR_FORMAT_RGB, + 0xff, 16, 0xff, 8, 0xff, 0)); + default: + return (1); + } } static int @@ -306,13 +303,13 @@ ipu3_fb_attach(device_t dev) * Mailbox relies on it to get data from VideoCore */ ipu3_fb_init(sc); - err = vt_generate_vga_palette(sc->sc_cmap, COLOR_FORMAT_RGB, 0xff, 16, - 0xff, 8, 0xff, 0); - if (err) - goto fail_retarn_dctmpl; + sc->sc_info.fb_name = device_get_nameunit(dev); - vt_allocate(&vt_imx_driver, sc); + ipu3_fb_init_cmap(sc->sc_info.fb_cmap, sc->sc_info.fb_depth); + sc->sc_info.fb_cmsize = 16; + + EVENTHANDLER_INVOKE(register_framebuffer, &sc->sc_info); return (0); @@ -355,111 +352,3 @@ static driver_t ipu3_fb_driver = { }; DRIVER_MODULE(ipu3fb, simplebus, ipu3_fb_driver, ipu3_fb_devclass, 0, 0); - -static void -vt_imx_blank(struct vt_device *vd, term_color_t color) -{ - struct ipu3sc_softc *sc = vd->vd_softc; - u_int ofs; - uint32_t c; - - c = sc->sc_cmap[color]; - switch (sc->sc_bpp) { - case 1: - for (ofs = 0; ofs < (sc->sc_stride * sc->sc_height); ofs++) - *(uint8_t *)(sc->sc_vaddr + ofs) = c & 0xff; - break; - case 2: - /* XXX must be 16bits colormap */ - for (ofs = 0; ofs < (sc->sc_stride * sc->sc_height); ofs++) - *(uint16_t *)(sc->sc_vaddr + 2 * ofs) = c & 0xffff; - break; - case 3: /* */ - /* line 0 */ - for (ofs = 0; ofs < sc->sc_stride; ofs++) { - *(uint8_t *)(sc->sc_vaddr + ofs + 0) = c >> 0& 0xff; - *(uint8_t *)(sc->sc_vaddr + ofs + 1) = c >> 8 & 0xff; - *(uint8_t *)(sc->sc_vaddr + ofs + 2) = c >> 16 & 0xff; - } - /* Copy line0 to all other lines. */ - for (ofs = 1; ofs < sc->sc_height; ofs++) { - memmove((void *)(sc->sc_vaddr + ofs * sc->sc_stride), - (void *)sc->sc_vaddr, sc->sc_stride); - } - break; - case 4: - for (ofs = 0; ofs < (sc->sc_stride * sc->sc_height); ofs++) - *(uint32_t *)(sc->sc_vaddr + 4 * ofs) = c; - break; - default: - /* panic? */ - break; - } -} - -static void -vt_imx_bitbltchr(struct vt_device *vd, const uint8_t *src, - vt_axis_t top, vt_axis_t left, unsigned int width, unsigned int height, - term_color_t fg, term_color_t bg) -{ - struct ipu3sc_softc *sc = vd->vd_softc; - u_long line; - uint32_t fgc, bgc, cc, o; - int c, l, bpp; - uint8_t b = 0; - - bpp = sc->sc_bpp; - fgc = sc->sc_cmap[fg]; - bgc = sc->sc_cmap[bg]; - - line = sc->sc_vaddr + (sc->sc_stride * top) + (left * bpp); - for (l = 0; l < height; l++) { - for (c = 0; c < width; c++) { - if (c % 8 == 0) - b = *src++; - else - b <<= 1; - o = line + (c * bpp); - cc = b & 0x80 ? fgc : bgc; - - switch(bpp) { - case 1: - *(uint8_t *)(o) = cc; - break; - case 2: - *(uint16_t *)(o) = cc; - break; - case 3: - /* Packed mode, so unaligned. Byte access. */ - *(uint8_t *)(o + 0) = (cc >> 16) & 0xff; - *(uint8_t *)(o + 1) = (cc >> 8) & 0xff; - *(uint8_t *)(o + 2) = (cc >> 0) & 0xff; - break; - case 4: - /* Cover both: 32bits and aligned 24bits. */ - *(uint32_t *)(o) = cc; - break; - default: - /* panic? */ - break; - } - } - line += sc->sc_stride; - } -} - -static int -vt_imx_init(struct vt_device *vd) -{ - struct ipu3sc_softc *sc; - - sc = vd->vd_softc; - - vd->vd_height = sc->sc_height; - vd->vd_width = sc->sc_width; - - /* Clear the screen. */ - vt_imx_blank(vd, TC_BLACK); - - return (CN_INTERNAL); -} From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 14:55:05 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 46CE0141; Tue, 22 Oct 2013 14:55:05 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 32C2C2079; Tue, 22 Oct 2013 14:55:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MEt5fE056670; Tue, 22 Oct 2013 14:55:05 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MEt5Me056668; Tue, 22 Oct 2013 14:55:05 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201310221455.r9MEt5Me056668@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 22 Oct 2013 14:55:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256908 - user/glebius/course/05.memory X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 14:55:05 -0000 Author: glebius Date: Tue Oct 22 14:55:04 2013 New Revision: 256908 URL: http://svnweb.freebsd.org/changeset/base/256908 Log: More on memory. Modified: user/glebius/course/05.memory/lection.tex Modified: user/glebius/course/05.memory/lection.tex ============================================================================== --- user/glebius/course/05.memory/lection.tex Tue Oct 22 14:50:28 2013 (r256907) +++ user/glebius/course/05.memory/lection.tex Tue Oct 22 14:55:04 2013 (r256908) @@ -16,12 +16,26 @@ \usetikzlibrary{arrows} \usetikzlibrary{decorations.text} \usetikzlibrary{chains} +\usetikzlibrary{scopes} \usetikzlibrary{calc} \input{../course.tex} \title{Memory management in FreeBSD} +\tikzset { + entry/.style={draw, thick, on chain, text width=.25\paperwidth, + align=center}, + large/.style={entry, minimum height=.15\paperheight}, + noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, + nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, + page/.style={draw, thick, node distance=3mm}, + vmmap/.style={draw, thick, rounded corners}, + vmentry/.style={draw, thick, rounded corners}, + vmobject/.style={draw, thick, rounded corners, text width=7ex }, + pointer/.style={->, thick, rounded corners}, +} + \begin{document} \begin{frame} @@ -33,13 +47,6 @@ \frametitle{Process (static) address space} \begin{figure} \begin{tikzpicture}[start chain=going below, node distance=0mm] - \tikzset { - entry/.style={draw, thick, on chain, text width=.25\paperwidth, - align=center}, - large/.style={entry, minimum height=.15\paperheight}, - noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, - nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, - } \node [name=kernel, nolarge] { kernel }; \node [name=argv, entry] { argv, envp }; \node [name=stack, large] { stack }; @@ -86,13 +93,6 @@ Try this out: \begin{column}{.4\paperwidth} \begin{figure} \begin{tikzpicture}[start chain=going below, node distance=0mm] - \tikzset { - entry/.style={draw, thick, on chain, text width=.25\paperwidth, - align=center}, - large/.style={entry, minimum height=.15\paperheight}, - noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, - nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, - } \node [name=argv, entry] { argv, envp }; \node [name=stack, large] { stack }; \node [name=unmap, nolarge] { not mapped memory }; @@ -115,13 +115,6 @@ Try this out: \begin{column}{.4\paperwidth} \begin{figure} \begin{tikzpicture}[start chain=going below, node distance=0mm] - \tikzset { - entry/.style={draw, thick, on chain, text width=.25\paperwidth, - align=center}, - large/.style={entry, minimum height=.15\paperheight}, - noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, - nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, - } \node [name=argv, entry] { argv, envp }; \node [name=stack, large, minimum height=.20\paperheight] { stack }; \node [name=unmap, nolarge, minimum height=.10\paperheight] @@ -149,13 +142,6 @@ Try this out: \begin{column}{.4\paperwidth} \begin{figure} \begin{tikzpicture}[start chain=going below, node distance=0mm] - \tikzset { - entry/.style={draw, thick, on chain, text width=.25\paperwidth, - align=center}, - large/.style={entry, minimum height=.15\paperheight}, - noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, - nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, - } \node [name=argv, entry] { argv, envp }; \node [name=stack, large] { stack }; \node [name=unmap, nolarge] { not mapped memory }; @@ -175,13 +161,6 @@ Try this out: \begin{column}{.4\paperwidth} \begin{figure} \begin{tikzpicture}[start chain=going below, node distance=0mm] - \tikzset { - entry/.style={draw, thick, on chain, text width=.25\paperwidth, - align=center}, - large/.style={entry, minimum height=.15\paperheight}, - noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, - nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, - } \node [name=argv, entry] { argv, envp }; \node [name=stack, large] { stack }; \node [name=unmap, nolarge, minimum height=.10\paperheight] @@ -209,13 +188,6 @@ Try this out: \begin{column}{.4\paperwidth} \begin{figure} \begin{tikzpicture}[start chain=going below, node distance=0mm] - \tikzset { - entry/.style={draw, thick, on chain, text width=.25\paperwidth, - align=center}, - large/.style={entry, minimum height=.15\paperheight}, - noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, - nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, - } \node [name=argv, entry] { argv, envp }; \node [name=stack, large] { stack }; \node [name=unmap, nolarge] { not mapped memory }; @@ -235,13 +207,6 @@ Try this out: \begin{column}{.4\paperwidth} \begin{figure} \begin{tikzpicture}[start chain=going below, node distance=0mm] - \tikzset { - entry/.style={draw, thick, on chain, text width=.25\paperwidth, - align=center}, - large/.style={entry, minimum height=.15\paperheight}, - noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, - nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, - } \node [name=argv, entry] { argv, envp }; \node [name=stack, large] { stack }; \node [name=unmap1, nolarge, minimum height=.05\paperheight] @@ -269,11 +234,7 @@ Try this out: \begin{figure} \begin{tikzpicture}[start chain=going below, node distance=0mm] \tikzset { - entry/.style={draw, thick, on chain, text width=.25\paperwidth, - align=center}, large/.style={entry, minimum height=.1\paperheight}, - noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, - nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, } \node [name=argv, entry] { argv, envp }; \node [name=stack, entry] { stack }; @@ -317,11 +278,7 @@ Try this out: \begin{figure} \begin{tikzpicture}[start chain=going below, node distance=0mm] \tikzset { - entry/.style={draw, thick, on chain, text width=.25\paperwidth, - align=center}, large/.style={entry, minimum height=.1\paperheight}, - noentry/.style={entry, fill=gray, shading=axis, shading angle=45}, - nolarge/.style={large, fill=gray, shading=axis, shading angle=45}, } \node [name=argv, entry] { argv, envp }; \node [name=stack, entry] { stack }; @@ -385,11 +342,11 @@ Try this out: }; \node [name=mark, node distance=5mm, above left=of entry1] {}; - \draw [->, thick, rounded corners] (vmmap.two east) -- ++(5mm,0) + \draw [pointer] (vmmap.two east) -- ++(5mm,0) |- (mark.center) |- (entry1.one west); \draw [->, thick] (entry1.two east) to [out=0, in=180] (entry2.one west); - \draw [->, thick, rounded corners] (entry2.two east) -- + \draw [pointer] (entry2.two east) -- ++(5mm,0) -- ++(0,-1cm); \end{tikzpicture} \end{figure} @@ -401,25 +358,24 @@ Try this out: \frametitle{A VM map entry is backed by an object} \begin{figure} \begin{tikzpicture} - \tikzset { - page/.style={draw, thick, node distance=3mm}, - } \node [name=entry, struct, rectangle split parts=4] { \textbf{struct vm\_map\_entry} \nodepart{two} \ldots \nodepart{three} struct vm\_object *object \nodepart{four} \ldots }; - \node [name=object, struct, right=of entry, rectangle split parts=3] { + \node [name=object, struct, right=of entry, rectangle split parts=5] { \textbf{struct vm\_object} - \nodepart{two} struct vm\_radix head - \nodepart{three} union *pager + \nodepart{two} \ldots + \nodepart{four} union *pager + \nodepart{three} struct vm\_radix rtree + \nodepart{five} \ldots }; \draw [->, thick] (entry.three east) to [out=0, in=180] (object.one west); \node [name=page1, page, below=of object] { vm\_page }; - \draw [->, thick, rounded corners] (object.two east) -- ++(1cm,0) + \draw [->, thick, rounded corners] (object.three east) -- ++(1cm,0) |- (page1.east); \node [name=page2, page, below right=of page1] { vm\_page }; @@ -445,4 +401,255 @@ Try this out: \end{frame} +\FootReferences{}{sys/vm/vm\_page.h, sys/vm/vm\_page.c} +\begin{frame} +\frametitle{VM page} + \begin{itemize} + \item{Small structure describing one resident physical page} + \item{All vm\_page structs are allocated at boot time} + \item{A page belongs to one object} + \end{itemize} +\end{frame} + + +\FootReferences{}{sys/vm/vm\_pager.h, sys/vm/vm\_pager.c} +\begin{frame} +\frametitle{VM objects' pager} +\begin{columns} +\begin{column}{.5\paperwidth} + \begin{itemize} + \item{Object serves as cache of memory page} + \item{Pager implements particular cache in/cache out semantics} + \end{itemize} +\end{column} +\begin{column}{.5\paperwidth} + \begin{figure} + \begin{tikzpicture} + \node [struct, rectangle split parts=7] { + \textbf{struct pagerops} + \nodepart{two} pgo\_init\_t *pgo\_init + \nodepart{three} pgo\_alloc\_t *pgo\_alloc + \nodepart{four} pgo\_dealloc\_t *pgo\_dealloc + \nodepart{five} pgo\_getpages\_t *pgo\_getpages + \nodepart{six} pgo\_putpages\_t *pgo\_putpages + \nodepart{seven} pgo\_haspage\_t *pgo\_haspage + }; + \end{tikzpicture} + \end{figure} +\end{column} +\end{columns} +\end{frame} + + +\FootReferences{}{sys/vm/vm\_object.h, sys/vm/vm\_object.c, + sys/vm/default\_pager.c, sys/vm/swap\_pager.c} +\begin{frame} +\frametitle{Anonymous object} +\begin{columns} +\begin{column}{.5\paperwidth} + \begin{figure} + \begin{tikzpicture} + \node [name=object, struct, rectangle split parts=5] { + \textbf{struct vm\_object} + \only<1> { \nodepart{two} \textit{uses default pager} } + \only<2,3> { \nodepart{two} \textit{{\color{red}uses swap pager}}} + \nodepart{three} \ldots + \nodepart{four} struct vm\_radix rtree + \nodepart{five} \ldots + }; + \node [name=page1, page, below right=of object] {vm\_page}; + \draw [pointer] (object.five east) -| (page1.north); + \only<1,2> { + \node [name=page2, page, node distance=0, below=of page1] {vm\_page}; + \node [name=page3, page, node distance=0, below=of page2] {vm\_page}; + } + \only<2> { + \node [name=swap, draw, rounded corners, fill=gray, shading=axis, + left=of page3, xshift=-2em] + {swap partition}; + \node [name=ell, draw, thick, color=red, ellipse, + minimum width=12ex, minimum height=4em] at (page2.south) {}; + \draw [->, thick, color=red] + (node cs:name=ell, angle=235) to [out=235, in=315] + node [above] { swap out } (swap.south); + } + \end{tikzpicture} + \end{figure} +\end{column} +\begin{column}{.4\paperwidth} + \begin{itemize} + \item{Anonymous object usually backs vm\_map\_entry made by sbrk(), + or mmap(MAP\_ANON), or stack} + \item{Default pager is a nop} + \onslide<2-> { + \item{In case of memory pressure default pages is changed to swap pager} + } + \onslide<3-> { + \item{Object remains with swap pager forever} + } + \end{itemize} +\end{column} +\end{columns} +\end{frame} + + +\FootReferences{}{sys/vm/vm\_object.h, sys/vm/vm\_object.c, + sys/vm/vnode\_pager.c} +\begin{frame} +\frametitle{Vnode backed object} +\begin{columns} +\begin{column}{.5\paperwidth} + \begin{figure} + \begin{tikzpicture} + \node [name=object, struct, rectangle split parts=6] { + \textbf{struct vm\_object} + \nodepart{two} uses vnode pager + \nodepart{three} \ldots + \nodepart{four} void *handle + \nodepart{five} struct vm\_radix rtree + \nodepart{six} \ldots + }; + \node [name=vnode, struct, below=of object.south west, anchor=west, + rectangle split parts=1] { + \textbf{struct vnode} + }; + \draw [->, thick] (object.four west) to [out=180, in=180] + (vnode.one west); + \node [name=file, draw, rounded corners, fill=gray, shading=axis, + below=of vnode] {a file}; + \draw [->, thick] (vnode) -- (file); + \node [name=page1, page, below right=of object] {vm\_page}; + \node [name=page2, page, node distance=0, below=of page1] {vm\_page}; + \node [name=page3, page, node distance=0, below=of page2] {vm\_page}; + \draw [pointer] (object.five east) -| (page1.north); + \only<2> { + \node [name=page4, page, color=red, node distance=0, below=of page3] + {vm\_page}; + \draw [->, thick, color=red] (file.east) to [out=0, in=270] + node [pos=.3, above, sloped] { page in } (page4.south); + } + \only<3> { + \node [name=ell, draw, thick, color=red, ellipse, + minimum width=12ex, minimum height=2em] at (page2) {}; + \draw [->, thick, color=red] (ell.west) to [out=180, in=0] + node [below, sloped] { page out } (file.east); + } + \end{tikzpicture} + \end{figure} +\end{column} +\begin{column}{.4\paperwidth} + \begin{itemize} + \item{Vnode object backs vm\_map\_entry made for program text, initialized + data, dynamic library text/data or result of mmap() on a file} + \onslide<2-> { + \item{Page fault brings a page from the file into memory} + } + \onslide<3-> { + \item{If mapping is {\color{red}writable and shared}, + dirty pages are written back to the file} + } + \end{itemize} +\end{column} +\end{columns} +\end{frame} + + +\FootReferences{}{sys/vm/vm\_object.h, sys/vm/vm\_object.c} +\begin{frame} +\frametitle<1>{Private mappings} +\frametitle<2>{Private mappings: a process fork(2)s} +\frametitle<3>{Private mappings: child modifies a page} +\frametitle<4-5>{Private mappings: shadow chains can grow hairy} +\frametitle<6-7>{Private mappings: shadow chain split} +\frametitle<8-9>{Private mappings: shadow chain collapse} +\begin{figure} +\begin{tikzpicture}[node distance=2mm] + \node [name=procA, vmmap] { process A }; + \node [name=entA, vmentry, below right=of procA] { vm\_map\_entry }; + \draw [pointer] (procA.south) |- (entA.west); + + \node [name=obj, vmobject, below right=2mm and .4\paperwidth of entA] + { vnode object }; + \draw [pointer] (entA.east) -| (obj.north); + \node [name=page1, page, below=of obj] {page 1}; + \draw [pointer] (obj) -- (page1); + \node [name=page2, page, node distance=0, below=of page1] {page 2}; + \node [name=page3, page, node distance=0, below=of page2] {page 3}; + + \onslide<2-7> { + \node [name=procB, vmmap, below=.2\paperheight of procA] { process B }; + \node [name=entB, vmentry, below right=of procB] { vm\_map\_entry }; + \draw [pointer] (procB.south) |- (entB.west); + } + + \only<2> { + \draw [pointer] (entB.north) |- (node cs:name=obj, angle=200); + } + + \onslide<3-> { + \node [name=shadow, vmobject, above right=2mm and 10mm of entB] + { shadow object }; + \draw [pointer] (shadow.east) to [out=0, in=180] (obj.west); + \node [name=pageB1, page, below=of shadow] {page 1}; + \draw [pointer] (shadow) -- (pageB1); + } + \onslide<3-7> { + \draw [pointer] (entB.north) |- (shadow.west); + } + + \onslide<4-> { + \node [name=procC, vmmap, below=.2\paperheight of procB] { process C }; + \node [name=entC, vmentry, below right=of procC] { vm\_map\_entry }; + \draw [pointer] (procC.south) |- (entC.west); + } + + \only<4> { + \node [name=mark, above right=of entC] {} ; + \draw [pointer] (entC.north) + .. controls +(0,10mm) and (mark) .. (shadow.south west); + } + + \onslide<5-8> { + \node [name=shadowC, vmobject, below=.2\paperheight of shadow] + { shadow object }; + \draw [pointer] (entC.north) |- (shadowC.west); + } + \onslide<5,8> { + \node [name=pageC2, page, below=of shadowC] {page 2}; + \draw [pointer] (shadowC) -- (pageC2); + } + \onslide<5,6,8> { + \draw [pointer] (shadowC.north west) + to [out=135, in=225] (shadow.south west); + } + + \onslide<6-7> { + \node [name=pageC1, page, below=of shadowC] {{\color{red}page 1}}; + \draw [pointer] (shadowC) -- (pageC1); + } + + \onslide<7> { + \draw [pointer, color=red] (shadowC.east) + to [out=0, in=225] (obj.south west); + } + + \onslide<8> { + \node [name=procB, vmmap, below=.2\paperheight of procA, dotted] + { process B }; + \node [name=entB, vmentry, below right=of procB, dotted] + { vm\_map\_entry }; + \draw [pointer, dotted] (procB.south) |- (entB.west); + \draw [pointer, dotted] (entB.north) |- (shadow.west); + } + + \onslide<9> { + \draw [pointer, color=red] (entC.north) to [out=90, in=180] (shadow.west); + \node [name=pageB2, page, node distance=0, below=of pageB1] + {{\color{red}page 2}}; + } + +\end{tikzpicture} +\end{figure} +\end{frame} + \end{document} From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 15:06:25 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 662CB47D; Tue, 22 Oct 2013 15:06:25 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5373E2120; Tue, 22 Oct 2013 15:06:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MF6PNZ062693; Tue, 22 Oct 2013 15:06:25 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MF6PnS062692; Tue, 22 Oct 2013 15:06:25 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201310221506.r9MF6PnS062692@svn.freebsd.org> From: Andre Oppermann Date: Tue, 22 Oct 2013 15:06:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256909 - user/andre/mbuf_staging/net X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 15:06:25 -0000 Author: andre Date: Tue Oct 22 15:06:24 2013 New Revision: 256909 URL: http://svnweb.freebsd.org/changeset/base/256909 Log: Make struct ifnet comprehensible by grouping related fields and variables together. Quantify the structure size and how bloated it has become. This is only a mechanical change. Obvious first candidates for slimming by externalizing are: - char if_xname[IFNAMSIZ] - struct ifaltq if_snd - struct if_data if_data - void *if_afdata[AF_MAX] Sponsored by: The FreeBSD Foundation Modified: user/andre/mbuf_staging/net/if_var.h Modified: user/andre/mbuf_staging/net/if_var.h ============================================================================== --- user/andre/mbuf_staging/net/if_var.h Tue Oct 22 14:55:04 2013 (r256908) +++ user/andre/mbuf_staging/net/if_var.h Tue Oct 22 15:06:24 2013 (r256909) @@ -120,18 +120,41 @@ struct ifqueue { /* * Structure defining a network interface. * - * (Would like to call this struct ``if'', but C isn't PL/1.) + * Size ILP32: 592 (approx) + * LP64: 1048 (approx) */ - struct ifnet { + /* General book keeping of interface lists. */ + TAILQ_ENTRY(ifnet) if_link; /* all struct ifnets are chained */ + LIST_ENTRY(ifnet) if_clones; /* interfaces of a cloner */ + TAILQ_HEAD(, ifg_list) if_groups; /* linked list of groups per if */ + /* protected by if_addr_lock */ + u_char if_alloctype; /* if_type at time of allocation */ + + /* Driver and protocol specific information that remains stable. */ void *if_softc; /* pointer to driver state */ + void *if_llsoftc; /* link layer softc */ void *if_l2com; /* pointer to protocol bits */ - struct vnet *if_vnet; /* pointer to network stack instance */ - TAILQ_ENTRY(ifnet) if_link; /* all struct ifnets are chained */ - char if_xname[IFNAMSIZ]; /* external name (name + unit) */ const char *if_dname; /* driver name */ int if_dunit; /* unit or IF_DUNIT_NONE */ + u_short if_index; /* numeric abbreviation for this if */ + short if_index_reserved; /* spare space to grow if_index */ + char if_xname[IFNAMSIZ]; /* external name (name + unit) */ + char *if_description; /* interface description */ + + /* Variable fields that are touched by the drivers. */ + int if_flags; /* up/down, broadcast, etc. */ + int if_capabilities; /* interface features & capabilities */ + int if_capenable; /* enabled features & capabilities */ + void *if_linkmib; /* link-type-specific MIB data */ + size_t if_linkmiblen; /* length of above data */ + int if_drv_flags; /* driver-managed status flags */ u_int if_refcount; /* reference count */ + struct ifaltq if_snd; /* output queue (includes altq) */ + struct if_data if_data; + struct task if_linktask; /* task for link change events */ + + /* Addresses of different protocol families assigned to this if. */ struct ifaddrhead if_addrhead; /* linked list of addresses per if */ /* * if_addrhead is the list of all addresses associated to @@ -143,21 +166,29 @@ struct ifnet { * However, access to the AF_LINK address through this * field is deprecated. Use if_addr or ifaddr_byindex() instead. */ + struct ifmultihead if_multiaddrs; /* multicast addresses configured */ + int if_amcount; /* number of all-multicast requests */ + struct ifaddr *if_addr; /* pointer to link-level address */ + const u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */ + struct rwlock if_addr_lock; /* lock to protect address lists */ + void *if_afdata[AF_MAX]; + int if_afdata_initialized; + struct rwlock if_afdata_lock; + + /* Additional interface features. */ + struct bpf_if *if_bpf; /* packet filter structure */ int if_pcount; /* number of promiscuous listeners */ + void *if_bridge; /* bridge glue */ + void *if_lagg; /* lagg glue */ + void *if_pf_kif; /* pf glue */ struct carp_if *if_carp; /* carp interface structure */ - struct bpf_if *if_bpf; /* packet filter structure */ - u_short if_index; /* numeric abbreviation for this if */ - short if_index_reserved; /* spare space to grow if_index */ struct ifvlantrunk *if_vlantrunk; /* pointer to 802.1q data */ - int if_flags; /* up/down, broadcast, etc. */ - int if_capabilities; /* interface features & capabilities */ - int if_capenable; /* enabled features & capabilities */ - void *if_linkmib; /* link-type-specific MIB data */ - size_t if_linkmiblen; /* length of above data */ - struct if_data if_data; - struct ifmultihead if_multiaddrs; /* multicast addresses configured */ - int if_amcount; /* number of all-multicast requests */ -/* procedure handles */ + struct vnet *if_vnet; /* pointer to network stack instance */ + struct vnet *if_home_vnet; /* where this ifnet originates from */ + u_int if_fib; /* interface FIB */ + struct label *if_label; /* interface MAC label */ + + /* Various procedures of the layer2 encapsulation and drivers. */ int (*if_output) /* output routine (enqueue) */ (struct ifnet *, struct mbuf *, const struct sockaddr *, struct route *); @@ -177,39 +208,12 @@ struct ifnet { (struct ifnet *, struct mbuf *); void (*if_reassign) /* reassign to vnet routine */ (struct ifnet *, struct vnet *, char *); - struct vnet *if_home_vnet; /* where this ifnet originates from */ - struct ifaddr *if_addr; /* pointer to link-level address */ - void *if_llsoftc; /* link layer softc */ - int if_drv_flags; /* driver-managed status flags */ - struct ifaltq if_snd; /* output queue (includes altq) */ - const u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */ - - void *if_bridge; /* bridge glue */ - - struct label *if_label; /* interface MAC label */ - - /* these are only used by IPv6 */ - void *if_unused[2]; - void *if_afdata[AF_MAX]; - int if_afdata_initialized; - struct rwlock if_afdata_lock; - struct task if_linktask; /* task for link change events */ - struct rwlock if_addr_lock; /* lock to protect address lists */ - - LIST_ENTRY(ifnet) if_clones; /* interfaces of a cloner */ - TAILQ_HEAD(, ifg_list) if_groups; /* linked list of groups per if */ - /* protected by if_addr_lock */ - void *if_pf_kif; - void *if_lagg; /* lagg glue */ - char *if_description; /* interface description */ - u_int if_fib; /* interface FIB */ - u_char if_alloctype; /* if_type at time of allocation */ + /* Stuff that's only temporary and doesn't belong here. */ u_int if_hw_tsomax; /* tso burst length limit, the minimum * is (IP_MAXPACKET / 8). * XXXAO: Have to find a better place * for it eventually. */ - /* * Spare fields are added so that we can modify sensitive data * structures without changing the kernel binary interface, and must @@ -217,6 +221,7 @@ struct ifnet { */ char if_cspare[3]; int if_ispare[4]; + void *if_unused[2]; void *if_pspare[8]; /* 1 netmap, 7 TDB */ }; From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 15:09:32 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 64D26574; Tue, 22 Oct 2013 15:09:32 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 509F32133; Tue, 22 Oct 2013 15:09:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MF9Wg4063772; Tue, 22 Oct 2013 15:09:32 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MF9WBv063771; Tue, 22 Oct 2013 15:09:32 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201310221509.r9MF9WBv063771@svn.freebsd.org> From: Andre Oppermann Date: Tue, 22 Oct 2013 15:09:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256910 - user/andre/mbuf_staging/net X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 15:09:32 -0000 Author: andre Date: Tue Oct 22 15:09:31 2013 New Revision: 256910 URL: http://svnweb.freebsd.org/changeset/base/256910 Log: Prepare to move all interface queue related structures, macros and definitions from net/if_var.h to its own new net/ifq.h home. Sponsored by: The FreeBSD Foundation Added: user/andre/mbuf_staging/net/ifq.h - copied unchanged from r256909, user/andre/mbuf_staging/net/if_var.h Copied: user/andre/mbuf_staging/net/ifq.h (from r256909, user/andre/mbuf_staging/net/if_var.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/andre/mbuf_staging/net/ifq.h Tue Oct 22 15:09:31 2013 (r256910, copy of r256909, user/andre/mbuf_staging/net/if_var.h) @@ -0,0 +1,979 @@ +/*- + * Copyright (c) 1982, 1986, 1989, 1993 + * The Regents of the University of California. 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. + * 4. Neither the name of the University 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 REGENTS 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 REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * From: @(#)if.h 8.1 (Berkeley) 6/10/93 + * $FreeBSD$ + */ + +#ifndef _NET_IF_VAR_H_ +#define _NET_IF_VAR_H_ + +/* + * Structures defining a network interface, providing a packet + * transport mechanism (ala level 0 of the PUP protocols). + * + * Each interface accepts output datagrams of a specified maximum + * length, and provides higher level routines with input datagrams + * received from its medium. + * + * Output occurs when the routine if_output is called, with three parameters: + * (*ifp->if_output)(ifp, m, dst, rt) + * Here m is the mbuf chain to be sent and dst is the destination address. + * The output routine encapsulates the supplied datagram if necessary, + * and then transmits it on its medium. + * + * On input, each interface unwraps the data received by it, and either + * places it on the input queue of an internetwork datagram routine + * and posts the associated software interrupt, or passes the datagram to a raw + * packet input routine. + * + * Routines exist for locating interfaces by their addresses + * or for locating an interface on a certain network, as well as more general + * routing and gateway routines maintaining information used to locate + * interfaces. These routines live in the files if.c and route.c + */ + +#ifdef __STDC__ +/* + * Forward structure declarations for function prototypes [sic]. + */ +struct mbuf; +struct thread; +struct rtentry; +struct rt_addrinfo; +struct socket; +struct ether_header; +struct carp_if; +struct carp_softc; +struct ifvlantrunk; +struct route; +struct vnet; +#endif + +#include /* get TAILQ macros */ + +#ifdef _KERNEL +#include +#include +#include +#include +#endif /* _KERNEL */ +#include +#include /* XXX */ +#include /* XXX */ +#include /* XXX */ +#include /* XXX */ +#include /* XXX */ +#include + +#define IF_DUNIT_NONE -1 + +#include + +TAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */ +TAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */ +TAILQ_HEAD(ifmultihead, ifmultiaddr); +TAILQ_HEAD(ifgrouphead, ifg_group); + +#ifdef _KERNEL +VNET_DECLARE(struct pfil_head, link_pfil_hook); /* packet filter hooks */ +#define V_link_pfil_hook VNET(link_pfil_hook) +#endif /* _KERNEL */ + +/* + * Structure defining a queue for a network interface. + */ +struct ifqueue { + struct mbuf *ifq_head; + struct mbuf *ifq_tail; + int ifq_len; + int ifq_maxlen; + int ifq_drops; + struct mtx ifq_mtx; +}; + +/* + * Structure defining a network interface. + * + * Size ILP32: 592 (approx) + * LP64: 1048 (approx) + */ +struct ifnet { + /* General book keeping of interface lists. */ + TAILQ_ENTRY(ifnet) if_link; /* all struct ifnets are chained */ + LIST_ENTRY(ifnet) if_clones; /* interfaces of a cloner */ + TAILQ_HEAD(, ifg_list) if_groups; /* linked list of groups per if */ + /* protected by if_addr_lock */ + u_char if_alloctype; /* if_type at time of allocation */ + + /* Driver and protocol specific information that remains stable. */ + void *if_softc; /* pointer to driver state */ + void *if_llsoftc; /* link layer softc */ + void *if_l2com; /* pointer to protocol bits */ + const char *if_dname; /* driver name */ + int if_dunit; /* unit or IF_DUNIT_NONE */ + u_short if_index; /* numeric abbreviation for this if */ + short if_index_reserved; /* spare space to grow if_index */ + char if_xname[IFNAMSIZ]; /* external name (name + unit) */ + char *if_description; /* interface description */ + + /* Variable fields that are touched by the drivers. */ + int if_flags; /* up/down, broadcast, etc. */ + int if_capabilities; /* interface features & capabilities */ + int if_capenable; /* enabled features & capabilities */ + void *if_linkmib; /* link-type-specific MIB data */ + size_t if_linkmiblen; /* length of above data */ + int if_drv_flags; /* driver-managed status flags */ + u_int if_refcount; /* reference count */ + struct ifaltq if_snd; /* output queue (includes altq) */ + struct if_data if_data; + struct task if_linktask; /* task for link change events */ + + /* Addresses of different protocol families assigned to this if. */ + struct ifaddrhead if_addrhead; /* linked list of addresses per if */ + /* + * if_addrhead is the list of all addresses associated to + * an interface. + * Some code in the kernel assumes that first element + * of the list has type AF_LINK, and contains sockaddr_dl + * addresses which store the link-level address and the name + * of the interface. + * However, access to the AF_LINK address through this + * field is deprecated. Use if_addr or ifaddr_byindex() instead. + */ + struct ifmultihead if_multiaddrs; /* multicast addresses configured */ + int if_amcount; /* number of all-multicast requests */ + struct ifaddr *if_addr; /* pointer to link-level address */ + const u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */ + struct rwlock if_addr_lock; /* lock to protect address lists */ + void *if_afdata[AF_MAX]; + int if_afdata_initialized; + struct rwlock if_afdata_lock; + + /* Additional interface features. */ + struct bpf_if *if_bpf; /* packet filter structure */ + int if_pcount; /* number of promiscuous listeners */ + void *if_bridge; /* bridge glue */ + void *if_lagg; /* lagg glue */ + void *if_pf_kif; /* pf glue */ + struct carp_if *if_carp; /* carp interface structure */ + struct ifvlantrunk *if_vlantrunk; /* pointer to 802.1q data */ + struct vnet *if_vnet; /* pointer to network stack instance */ + struct vnet *if_home_vnet; /* where this ifnet originates from */ + u_int if_fib; /* interface FIB */ + struct label *if_label; /* interface MAC label */ + + /* Various procedures of the layer2 encapsulation and drivers. */ + int (*if_output) /* output routine (enqueue) */ + (struct ifnet *, struct mbuf *, const struct sockaddr *, + struct route *); + void (*if_input) /* input routine (from h/w driver) */ + (struct ifnet *, struct mbuf *); + void (*if_start) /* initiate output routine */ + (struct ifnet *); + int (*if_ioctl) /* ioctl routine */ + (struct ifnet *, u_long, caddr_t); + void (*if_init) /* Init routine */ + (void *); + int (*if_resolvemulti) /* validate/resolve multicast */ + (struct ifnet *, struct sockaddr **, struct sockaddr *); + void (*if_qflush) /* flush any queues */ + (struct ifnet *); + int (*if_transmit) /* initiate output routine */ + (struct ifnet *, struct mbuf *); + void (*if_reassign) /* reassign to vnet routine */ + (struct ifnet *, struct vnet *, char *); + + /* Stuff that's only temporary and doesn't belong here. */ + u_int if_hw_tsomax; /* tso burst length limit, the minimum + * is (IP_MAXPACKET / 8). + * XXXAO: Have to find a better place + * for it eventually. */ + /* + * Spare fields are added so that we can modify sensitive data + * structures without changing the kernel binary interface, and must + * be used with care where binary compatibility is required. + */ + char if_cspare[3]; + int if_ispare[4]; + void *if_unused[2]; + void *if_pspare[8]; /* 1 netmap, 7 TDB */ +}; + +typedef void if_init_f_t(void *); + +/* + * XXX These aliases are terribly dangerous because they could apply + * to anything. + */ +#define if_mtu if_data.ifi_mtu +#define if_type if_data.ifi_type +#define if_physical if_data.ifi_physical +#define if_addrlen if_data.ifi_addrlen +#define if_hdrlen if_data.ifi_hdrlen +#define if_metric if_data.ifi_metric +#define if_link_state if_data.ifi_link_state +#define if_baudrate if_data.ifi_baudrate +#define if_baudrate_pf if_data.ifi_baudrate_pf +#define if_hwassist if_data.ifi_hwassist +#define if_ipackets if_data.ifi_ipackets +#define if_ierrors if_data.ifi_ierrors +#define if_opackets if_data.ifi_opackets +#define if_oerrors if_data.ifi_oerrors +#define if_collisions if_data.ifi_collisions +#define if_ibytes if_data.ifi_ibytes +#define if_obytes if_data.ifi_obytes +#define if_imcasts if_data.ifi_imcasts +#define if_omcasts if_data.ifi_omcasts +#define if_iqdrops if_data.ifi_iqdrops +#define if_noproto if_data.ifi_noproto +#define if_lastchange if_data.ifi_lastchange + +/* for compatibility with other BSDs */ +#define if_addrlist if_addrhead +#define if_list if_link +#define if_name(ifp) ((ifp)->if_xname) + +/* + * Locks for address lists on the network interface. + */ +#define IF_ADDR_LOCK_INIT(if) rw_init(&(if)->if_addr_lock, "if_addr_lock") +#define IF_ADDR_LOCK_DESTROY(if) rw_destroy(&(if)->if_addr_lock) +#define IF_ADDR_WLOCK(if) rw_wlock(&(if)->if_addr_lock) +#define IF_ADDR_WUNLOCK(if) rw_wunlock(&(if)->if_addr_lock) +#define IF_ADDR_RLOCK(if) rw_rlock(&(if)->if_addr_lock) +#define IF_ADDR_RUNLOCK(if) rw_runlock(&(if)->if_addr_lock) +#define IF_ADDR_LOCK_ASSERT(if) rw_assert(&(if)->if_addr_lock, RA_LOCKED) +#define IF_ADDR_WLOCK_ASSERT(if) rw_assert(&(if)->if_addr_lock, RA_WLOCKED) + +/* + * 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 + * by these macros. + */ +#define IF_LOCK(ifq) mtx_lock(&(ifq)->ifq_mtx) +#define IF_UNLOCK(ifq) mtx_unlock(&(ifq)->ifq_mtx) +#define IF_LOCK_ASSERT(ifq) mtx_assert(&(ifq)->ifq_mtx, MA_OWNED) +#define _IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) +#define _IF_DROP(ifq) ((ifq)->ifq_drops++) +#define _IF_QLEN(ifq) ((ifq)->ifq_len) + +#define _IF_ENQUEUE(ifq, m) do { \ + (m)->m_nextpkt = NULL; \ + if ((ifq)->ifq_tail == NULL) \ + (ifq)->ifq_head = m; \ + else \ + (ifq)->ifq_tail->m_nextpkt = m; \ + (ifq)->ifq_tail = m; \ + (ifq)->ifq_len++; \ +} while (0) + +#define IF_ENQUEUE(ifq, m) do { \ + IF_LOCK(ifq); \ + _IF_ENQUEUE(ifq, m); \ + IF_UNLOCK(ifq); \ +} while (0) + +#define _IF_PREPEND(ifq, m) do { \ + (m)->m_nextpkt = (ifq)->ifq_head; \ + if ((ifq)->ifq_tail == NULL) \ + (ifq)->ifq_tail = (m); \ + (ifq)->ifq_head = (m); \ + (ifq)->ifq_len++; \ +} while (0) + +#define IF_PREPEND(ifq, m) do { \ + IF_LOCK(ifq); \ + _IF_PREPEND(ifq, m); \ + IF_UNLOCK(ifq); \ +} while (0) + +#define _IF_DEQUEUE(ifq, m) do { \ + (m) = (ifq)->ifq_head; \ + if (m) { \ + if (((ifq)->ifq_head = (m)->m_nextpkt) == NULL) \ + (ifq)->ifq_tail = NULL; \ + (m)->m_nextpkt = NULL; \ + (ifq)->ifq_len--; \ + } \ +} while (0) + +#define IF_DEQUEUE(ifq, m) do { \ + IF_LOCK(ifq); \ + _IF_DEQUEUE(ifq, m); \ + IF_UNLOCK(ifq); \ +} while (0) + +#define _IF_DEQUEUE_ALL(ifq, m) do { \ + (m) = (ifq)->ifq_head; \ + (ifq)->ifq_head = (ifq)->ifq_tail = NULL; \ + (ifq)->ifq_len = 0; \ +} while (0) + +#define IF_DEQUEUE_ALL(ifq, m) do { \ + IF_LOCK(ifq); \ + _IF_DEQUEUE_ALL(ifq, m); \ + IF_UNLOCK(ifq); \ +} while (0) + +#define _IF_POLL(ifq, m) ((m) = (ifq)->ifq_head) +#define IF_POLL(ifq, m) _IF_POLL(ifq, m) + +#define _IF_DRAIN(ifq) do { \ + struct mbuf *m; \ + for (;;) { \ + _IF_DEQUEUE(ifq, m); \ + if (m == NULL) \ + break; \ + m_freem(m); \ + } \ +} while (0) + +#define IF_DRAIN(ifq) do { \ + IF_LOCK(ifq); \ + _IF_DRAIN(ifq); \ + IF_UNLOCK(ifq); \ +} while(0) + +#ifdef _KERNEL +/* interface link layer address change event */ +typedef void (*iflladdr_event_handler_t)(void *, struct ifnet *); +EVENTHANDLER_DECLARE(iflladdr_event, iflladdr_event_handler_t); +/* interface address change event */ +typedef void (*ifaddr_event_handler_t)(void *, struct ifnet *); +EVENTHANDLER_DECLARE(ifaddr_event, ifaddr_event_handler_t); +/* new interface arrival event */ +typedef void (*ifnet_arrival_event_handler_t)(void *, struct ifnet *); +EVENTHANDLER_DECLARE(ifnet_arrival_event, ifnet_arrival_event_handler_t); +/* interface departure event */ +typedef void (*ifnet_departure_event_handler_t)(void *, struct ifnet *); +EVENTHANDLER_DECLARE(ifnet_departure_event, ifnet_departure_event_handler_t); +/* Interface link state change event */ +typedef void (*ifnet_link_event_handler_t)(void *, struct ifnet *, int); +EVENTHANDLER_DECLARE(ifnet_link_event, ifnet_link_event_handler_t); + +/* + * interface groups + */ +struct ifg_group { + char ifg_group[IFNAMSIZ]; + u_int ifg_refcnt; + void *ifg_pf_kif; + TAILQ_HEAD(, ifg_member) ifg_members; + TAILQ_ENTRY(ifg_group) ifg_next; +}; + +struct ifg_member { + TAILQ_ENTRY(ifg_member) ifgm_next; + struct ifnet *ifgm_ifp; +}; + +struct ifg_list { + struct ifg_group *ifgl_group; + TAILQ_ENTRY(ifg_list) ifgl_next; +}; + +/* group attach event */ +typedef void (*group_attach_event_handler_t)(void *, struct ifg_group *); +EVENTHANDLER_DECLARE(group_attach_event, group_attach_event_handler_t); +/* group detach event */ +typedef void (*group_detach_event_handler_t)(void *, struct ifg_group *); +EVENTHANDLER_DECLARE(group_detach_event, group_detach_event_handler_t); +/* group change event */ +typedef void (*group_change_event_handler_t)(void *, const char *); +EVENTHANDLER_DECLARE(group_change_event, group_change_event_handler_t); + +#define IF_AFDATA_LOCK_INIT(ifp) \ + rw_init(&(ifp)->if_afdata_lock, "if_afdata") + +#define IF_AFDATA_WLOCK(ifp) rw_wlock(&(ifp)->if_afdata_lock) +#define IF_AFDATA_RLOCK(ifp) rw_rlock(&(ifp)->if_afdata_lock) +#define IF_AFDATA_WUNLOCK(ifp) rw_wunlock(&(ifp)->if_afdata_lock) +#define IF_AFDATA_RUNLOCK(ifp) rw_runlock(&(ifp)->if_afdata_lock) +#define IF_AFDATA_LOCK(ifp) IF_AFDATA_WLOCK(ifp) +#define IF_AFDATA_UNLOCK(ifp) IF_AFDATA_WUNLOCK(ifp) +#define IF_AFDATA_TRYLOCK(ifp) rw_try_wlock(&(ifp)->if_afdata_lock) +#define IF_AFDATA_DESTROY(ifp) rw_destroy(&(ifp)->if_afdata_lock) + +#define IF_AFDATA_LOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_LOCKED) +#define IF_AFDATA_RLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_RLOCKED) +#define IF_AFDATA_WLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_WLOCKED) +#define IF_AFDATA_UNLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_UNLOCKED) + +int if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, + int adjust); +#define IF_HANDOFF(ifq, m, ifp) \ + if_handoff((struct ifqueue *)ifq, m, ifp, 0) +#define IF_HANDOFF_ADJ(ifq, m, ifp, adj) \ + if_handoff((struct ifqueue *)ifq, m, ifp, adj) + +void if_start(struct ifnet *); + +#define IFQ_ENQUEUE(ifq, m, err) \ +do { \ + IF_LOCK(ifq); \ + if (ALTQ_IS_ENABLED(ifq)) \ + ALTQ_ENQUEUE(ifq, m, NULL, err); \ + else { \ + if (_IF_QFULL(ifq)) { \ + m_freem(m); \ + (err) = ENOBUFS; \ + } else { \ + _IF_ENQUEUE(ifq, m); \ + (err) = 0; \ + } \ + } \ + if (err) \ + (ifq)->ifq_drops++; \ + IF_UNLOCK(ifq); \ +} while (0) + +#define IFQ_DEQUEUE_NOLOCK(ifq, m) \ +do { \ + if (TBR_IS_ENABLED(ifq)) \ + (m) = tbr_dequeue_ptr(ifq, ALTDQ_REMOVE); \ + else if (ALTQ_IS_ENABLED(ifq)) \ + ALTQ_DEQUEUE(ifq, m); \ + else \ + _IF_DEQUEUE(ifq, m); \ +} while (0) + +#define IFQ_DEQUEUE(ifq, m) \ +do { \ + IF_LOCK(ifq); \ + IFQ_DEQUEUE_NOLOCK(ifq, m); \ + IF_UNLOCK(ifq); \ +} while (0) + +#define IFQ_POLL_NOLOCK(ifq, m) \ +do { \ + if (TBR_IS_ENABLED(ifq)) \ + (m) = tbr_dequeue_ptr(ifq, ALTDQ_POLL); \ + else if (ALTQ_IS_ENABLED(ifq)) \ + ALTQ_POLL(ifq, m); \ + else \ + _IF_POLL(ifq, m); \ +} while (0) + +#define IFQ_POLL(ifq, m) \ +do { \ + IF_LOCK(ifq); \ + IFQ_POLL_NOLOCK(ifq, m); \ + IF_UNLOCK(ifq); \ +} while (0) + +#define IFQ_PURGE_NOLOCK(ifq) \ +do { \ + if (ALTQ_IS_ENABLED(ifq)) { \ + ALTQ_PURGE(ifq); \ + } else \ + _IF_DRAIN(ifq); \ +} while (0) + +#define IFQ_PURGE(ifq) \ +do { \ + IF_LOCK(ifq); \ + IFQ_PURGE_NOLOCK(ifq); \ + IF_UNLOCK(ifq); \ +} while (0) + +#define IFQ_SET_READY(ifq) \ + do { ((ifq)->altq_flags |= ALTQF_READY); } while (0) + +#define IFQ_LOCK(ifq) IF_LOCK(ifq) +#define IFQ_UNLOCK(ifq) IF_UNLOCK(ifq) +#define IFQ_LOCK_ASSERT(ifq) IF_LOCK_ASSERT(ifq) +#define IFQ_IS_EMPTY(ifq) ((ifq)->ifq_len == 0) +#define IFQ_INC_LEN(ifq) ((ifq)->ifq_len++) +#define IFQ_DEC_LEN(ifq) (--(ifq)->ifq_len) +#define IFQ_INC_DROPS(ifq) ((ifq)->ifq_drops++) +#define IFQ_SET_MAXLEN(ifq, len) ((ifq)->ifq_maxlen = (len)) + +/* + * The IFF_DRV_OACTIVE test should really occur in the device driver, not in + * the handoff logic, as that flag is locked by the device driver. + */ +#define IFQ_HANDOFF_ADJ(ifp, m, adj, err) \ +do { \ + int len; \ + short mflags; \ + \ + len = (m)->m_pkthdr.len; \ + mflags = (m)->m_flags; \ + IFQ_ENQUEUE(&(ifp)->if_snd, m, err); \ + if ((err) == 0) { \ + (ifp)->if_obytes += len + (adj); \ + if (mflags & M_MCAST) \ + (ifp)->if_omcasts++; \ + if (((ifp)->if_drv_flags & IFF_DRV_OACTIVE) == 0) \ + if_start(ifp); \ + } \ +} while (0) + +#define IFQ_HANDOFF(ifp, m, err) \ + IFQ_HANDOFF_ADJ(ifp, m, 0, err) + +#define IFQ_DRV_DEQUEUE(ifq, m) \ +do { \ + (m) = (ifq)->ifq_drv_head; \ + if (m) { \ + if (((ifq)->ifq_drv_head = (m)->m_nextpkt) == NULL) \ + (ifq)->ifq_drv_tail = NULL; \ + (m)->m_nextpkt = NULL; \ + (ifq)->ifq_drv_len--; \ + } else { \ + IFQ_LOCK(ifq); \ + IFQ_DEQUEUE_NOLOCK(ifq, m); \ + while ((ifq)->ifq_drv_len < (ifq)->ifq_drv_maxlen) { \ + struct mbuf *m0; \ + IFQ_DEQUEUE_NOLOCK(ifq, m0); \ + if (m0 == NULL) \ + break; \ + m0->m_nextpkt = NULL; \ + if ((ifq)->ifq_drv_tail == NULL) \ + (ifq)->ifq_drv_head = m0; \ + else \ + (ifq)->ifq_drv_tail->m_nextpkt = m0; \ + (ifq)->ifq_drv_tail = m0; \ + (ifq)->ifq_drv_len++; \ + } \ + IFQ_UNLOCK(ifq); \ + } \ +} while (0) + +#define IFQ_DRV_PREPEND(ifq, m) \ +do { \ + (m)->m_nextpkt = (ifq)->ifq_drv_head; \ + if ((ifq)->ifq_drv_tail == NULL) \ + (ifq)->ifq_drv_tail = (m); \ + (ifq)->ifq_drv_head = (m); \ + (ifq)->ifq_drv_len++; \ +} while (0) + +#define IFQ_DRV_IS_EMPTY(ifq) \ + (((ifq)->ifq_drv_len == 0) && ((ifq)->ifq_len == 0)) + +#define IFQ_DRV_PURGE(ifq) \ +do { \ + struct mbuf *m, *n = (ifq)->ifq_drv_head; \ + while((m = n) != NULL) { \ + n = m->m_nextpkt; \ + m_freem(m); \ + } \ + (ifq)->ifq_drv_head = (ifq)->ifq_drv_tail = NULL; \ + (ifq)->ifq_drv_len = 0; \ + IFQ_PURGE(ifq); \ +} while (0) + +#ifdef _KERNEL +static __inline void +if_initbaudrate(struct ifnet *ifp, uintmax_t baud) +{ + + ifp->if_baudrate_pf = 0; + while (baud > (u_long)(~0UL)) { + baud /= 10; + ifp->if_baudrate_pf++; + } + ifp->if_baudrate = baud; +} + +static __inline int +drbr_enqueue(struct ifnet *ifp, struct buf_ring *br, struct mbuf *m) +{ + int error = 0; + +#ifdef ALTQ + if (ALTQ_IS_ENABLED(&ifp->if_snd)) { + IFQ_ENQUEUE(&ifp->if_snd, m, error); + return (error); + } +#endif + error = buf_ring_enqueue(br, m); + if (error) + m_freem(m); + + return (error); +} + +static __inline void +drbr_putback(struct ifnet *ifp, struct buf_ring *br, struct mbuf *new) +{ + /* + * The top of the list needs to be swapped + * for this one. + */ +#ifdef ALTQ + if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) { + /* + * Peek in altq case dequeued it + * so put it back. + */ + IFQ_DRV_PREPEND(&ifp->if_snd, new); + return; + } +#endif + buf_ring_putback_sc(br, new); +} + +static __inline struct mbuf * +drbr_peek(struct ifnet *ifp, struct buf_ring *br) +{ +#ifdef ALTQ + struct mbuf *m; + if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) { + /* + * Pull it off like a dequeue + * since drbr_advance() does nothing + * for altq and drbr_putback() will + * use the old prepend function. + */ + IFQ_DEQUEUE(&ifp->if_snd, m); + return (m); + } +#endif + return(buf_ring_peek(br)); +} + +static __inline void +drbr_flush(struct ifnet *ifp, struct buf_ring *br) +{ + struct mbuf *m; + +#ifdef ALTQ + if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) + IFQ_PURGE(&ifp->if_snd); +#endif + while ((m = buf_ring_dequeue_sc(br)) != NULL) + m_freem(m); +} + +static __inline void +drbr_free(struct buf_ring *br, struct malloc_type *type) +{ + + drbr_flush(NULL, br); + buf_ring_free(br, type); +} + +static __inline struct mbuf * +drbr_dequeue(struct ifnet *ifp, struct buf_ring *br) +{ +#ifdef ALTQ + struct mbuf *m; + + if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) { + IFQ_DEQUEUE(&ifp->if_snd, m); + return (m); + } +#endif + return (buf_ring_dequeue_sc(br)); +} + +static __inline void +drbr_advance(struct ifnet *ifp, struct buf_ring *br) +{ +#ifdef ALTQ + /* Nothing to do here since peek dequeues in altq case */ + if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) + return; +#endif + return (buf_ring_advance_sc(br)); +} + + +static __inline struct mbuf * +drbr_dequeue_cond(struct ifnet *ifp, struct buf_ring *br, + int (*func) (struct mbuf *, void *), void *arg) +{ + struct mbuf *m; +#ifdef ALTQ + if (ALTQ_IS_ENABLED(&ifp->if_snd)) { + IFQ_LOCK(&ifp->if_snd); + IFQ_POLL_NOLOCK(&ifp->if_snd, m); + if (m != NULL && func(m, arg) == 0) { + IFQ_UNLOCK(&ifp->if_snd); + return (NULL); + } + IFQ_DEQUEUE_NOLOCK(&ifp->if_snd, m); + IFQ_UNLOCK(&ifp->if_snd); + return (m); + } +#endif + m = buf_ring_peek(br); + if (m == NULL || func(m, arg) == 0) + return (NULL); + + return (buf_ring_dequeue_sc(br)); +} + +static __inline int +drbr_empty(struct ifnet *ifp, struct buf_ring *br) +{ +#ifdef ALTQ + if (ALTQ_IS_ENABLED(&ifp->if_snd)) + return (IFQ_IS_EMPTY(&ifp->if_snd)); +#endif + return (buf_ring_empty(br)); +} + +static __inline int +drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br) +{ +#ifdef ALTQ + if (ALTQ_IS_ENABLED(&ifp->if_snd)) + return (1); +#endif + return (!buf_ring_empty(br)); +} + +static __inline int +drbr_inuse(struct ifnet *ifp, struct buf_ring *br) +{ +#ifdef ALTQ + if (ALTQ_IS_ENABLED(&ifp->if_snd)) + return (ifp->if_snd.ifq_len); +#endif + return (buf_ring_count(br)); +} +#endif +/* + * 72 was chosen below because it is the size of a TCP/IP + * header (40) + the minimum mss (32). + */ +#define IF_MINMTU 72 +#define IF_MAXMTU 65535 + +#define TOEDEV(ifp) ((ifp)->if_llsoftc) + +#endif /* _KERNEL */ + +/* + * The ifaddr structure contains information about one address + * of an interface. They are maintained by the different address families, + * are allocated and attached when an address is set, and are linked + * together so all addresses for an interface can be located. + * + * NOTE: a 'struct ifaddr' is always at the beginning of a larger + * chunk of malloc'ed memory, where we store the three addresses + * (ifa_addr, ifa_dstaddr and ifa_netmask) referenced here. + */ +#if defined(_KERNEL) || defined(_WANT_IFADDR) +struct ifaddr { + struct sockaddr *ifa_addr; /* address of interface */ + struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */ +#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ + struct sockaddr *ifa_netmask; /* used to determine subnet */ + struct ifnet *ifa_ifp; /* back-pointer to interface */ + struct carp_softc *ifa_carp; /* pointer to CARP data */ + TAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */ + void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ + (int, struct rtentry *, struct rt_addrinfo *); + u_short ifa_flags; /* mostly rt_flags for cloning */ + u_int ifa_refcnt; /* references to this structure */ + int ifa_metric; /* cost of going out this interface */ + int (*ifa_claim_addr) /* check if an addr goes to this if */ + (struct ifaddr *, struct sockaddr *); + + counter_u64_t ifa_ipackets; + counter_u64_t ifa_opackets; + counter_u64_t ifa_ibytes; + counter_u64_t ifa_obytes; +}; +#endif + +#ifdef _KERNEL +#define IFA_ROUTE RTF_UP /* route installed */ +#define IFA_RTSELF RTF_HOST /* loopback route to self installed */ + +/* For compatibility with other BSDs. SCTP uses it. */ +#define ifa_list ifa_link + +struct ifaddr * ifa_alloc(size_t size, int flags); +void ifa_free(struct ifaddr *ifa); +void ifa_ref(struct ifaddr *ifa); +#endif /* _KERNEL */ + +/* + * Multicast address structure. This is analogous to the ifaddr + * structure except that it keeps track of multicast addresses. + */ +struct ifmultiaddr { + TAILQ_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */ + struct sockaddr *ifma_addr; /* address this membership is for */ + struct sockaddr *ifma_lladdr; /* link-layer translation, if any */ + struct ifnet *ifma_ifp; /* back-pointer to interface */ + u_int ifma_refcount; /* reference count */ + void *ifma_protospec; /* protocol-specific state, if any */ + struct ifmultiaddr *ifma_llifma; /* pointer to ifma for ifma_lladdr */ +}; + +#ifdef _KERNEL + +extern struct rwlock ifnet_rwlock; +extern struct sx ifnet_sxlock; + +#define IFNET_LOCK_INIT() do { \ + rw_init_flags(&ifnet_rwlock, "ifnet_rw", RW_RECURSE); \ + sx_init_flags(&ifnet_sxlock, "ifnet_sx", SX_RECURSE); \ +} while(0) + +#define IFNET_WLOCK() do { \ + sx_xlock(&ifnet_sxlock); \ + rw_wlock(&ifnet_rwlock); \ +} while (0) + +#define IFNET_WUNLOCK() do { \ + rw_wunlock(&ifnet_rwlock); \ + sx_xunlock(&ifnet_sxlock); \ +} while (0) + +/* + * To assert the ifnet lock, you must know not only whether it's for read or + * write, but also whether it was acquired with sleep support or not. + */ +#define IFNET_RLOCK_ASSERT() sx_assert(&ifnet_sxlock, SA_SLOCKED) +#define IFNET_RLOCK_NOSLEEP_ASSERT() rw_assert(&ifnet_rwlock, RA_RLOCKED) +#define IFNET_WLOCK_ASSERT() do { \ + sx_assert(&ifnet_sxlock, SA_XLOCKED); \ + rw_assert(&ifnet_rwlock, RA_WLOCKED); \ +} while (0) + +#define IFNET_RLOCK() sx_slock(&ifnet_sxlock) +#define IFNET_RLOCK_NOSLEEP() rw_rlock(&ifnet_rwlock) +#define IFNET_RUNLOCK() sx_sunlock(&ifnet_sxlock) +#define IFNET_RUNLOCK_NOSLEEP() rw_runlock(&ifnet_rwlock) + +/* + * Look up an ifnet given its index; the _ref variant also acquires a + * reference that must be freed using if_rele(). It is almost always a bug + * to call ifnet_byindex() instead if ifnet_byindex_ref(). + */ +struct ifnet *ifnet_byindex(u_short idx); +struct ifnet *ifnet_byindex_locked(u_short idx); +struct ifnet *ifnet_byindex_ref(u_short idx); + +/* + * Given the index, ifaddr_byindex() returns the one and only + * link-level ifaddr for the interface. You are not supposed to use + * it to traverse the list of addresses associated to the interface. + */ +struct ifaddr *ifaddr_byindex(u_short idx); + +VNET_DECLARE(struct ifnethead, ifnet); +VNET_DECLARE(struct ifgrouphead, ifg_head); +VNET_DECLARE(int, if_index); +VNET_DECLARE(struct ifnet *, loif); /* first loopback interface */ +VNET_DECLARE(int, useloopback); + +#define V_ifnet VNET(ifnet) +#define V_ifg_head VNET(ifg_head) +#define V_if_index VNET(if_index) +#define V_loif VNET(loif) +#define V_useloopback VNET(useloopback) + +extern int ifqmaxlen; + +int if_addgroup(struct ifnet *, const char *); +int if_delgroup(struct ifnet *, const char *); +int if_addmulti(struct ifnet *, struct sockaddr *, struct ifmultiaddr **); +int if_allmulti(struct ifnet *, int); +struct ifnet* if_alloc(u_char); +void if_attach(struct ifnet *); +void if_dead(struct ifnet *); +int if_delmulti(struct ifnet *, struct sockaddr *); +void if_delmulti_ifma(struct ifmultiaddr *); +void if_detach(struct ifnet *); +void if_vmove(struct ifnet *, struct vnet *); +void if_purgeaddrs(struct ifnet *); +void if_delallmulti(struct ifnet *); +void if_down(struct ifnet *); +struct ifmultiaddr * + if_findmulti(struct ifnet *, struct sockaddr *); +void if_free(struct ifnet *); +void if_initname(struct ifnet *, const char *, int); +void if_link_state_change(struct ifnet *, int); +int if_printf(struct ifnet *, const char *, ...) __printflike(2, 3); +void if_qflush(struct ifnet *); +void if_ref(struct ifnet *); +void if_rele(struct ifnet *); +int if_setlladdr(struct ifnet *, const u_char *, int); +void if_up(struct ifnet *); +int ifioctl(struct socket *, u_long, caddr_t, struct thread *); +int ifpromisc(struct ifnet *, int); +struct ifnet *ifunit(const char *); +struct ifnet *ifunit_ref(const char *); + +void ifq_init(struct ifaltq *, struct ifnet *ifp); +void ifq_delete(struct ifaltq *); + +int ifa_add_loopback_route(struct ifaddr *, struct sockaddr *); +int ifa_del_loopback_route(struct ifaddr *, struct sockaddr *); + +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 *, int); +struct ifaddr *ifa_ifwithroute(int, struct sockaddr *, struct sockaddr *); +struct ifaddr *ifa_ifwithroute_fib(int, struct sockaddr *, struct sockaddr *, u_int); +struct ifaddr *ifaof_ifpforaddr(struct sockaddr *, struct ifnet *); +int ifa_preferred(struct ifaddr *, struct ifaddr *); + +int if_simloop(struct ifnet *ifp, struct mbuf *m, int af, int hlen); + +typedef void *if_com_alloc_t(u_char type, struct ifnet *ifp); +typedef void if_com_free_t(void *com, u_char type); +void if_register_com_alloc(u_char type, if_com_alloc_t *a, if_com_free_t *f); +void if_deregister_com_alloc(u_char type); + +#define IF_LLADDR(ifp) \ + LLADDR((struct sockaddr_dl *)((ifp)->if_addr->ifa_addr)) + +#ifdef DEVICE_POLLING +enum poll_cmd { POLL_ONLY, POLL_AND_CHECK_STATUS }; + +typedef int poll_handler_t(struct ifnet *ifp, enum poll_cmd cmd, int count); +int ether_poll_register(poll_handler_t *h, struct ifnet *ifp); +int ether_poll_deregister(struct ifnet *ifp); +#endif /* DEVICE_POLLING */ + +#endif /* _KERNEL */ + +#endif /* !_NET_IF_VAR_H_ */ From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 15:46:22 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9045FF83; Tue, 22 Oct 2013 15:46:22 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7D13623A6; Tue, 22 Oct 2013 15:46:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MFkMHh083516; Tue, 22 Oct 2013 15:46:22 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MFkMQJ083513; Tue, 22 Oct 2013 15:46:22 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201310221546.r9MFkMQJ083513@svn.freebsd.org> From: Andre Oppermann Date: Tue, 22 Oct 2013 15:46:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256913 - user/andre/mbuf_staging/net X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 15:46:22 -0000 Author: andre Date: Tue Oct 22 15:46:21 2013 New Revision: 256913 URL: http://svnweb.freebsd.org/changeset/base/256913 Log: Remove all interface queue related structures, macros and definitions from net/if_var.h and the other way around in net/ifq.h. Discussed with: glebius Sponsored by: The FreeBSD Foundation Modified: user/andre/mbuf_staging/net/if_var.h user/andre/mbuf_staging/net/ifq.h Modified: user/andre/mbuf_staging/net/if_var.h ============================================================================== --- user/andre/mbuf_staging/net/if_var.h Tue Oct 22 15:45:31 2013 (r256912) +++ user/andre/mbuf_staging/net/if_var.h Tue Oct 22 15:46:21 2013 (r256913) @@ -93,7 +93,7 @@ struct vnet; #define IF_DUNIT_NONE -1 -#include +#include TAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */ TAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */ @@ -106,18 +106,6 @@ VNET_DECLARE(struct pfil_head, link_pfil #endif /* _KERNEL */ /* - * Structure defining a queue for a network interface. - */ -struct ifqueue { - struct mbuf *ifq_head; - struct mbuf *ifq_tail; - int ifq_len; - int ifq_maxlen; - int ifq_drops; - struct mtx ifq_mtx; -}; - -/* * Structure defining a network interface. * * Size ILP32: 592 (approx) @@ -281,96 +269,6 @@ void if_addr_runlock(struct ifnet *ifp); 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 - * by these macros. - */ -#define IF_LOCK(ifq) mtx_lock(&(ifq)->ifq_mtx) -#define IF_UNLOCK(ifq) mtx_unlock(&(ifq)->ifq_mtx) -#define IF_LOCK_ASSERT(ifq) mtx_assert(&(ifq)->ifq_mtx, MA_OWNED) -#define _IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) -#define _IF_DROP(ifq) ((ifq)->ifq_drops++) -#define _IF_QLEN(ifq) ((ifq)->ifq_len) - -#define _IF_ENQUEUE(ifq, m) do { \ - (m)->m_nextpkt = NULL; \ - if ((ifq)->ifq_tail == NULL) \ - (ifq)->ifq_head = m; \ - else \ - (ifq)->ifq_tail->m_nextpkt = m; \ - (ifq)->ifq_tail = m; \ - (ifq)->ifq_len++; \ -} while (0) - -#define IF_ENQUEUE(ifq, m) do { \ - IF_LOCK(ifq); \ - _IF_ENQUEUE(ifq, m); \ - IF_UNLOCK(ifq); \ -} while (0) - -#define _IF_PREPEND(ifq, m) do { \ - (m)->m_nextpkt = (ifq)->ifq_head; \ - if ((ifq)->ifq_tail == NULL) \ - (ifq)->ifq_tail = (m); \ - (ifq)->ifq_head = (m); \ - (ifq)->ifq_len++; \ -} while (0) - -#define IF_PREPEND(ifq, m) do { \ - IF_LOCK(ifq); \ - _IF_PREPEND(ifq, m); \ - IF_UNLOCK(ifq); \ -} while (0) - -#define _IF_DEQUEUE(ifq, m) do { \ - (m) = (ifq)->ifq_head; \ - if (m) { \ - if (((ifq)->ifq_head = (m)->m_nextpkt) == NULL) \ - (ifq)->ifq_tail = NULL; \ - (m)->m_nextpkt = NULL; \ - (ifq)->ifq_len--; \ - } \ -} while (0) - -#define IF_DEQUEUE(ifq, m) do { \ - IF_LOCK(ifq); \ - _IF_DEQUEUE(ifq, m); \ - IF_UNLOCK(ifq); \ -} while (0) - -#define _IF_DEQUEUE_ALL(ifq, m) do { \ - (m) = (ifq)->ifq_head; \ - (ifq)->ifq_head = (ifq)->ifq_tail = NULL; \ - (ifq)->ifq_len = 0; \ -} while (0) - -#define IF_DEQUEUE_ALL(ifq, m) do { \ - IF_LOCK(ifq); \ - _IF_DEQUEUE_ALL(ifq, m); \ - IF_UNLOCK(ifq); \ -} while (0) - -#define _IF_POLL(ifq, m) ((m) = (ifq)->ifq_head) -#define IF_POLL(ifq, m) _IF_POLL(ifq, m) - -#define _IF_DRAIN(ifq) do { \ - struct mbuf *m; \ - for (;;) { \ - _IF_DEQUEUE(ifq, m); \ - if (m == NULL) \ - break; \ - m_freem(m); \ - } \ -} while (0) - -#define IF_DRAIN(ifq) do { \ - IF_LOCK(ifq); \ - _IF_DRAIN(ifq); \ - IF_UNLOCK(ifq); \ -} while(0) - #ifdef _KERNEL /* interface link layer address change event */ typedef void (*iflladdr_event_handler_t)(void *, struct ifnet *); @@ -436,172 +334,6 @@ EVENTHANDLER_DECLARE(group_change_event, #define IF_AFDATA_WLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_WLOCKED) #define IF_AFDATA_UNLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_UNLOCKED) -int if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, - int adjust); -#define IF_HANDOFF(ifq, m, ifp) \ - if_handoff((struct ifqueue *)ifq, m, ifp, 0) -#define IF_HANDOFF_ADJ(ifq, m, ifp, adj) \ - if_handoff((struct ifqueue *)ifq, m, ifp, adj) - -void if_start(struct ifnet *); - -#define IFQ_ENQUEUE(ifq, m, err) \ -do { \ - IF_LOCK(ifq); \ - if (ALTQ_IS_ENABLED(ifq)) \ - ALTQ_ENQUEUE(ifq, m, NULL, err); \ - else { \ - if (_IF_QFULL(ifq)) { \ - m_freem(m); \ - (err) = ENOBUFS; \ - } else { \ - _IF_ENQUEUE(ifq, m); \ - (err) = 0; \ - } \ - } \ - if (err) \ - (ifq)->ifq_drops++; \ - IF_UNLOCK(ifq); \ -} while (0) - -#define IFQ_DEQUEUE_NOLOCK(ifq, m) \ -do { \ - if (TBR_IS_ENABLED(ifq)) \ - (m) = tbr_dequeue_ptr(ifq, ALTDQ_REMOVE); \ - else if (ALTQ_IS_ENABLED(ifq)) \ - ALTQ_DEQUEUE(ifq, m); \ - else \ - _IF_DEQUEUE(ifq, m); \ -} while (0) - -#define IFQ_DEQUEUE(ifq, m) \ -do { \ - IF_LOCK(ifq); \ - IFQ_DEQUEUE_NOLOCK(ifq, m); \ - IF_UNLOCK(ifq); \ -} while (0) - -#define IFQ_POLL_NOLOCK(ifq, m) \ -do { \ - if (TBR_IS_ENABLED(ifq)) \ - (m) = tbr_dequeue_ptr(ifq, ALTDQ_POLL); \ - else if (ALTQ_IS_ENABLED(ifq)) \ - ALTQ_POLL(ifq, m); \ - else \ - _IF_POLL(ifq, m); \ -} while (0) - -#define IFQ_POLL(ifq, m) \ -do { \ - IF_LOCK(ifq); \ - IFQ_POLL_NOLOCK(ifq, m); \ - IF_UNLOCK(ifq); \ -} while (0) - -#define IFQ_PURGE_NOLOCK(ifq) \ -do { \ - if (ALTQ_IS_ENABLED(ifq)) { \ - ALTQ_PURGE(ifq); \ - } else \ - _IF_DRAIN(ifq); \ -} while (0) - -#define IFQ_PURGE(ifq) \ -do { \ - IF_LOCK(ifq); \ - IFQ_PURGE_NOLOCK(ifq); \ - IF_UNLOCK(ifq); \ -} while (0) - -#define IFQ_SET_READY(ifq) \ - do { ((ifq)->altq_flags |= ALTQF_READY); } while (0) - -#define IFQ_LOCK(ifq) IF_LOCK(ifq) -#define IFQ_UNLOCK(ifq) IF_UNLOCK(ifq) -#define IFQ_LOCK_ASSERT(ifq) IF_LOCK_ASSERT(ifq) -#define IFQ_IS_EMPTY(ifq) ((ifq)->ifq_len == 0) -#define IFQ_INC_LEN(ifq) ((ifq)->ifq_len++) -#define IFQ_DEC_LEN(ifq) (--(ifq)->ifq_len) -#define IFQ_INC_DROPS(ifq) ((ifq)->ifq_drops++) -#define IFQ_SET_MAXLEN(ifq, len) ((ifq)->ifq_maxlen = (len)) - -/* - * The IFF_DRV_OACTIVE test should really occur in the device driver, not in - * the handoff logic, as that flag is locked by the device driver. - */ -#define IFQ_HANDOFF_ADJ(ifp, m, adj, err) \ -do { \ - int len; \ - short mflags; \ - \ - len = (m)->m_pkthdr.len; \ - mflags = (m)->m_flags; \ - IFQ_ENQUEUE(&(ifp)->if_snd, m, err); \ - if ((err) == 0) { \ - (ifp)->if_obytes += len + (adj); \ - if (mflags & M_MCAST) \ - (ifp)->if_omcasts++; \ - if (((ifp)->if_drv_flags & IFF_DRV_OACTIVE) == 0) \ - if_start(ifp); \ - } \ -} while (0) - -#define IFQ_HANDOFF(ifp, m, err) \ - IFQ_HANDOFF_ADJ(ifp, m, 0, err) - -#define IFQ_DRV_DEQUEUE(ifq, m) \ -do { \ - (m) = (ifq)->ifq_drv_head; \ - if (m) { \ - if (((ifq)->ifq_drv_head = (m)->m_nextpkt) == NULL) \ - (ifq)->ifq_drv_tail = NULL; \ - (m)->m_nextpkt = NULL; \ - (ifq)->ifq_drv_len--; \ - } else { \ - IFQ_LOCK(ifq); \ - IFQ_DEQUEUE_NOLOCK(ifq, m); \ - while ((ifq)->ifq_drv_len < (ifq)->ifq_drv_maxlen) { \ - struct mbuf *m0; \ - IFQ_DEQUEUE_NOLOCK(ifq, m0); \ - if (m0 == NULL) \ - break; \ - m0->m_nextpkt = NULL; \ - if ((ifq)->ifq_drv_tail == NULL) \ - (ifq)->ifq_drv_head = m0; \ - else \ - (ifq)->ifq_drv_tail->m_nextpkt = m0; \ - (ifq)->ifq_drv_tail = m0; \ - (ifq)->ifq_drv_len++; \ - } \ - IFQ_UNLOCK(ifq); \ - } \ -} while (0) - -#define IFQ_DRV_PREPEND(ifq, m) \ -do { \ - (m)->m_nextpkt = (ifq)->ifq_drv_head; \ - if ((ifq)->ifq_drv_tail == NULL) \ - (ifq)->ifq_drv_tail = (m); \ - (ifq)->ifq_drv_head = (m); \ - (ifq)->ifq_drv_len++; \ -} while (0) - -#define IFQ_DRV_IS_EMPTY(ifq) \ - (((ifq)->ifq_drv_len == 0) && ((ifq)->ifq_len == 0)) - -#define IFQ_DRV_PURGE(ifq) \ -do { \ - struct mbuf *m, *n = (ifq)->ifq_drv_head; \ - while((m = n) != NULL) { \ - n = m->m_nextpkt; \ - m_freem(m); \ - } \ - (ifq)->ifq_drv_head = (ifq)->ifq_drv_tail = NULL; \ - (ifq)->ifq_drv_len = 0; \ - IFQ_PURGE(ifq); \ -} while (0) - -#ifdef _KERNEL static __inline void if_initbaudrate(struct ifnet *ifp, uintmax_t baud) { @@ -613,166 +345,6 @@ if_initbaudrate(struct ifnet *ifp, uintm } ifp->if_baudrate = baud; } - -static __inline int -drbr_enqueue(struct ifnet *ifp, struct buf_ring *br, struct mbuf *m) -{ - int error = 0; - -#ifdef ALTQ - if (ALTQ_IS_ENABLED(&ifp->if_snd)) { - IFQ_ENQUEUE(&ifp->if_snd, m, error); - return (error); - } -#endif - error = buf_ring_enqueue(br, m); - if (error) - m_freem(m); - - return (error); -} - -static __inline void -drbr_putback(struct ifnet *ifp, struct buf_ring *br, struct mbuf *new) -{ - /* - * The top of the list needs to be swapped - * for this one. - */ -#ifdef ALTQ - if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) { - /* - * Peek in altq case dequeued it - * so put it back. - */ - IFQ_DRV_PREPEND(&ifp->if_snd, new); - return; - } -#endif - buf_ring_putback_sc(br, new); -} - -static __inline struct mbuf * -drbr_peek(struct ifnet *ifp, struct buf_ring *br) -{ -#ifdef ALTQ - struct mbuf *m; - if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) { - /* - * Pull it off like a dequeue - * since drbr_advance() does nothing - * for altq and drbr_putback() will - * use the old prepend function. - */ - IFQ_DEQUEUE(&ifp->if_snd, m); - return (m); - } -#endif - return(buf_ring_peek(br)); -} - -static __inline void -drbr_flush(struct ifnet *ifp, struct buf_ring *br) -{ - struct mbuf *m; - -#ifdef ALTQ - if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) - IFQ_PURGE(&ifp->if_snd); -#endif - while ((m = buf_ring_dequeue_sc(br)) != NULL) - m_freem(m); -} - -static __inline void -drbr_free(struct buf_ring *br, struct malloc_type *type) -{ - - drbr_flush(NULL, br); - buf_ring_free(br, type); -} - -static __inline struct mbuf * -drbr_dequeue(struct ifnet *ifp, struct buf_ring *br) -{ -#ifdef ALTQ - struct mbuf *m; - - if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) { - IFQ_DEQUEUE(&ifp->if_snd, m); - return (m); - } -#endif - return (buf_ring_dequeue_sc(br)); -} - -static __inline void -drbr_advance(struct ifnet *ifp, struct buf_ring *br) -{ -#ifdef ALTQ - /* Nothing to do here since peek dequeues in altq case */ - if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) - return; -#endif - return (buf_ring_advance_sc(br)); -} - - -static __inline struct mbuf * -drbr_dequeue_cond(struct ifnet *ifp, struct buf_ring *br, - int (*func) (struct mbuf *, void *), void *arg) -{ - struct mbuf *m; -#ifdef ALTQ - if (ALTQ_IS_ENABLED(&ifp->if_snd)) { - IFQ_LOCK(&ifp->if_snd); - IFQ_POLL_NOLOCK(&ifp->if_snd, m); - if (m != NULL && func(m, arg) == 0) { - IFQ_UNLOCK(&ifp->if_snd); - return (NULL); - } - IFQ_DEQUEUE_NOLOCK(&ifp->if_snd, m); - IFQ_UNLOCK(&ifp->if_snd); - return (m); - } -#endif - m = buf_ring_peek(br); - if (m == NULL || func(m, arg) == 0) - return (NULL); - - return (buf_ring_dequeue_sc(br)); -} - -static __inline int -drbr_empty(struct ifnet *ifp, struct buf_ring *br) -{ -#ifdef ALTQ - if (ALTQ_IS_ENABLED(&ifp->if_snd)) - return (IFQ_IS_EMPTY(&ifp->if_snd)); -#endif - return (buf_ring_empty(br)); -} - -static __inline int -drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br) -{ -#ifdef ALTQ - if (ALTQ_IS_ENABLED(&ifp->if_snd)) - return (1); -#endif - return (!buf_ring_empty(br)); -} - -static __inline int -drbr_inuse(struct ifnet *ifp, struct buf_ring *br) -{ -#ifdef ALTQ - if (ALTQ_IS_ENABLED(&ifp->if_snd)) - return (ifp->if_snd.ifq_len); -#endif - return (buf_ring_count(br)); -} -#endif /* * 72 was chosen below because it is the size of a TCP/IP * header (40) + the minimum mss (32). @@ -908,8 +480,6 @@ VNET_DECLARE(int, useloopback); #define V_loif VNET(loif) #define V_useloopback VNET(useloopback) -extern int ifqmaxlen; - int if_addgroup(struct ifnet *, const char *); int if_delgroup(struct ifnet *, const char *); int if_addmulti(struct ifnet *, struct sockaddr *, struct ifmultiaddr **); @@ -930,7 +500,6 @@ void if_free(struct ifnet *); void if_initname(struct ifnet *, const char *, int); void if_link_state_change(struct ifnet *, int); int if_printf(struct ifnet *, const char *, ...) __printflike(2, 3); -void if_qflush(struct ifnet *); void if_ref(struct ifnet *); void if_rele(struct ifnet *); int if_setlladdr(struct ifnet *, const u_char *, int); @@ -965,15 +534,5 @@ void if_deregister_com_alloc(u_char type #define IF_LLADDR(ifp) \ LLADDR((struct sockaddr_dl *)((ifp)->if_addr->ifa_addr)) - -#ifdef DEVICE_POLLING -enum poll_cmd { POLL_ONLY, POLL_AND_CHECK_STATUS }; - -typedef int poll_handler_t(struct ifnet *ifp, enum poll_cmd cmd, int count); -int ether_poll_register(poll_handler_t *h, struct ifnet *ifp); -int ether_poll_deregister(struct ifnet *ifp); -#endif /* DEVICE_POLLING */ - #endif /* _KERNEL */ - #endif /* !_NET_IF_VAR_H_ */ Modified: user/andre/mbuf_staging/net/ifq.h ============================================================================== --- user/andre/mbuf_staging/net/ifq.h Tue Oct 22 15:45:31 2013 (r256912) +++ user/andre/mbuf_staging/net/ifq.h Tue Oct 22 15:46:21 2013 (r256913) @@ -30,50 +30,8 @@ * $FreeBSD$ */ -#ifndef _NET_IF_VAR_H_ -#define _NET_IF_VAR_H_ - -/* - * Structures defining a network interface, providing a packet - * transport mechanism (ala level 0 of the PUP protocols). - * - * Each interface accepts output datagrams of a specified maximum - * length, and provides higher level routines with input datagrams - * received from its medium. - * - * Output occurs when the routine if_output is called, with three parameters: - * (*ifp->if_output)(ifp, m, dst, rt) - * Here m is the mbuf chain to be sent and dst is the destination address. - * The output routine encapsulates the supplied datagram if necessary, - * and then transmits it on its medium. - * - * On input, each interface unwraps the data received by it, and either - * places it on the input queue of an internetwork datagram routine - * and posts the associated software interrupt, or passes the datagram to a raw - * packet input routine. - * - * Routines exist for locating interfaces by their addresses - * or for locating an interface on a certain network, as well as more general - * routing and gateway routines maintaining information used to locate - * interfaces. These routines live in the files if.c and route.c - */ - -#ifdef __STDC__ -/* - * Forward structure declarations for function prototypes [sic]. - */ -struct mbuf; -struct thread; -struct rtentry; -struct rt_addrinfo; -struct socket; -struct ether_header; -struct carp_if; -struct carp_softc; -struct ifvlantrunk; -struct route; -struct vnet; -#endif +#ifndef _NET_IFQ_H_ +#define _NET_IFQ_H_ #include /* get TAILQ macros */ @@ -83,6 +41,7 @@ struct vnet; #include #include #endif /* _KERNEL */ + #include #include /* XXX */ #include /* XXX */ @@ -95,16 +54,6 @@ struct vnet; #include -TAILQ_HEAD(ifnethead, ifnet); /* we use TAILQs so that the order of */ -TAILQ_HEAD(ifaddrhead, ifaddr); /* instantiation is preserved in the list */ -TAILQ_HEAD(ifmultihead, ifmultiaddr); -TAILQ_HEAD(ifgrouphead, ifg_group); - -#ifdef _KERNEL -VNET_DECLARE(struct pfil_head, link_pfil_hook); /* packet filter hooks */ -#define V_link_pfil_hook VNET(link_pfil_hook) -#endif /* _KERNEL */ - /* * Structure defining a queue for a network interface. */ @@ -117,170 +66,7 @@ struct ifqueue { struct mtx ifq_mtx; }; -/* - * Structure defining a network interface. - * - * Size ILP32: 592 (approx) - * LP64: 1048 (approx) - */ -struct ifnet { - /* General book keeping of interface lists. */ - TAILQ_ENTRY(ifnet) if_link; /* all struct ifnets are chained */ - LIST_ENTRY(ifnet) if_clones; /* interfaces of a cloner */ - TAILQ_HEAD(, ifg_list) if_groups; /* linked list of groups per if */ - /* protected by if_addr_lock */ - u_char if_alloctype; /* if_type at time of allocation */ - - /* Driver and protocol specific information that remains stable. */ - void *if_softc; /* pointer to driver state */ - void *if_llsoftc; /* link layer softc */ - void *if_l2com; /* pointer to protocol bits */ - const char *if_dname; /* driver name */ - int if_dunit; /* unit or IF_DUNIT_NONE */ - u_short if_index; /* numeric abbreviation for this if */ - short if_index_reserved; /* spare space to grow if_index */ - char if_xname[IFNAMSIZ]; /* external name (name + unit) */ - char *if_description; /* interface description */ - - /* Variable fields that are touched by the drivers. */ - int if_flags; /* up/down, broadcast, etc. */ - int if_capabilities; /* interface features & capabilities */ - int if_capenable; /* enabled features & capabilities */ - void *if_linkmib; /* link-type-specific MIB data */ - size_t if_linkmiblen; /* length of above data */ - int if_drv_flags; /* driver-managed status flags */ - u_int if_refcount; /* reference count */ - struct ifaltq if_snd; /* output queue (includes altq) */ - struct if_data if_data; - struct task if_linktask; /* task for link change events */ - - /* Addresses of different protocol families assigned to this if. */ - struct ifaddrhead if_addrhead; /* linked list of addresses per if */ - /* - * if_addrhead is the list of all addresses associated to - * an interface. - * Some code in the kernel assumes that first element - * of the list has type AF_LINK, and contains sockaddr_dl - * addresses which store the link-level address and the name - * of the interface. - * However, access to the AF_LINK address through this - * field is deprecated. Use if_addr or ifaddr_byindex() instead. - */ - struct ifmultihead if_multiaddrs; /* multicast addresses configured */ - int if_amcount; /* number of all-multicast requests */ - struct ifaddr *if_addr; /* pointer to link-level address */ - const u_int8_t *if_broadcastaddr; /* linklevel broadcast bytestring */ - struct rwlock if_addr_lock; /* lock to protect address lists */ - void *if_afdata[AF_MAX]; - int if_afdata_initialized; - struct rwlock if_afdata_lock; - - /* Additional interface features. */ - struct bpf_if *if_bpf; /* packet filter structure */ - int if_pcount; /* number of promiscuous listeners */ - void *if_bridge; /* bridge glue */ - void *if_lagg; /* lagg glue */ - void *if_pf_kif; /* pf glue */ - struct carp_if *if_carp; /* carp interface structure */ - struct ifvlantrunk *if_vlantrunk; /* pointer to 802.1q data */ - struct vnet *if_vnet; /* pointer to network stack instance */ - struct vnet *if_home_vnet; /* where this ifnet originates from */ - u_int if_fib; /* interface FIB */ - struct label *if_label; /* interface MAC label */ - - /* Various procedures of the layer2 encapsulation and drivers. */ - int (*if_output) /* output routine (enqueue) */ - (struct ifnet *, struct mbuf *, const struct sockaddr *, - struct route *); - void (*if_input) /* input routine (from h/w driver) */ - (struct ifnet *, struct mbuf *); - void (*if_start) /* initiate output routine */ - (struct ifnet *); - int (*if_ioctl) /* ioctl routine */ - (struct ifnet *, u_long, caddr_t); - void (*if_init) /* Init routine */ - (void *); - int (*if_resolvemulti) /* validate/resolve multicast */ - (struct ifnet *, struct sockaddr **, struct sockaddr *); - void (*if_qflush) /* flush any queues */ - (struct ifnet *); - int (*if_transmit) /* initiate output routine */ - (struct ifnet *, struct mbuf *); - void (*if_reassign) /* reassign to vnet routine */ - (struct ifnet *, struct vnet *, char *); - - /* Stuff that's only temporary and doesn't belong here. */ - u_int if_hw_tsomax; /* tso burst length limit, the minimum - * is (IP_MAXPACKET / 8). - * XXXAO: Have to find a better place - * for it eventually. */ - /* - * Spare fields are added so that we can modify sensitive data - * structures without changing the kernel binary interface, and must - * be used with care where binary compatibility is required. - */ - char if_cspare[3]; - int if_ispare[4]; - void *if_unused[2]; - void *if_pspare[8]; /* 1 netmap, 7 TDB */ -}; - -typedef void if_init_f_t(void *); - -/* - * XXX These aliases are terribly dangerous because they could apply - * to anything. - */ -#define if_mtu if_data.ifi_mtu -#define if_type if_data.ifi_type -#define if_physical if_data.ifi_physical -#define if_addrlen if_data.ifi_addrlen -#define if_hdrlen if_data.ifi_hdrlen -#define if_metric if_data.ifi_metric -#define if_link_state if_data.ifi_link_state -#define if_baudrate if_data.ifi_baudrate -#define if_baudrate_pf if_data.ifi_baudrate_pf -#define if_hwassist if_data.ifi_hwassist -#define if_ipackets if_data.ifi_ipackets -#define if_ierrors if_data.ifi_ierrors -#define if_opackets if_data.ifi_opackets -#define if_oerrors if_data.ifi_oerrors -#define if_collisions if_data.ifi_collisions -#define if_ibytes if_data.ifi_ibytes -#define if_obytes if_data.ifi_obytes -#define if_imcasts if_data.ifi_imcasts -#define if_omcasts if_data.ifi_omcasts -#define if_iqdrops if_data.ifi_iqdrops -#define if_noproto if_data.ifi_noproto -#define if_lastchange if_data.ifi_lastchange - -/* for compatibility with other BSDs */ -#define if_addrlist if_addrhead -#define if_list if_link -#define if_name(ifp) ((ifp)->if_xname) - -/* - * Locks for address lists on the network interface. - */ -#define IF_ADDR_LOCK_INIT(if) rw_init(&(if)->if_addr_lock, "if_addr_lock") -#define IF_ADDR_LOCK_DESTROY(if) rw_destroy(&(if)->if_addr_lock) -#define IF_ADDR_WLOCK(if) rw_wlock(&(if)->if_addr_lock) -#define IF_ADDR_WUNLOCK(if) rw_wunlock(&(if)->if_addr_lock) -#define IF_ADDR_RLOCK(if) rw_rlock(&(if)->if_addr_lock) -#define IF_ADDR_RUNLOCK(if) rw_runlock(&(if)->if_addr_lock) -#define IF_ADDR_LOCK_ASSERT(if) rw_assert(&(if)->if_addr_lock, RA_LOCKED) -#define IF_ADDR_WLOCK_ASSERT(if) rw_assert(&(if)->if_addr_lock, RA_WLOCKED) - -/* - * 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 */ - +#ifdef _KERNEL /* * Output queues (ifp->if_snd) and slow device input queues (*ifp->if_slowq) * are queues of messages stored on ifqueue structures @@ -371,71 +157,6 @@ void if_maddr_runlock(struct ifnet *ifp) IF_UNLOCK(ifq); \ } while(0) -#ifdef _KERNEL -/* interface link layer address change event */ -typedef void (*iflladdr_event_handler_t)(void *, struct ifnet *); -EVENTHANDLER_DECLARE(iflladdr_event, iflladdr_event_handler_t); -/* interface address change event */ -typedef void (*ifaddr_event_handler_t)(void *, struct ifnet *); -EVENTHANDLER_DECLARE(ifaddr_event, ifaddr_event_handler_t); -/* new interface arrival event */ -typedef void (*ifnet_arrival_event_handler_t)(void *, struct ifnet *); -EVENTHANDLER_DECLARE(ifnet_arrival_event, ifnet_arrival_event_handler_t); -/* interface departure event */ -typedef void (*ifnet_departure_event_handler_t)(void *, struct ifnet *); -EVENTHANDLER_DECLARE(ifnet_departure_event, ifnet_departure_event_handler_t); -/* Interface link state change event */ -typedef void (*ifnet_link_event_handler_t)(void *, struct ifnet *, int); -EVENTHANDLER_DECLARE(ifnet_link_event, ifnet_link_event_handler_t); - -/* - * interface groups - */ -struct ifg_group { - char ifg_group[IFNAMSIZ]; - u_int ifg_refcnt; - void *ifg_pf_kif; - TAILQ_HEAD(, ifg_member) ifg_members; - TAILQ_ENTRY(ifg_group) ifg_next; -}; - -struct ifg_member { - TAILQ_ENTRY(ifg_member) ifgm_next; - struct ifnet *ifgm_ifp; -}; - -struct ifg_list { - struct ifg_group *ifgl_group; - TAILQ_ENTRY(ifg_list) ifgl_next; -}; - -/* group attach event */ -typedef void (*group_attach_event_handler_t)(void *, struct ifg_group *); -EVENTHANDLER_DECLARE(group_attach_event, group_attach_event_handler_t); -/* group detach event */ -typedef void (*group_detach_event_handler_t)(void *, struct ifg_group *); -EVENTHANDLER_DECLARE(group_detach_event, group_detach_event_handler_t); -/* group change event */ -typedef void (*group_change_event_handler_t)(void *, const char *); -EVENTHANDLER_DECLARE(group_change_event, group_change_event_handler_t); - -#define IF_AFDATA_LOCK_INIT(ifp) \ - rw_init(&(ifp)->if_afdata_lock, "if_afdata") - -#define IF_AFDATA_WLOCK(ifp) rw_wlock(&(ifp)->if_afdata_lock) -#define IF_AFDATA_RLOCK(ifp) rw_rlock(&(ifp)->if_afdata_lock) -#define IF_AFDATA_WUNLOCK(ifp) rw_wunlock(&(ifp)->if_afdata_lock) -#define IF_AFDATA_RUNLOCK(ifp) rw_runlock(&(ifp)->if_afdata_lock) -#define IF_AFDATA_LOCK(ifp) IF_AFDATA_WLOCK(ifp) -#define IF_AFDATA_UNLOCK(ifp) IF_AFDATA_WUNLOCK(ifp) -#define IF_AFDATA_TRYLOCK(ifp) rw_try_wlock(&(ifp)->if_afdata_lock) -#define IF_AFDATA_DESTROY(ifp) rw_destroy(&(ifp)->if_afdata_lock) - -#define IF_AFDATA_LOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_LOCKED) -#define IF_AFDATA_RLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_RLOCKED) -#define IF_AFDATA_WLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_WLOCKED) -#define IF_AFDATA_UNLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_UNLOCKED) - int if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, int adjust); #define IF_HANDOFF(ifq, m, ifp) \ @@ -601,19 +322,6 @@ do { \ IFQ_PURGE(ifq); \ } while (0) -#ifdef _KERNEL -static __inline void -if_initbaudrate(struct ifnet *ifp, uintmax_t baud) -{ - - ifp->if_baudrate_pf = 0; - while (baud > (u_long)(~0UL)) { - baud /= 10; - ifp->if_baudrate_pf++; - } - ifp->if_baudrate = baud; -} - static __inline int drbr_enqueue(struct ifnet *ifp, struct buf_ring *br, struct mbuf *m) { @@ -772,199 +480,11 @@ drbr_inuse(struct ifnet *ifp, struct buf #endif return (buf_ring_count(br)); } -#endif -/* - * 72 was chosen below because it is the size of a TCP/IP - * header (40) + the minimum mss (32). - */ -#define IF_MINMTU 72 -#define IF_MAXMTU 65535 - -#define TOEDEV(ifp) ((ifp)->if_llsoftc) - #endif /* _KERNEL */ -/* - * The ifaddr structure contains information about one address - * of an interface. They are maintained by the different address families, - * are allocated and attached when an address is set, and are linked - * together so all addresses for an interface can be located. - * - * NOTE: a 'struct ifaddr' is always at the beginning of a larger - * chunk of malloc'ed memory, where we store the three addresses - * (ifa_addr, ifa_dstaddr and ifa_netmask) referenced here. - */ -#if defined(_KERNEL) || defined(_WANT_IFADDR) -struct ifaddr { - struct sockaddr *ifa_addr; /* address of interface */ - struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */ -#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ - struct sockaddr *ifa_netmask; /* used to determine subnet */ - struct ifnet *ifa_ifp; /* back-pointer to interface */ - struct carp_softc *ifa_carp; /* pointer to CARP data */ - TAILQ_ENTRY(ifaddr) ifa_link; /* queue macro glue */ - void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ - (int, struct rtentry *, struct rt_addrinfo *); - u_short ifa_flags; /* mostly rt_flags for cloning */ - u_int ifa_refcnt; /* references to this structure */ - int ifa_metric; /* cost of going out this interface */ - int (*ifa_claim_addr) /* check if an addr goes to this if */ - (struct ifaddr *, struct sockaddr *); - - counter_u64_t ifa_ipackets; - counter_u64_t ifa_opackets; - counter_u64_t ifa_ibytes; - counter_u64_t ifa_obytes; -}; -#endif - -#ifdef _KERNEL -#define IFA_ROUTE RTF_UP /* route installed */ -#define IFA_RTSELF RTF_HOST /* loopback route to self installed */ - -/* For compatibility with other BSDs. SCTP uses it. */ -#define ifa_list ifa_link - -struct ifaddr * ifa_alloc(size_t size, int flags); -void ifa_free(struct ifaddr *ifa); -void ifa_ref(struct ifaddr *ifa); -#endif /* _KERNEL */ - -/* - * Multicast address structure. This is analogous to the ifaddr - * structure except that it keeps track of multicast addresses. - */ -struct ifmultiaddr { - TAILQ_ENTRY(ifmultiaddr) ifma_link; /* queue macro glue */ - struct sockaddr *ifma_addr; /* address this membership is for */ - struct sockaddr *ifma_lladdr; /* link-layer translation, if any */ - struct ifnet *ifma_ifp; /* back-pointer to interface */ - u_int ifma_refcount; /* reference count */ - void *ifma_protospec; /* protocol-specific state, if any */ - struct ifmultiaddr *ifma_llifma; /* pointer to ifma for ifma_lladdr */ -}; - -#ifdef _KERNEL - -extern struct rwlock ifnet_rwlock; -extern struct sx ifnet_sxlock; - -#define IFNET_LOCK_INIT() do { \ - rw_init_flags(&ifnet_rwlock, "ifnet_rw", RW_RECURSE); \ - sx_init_flags(&ifnet_sxlock, "ifnet_sx", SX_RECURSE); \ -} while(0) - -#define IFNET_WLOCK() do { \ - sx_xlock(&ifnet_sxlock); \ - rw_wlock(&ifnet_rwlock); \ -} while (0) - -#define IFNET_WUNLOCK() do { \ - rw_wunlock(&ifnet_rwlock); \ - sx_xunlock(&ifnet_sxlock); \ -} while (0) - -/* - * To assert the ifnet lock, you must know not only whether it's for read or - * write, but also whether it was acquired with sleep support or not. - */ -#define IFNET_RLOCK_ASSERT() sx_assert(&ifnet_sxlock, SA_SLOCKED) -#define IFNET_RLOCK_NOSLEEP_ASSERT() rw_assert(&ifnet_rwlock, RA_RLOCKED) -#define IFNET_WLOCK_ASSERT() do { \ - sx_assert(&ifnet_sxlock, SA_XLOCKED); \ - rw_assert(&ifnet_rwlock, RA_WLOCKED); \ -} while (0) - -#define IFNET_RLOCK() sx_slock(&ifnet_sxlock) -#define IFNET_RLOCK_NOSLEEP() rw_rlock(&ifnet_rwlock) -#define IFNET_RUNLOCK() sx_sunlock(&ifnet_sxlock) -#define IFNET_RUNLOCK_NOSLEEP() rw_runlock(&ifnet_rwlock) - -/* - * Look up an ifnet given its index; the _ref variant also acquires a - * reference that must be freed using if_rele(). It is almost always a bug - * to call ifnet_byindex() instead if ifnet_byindex_ref(). - */ -struct ifnet *ifnet_byindex(u_short idx); -struct ifnet *ifnet_byindex_locked(u_short idx); -struct ifnet *ifnet_byindex_ref(u_short idx); - -/* - * Given the index, ifaddr_byindex() returns the one and only - * link-level ifaddr for the interface. You are not supposed to use - * it to traverse the list of addresses associated to the interface. - */ -struct ifaddr *ifaddr_byindex(u_short idx); - -VNET_DECLARE(struct ifnethead, ifnet); -VNET_DECLARE(struct ifgrouphead, ifg_head); -VNET_DECLARE(int, if_index); -VNET_DECLARE(struct ifnet *, loif); /* first loopback interface */ -VNET_DECLARE(int, useloopback); - -#define V_ifnet VNET(ifnet) -#define V_ifg_head VNET(ifg_head) -#define V_if_index VNET(if_index) -#define V_loif VNET(loif) -#define V_useloopback VNET(useloopback) - extern int ifqmaxlen; -int if_addgroup(struct ifnet *, const char *); -int if_delgroup(struct ifnet *, const char *); -int if_addmulti(struct ifnet *, struct sockaddr *, struct ifmultiaddr **); -int if_allmulti(struct ifnet *, int); -struct ifnet* if_alloc(u_char); -void if_attach(struct ifnet *); -void if_dead(struct ifnet *); -int if_delmulti(struct ifnet *, struct sockaddr *); -void if_delmulti_ifma(struct ifmultiaddr *); -void if_detach(struct ifnet *); -void if_vmove(struct ifnet *, struct vnet *); -void if_purgeaddrs(struct ifnet *); -void if_delallmulti(struct ifnet *); -void if_down(struct ifnet *); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 18:39:46 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C4806255; Tue, 22 Oct 2013 18:39:46 +0000 (UTC) (envelope-from andre@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AE8A42E87; Tue, 22 Oct 2013 18:39:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MIdkD1079299; Tue, 22 Oct 2013 18:39:46 GMT (envelope-from andre@svn.freebsd.org) Received: (from andre@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MIdipQ079288; Tue, 22 Oct 2013 18:39:44 GMT (envelope-from andre@svn.freebsd.org) Message-Id: <201310221839.r9MIdipQ079288@svn.freebsd.org> From: Andre Oppermann Date: Tue, 22 Oct 2013 18:39:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256922 - in user/andre/mbuf_staging: arm/allwinner arm/broadcom/bcm2835 arm/conf arm/freescale/imx boot/fdt/dts cam cam/ata cam/ctl cam/scsi cddl/contrib/opensolaris/uts/common/fs/zfs ... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 18:39:46 -0000 Author: andre Date: Tue Oct 22 18:39:43 2013 New Revision: 256922 URL: http://svnweb.freebsd.org/changeset/base/256922 Log: IFC @256921. Added: user/andre/mbuf_staging/arm/conf/IMX53-QSB - copied unchanged from r256921, head/sys/arm/conf/IMX53-QSB user/andre/mbuf_staging/boot/fdt/dts/beri-sim.dts - copied unchanged from r256921, head/sys/boot/fdt/dts/beri-sim.dts user/andre/mbuf_staging/boot/fdt/dts/beripad-de4.dts - copied unchanged from r256921, head/sys/boot/fdt/dts/beripad-de4.dts user/andre/mbuf_staging/boot/fdt/dts/imx53-qsb.dts - copied unchanged from r256921, head/sys/boot/fdt/dts/imx53-qsb.dts - copied unchanged from r256921, head/sys/dev/fdt/fdt_ic_if.m user/andre/mbuf_staging/dev/ffec/ - copied from r256921, head/sys/dev/ffec/ user/andre/mbuf_staging/dev/usb/controller/dwc_otg_fdt.c - copied unchanged from r256921, head/sys/dev/usb/controller/dwc_otg_fdt.c user/andre/mbuf_staging/mips/beri/beri_pic.c - copied unchanged from r256921, head/sys/mips/beri/beri_pic.c user/andre/mbuf_staging/mips/conf/BERI_DE4_BASE - copied unchanged from r256921, head/sys/mips/conf/BERI_DE4_BASE user/andre/mbuf_staging/mips/conf/BERI_SIM_BASE - copied unchanged from r256921, head/sys/mips/conf/BERI_SIM_BASE user/andre/mbuf_staging/mips/conf/BERI_SIM_SDROOT - copied unchanged from r256921, head/sys/mips/conf/BERI_SIM_SDROOT user/andre/mbuf_staging/powerpc/ofw/openpic_ofw.c - copied unchanged from r256921, head/sys/powerpc/ofw/openpic_ofw.c user/andre/mbuf_staging/powerpc/powerpc/clock.c - copied unchanged from r256921, head/sys/powerpc/powerpc/clock.c user/andre/mbuf_staging/powerpc/powerpc/nexus.c - copied unchanged from r256921, head/sys/powerpc/powerpc/nexus.c user/andre/mbuf_staging/powerpc/powerpc/vm_machdep.c - copied unchanged from r256921, head/sys/powerpc/powerpc/vm_machdep.c Directory Properties: user/andre/mbuf_staging/dev/fdt/fdt_ic_if.m (props changed) Deleted: user/andre/mbuf_staging/arm/broadcom/bcm2835/dwc_otg_brcm.c user/andre/mbuf_staging/dev/isf/ user/andre/mbuf_staging/powerpc/aim/clock.c user/andre/mbuf_staging/powerpc/aim/nexus.c user/andre/mbuf_staging/powerpc/aim/vm_machdep.c user/andre/mbuf_staging/powerpc/booke/clock.c user/andre/mbuf_staging/powerpc/booke/vm_machdep.c user/andre/mbuf_staging/powerpc/mambo/mambo_openpic.c user/andre/mbuf_staging/powerpc/mpc85xx/nexus.c user/andre/mbuf_staging/powerpc/powermac/openpic_macio.c user/andre/mbuf_staging/powerpc/powerpc/openpic_fdt.c Modified: user/andre/mbuf_staging/arm/allwinner/a10_wdog.c user/andre/mbuf_staging/arm/broadcom/bcm2835/bcm2835_wdog.c user/andre/mbuf_staging/arm/broadcom/bcm2835/files.bcm2835 user/andre/mbuf_staging/arm/freescale/imx/files.imx53 user/andre/mbuf_staging/boot/fdt/dts/digi-ccwmx53.dts user/andre/mbuf_staging/cam/ata/ata_da.c user/andre/mbuf_staging/cam/ata/ata_pmp.c user/andre/mbuf_staging/cam/ata/ata_xpt.c user/andre/mbuf_staging/cam/cam_ccb.h user/andre/mbuf_staging/cam/cam_periph.c user/andre/mbuf_staging/cam/cam_periph.h user/andre/mbuf_staging/cam/cam_queue.c user/andre/mbuf_staging/cam/cam_queue.h user/andre/mbuf_staging/cam/cam_sim.c user/andre/mbuf_staging/cam/cam_sim.h user/andre/mbuf_staging/cam/cam_xpt.c user/andre/mbuf_staging/cam/cam_xpt.h user/andre/mbuf_staging/cam/cam_xpt_internal.h user/andre/mbuf_staging/cam/cam_xpt_sim.h user/andre/mbuf_staging/cam/ctl/ctl_frontend_cam_sim.c user/andre/mbuf_staging/cam/ctl/scsi_ctl.c user/andre/mbuf_staging/cam/scsi/scsi_cd.c user/andre/mbuf_staging/cam/scsi/scsi_ch.c user/andre/mbuf_staging/cam/scsi/scsi_da.c user/andre/mbuf_staging/cam/scsi/scsi_enc.c user/andre/mbuf_staging/cam/scsi/scsi_enc_internal.h user/andre/mbuf_staging/cam/scsi/scsi_enc_safte.c user/andre/mbuf_staging/cam/scsi/scsi_enc_ses.c user/andre/mbuf_staging/cam/scsi/scsi_pass.c user/andre/mbuf_staging/cam/scsi/scsi_pt.c user/andre/mbuf_staging/cam/scsi/scsi_sa.c user/andre/mbuf_staging/cam/scsi/scsi_sg.c user/andre/mbuf_staging/cam/scsi/scsi_targ_bh.c user/andre/mbuf_staging/cam/scsi/scsi_target.c user/andre/mbuf_staging/cam/scsi/scsi_xpt.c user/andre/mbuf_staging/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c user/andre/mbuf_staging/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c user/andre/mbuf_staging/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c user/andre/mbuf_staging/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c user/andre/mbuf_staging/cddl/dev/dtrace/amd64/dtrace_isa.c user/andre/mbuf_staging/conf/files user/andre/mbuf_staging/conf/files.powerpc user/andre/mbuf_staging/dev/aha/aha.c user/andre/mbuf_staging/dev/ahci/ahci.c user/andre/mbuf_staging/dev/ahci/ahci.h user/andre/mbuf_staging/dev/aic7xxx/aic79xx.c user/andre/mbuf_staging/dev/aic7xxx/aic7xxx.c user/andre/mbuf_staging/dev/ata/ata-all.c user/andre/mbuf_staging/dev/buslogic/bt.c user/andre/mbuf_staging/dev/cfi/cfi_bus_nexus.c user/andre/mbuf_staging/dev/drm2/i915/i915_drv.c user/andre/mbuf_staging/dev/fdt/fdt_common.c user/andre/mbuf_staging/dev/fdt/fdt_common.h user/andre/mbuf_staging/dev/fdt/fdt_mips.c user/andre/mbuf_staging/dev/fdt/fdt_pci.c user/andre/mbuf_staging/dev/fdt/fdt_powerpc.c user/andre/mbuf_staging/dev/fdt/fdtbus.c user/andre/mbuf_staging/dev/fdt/simplebus.c user/andre/mbuf_staging/dev/firewire/sbp_targ.c user/andre/mbuf_staging/dev/isp/isp_freebsd.c user/andre/mbuf_staging/dev/md/md.c user/andre/mbuf_staging/dev/mpt/mpt_cam.c user/andre/mbuf_staging/dev/mvs/mvs.c user/andre/mbuf_staging/dev/ofw/ofw_bus_subr.c user/andre/mbuf_staging/dev/ofw/ofw_fdt.c user/andre/mbuf_staging/dev/re/if_re.c user/andre/mbuf_staging/dev/siis/siis.c user/andre/mbuf_staging/dev/uart/uart_dev_pl011.c user/andre/mbuf_staging/dev/usb/serial/uslcom.c user/andre/mbuf_staging/dev/usb/usbdevs user/andre/mbuf_staging/dev/xen/netback/netback.c user/andre/mbuf_staging/geom/concat/g_concat.c user/andre/mbuf_staging/geom/concat/g_concat.h user/andre/mbuf_staging/geom/gate/g_gate.c user/andre/mbuf_staging/geom/geom.h user/andre/mbuf_staging/geom/geom_dev.c user/andre/mbuf_staging/geom/geom_disk.c user/andre/mbuf_staging/geom/geom_disk.h user/andre/mbuf_staging/geom/geom_int.h user/andre/mbuf_staging/geom/geom_io.c user/andre/mbuf_staging/geom/geom_kern.c user/andre/mbuf_staging/geom/geom_slice.c user/andre/mbuf_staging/geom/geom_vfs.c user/andre/mbuf_staging/geom/mirror/g_mirror.c user/andre/mbuf_staging/geom/mirror/g_mirror.h user/andre/mbuf_staging/geom/multipath/g_multipath.c user/andre/mbuf_staging/geom/nop/g_nop.c user/andre/mbuf_staging/geom/nop/g_nop.h user/andre/mbuf_staging/geom/part/g_part.c user/andre/mbuf_staging/geom/raid/g_raid.c user/andre/mbuf_staging/geom/raid/md_ddf.c user/andre/mbuf_staging/geom/raid/md_intel.c user/andre/mbuf_staging/geom/raid/md_jmicron.c user/andre/mbuf_staging/geom/raid/md_nvidia.c user/andre/mbuf_staging/geom/raid/md_promise.c user/andre/mbuf_staging/geom/raid/md_sii.c user/andre/mbuf_staging/geom/stripe/g_stripe.c user/andre/mbuf_staging/geom/stripe/g_stripe.h user/andre/mbuf_staging/geom/zero/g_zero.c user/andre/mbuf_staging/kern/kern_conf.c user/andre/mbuf_staging/kern/kern_event.c user/andre/mbuf_staging/kern/kern_resource.c user/andre/mbuf_staging/kern/subr_devstat.c user/andre/mbuf_staging/kern/subr_taskqueue.c user/andre/mbuf_staging/kern/uipc_mbuf.c user/andre/mbuf_staging/kern/uipc_syscalls.c user/andre/mbuf_staging/kern/vfs_bio.c user/andre/mbuf_staging/mips/beri/files.beri user/andre/mbuf_staging/mips/conf/BERI_DE4.hints user/andre/mbuf_staging/mips/conf/BERI_DE4_MDROOT user/andre/mbuf_staging/mips/conf/BERI_DE4_SDROOT user/andre/mbuf_staging/mips/conf/BERI_SIM_MDROOT user/andre/mbuf_staging/mips/conf/BERI_TEMPLATE user/andre/mbuf_staging/net/if_media.h user/andre/mbuf_staging/pci/if_rlreg.h user/andre/mbuf_staging/powerpc/aim/machdep.c user/andre/mbuf_staging/powerpc/booke/machdep.c user/andre/mbuf_staging/powerpc/booke/pmap.c user/andre/mbuf_staging/powerpc/ofw/ofw_pci.c user/andre/mbuf_staging/powerpc/ofw/ofw_pci.h user/andre/mbuf_staging/powerpc/ofw/ofw_pcib_pci.c user/andre/mbuf_staging/powerpc/ofw/ofw_pcibus.c user/andre/mbuf_staging/powerpc/pseries/phyp_llan.c user/andre/mbuf_staging/sys/eventvar.h user/andre/mbuf_staging/sys/proc.h user/andre/mbuf_staging/sys/resource.h user/andre/mbuf_staging/sys/resourcevar.h user/andre/mbuf_staging/ufs/ffs/ffs_extern.h user/andre/mbuf_staging/ufs/ffs/ffs_softdep.c user/andre/mbuf_staging/ufs/ffs/ffs_vfsops.c user/andre/mbuf_staging/ufs/ffs/softdep.h user/andre/mbuf_staging/ufs/ufs/ufs_extern.h user/andre/mbuf_staging/ufs/ufs/ufsmount.h Directory Properties: user/andre/mbuf_staging/ (props changed) user/andre/mbuf_staging/boot/ (props changed) user/andre/mbuf_staging/cddl/contrib/opensolaris/ (props changed) user/andre/mbuf_staging/conf/ (props changed) Modified: user/andre/mbuf_staging/arm/allwinner/a10_wdog.c ============================================================================== --- user/andre/mbuf_staging/arm/allwinner/a10_wdog.c Tue Oct 22 18:36:39 2013 (r256921) +++ user/andre/mbuf_staging/arm/allwinner/a10_wdog.c Tue Oct 22 18:39:43 2013 (r256922) @@ -150,6 +150,18 @@ a10wd_watchdog_fn(void *private, u_int c (wd_intervals[i].value << WDOG_MODE_INTVL_SHIFT) | WDOG_MODE_EN | WDOG_MODE_RST_EN); WRITE(sc, WDOG_CTRL, WDOG_CTRL_RESTART); + *error = 0; + } + else { + /* + * Can't arm + * disable watchdog as watchdog(9) requires + */ + device_printf(sc->dev, + "Can't arm, timeout is more than 16 sec\n"); + mtx_unlock(&sc->mtx); + WRITE(sc, WDOG_MODE, 0); + return; } } else Modified: user/andre/mbuf_staging/arm/broadcom/bcm2835/bcm2835_wdog.c ============================================================================== --- user/andre/mbuf_staging/arm/broadcom/bcm2835/bcm2835_wdog.c Tue Oct 22 18:36:39 2013 (r256921) +++ user/andre/mbuf_staging/arm/broadcom/bcm2835/bcm2835_wdog.c Tue Oct 22 18:39:43 2013 (r256922) @@ -76,11 +76,10 @@ struct bcmwd_softc { int wdog_armed; int wdog_period; char wdog_passwd; + struct mtx mtx; }; -#ifdef notyet static void bcmwd_watchdog_fn(void *private, u_int cmd, int *error); -#endif static int bcmwd_probe(device_t dev) @@ -120,19 +119,59 @@ bcmwd_attach(device_t dev) sc->bsh = rman_get_bushandle(sc->res); bcmwd_lsc = sc; -#ifdef notyet + mtx_init(&sc->mtx, "BCM2835 Watchdog", "bcmwd", MTX_DEF); EVENTHANDLER_REGISTER(watchdog_list, bcmwd_watchdog_fn, sc, 0); -#endif + return (0); } -#ifdef notyet static void bcmwd_watchdog_fn(void *private, u_int cmd, int *error) { - /* XXX: not yet */ + struct bcmwd_softc *sc; + uint64_t sec; + uint32_t ticks, reg; + + sc = private; + mtx_lock(&sc->mtx); + + cmd &= WD_INTERVAL; + + if (cmd > 0) { + sec = ((uint64_t)1 << (cmd & WD_INTERVAL)) / 1000000000; + ticks = (sec << 16) & BCM2835_WDOG_TIME_MASK; + if (ticks == 0) { + /* + * Can't arm + * disable watchdog as watchdog(9) requires + */ + device_printf(sc->dev, + "Can't arm, timeout is less than 1 second\n"); + WRITE(sc, BCM2835_RSTC_REG, + (BCM2835_PASWORD << BCM2835_PASSWORD_SHIFT) | + BCM2835_RSTC_RESET); + mtx_unlock(&sc->mtx); + return; + } + + reg = (BCM2835_PASWORD << BCM2835_PASSWORD_SHIFT) | ticks; + WRITE(sc, BCM2835_WDOG_REG, reg); + + reg = READ(sc, BCM2835_RSTC_REG); + reg &= BCM2835_RSTC_WRCFG_CLR; + reg |= BCM2835_RSTC_WRCFG_FULL_RESET; + reg |= (BCM2835_PASWORD << BCM2835_PASSWORD_SHIFT); + WRITE(sc, BCM2835_RSTC_REG, reg); + + *error = 0; + } + else + WRITE(sc, BCM2835_RSTC_REG, + (BCM2835_PASWORD << BCM2835_PASSWORD_SHIFT) | + BCM2835_RSTC_RESET); + + mtx_unlock(&sc->mtx); } -#endif void bcmwd_watchdog_reset() Modified: user/andre/mbuf_staging/arm/broadcom/bcm2835/files.bcm2835 ============================================================================== --- user/andre/mbuf_staging/arm/broadcom/bcm2835/files.bcm2835 Tue Oct 22 18:36:39 2013 (r256921) +++ user/andre/mbuf_staging/arm/broadcom/bcm2835/files.bcm2835 Tue Oct 22 18:39:43 2013 (r256922) @@ -11,7 +11,7 @@ arm/broadcom/bcm2835/bcm2835_systimer.c arm/broadcom/bcm2835/bcm2835_wdog.c standard arm/broadcom/bcm2835/bus_space.c optional fdt arm/broadcom/bcm2835/common.c optional fdt -arm/broadcom/bcm2835/dwc_otg_brcm.c optional dwcotg +dev/usb/controller/dwc_otg_fdt.c optional dwcotg arm/arm/bus_space_generic.c standard arm/arm/bus_space_asm_generic.S standard Copied: user/andre/mbuf_staging/arm/conf/IMX53-QSB (from r256921, head/sys/arm/conf/IMX53-QSB) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/andre/mbuf_staging/arm/conf/IMX53-QSB Tue Oct 22 18:39:43 2013 (r256922, copy of r256921, head/sys/arm/conf/IMX53-QSB) @@ -0,0 +1,179 @@ +# Kernel configuration for Freescale i.MX53 Quick Start Board +# +# 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 +# +# The handbook is also available locally in /usr/share/doc/handbook +# if you've installed the doc distribution, otherwise always see the +# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the +# latest information. +# +# An exhaustive list of options and more detailed explanations of the +# device lines is also present in the ../../conf/NOTES and NOTES files. +# If you are in doubt as to the purpose or necessity of a line, check first +# in NOTES. +# +# $FreeBSD$ + +ident IMX53-QSB + +include "../freescale/imx/std.imx53" + +makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols +#options DEBUG + +options HZ=250 # 4ms scheduling quantum +options SCHED_4BSD # 4BSD scheduler +#options PREEMPTION # Enable kernel thread preemption +options INET # InterNETworking +options INET6 # IPv6 communications protocols +#options SCTP # Stream Control Transmission Protocol +options FFS # Berkeley Fast Filesystem +options SOFTUPDATES # Enable FFS soft updates support +options UFS_ACL # Support for access control lists +options UFS_DIRHASH # Improve performance on big directories +options UFS_GJOURNAL # Enable gjournal-based UFS journaling +#options MD_ROOT # MD is a potential root device +options NFSCL # New Network Filesystem Client +#options NFSD # New Network Filesystem Server +options NFSLOCKD # Network Lock Manager +options NFS_ROOT # NFS usable as /, requires NFSCL +options MSDOSFS # MSDOS Filesystem +options CD9660 # ISO 9660 Filesystem +#options PROCFS # Process filesystem (requires PSEUDOFS) +options PSEUDOFS # Pseudo-filesystem framework +options TMPFS # TMP Memory Filesystem +options GEOM_PART_GPT # GUID Partition Tables. +options GEOM_LABEL # Provides labelization +#options COMPAT_FREEBSD5 # Compatible with FreeBSD5 +#options COMPAT_FREEBSD6 # Compatible with FreeBSD6 +#options COMPAT_FREEBSD7 # Compatible with FreeBSD7 +options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI +options KTRACE # ktrace(1) support +options SYSVSHM # SYSV-style shared memory +options SYSVMSG # SYSV-style message queues +options SYSVSEM # SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions +options INCLUDE_CONFIG_FILE # Include this file in kernel +options VFP # vfp/neon + +# required for netbooting +#options BOOTP +#options BOOTP_COMPAT +#options BOOTP_NFSROOT +#options BOOTP_NFSV3 +#options BOOTP_WIRED_TO=ue0 + +#options ROOTDEVNAME=\"ufs:ada0s2a\" + + +# kernel/memory size reduction +#options MUTEX_NOINLINE +#options NO_FFS_SNAPSHOT +#options NO_SWAPPING +#options NO_SYSCTL_DESCR +#options RWLOCK_NOINLINE + +# Debugging support. Always need this: +options KDB # Enable kernel debugger support. +# For minimum debugger support (stable branch) use: +#options KDB_TRACE # Print a stack trace for a panic. +# For full debugger support use this instead: +options DDB # Support DDB. +#options GDB # Support remote GDB. +#options DEADLKRES # Enable the deadlock resolver +#options INVARIANTS # Enable calls of extra sanity checking +#options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS +#options WITNESS # Enable checks to detect deadlocks and cycles + +# The `bpf' device enables the Berkeley Packet Filter. +# Be aware of the administrative consequences of enabling this! +# Note that 'bpf' is required for DHCP. +device bpf # Berkeley packet filter + +# Pseudo devices. +device loop # Network loopback +device random # Entropy device +device ether # Ethernet support +#device vlan # 802.1Q VLAN support +#device tun # Packet tunnel. +device md # Memory "disks" +#device gif # IPv6 and IPv4 tunneling +#device faith # IPv6-to-IPv4 relaying (translation) +#device firmware # firmware assist module + +# Ethernet +device ffec # Freescale Fast Ethernet Controller +device miibus # Standard mii bus + +# Serial (COM) ports +device uart # Multi-uart driver +options ALT_BREAK_TO_DEBUGGER + +#device ata +#device atapci # Only for helper functions +#device imxata +#options ATA_STATIC_ID # Static device numbering + +device iomux # IO Multiplexor + +device gpio +device gpioled + +device fsliic +device iic +device iicbus + +# SCSI peripherals +device scbus # SCSI bus (required for SCSI) +device da # Direct Access (disks) +device cd # CD +device pass # Passthrough device (direct SCSI access) + +# USB support +#options USB_DEBUG # enable debug msgs +device ehci # OHCI USB interface +device usb # USB Bus (required) +device umass # Disks/Mass storage - Requires scbus and da +#device uhid # "Human Interface Devices" +#device ukbd # Allow keyboard like HIDs to control console +#device ums + +# USB Ethernet, requires miibus +#device 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 + +# USB Wireless +#device rum # Ralink Technology RT2501USB wireless NICs + +# Watchdog timer. +# WARNING: can't be disabled!!! +device imxwdt # Watchdog + +# Wireless NIC cards +device wlan # 802.11 support +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 + +# Flattened Device Tree +options FDT +options FDT_DTB_STATIC +makeoptions FDT_DTS_FILE=imx53-qsb.dts + +# NOTE: serial console will be disabled if syscons enabled +# Uncomment following lines for framebuffer/syscons support +#device sc +#device kbdmux +#options SC_DFLT_FONT # compile font in +#makeoptions SC_DFLT_FONT=cp437 + Modified: user/andre/mbuf_staging/arm/freescale/imx/files.imx53 ============================================================================== --- user/andre/mbuf_staging/arm/freescale/imx/files.imx53 Tue Oct 22 18:36:39 2013 (r256921) +++ user/andre/mbuf_staging/arm/freescale/imx/files.imx53 Tue Oct 22 18:39:43 2013 (r256922) @@ -12,8 +12,11 @@ arm/freescale/imx/imx53_machdep.c standa arm/freescale/imx/common.c standard arm/freescale/imx/bus_space.c standard -# Dummy serial console -arm/freescale/imx/console.c standard +# Special serial console for debuging early boot code +#arm/freescale/imx/console.c standard + +# UART driver (includes serial console support) +dev/uart/uart_dev_imx.c optional uart # TrustZone Interrupt Controller arm/freescale/imx/tzic.c standard @@ -33,9 +36,6 @@ arm/freescale/imx/imx51_ccm.c standard # i.MX5xx PATA controller dev/ata/chipsets/ata-fsl.c optional imxata -# UART driver -#dev/uart/uart_dev_imx.c optional uart - # USB join controller (1 OTG, 3 EHCI) dev/usb/controller/ehci_imx.c optional ehci @@ -49,3 +49,6 @@ dev/ofw/ofw_iicbus.c optional fsliic # IPU - Image Processing Unit (frame buffer also) arm/freescale/imx/imx51_ipuv3.c optional sc +# Fast Ethernet Controller +dev/ffec/if_ffec.c optional ffec + Copied: user/andre/mbuf_staging/boot/fdt/dts/beri-sim.dts (from r256921, head/sys/boot/fdt/dts/beri-sim.dts) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/andre/mbuf_staging/boot/fdt/dts/beri-sim.dts Tue Oct 22 18:39:43 2013 (r256922, copy of r256921, head/sys/boot/fdt/dts/beri-sim.dts) @@ -0,0 +1,144 @@ +/*- + * Copyright (c) 2012-2013 Robert N. M. Watson + * Copyright (c) 2013 SRI International + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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$ + */ + +/dts-v1/; + +/* + * Device names here have been largely made up on the spot, especially for the + * "compatible" strings, and might want to be revised. + * + * For now, use 32-bit addressing as our Avalon bus is 32-bit. However, in + * the future, we should likely change to 64-bit. + */ + +/ { + model = "SRI/Cambridge BERI simulation"; + compatible = "sri-cambridge,beri-sim"; + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <1>; + + /* + * Secondary CPUs all start disabled and use the + * spin-table enable method. cpu-release-addr must be + * specified for each cpu other than cpu@0. Values of + * cpu-release-addr grow down from 0x100000 (kernel). + */ + status = "disabled"; + enable-method = "spin-table"; + + cpu@0 { + device-type = "cpu"; + compatible = "sri-cambridge,beri"; + + reg = <0>; + status = "okay"; + }; + +/* + cpu@1 { + device-type = "cpu"; + compatible = "sri-cambridge,beri"; + + reg = <1>; + // XXX: should we need cached prefix? + cpu-release-addr = <0xffffffff 0x800fffe0>; + }; +*/ + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + #interrupt-cells = <1>; + + /* + * Declare mips,mips4k since BERI doesn't (yet) have a PIC, so + * we use mips4k coprocessor 0 interrupt management directly. + */ + compatible = "simple-bus", "mips,mips4k"; + ranges = <>; + + memory { + device_type = "memory"; + reg = <0x0 0x4000000>; // 64M at 0x0 + }; + + beripic: beripic@7f804000 { + compatible = "sri-cambridge,beri-pic"; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + reg = <0x7f804000 0x400 + 0x7f806000 0x10 + 0x7f806080 0x10 + 0x7f806100 0x10>; + interrupts = <0 1 2 3 4>; + hard-interrupt-sources = <64>; + soft-interrupt-sources = <64>; + }; + + serial@7f000000 { + compatible = "altera,jtag_uart-11_0"; + reg = <0x7f000000 0x40>; + interrupts = <0>; + interrupt-parent = <&beripic>; + }; + + serial@7f001000 { + compatible = "altera,jtag_uart-11_0"; + reg = <0x7f001000 0x40>; + }; + + serial@7f002000 { + compatible = "altera,jtag_uart-11_0"; + reg = <0x7f002000 0x40>; + }; + + sdcard@7f008000 { + compatible = "altera,sdcard_11_2011"; + reg = <0x7f008000 0x400>; + }; + + avgen@0x7f00a000 { + compatible = "sri-cambridge,avgen"; + reg = <0x7f00a000 0x14>; + sri-cambridge,width = <4>; + sri-cambridge,fileio = "rw"; + sri-cambridge,devname = "berirom"; + }; + }; +}; Copied: user/andre/mbuf_staging/boot/fdt/dts/beripad-de4.dts (from r256921, head/sys/boot/fdt/dts/beripad-de4.dts) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/andre/mbuf_staging/boot/fdt/dts/beripad-de4.dts Tue Oct 22 18:39:43 2013 (r256922, copy of r256921, head/sys/boot/fdt/dts/beripad-de4.dts) @@ -0,0 +1,266 @@ +/*- + * Copyright (c) 2012-2013 Robert N. M. Watson + * Copyright (c) 2013 SRI International + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * 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$ + */ + +/dts-v1/; + +/* + * Device names here have been largely made up on the spot, especially for the + * "compatible" strings, and might want to be revised. + * + * For now, use 32-bit addressing as our Avalon bus is 32-bit. However, in + * the future, we should likely change to 64-bit. + */ + +/ { + model = "SRI/Cambridge BeriPad (DE4)"; + compatible = "sri-cambridge,beripad-de4"; + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <1>; + + /* + * Secondary CPUs all start disabled and use the + * spin-table enable method. cpu-release-addr must be + * specified for each cpu other than cpu@0. Values of + * cpu-release-addr grow down from 0x100000 (kernel). + */ + status = "disabled"; + enable-method = "spin-table"; + + cpu@0 { + device-type = "cpu"; + compatible = "sri-cambridge,beri"; + + reg = <0>; + status = "okay"; + }; + +/* + cpu@1 { + device-type = "cpu"; + compatible = "sri-cambridge,beri"; + + reg = <1>; + // XXX: should we need cached prefix? + cpu-release-addr = <0xffffffff 0x800fffe0>; + }; +*/ + }; + + soc { + #address-cells = <1>; + #size-cells = <1>; + #interrupt-cells = <1>; + + /* + * Declare mips,mips4k since BERI doesn't (yet) have a PIC, so + * we use mips4k coprocessor 0 interrupt management directly. + */ + compatible = "simple-bus", "mips,mips4k"; + ranges = <>; + + memory { + device_type = "memory"; + reg = <0x0 0x40000000>; // 1G at 0x0 + }; + + beripic: beripic@7f804000 { + compatible = "sri-cambridge,beri-pic"; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + reg = <0x7f804000 0x400 + 0x7f806000 0x10 + 0x7f806080 0x10 + 0x7f806100 0x10>; + interrupts = <0 1 2 3 4>; + hard-interrupt-sources = <64>; + soft-interrupt-sources = <64>; + }; + + serial@7f002100 { + compatible = "ns16550"; + reg = <0x7f002100 0x20>; + reg-shift = <2>; + clock-frequency = <50000000>; + interrupts = <6>; + interrupt-parent = <&beripic>; + }; + + serial@7f000000 { + compatible = "altera,jtag_uart-11_0"; + reg = <0x7f000000 0x40>; + interrupts = <0>; + interrupt-parent = <&beripic>; + }; + + serial@7f001000 { + compatible = "altera,jtag_uart-11_0"; + reg = <0x7f001000 0x40>; + }; + + serial@7f002000 { + compatible = "altera,jtag_uart-11_0"; + reg = <0x7f002000 0x40>; + }; + + sdcard@7f008000 { + compatible = "altera,sdcard_11_2011"; + reg = <0x7f008000 0x400>; + }; + + led@7f006000 { + compatible = "sri-cambridge,de4led"; + reg = <0x7f006000 0x1>; + }; + + /* + * XXX-BZ keep flash before ethernet so that atse can read the + * Ethernet addresses for now. + */ + flash@74000000 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "cfi-flash"; + reg = <0x74000000 0x4000000>; + + /* Board configuration */ + partition@0 { + reg = <0x0 0x20000>; + label = "config"; + }; + + /* Power up FPGA image */ + partition@20000 { + reg = <0x20000 0xc00000>; + label = "fpga0"; + }; + + /* Secondary FPGA image (on RE_CONFIGn button) */ + partition@C20000 { + reg = <0xc20000 0xc00000>; + label = "fpga1"; + }; + + /* Space for operating system use */ + partition@1820000 { + reg = <0x1820000 0x027c0000>; + label = "os"; + }; + + /* Second stage bootloader */ + parition@3fe0000 { + reg = <0x3fe0000 0x20000>; + label = "boot"; + }; + }; + + ethernet@7f007000 { + compatible = "altera,atse"; + // MAC, RX+RXC, TX+TXC. + reg = <0x7f007000 0x400 + 0x7f007500 0x8 + 0x7f007520 0x20 + 0x7f007400 0x8 + 0x7f007420 0x20>; + // RX, TX + interrupts = <1 2>; + interrupt-parent = <&beripic>; + }; + + ethernet@7f005000 { + compatible = "altera,atse"; + // MAC, RX+RXC, TX+TXC. + reg = <0x7f005000 0x400 + 0x7f005500 0x8 + 0x7f005520 0x20 + 0x7f005400 0x8 + 0x7f005420 0x20>; + // RX, TX + interrupts = <11 12>; + interrupt-parent = <&beripic>; + }; + + touchscreen@70400000 { + compatible = "sri-cambridge,mtl"; + reg = <0x70400000 0x1000 + 0x70000000 0x177000 + 0x70177000 0x2000>; + }; + + usb@0x7f100000 { + compatible = "philips,isp1761"; + reg = <0x7f100000 0x40000 + 0x7f140000 0x4>; + // IRQ 4 is DC, IRQ 5 is HC. + interrupts = <4 5>; + interrupt-parent = <&beripic>; + }; + + avgen@0x7f009000 { + compatible = "sri-cambridge,avgen"; + reg = <0x7f009000 0x2>; + sri-cambridge,width = <1>; + sri-cambridge,fileio = "r"; + sri-cambridge,devname = "de4bsw"; + }; + + avgen@0x7f00a000 { + compatible = "sri-cambridge,avgen"; + reg = <0x7f00a000 0x14>; + sri-cambridge,width = <4>; + sri-cambridge,fileio = "rw"; + sri-cambridge,devname = "berirom"; + }; + + avgen@0x7f00c000 { + compatible = "sri-cambridge,avgen"; + reg = <0x7f00c000 0x8>; + sri-cambridge,width = <4>; + sri-cambridge,fileio = "rw"; + sri-cambridge,devname = "de4tempfan"; + }; + + avgen@0x7f100000 { + compatible = "sri-cambridge,avgen"; + reg = <0x7f100000 0x40000>; + sri-cambridge,width = <4>; + sri-cambridge,fileio = "r"; + sri-cambridge,devname = "usbmem"; + }; + + }; +}; Modified: user/andre/mbuf_staging/boot/fdt/dts/digi-ccwmx53.dts ============================================================================== --- user/andre/mbuf_staging/boot/fdt/dts/digi-ccwmx53.dts Tue Oct 22 18:36:39 2013 (r256921) +++ user/andre/mbuf_staging/boot/fdt/dts/digi-ccwmx53.dts Tue Oct 22 18:39:43 2013 (r256922) @@ -70,9 +70,9 @@ }; /* UART1, console */ - UART1: serial@53fbc000 { + console: serial@53fbc000 { status = "okay"; - clock-frequency = <3000000>; /* XXX */ + clock-frequency = <0>; /* won't load w/o this */ }; clock@53fd4000 { @@ -111,13 +111,12 @@ }; aliases { - UART1 = &UART1; SSI2 = &SSI2; }; chosen { bootargs = "-v"; - stdin = "UART1"; - stdout = "UART1"; + stdin = &console; + stdout = &console; }; }; Copied: user/andre/mbuf_staging/boot/fdt/dts/imx53-qsb.dts (from r256921, head/sys/boot/fdt/dts/imx53-qsb.dts) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/andre/mbuf_staging/boot/fdt/dts/imx53-qsb.dts Tue Oct 22 18:39:43 2013 (r256922, copy of r256921, head/sys/boot/fdt/dts/imx53-qsb.dts) @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2012 The FreeBSD Foundation + * Copyright (c) 2013 Rui Paulo + * All rights reserved. + * + * This software was developed by Semihalf 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. + * + * Freescale i.MX53 Quick Start Board + * + * $FreeBSD$ + */ + +/dts-v1/; +/include/ "imx53x.dtsi" + +/ { + model = "Freescale i.MX53 Quick Start Board"; + compatible = "fsl,imx53-qsb", "fsl,imx53"; + + memory { + /* RAM 512M */ + reg = <0x70000000 0x20000000>; + }; + + localbus@18000000 { + ipu3@18000000 { + status = "okay"; + }; + }; + + soc@50000000 { + aips@50000000 { + spba@50000000 { + esdhc@50004000 { + clock-frequency = <216000000>; + status = "okay"; + }; + esdhc@50008000 { + clock-frequency = <216000000>; + status = "okay"; + }; + SSI2: ssi@50014000 { + status = "okay"; + }; + }; + timer@53fa0000 { + status = "okay"; + }; + + /* UART1, console */ + console: serial@53fbc000 { + status = "okay"; + clock-frequency = <0>; /* won't load w/o this */ + }; + + clock@53fd4000 { + status = "okay"; + }; + gpio@53f84000 { + status = "okay"; + }; + gpio@53f88000 { + status = "okay"; + }; + gpio@53f8c000 { + status = "okay"; + }; + gpio@53f90000 { + status = "okay"; + }; + wdog@53f98000 { + status = "okay"; + }; + }; + aips@60000000 { + ethernet@63fec000 { + status = "okay"; + phy-mode = "rmii"; + } + i2c@63fc4000 { + status = "okay"; + }; + i2c@63fc8000 { + status = "okay"; + }; + audmux@63fd4000 { + status = "okay"; + }; + ide@63fe0000 { + status = "okay"; + }; + }; + }; + + aliases { + SSI2 = &SSI2; + }; + + chosen { + bootargs = "-v"; + stdin = &console; + stdout = &console; + }; +}; Modified: user/andre/mbuf_staging/cam/ata/ata_da.c ============================================================================== --- user/andre/mbuf_staging/cam/ata/ata_da.c Tue Oct 22 18:36:39 2013 (r256921) +++ user/andre/mbuf_staging/cam/ata/ata_da.c Tue Oct 22 18:39:43 2013 (r256922) @@ -103,7 +103,6 @@ typedef enum { ADA_CCB_RAHEAD = 0x01, ADA_CCB_WCACHE = 0x02, ADA_CCB_BUFFER_IO = 0x03, - ADA_CCB_WAITING = 0x04, ADA_CCB_DUMP = 0x05, ADA_CCB_TRIM = 0x06, ADA_CCB_TYPE_MASK = 0x0F, @@ -123,10 +122,9 @@ struct disk_params { #define TRIM_MAX_BLOCKS 8 #define TRIM_MAX_RANGES (TRIM_MAX_BLOCKS * ATA_DSM_BLK_RANGES) -#define TRIM_MAX_BIOS (TRIM_MAX_RANGES * 4) struct trim_request { uint8_t data[TRIM_MAX_RANGES * ATA_DSM_RANGE_SIZE]; - struct bio *bps[TRIM_MAX_BIOS]; + TAILQ_HEAD(, bio) bps; }; struct ada_softc { @@ -155,6 +153,7 @@ struct ada_softc { struct sysctl_oid *sysctl_tree; struct callout sendordered_c; struct trim_request trim_req; + int refcount; }; struct ada_quirk_entry { @@ -638,14 +637,8 @@ adaclose(struct disk *dp) int error; periph = (struct cam_periph *)dp->d_drv1; - cam_periph_lock(periph); - if (cam_periph_hold(periph, PRIBIO) != 0) { - cam_periph_unlock(periph); - cam_periph_release(periph); - return (0); - } - softc = (struct ada_softc *)periph->softc; + cam_periph_lock(periph); CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, ("adaclose\n")); @@ -653,7 +646,8 @@ adaclose(struct disk *dp) /* We only sync the cache if the drive is capable of it. */ if ((softc->flags & ADA_FLAG_DIRTY) != 0 && (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) != 0 && - (periph->flags & CAM_PERIPH_INVALID) == 0) { + (periph->flags & CAM_PERIPH_INVALID) == 0 && + cam_periph_hold(periph, PRIBIO) == 0) { ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); cam_fill_ataio(&ccb->ataio, @@ -677,10 +671,13 @@ adaclose(struct disk *dp) else softc->flags &= ~ADA_FLAG_DIRTY; xpt_release_ccb(ccb); + cam_periph_unhold(periph); } softc->flags &= ~ADA_FLAG_OPEN; - cam_periph_unhold(periph); + + while (softc->refcount != 0) + cam_periph_sleep(periph, &softc->refcount, PRIBIO, "adaclose", 1); cam_periph_unlock(periph); cam_periph_release(periph); return (0); @@ -690,23 +687,15 @@ static void adaschedule(struct cam_periph *periph) { struct ada_softc *softc = (struct ada_softc *)periph->softc; - uint32_t prio; if (softc->state != ADA_STATE_NORMAL) return; - /* Check if cam_periph_getccb() was called. */ - prio = periph->immediate_priority; - /* Check if we have more work to do. */ if (bioq_first(&softc->bio_queue) || (!softc->trim_running && bioq_first(&softc->trim_queue))) { - prio = CAM_PRIORITY_NORMAL; + xpt_schedule(periph, CAM_PRIORITY_NORMAL); } - - /* Schedule CCB if any of above is true. */ - if (prio != CAM_PRIORITY_NONE) - xpt_schedule(periph, prio); } /* @@ -970,7 +959,7 @@ adaasync(void *callback_arg, u_int32_t c status = cam_periph_alloc(adaregister, adaoninvalidate, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 20:27:32 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0D870234; Tue, 22 Oct 2013 20:27:32 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EDC2D25C9; Tue, 22 Oct 2013 20:27:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MKRV1a031329; Tue, 22 Oct 2013 20:27:31 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MKRU8u031324; Tue, 22 Oct 2013 20:27:30 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310222027.r9MKRU8u031324@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 22 Oct 2013 20:27:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256928 - in user/ed/newcons/sys/dev/drm2: . i915 radeon X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 20:27:32 -0000 Author: ray Date: Tue Oct 22 20:27:30 2013 New Revision: 256928 URL: http://svnweb.freebsd.org/changeset/base/256928 Log: o Update drivers according to fb_info structure changes. o Switch drm_fb_helper to be simple framebuffer provider. Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/dev/drm2/drm_fb_helper.c user/ed/newcons/sys/dev/drm2/drm_fb_helper.h user/ed/newcons/sys/dev/drm2/drm_os_freebsd.h user/ed/newcons/sys/dev/drm2/i915/intel_fb.c user/ed/newcons/sys/dev/drm2/radeon/radeon_fb.c Modified: user/ed/newcons/sys/dev/drm2/drm_fb_helper.c ============================================================================== --- user/ed/newcons/sys/dev/drm2/drm_fb_helper.c Tue Oct 22 20:10:38 2013 (r256927) +++ user/ed/newcons/sys/dev/drm2/drm_fb_helper.c Tue Oct 22 20:27:30 2013 (r256928) @@ -36,175 +36,36 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include - +#if defined(__FreeBSD__) struct vt_kms_softc { - intptr_t sc_paddr; - intptr_t sc_vaddr; - int sc_depth; - int sc_stride; - int sc_width; - int sc_height; struct drm_fb_helper *fb_helper; struct task fb_mode_task; - uint32_t sc_cmap[16]; }; -static vd_init_t vt_kms_init; -static vd_blank_t vt_kms_blank; -static vd_bitbltchr_t vt_kms_bitbltchr; -static vd_postswitch_t vt_kms_postswitch; +static fb_enter_t vt_kms_postswitch; static void vt_restore_fbdev_mode(void *, int); -static struct vt_driver vt_vt_kms_driver = { - .vd_init = vt_kms_init, - .vd_blank = vt_kms_blank, - .vd_bitbltchr = vt_kms_bitbltchr, - .vd_postswitch = vt_kms_postswitch, -}; - -static void -vt_kms_blank(struct vt_device *vd, term_color_t color) -{ - struct vt_kms_softc *sc = vd->vd_softc; - u_int ofs; - uint32_t c; - - c = sc->sc_cmap[color]; - /* TODO handle difference between depth and bpp. */ - switch (sc->sc_depth) { - case 8: - for (ofs = 0; ofs < (sc->sc_stride * vd->vd_height); ofs++) - *(uint8_t *)(sc->sc_vaddr + ofs) = c & 0xff; - break; - case 16: - /* XXX must be 16bits colormap */ - for (ofs = 0; ofs < (sc->sc_stride * vd->vd_height); ofs++) - *(uint16_t *)(sc->sc_vaddr + 2 * ofs) = c & 0xffff; - break; - case 24: /* */ - case 32: - c = sc->sc_cmap[color]; - for (ofs = 0; ofs < (sc->sc_stride * vd->vd_height); ofs++) - *(uint32_t *)(sc->sc_vaddr + 4 * ofs) = c; - break; - default: - /* panic? */ - break; - } -} - -static void -vt_kms_bitbltchr(struct vt_device *vd, const uint8_t *src, - vt_axis_t top, vt_axis_t left, unsigned int width, unsigned int height, - term_color_t fg, term_color_t bg) -{ - struct vt_kms_softc *sc = vd->vd_softc; - u_long line; - uint32_t fgc, bgc; - int c; - uint8_t b = 0; - - fgc = sc->sc_cmap[fg]; - bgc = sc->sc_cmap[bg]; - - line = (sc->sc_stride * top) + left * sc->sc_depth/8; - for (; height > 0; height--) { - for (c = 0; c < width; c++) { - if (c % 8 == 0) - b = *src++; - else - b <<= 1; - switch(sc->sc_depth) { - case 8: - *(uint8_t *)(sc->sc_vaddr + line + c) = - (b & 0x80 ? fgc : bgc) & 0xff; - break; - /* TODO 16 */ - /* TODO 24 */ - case 32: - *(uint32_t *)(sc->sc_vaddr + line + 4*c) = - (b & 0x80) ? fgc : bgc; - break; - default: - /* panic? */ - break; - } - } - line += sc->sc_stride; - } -} - -static int -vt_kms_init(struct vt_device *vd) -{ - struct vt_kms_softc *sc; - int err; - - sc = vd->vd_softc; - - vd->vd_height = sc->sc_height; - vd->vd_width = sc->sc_width; - - switch (sc->sc_depth) { - case 8: - err = vt_generate_vga_palette(sc->sc_cmap, COLOR_FORMAT_RGB, - 0x7, 5, 0x7, 2, 0x3, 0); - if (err) - return (CN_DEAD); - break; - case 15: - err = vt_generate_vga_palette(sc->sc_cmap, COLOR_FORMAT_RGB, - 0x1f, 10, 0x1f, 5, 0x1f, 0); - if (err) - return (CN_DEAD); - break; - case 16: - err = vt_generate_vga_palette(sc->sc_cmap, COLOR_FORMAT_RGB, - 0x1f, 11, 0x3f, 5, 0x1f, 0); - if (err) - return (CN_DEAD); - break; - case 24: - case 32: /* Ignore alpha. */ - err = vt_generate_vga_palette(sc->sc_cmap, COLOR_FORMAT_RGB, - 0xff, 0, 0xff, 8, 0xff, 16); - if (err) - return (CN_DEAD); - break; - default: - return (CN_DEAD); - } - - /* Clear the screen. */ - vt_kms_blank(vd, TC_BLACK); - - TASK_INIT(&sc->fb_mode_task, 0, vt_restore_fbdev_mode, vd); - - return (CN_INTERNAL); -} - /* Call restore out of vt(9) locks. */ static void vt_restore_fbdev_mode(void *arg, int pending) { struct vt_kms_softc *sc; - struct vt_device *vd; - vd = (struct vt_device *)arg; - sc = vd->vd_softc; + sc = (struct vt_kms_softc *)arg; drm_fb_helper_restore_fbdev_mode(sc->fb_helper); } -static void -vt_kms_postswitch(struct vt_device *vd) +static int +vt_kms_postswitch(void *arg) { struct vt_kms_softc *sc; - sc = vd->vd_softc; + sc = (struct vt_kms_softc *)arg; taskqueue_enqueue_fast(taskqueue_thread, &sc->fb_mode_task); + + return (0); } +#endif static DRM_LIST_HEAD(kernel_fb_helper_list); @@ -1069,6 +930,9 @@ int drm_fb_helper_single_fb_probe(struct struct fb_info *info; struct drm_fb_helper_surface_size sizes; int gamma_size = 0; +#if defined(__FreeBSD__) + struct vt_kms_softc *sc; +#endif memset(&sizes, 0, sizeof(struct drm_fb_helper_surface_size)); sizes.surface_depth = 24; @@ -1145,14 +1009,33 @@ int drm_fb_helper_single_fb_probe(struct if (new_fb < 0) return new_fb; +#if defined(__FreeBSD__) + sc = malloc(sizeof(struct vt_kms_softc), DRM_MEM_KMS, + M_WAITOK | M_ZERO); + sc->fb_helper = fb_helper; + TASK_INIT(&sc->fb_mode_task, 0, vt_restore_fbdev_mode, sc); + info = fb_helper->fbdev; + info->fb_name = device_get_nameunit(fb_helper->dev->device); + info->fb_depth = fb_helper->fb->bits_per_pixel; + info->fb_height = fb_helper->fb->height; + info->fb_width = fb_helper->fb->width; + info->fb_stride = fb_helper->fb->pitches[0]; + info->fb_priv = sc; + info->enter = &vt_kms_postswitch; +#endif + /* set the fb pointer */ for (i = 0; i < fb_helper->crtc_count; i++) { fb_helper->crtc_info[i].mode_set.fb = fb_helper->fb; } -#if 0 +#if defined(__FreeBSD__) + if (new_fb) { + register_framebuffer(info); + } +#else if (new_fb) { info->var.pixclock = 0; if (register_framebuffer(info) < 0) { @@ -1176,27 +1059,6 @@ int drm_fb_helper_single_fb_probe(struct if (new_fb) list_add(&fb_helper->kernel_fb_list, &kernel_fb_helper_list); #endif - - struct vt_kms_softc *sc = (struct vt_kms_softc *)malloc(sizeof(struct vt_kms_softc), M_TEMP, M_WAITOK); - sc->sc_vaddr = info->fb_vbase; - sc->sc_paddr = info->fb_pbase; - - sc->sc_depth = fb_helper->fb->bits_per_pixel; /* XXX: fix depth in VT, bpp is pix size, depth is meaning bits size */ - - sc->sc_height = fb_helper->fb->height; - sc->sc_stride = fb_helper->fb->pitches[0]; - sc->sc_width = fb_helper->fb->width; - /* Save fb_helper (XXX Do we really need it?) */ - sc->fb_helper = fb_helper; - - drm_fb_helper_restore_fbdev_mode(fb_helper); - - vt_allocate(&vt_vt_kms_driver, sc); - - DRM_DEBUG("Attach VT to %dx%d fb: P %#lx V %#lx\n", - fb_helper->fb->width, fb_helper->fb->height, - info->fb_pbase, info->fb_vbase); - return 0; } Modified: user/ed/newcons/sys/dev/drm2/drm_fb_helper.h ============================================================================== --- user/ed/newcons/sys/dev/drm2/drm_fb_helper.h Tue Oct 22 20:10:38 2013 (r256927) +++ user/ed/newcons/sys/dev/drm2/drm_fb_helper.h Tue Oct 22 20:27:30 2013 (r256928) @@ -79,19 +79,6 @@ struct drm_fb_helper_connector { struct drm_connector *connector; }; -/* TODO: move it out as separate FrameBuffer interface. */ -struct fb_info { - vm_offset_t fb_vbase; - vm_paddr_t fb_pbase; - size_t fb_size; - /* TODO fb_read method. */ - /* TODO fb_write method. */ - /* TODO fb_bitblt method. */ - /* TODO fb_blank method. */ - /* TODO H/W cursor methods. */ - /* TODO H/W mouse cursor methods. */ -}; - struct drm_fb_helper { struct drm_framebuffer *fb; struct drm_framebuffer *saved_fb; Modified: user/ed/newcons/sys/dev/drm2/drm_os_freebsd.h ============================================================================== --- user/ed/newcons/sys/dev/drm2/drm_os_freebsd.h Tue Oct 22 20:10:38 2013 (r256927) +++ user/ed/newcons/sys/dev/drm2/drm_os_freebsd.h Tue Oct 22 20:27:30 2013 (r256928) @@ -6,6 +6,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #if _BYTE_ORDER == _BIG_ENDIAN #define __BIG_ENDIAN 4321 #else Modified: user/ed/newcons/sys/dev/drm2/i915/intel_fb.c ============================================================================== --- user/ed/newcons/sys/dev/drm2/i915/intel_fb.c Tue Oct 22 20:10:38 2013 (r256927) +++ user/ed/newcons/sys/dev/drm2/i915/intel_fb.c Tue Oct 22 20:27:30 2013 (r256928) @@ -89,7 +89,9 @@ static int intelfb_create(struct intel_f #else info = malloc(sizeof(struct fb_info), DRM_MEM_KMS, M_WAITOK | M_ZERO); info->fb_size = size; - + info->fb_bpp = sizes->surface_bpp; + info->fb_width = sizes->fb_width; + info->fb_height = sizes->fb_height; info->fb_pbase = dev->agp->base + obj->gtt_offset; info->fb_vbase = (vm_offset_t)pmap_mapdev_attr(info->fb_pbase, size, PAT_WRITE_COMBINING); Modified: user/ed/newcons/sys/dev/drm2/radeon/radeon_fb.c ============================================================================== --- user/ed/newcons/sys/dev/drm2/radeon/radeon_fb.c Tue Oct 22 20:10:38 2013 (r256927) +++ user/ed/newcons/sys/dev/drm2/radeon/radeon_fb.c Tue Oct 22 20:27:30 2013 (r256928) @@ -235,6 +235,9 @@ static int radeonfb_create(struct radeon tmp = radeon_bo_gpu_offset(rbo) - rdev->mc.vram_start; info->fb_size = radeon_bo_size(rbo); + info->fb_bpp = sizes->surface_bpp; + info->fb_width = sizes->surface_width; + info->fb_height = sizes->surface_height; info->fb_pbase = rdev->mc.aper_base + tmp; info->fb_vbase = (vm_offset_t)rbo->kptr; From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 20:30:55 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 6C3EF474; Tue, 22 Oct 2013 20:30:55 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5A0C72624; Tue, 22 Oct 2013 20:30:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MKUtwi033857; Tue, 22 Oct 2013 20:30:55 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MKUtES033856; Tue, 22 Oct 2013 20:30:55 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310222030.r9MKUtES033856@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 22 Oct 2013 20:30:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256929 - user/ed/newcons/sys/arm/freescale/imx X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 20:30:55 -0000 Author: ray Date: Tue Oct 22 20:30:54 2013 New Revision: 256929 URL: http://svnweb.freebsd.org/changeset/base/256929 Log: Enable cache early to speed up memory operations. Modified: user/ed/newcons/sys/arm/freescale/imx/imx51_machdep.c Modified: user/ed/newcons/sys/arm/freescale/imx/imx51_machdep.c ============================================================================== --- user/ed/newcons/sys/arm/freescale/imx/imx51_machdep.c Tue Oct 22 20:27:30 2013 (r256928) +++ user/ed/newcons/sys/arm/freescale/imx/imx51_machdep.c Tue Oct 22 20:30:54 2013 (r256929) @@ -88,6 +88,8 @@ void initarm_late_init(void) { + cpufunc_control(CPU_CONTROL_DC_ENABLE|CPU_CONTROL_IC_ENABLE, + CPU_CONTROL_DC_ENABLE|CPU_CONTROL_IC_ENABLE); } #define FDT_DEVMAP_MAX 2 From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 20:32:00 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 108F356A; Tue, 22 Oct 2013 20:32:00 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F1C752631; Tue, 22 Oct 2013 20:31:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MKVxmS034285; Tue, 22 Oct 2013 20:31:59 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MKVxZV034284; Tue, 22 Oct 2013 20:31:59 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310222031.r9MKVxZV034284@svn.freebsd.org> From: Aleksandr Rybalko Date: Tue, 22 Oct 2013 20:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256930 - user/ed/newcons/sys/arm/conf X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 20:32:00 -0000 Author: ray Date: Tue Oct 22 20:31:59 2013 New Revision: 256930 URL: http://svnweb.freebsd.org/changeset/base/256930 Log: Remove syscons related flags. Modified: user/ed/newcons/sys/arm/conf/EFIKA_MX Modified: user/ed/newcons/sys/arm/conf/EFIKA_MX ============================================================================== --- user/ed/newcons/sys/arm/conf/EFIKA_MX Tue Oct 22 20:30:54 2013 (r256929) +++ user/ed/newcons/sys/arm/conf/EFIKA_MX Tue Oct 22 20:31:59 2013 (r256930) @@ -169,11 +169,8 @@ makeoptions FDT_DTS_FILE=efikamx.dts # NOTE: serial console will be disabled if syscons enabled # Uncomment following lines for framebuffer/syscons support device vt -#options SC_OFWFB device vkbd device kbdmux -#options SC_DFLT_FONT # compile font in -#makeoptions SC_DFLT_FONT=cp437 device ukbd # Allow keyboard like HIDs to control console device ums From owner-svn-src-user@FreeBSD.ORG Tue Oct 22 20:58:24 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 40F60672; Tue, 22 Oct 2013 20:58:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2D5262803; Tue, 22 Oct 2013 20:58:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9MKwOqa043322; Tue, 22 Oct 2013 20:58:24 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9MKwO90043321; Tue, 22 Oct 2013 20:58:24 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201310222058.r9MKwO90043321@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 22 Oct 2013 20:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256933 - user/glebius/course/05.memory X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2013 20:58:24 -0000 Author: glebius Date: Tue Oct 22 20:58:23 2013 New Revision: 256933 URL: http://svnweb.freebsd.org/changeset/base/256933 Log: More on memory. Modified: user/glebius/course/05.memory/lection.tex Modified: user/glebius/course/05.memory/lection.tex ============================================================================== --- user/glebius/course/05.memory/lection.tex Tue Oct 22 20:57:24 2013 (r256932) +++ user/glebius/course/05.memory/lection.tex Tue Oct 22 20:58:23 2013 (r256933) @@ -15,6 +15,7 @@ \usetikzlibrary{shapes} \usetikzlibrary{arrows} \usetikzlibrary{decorations.text} +\usetikzlibrary{patterns} \usetikzlibrary{chains} \usetikzlibrary{scopes} \usetikzlibrary{calc} @@ -647,9 +648,164 @@ Try this out: \node [name=pageB2, page, node distance=0, below=of pageB1] {{\color{red}page 2}}; } +\end{tikzpicture} +\end{figure} +\end{frame} + +\FootReferences{malloc(9),memguard(9),redzone(9)}{sys/kern/kern\_malloc.c} +\begin{frame} +\frametitle{kernel malloc(9)} +\begin{figure} +\begin{tikzpicture}[start chain=main going below, + node distance=3mm, + every join/.style={->, draw}, + font=\scriptsize] + \tikzset { + base/.style={draw, thick, on chain, align=center, minimum height=4ex}, + proc/.style={base, rectangle}, + test/.style={base, diamond, aspect=3}, + term/.style={proc, rounded corners}, + } + + \node [name=entry, proc] {malloc(size)}; + \node [name=memguard, test, join] {memguard?}; + { [start branch=memguard going below] + \node [name=guardalloc, proc, join] {v = memguard\_alloc()}; + } + \node [name=pagesize, continue chain=going right, test, join] + {size <= page size}; + { [start branch=large going right] + \node [name=largealloc, proc, join] {v = uma\_large\_malloc()}; + } + \node [name=zone, continue chain=going below, proc, join] + {zone = min(power2(size))}; + \node [name=zalloc, proc, join] {v = uma\_zalloc(zone)}; + \node [name=mtp, proc, join] {malloc type accounting}; + \node [name=redzone, test, join] {redzone?}; + { [start branch=redzone going right] + \node [name=redsetup, proc, join] {redzone\_setup(v)}; + } + \node [name=return, term, join] {return v}; + + \path (memguard.east) to node [yshift=1ex, red] {$no$} (pagesize); + \path (memguard.south) to node [xshift=1em, green] {$yes$} (guardalloc); + \draw [->,rounded corners] (guardalloc.south) |- (return.west); + \path (pagesize.south) to node [xshift=1em, green] {$yes$} (zone); + \path (pagesize.east) to node [yshift=1ex, red] {$no$} (largealloc); + \draw [->,rounded corners] (largealloc.south) |- (mtp.east); + \path (redzone.south) to node [xshift=1em, red] {$no$} (return); + \path (redzone.east) to node [yshift=1ex, green] {$yes$} (redsetup); + \draw [->,rounded corners] (redsetup.south) |- (return.east); \end{tikzpicture} \end{figure} \end{frame} + +\FootReferences{uma(9),vmstat(8)}{sys/vm/uma\_int.h,sys/vm/uma\_core.c} +\begin{frame} +\frametitle{uma(9): the zone allocator} +Let's look at malloc(9) zones in UMA: +\shellcmd{% +\# vmstat -z \textbar~head -1 \&\& vmstat -z \textbar~egrep '\^~\lbrack0-9\rbrack+:'\\ +\begin{tabular}{rrrrrrrr} +ITEM & SIZE & LIMIT & USED & FREE & REQ &FAIL &SLEEP \\ +16: & 16, & 0, & 8055, & 479, & 30823,& 0,& 0 \\ +32: & 32, & 0, & 706, & 1044, & 197057,& 0,& 0 \\ +64: & 64, & 0, & 1905, & 8759, &3215548,& 0,& 0 \\ +128: & 128, & 0, & 1463, & 5202, & 387198,& 0,& 0 \\ +256: & 256, & 0, & 616, & 4304, & 757799,& 0,& 0 \\ +512: & 512, & 0, & 426, & 3846, & 50371,& 0,& 0 \\ +1024: & 1024, & 0, & 80, & 116, & 70702,& 0,& 0 \\ +2048: & 2048, & 0, & 79, & 87, & 71207,& 0,& 0 \\ +4096: & 4096, & 0, & 193, & 49, & 78923,& 0,& 0 \\ +\end{tabular} +} +\end{frame} + +% +% This ugly TikZ code is taken from my master thesis and needs to +% be redesigned. Too much absolute node positioning here. +% +\newcommand{\structline}[2]{ #1 & #2 \\ } +\FootReferences{uma(9)}{sys/vm/uma\_int.h, sys/vm/uma\_core.c} +\begin{frame} +\frametitle{uma(9) is a slab allocator} +\begin{columns} +\begin{column}{.03\paperwidth} +\end{column} +\begin{column}{.97\paperwidth} +\begin{tikzpicture}[thick] +\draw [rounded corners] (1.0cm, 0cm) -- (0cm, 0cm) -- (0cm, 3cm) + -- (1.0cm, 3cm); +\foreach \i in { 1, 2, 4, 5} + \node (item\i) at (\i cm * 1.0, 0cm) [draw, anchor=south west, + outer sep=0pt, minimum height=3cm, minimum width=1.0cm] {}; +\node (item3) at (3.0cm, 0cm) [anchor=south west, + outer sep=0pt, minimum height=3cm, minimum width=1.0cm] { \ldots }; +% waste +\draw [pattern=checkerboard light gray] + (node cs:name=item5, anchor=north east) -- + (7cm, 3cm) -- (7cm, 0cm) -- + (node cs:name=item5, anchor=south east) -- cycle; +% slab header +\shadedraw [shading=axis,shading angle=45] (7cm, 0cm) -- (7cm, 3cm) + { [rounded corners] -- (12cm, 3cm) -- (12cm, 0cm) } -- cycle; +\draw (9.5cm, 1.5cm) node (slab) [rectangle split, rectangle split parts = 2, + rounded corners, draw, fill=white] { + \textbf{struct uma\_slab} + \nodepart{two} + \begin{tabular}{ll} + \structline{uint8\_t} {*us\_data} + \structline{slabbits} {us\_free} + \ldots + \end{tabular} +}; +% slab size +\draw (12cm / 2, 3.25cm) node (sizelabel) {slab size (PAGE\_SIZE)}; +\draw [<-] (0cm, 3.25cm) -- (sizelabel.west); +\draw [->] (sizelabel.east) -- (12cm, 3.25cm); +% pointer +\draw [fill] (node cs:name=slab,angle=5) circle (2pt); +\draw [rounded corners, ->] (node cs:name=slab,angle=5) -| ++(0.25cm, -2cm) -| + (0.55cm,0cm); +\end{tikzpicture} +\end{column} +\end{columns} +\end{frame} + + +\begin{frame} +\frametitle{uma(9) structures} +\begin{columns} +\begin{column}{.03\paperwidth} +\end{column} +\begin{column}{.97\paperwidth} +m = uma\_zalloc(zone, \ldots); +\begin{tikzpicture}[node distance=5mm] + \node [name=zone, struct, rectangle split parts=4] { + \textbf{struct uma\_zone} + \nodepart{two} struct uma\_cache uz\_cpu\lbrack$ncpus$\rbrack + \nodepart{three} LIST\_HEAD(,uma\_bucket) uz\_buckets + \nodepart{four} struct uma\_keg *uz\_keg + }; + \node [name=cache, below left=5mm and 0mm of zone, + struct, rectangle split parts=3] { + \textbf{struct uma\_cache} + \nodepart{two} uma\_bucket\_t uc\_freebucket + \nodepart{three} uma\_bucket\_t uc\_allocbucket + }; + \node [name=bucket, below=of zone, struct, rectangle split parts=4] { + \textbf{struct uma\_bucket} + \nodepart{two} int16\_t ub\_cnt + \nodepart{three} int16\_t ub\_entries + \nodepart{four} void *ub\_bucket\lbrack\rbrack + }; + \draw [pointer] (zone.two west) -| (cache.north); + \draw [pointer] (cache.two east) to [out=0, in=180] (bucket.one west); +\end{tikzpicture} +\end{column} +\end{columns} +\end{frame} + \end{document} From owner-svn-src-user@FreeBSD.ORG Wed Oct 23 09:21:17 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DE602FFE; Wed, 23 Oct 2013 09:21:17 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C74C92F49; Wed, 23 Oct 2013 09:21:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9N9LH4L001615; Wed, 23 Oct 2013 09:21:17 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9N9LGrb001605; Wed, 23 Oct 2013 09:21:16 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310230921.r9N9LGrb001605@svn.freebsd.org> From: Aleksandr Rybalko Date: Wed, 23 Oct 2013 09:21:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256954 - in user/ed/newcons: . bin bin/freebsd-version bin/ps bin/sh cddl/contrib/opensolaris/cmd/dtrace cddl/contrib/opensolaris/lib/libdtrace/common cddl/contrib/opensolaris/lib/libd... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 09:21:17 -0000 Author: ray Date: Wed Oct 23 09:21:14 2013 New Revision: 256954 URL: http://svnweb.freebsd.org/changeset/base/256954 Log: MFC @r256953 Added: user/ed/newcons/bin/freebsd-version/ - copied from r256953, head/bin/freebsd-version/ user/ed/newcons/gnu/usr.bin/rcs/ - copied from r256953, head/gnu/usr.bin/rcs/ user/ed/newcons/share/doc/psd/13.rcs/ - copied from r256953, head/share/doc/psd/13.rcs/ user/ed/newcons/share/man/man4/altera_atse.4 - copied unchanged from r256953, head/share/man/man4/altera_atse.4 user/ed/newcons/share/man/man9/getenv.9 - copied unchanged from r256953, head/share/man/man9/getenv.9 user/ed/newcons/sys/arm/conf/IMX53-QSB - copied unchanged from r256953, head/sys/arm/conf/IMX53-QSB user/ed/newcons/sys/arm/conf/RADXA - copied unchanged from r256953, head/sys/arm/conf/RADXA user/ed/newcons/sys/arm/rockchip/ - copied from r256953, head/sys/arm/rockchip/ user/ed/newcons/sys/boot/fdt/dts/beri-sim.dts - copied unchanged from r256953, head/sys/boot/fdt/dts/beri-sim.dts user/ed/newcons/sys/boot/fdt/dts/beripad-de4.dts - copied unchanged from r256953, head/sys/boot/fdt/dts/beripad-de4.dts user/ed/newcons/sys/boot/fdt/dts/imx53-qsb.dts - copied unchanged from r256953, head/sys/boot/fdt/dts/imx53-qsb.dts user/ed/newcons/sys/boot/fdt/dts/rk3188-radxa.dts - copied unchanged from r256953, head/sys/boot/fdt/dts/rk3188-radxa.dts user/ed/newcons/sys/boot/fdt/dts/rk3188.dtsi - copied unchanged from r256953, head/sys/boot/fdt/dts/rk3188.dtsi user/ed/newcons/sys/dev/altera/atse/ - copied from r256953, head/sys/dev/altera/atse/ user/ed/newcons/sys/dev/cxgbe/firmware/t4fw-1.9.12.0.bin.uu - copied unchanged from r256953, head/sys/dev/cxgbe/firmware/t4fw-1.9.12.0.bin.uu user/ed/newcons/sys/dev/cxgbe/firmware/t5fw-1.9.12.0.bin.uu - copied unchanged from r256953, head/sys/dev/cxgbe/firmware/t5fw-1.9.12.0.bin.uu user/ed/newcons/sys/dev/cxgbe/iw_cxgbe/ - copied from r256953, head/sys/dev/cxgbe/iw_cxgbe/ user/ed/newcons/sys/dev/etherswitch/arswitch/arswitch_9340.c - copied unchanged from r256953, head/sys/dev/etherswitch/arswitch/arswitch_9340.c user/ed/newcons/sys/dev/etherswitch/arswitch/arswitch_9340.h - copied unchanged from r256953, head/sys/dev/etherswitch/arswitch/arswitch_9340.h - copied unchanged from r256953, head/sys/dev/fdt/fdt_ic_if.m user/ed/newcons/sys/dev/ffec/ - copied from r256953, head/sys/dev/ffec/ user/ed/newcons/sys/dev/random/dummy_rng.c - copied unchanged from r256953, head/sys/dev/random/dummy_rng.c user/ed/newcons/sys/dev/random/live_entropy_sources.c - copied unchanged from r256953, head/sys/dev/random/live_entropy_sources.c user/ed/newcons/sys/dev/random/live_entropy_sources.h - copied unchanged from r256953, head/sys/dev/random/live_entropy_sources.h user/ed/newcons/sys/dev/random/rwfile.c - copied unchanged from r256953, head/sys/dev/random/rwfile.c user/ed/newcons/sys/dev/random/rwfile.h - copied unchanged from r256953, head/sys/dev/random/rwfile.h user/ed/newcons/sys/dev/usb/controller/dwc_otg_fdt.c - copied unchanged from r256953, head/sys/dev/usb/controller/dwc_otg_fdt.c user/ed/newcons/sys/mips/beri/beri_pic.c - copied unchanged from r256953, head/sys/mips/beri/beri_pic.c user/ed/newcons/sys/mips/conf/BERI_DE4_BASE - copied unchanged from r256953, head/sys/mips/conf/BERI_DE4_BASE user/ed/newcons/sys/mips/conf/BERI_SIM_BASE - copied unchanged from r256953, head/sys/mips/conf/BERI_SIM_BASE user/ed/newcons/sys/mips/conf/BERI_SIM_SDROOT - copied unchanged from r256953, head/sys/mips/conf/BERI_SIM_SDROOT user/ed/newcons/sys/modules/cxgbe/iw_cxgbe/ - copied from r256953, head/sys/modules/cxgbe/iw_cxgbe/ user/ed/newcons/sys/powerpc/ofw/openpic_ofw.c - copied unchanged from r256953, head/sys/powerpc/ofw/openpic_ofw.c user/ed/newcons/sys/powerpc/powerpc/clock.c - copied unchanged from r256953, head/sys/powerpc/powerpc/clock.c user/ed/newcons/sys/powerpc/powerpc/nexus.c - copied unchanged from r256953, head/sys/powerpc/powerpc/nexus.c user/ed/newcons/sys/powerpc/powerpc/vm_machdep.c - copied unchanged from r256953, head/sys/powerpc/powerpc/vm_machdep.c user/ed/newcons/sys/powerpc/pseries/phyp_llan.c - copied unchanged from r256953, head/sys/powerpc/pseries/phyp_llan.c user/ed/newcons/tools/build/options/WITHOUT_RCS - copied unchanged from r256953, head/tools/build/options/WITHOUT_RCS user/ed/newcons/tools/tools/atsectl/ - copied from r256953, head/tools/tools/atsectl/ user/ed/newcons/usr.sbin/bsdconfig/share/keymap.subr - copied unchanged from r256953, head/usr.sbin/bsdconfig/share/keymap.subr user/ed/newcons/usr.sbin/bsdinstall/scripts/entropy - copied unchanged from r256953, head/usr.sbin/bsdinstall/scripts/entropy user/ed/newcons/usr.sbin/bsdinstall/scripts/zfsboot - copied unchanged from r256953, head/usr.sbin/bsdinstall/scripts/zfsboot Directory Properties: user/ed/newcons/sys/dev/fdt/fdt_ic_if.m (props changed) Deleted: user/ed/newcons/etc/atf/ user/ed/newcons/lib/libyaml/libbsdyml.3 user/ed/newcons/libexec/freebsd-version/ user/ed/newcons/share/atf/ user/ed/newcons/share/examples/atf/ user/ed/newcons/share/man/man4/isf.4 user/ed/newcons/share/xml/ user/ed/newcons/share/xsl/ user/ed/newcons/sys/arm/broadcom/bcm2835/dwc_otg_brcm.c user/ed/newcons/sys/contrib/rdma/core_priv.h user/ed/newcons/sys/contrib/rdma/ib_addr.h user/ed/newcons/sys/contrib/rdma/ib_cache.h user/ed/newcons/sys/contrib/rdma/ib_cm.h user/ed/newcons/sys/contrib/rdma/ib_fmr_pool.h user/ed/newcons/sys/contrib/rdma/ib_mad.h user/ed/newcons/sys/contrib/rdma/ib_marshall.h user/ed/newcons/sys/contrib/rdma/ib_pack.h user/ed/newcons/sys/contrib/rdma/ib_sa.h user/ed/newcons/sys/contrib/rdma/ib_smi.h user/ed/newcons/sys/contrib/rdma/ib_umem.h user/ed/newcons/sys/contrib/rdma/ib_user_cm.h user/ed/newcons/sys/contrib/rdma/ib_user_mad.h user/ed/newcons/sys/contrib/rdma/ib_user_sa.h user/ed/newcons/sys/contrib/rdma/ib_user_verbs.h user/ed/newcons/sys/contrib/rdma/ib_verbs.h user/ed/newcons/sys/contrib/rdma/iw_cm.h user/ed/newcons/sys/contrib/rdma/rdma_addr.c user/ed/newcons/sys/contrib/rdma/rdma_cache.c user/ed/newcons/sys/contrib/rdma/rdma_cm.h user/ed/newcons/sys/contrib/rdma/rdma_cm_ib.h user/ed/newcons/sys/contrib/rdma/rdma_cma.c user/ed/newcons/sys/contrib/rdma/rdma_device.c user/ed/newcons/sys/contrib/rdma/rdma_iwcm.c user/ed/newcons/sys/contrib/rdma/rdma_user_cm.h user/ed/newcons/sys/contrib/rdma/rdma_verbs.c user/ed/newcons/sys/contrib/rdma/types.h user/ed/newcons/sys/dev/cxgbe/firmware/t4fw-1.8.11.0.bin.uu user/ed/newcons/sys/dev/cxgbe/firmware/t5fw-1.8.22.0.bin.uu user/ed/newcons/sys/dev/isf/ user/ed/newcons/sys/dev/random/pseudo_rng.c user/ed/newcons/sys/modules/rdma/addr/ user/ed/newcons/sys/modules/rdma/cma/ user/ed/newcons/sys/modules/rdma/core/ user/ed/newcons/sys/modules/rdma/iwcm/ user/ed/newcons/sys/powerpc/aim/clock.c user/ed/newcons/sys/powerpc/aim/nexus.c user/ed/newcons/sys/powerpc/aim/vm_machdep.c user/ed/newcons/sys/powerpc/booke/clock.c user/ed/newcons/sys/powerpc/booke/vm_machdep.c user/ed/newcons/sys/powerpc/mambo/mambo_openpic.c user/ed/newcons/sys/powerpc/mpc85xx/nexus.c user/ed/newcons/sys/powerpc/powermac/openpic_macio.c user/ed/newcons/sys/powerpc/powerpc/openpic_fdt.c user/ed/newcons/usr.bin/atf/atf-config/ user/ed/newcons/usr.bin/atf/atf-report/ user/ed/newcons/usr.bin/atf/atf-run/ user/ed/newcons/usr.bin/atf/atf-version/ user/ed/newcons/usr.sbin/isfctl/ Modified: user/ed/newcons/Makefile.inc1 user/ed/newcons/ObsoleteFiles.inc user/ed/newcons/UPDATING user/ed/newcons/bin/Makefile user/ed/newcons/bin/ps/print.c user/ed/newcons/bin/sh/jobs.c user/ed/newcons/bin/sh/miscbltin.c user/ed/newcons/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 user/ed/newcons/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c user/ed/newcons/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c user/ed/newcons/cddl/contrib/opensolaris/lib/libdtrace/powerpc/dt_isadep.c user/ed/newcons/cddl/lib/libdtrace/psinfo.d user/ed/newcons/contrib/binutils/gas/config/tc-arm.c user/ed/newcons/contrib/binutils/gas/config/tc-mips.c user/ed/newcons/contrib/binutils/gas/config/tc-mips.h user/ed/newcons/contrib/binutils/gas/dwarf2dbg.c user/ed/newcons/contrib/bsnmp/lib/snmp.c user/ed/newcons/contrib/bsnmp/lib/snmp.h user/ed/newcons/contrib/bsnmp/lib/snmpagent.c user/ed/newcons/contrib/gcclibs/libssp/ssp.c user/ed/newcons/contrib/ipfilter/ipf.h user/ed/newcons/contrib/jemalloc/ChangeLog user/ed/newcons/contrib/jemalloc/FREEBSD-diffs user/ed/newcons/contrib/jemalloc/FREEBSD-upgrade user/ed/newcons/contrib/jemalloc/VERSION user/ed/newcons/contrib/jemalloc/doc/jemalloc.3 user/ed/newcons/contrib/jemalloc/include/jemalloc/internal/arena.h user/ed/newcons/contrib/jemalloc/include/jemalloc/internal/jemalloc_internal.h user/ed/newcons/contrib/jemalloc/include/jemalloc/internal/private_namespace.h user/ed/newcons/contrib/jemalloc/include/jemalloc/internal/tcache.h user/ed/newcons/contrib/jemalloc/include/jemalloc/jemalloc.h user/ed/newcons/contrib/jemalloc/src/arena.c user/ed/newcons/contrib/jemalloc/src/chunk.c user/ed/newcons/contrib/jemalloc/src/ctl.c user/ed/newcons/contrib/jemalloc/src/jemalloc.c user/ed/newcons/contrib/libcxxrt/typeinfo.cc user/ed/newcons/contrib/mtree/compare.c user/ed/newcons/contrib/mtree/create.c user/ed/newcons/contrib/mtree/getid.c user/ed/newcons/contrib/mtree/spec.c user/ed/newcons/etc/Makefile user/ed/newcons/etc/defaults/periodic.conf user/ed/newcons/etc/defaults/rc.conf user/ed/newcons/etc/ftpusers user/ed/newcons/etc/group user/ed/newcons/etc/login.conf user/ed/newcons/etc/master.passwd user/ed/newcons/etc/mtree/BSD.root.dist user/ed/newcons/etc/mtree/BSD.usr.dist user/ed/newcons/etc/netstart user/ed/newcons/etc/network.subr user/ed/newcons/etc/rc user/ed/newcons/etc/rc.d/initrandom user/ed/newcons/etc/rc.d/jail user/ed/newcons/etc/rc.d/netif user/ed/newcons/etc/rc.d/rtadvd user/ed/newcons/etc/rc.d/sendmail user/ed/newcons/etc/rc.subr user/ed/newcons/etc/sendmail/freebsd.mc user/ed/newcons/gnu/usr.bin/Makefile user/ed/newcons/gnu/usr.bin/cc/cc_tools/freebsd-native.h user/ed/newcons/gnu/usr.bin/groff/tmac/mdoc.local user/ed/newcons/include/pthread.h user/ed/newcons/lib/clang/clang.build.mk user/ed/newcons/lib/libc/gen/getutxent.c user/ed/newcons/lib/libc/gen/popen.c user/ed/newcons/lib/libc/gen/syslog.c user/ed/newcons/lib/libc/iconv/citrus_mapper.c user/ed/newcons/lib/libc/sys/getrlimit.2 user/ed/newcons/lib/libcrypt/tests/Makefile user/ed/newcons/lib/libcrypt/tests/crypt_tests.c user/ed/newcons/lib/libproc/_libproc.h user/ed/newcons/lib/libprocstat/libprocstat.c user/ed/newcons/lib/libstand/tftp.c user/ed/newcons/lib/libutil/login_class.3 user/ed/newcons/lib/libutil/login_class.c user/ed/newcons/lib/libvmmapi/vmmapi.c user/ed/newcons/lib/libvmmapi/vmmapi.h user/ed/newcons/lib/libyaml/Makefile user/ed/newcons/lib/libz/zopen.c user/ed/newcons/libexec/Makefile user/ed/newcons/release/Makefile user/ed/newcons/release/picobsd/build/picobsd user/ed/newcons/release/picobsd/floppy.tree/etc/rc1 user/ed/newcons/release/picobsd/floppy.tree/etc/ssh/sshd_config user/ed/newcons/release/release.sh user/ed/newcons/sbin/camcontrol/modeedit.c user/ed/newcons/sbin/gvinum/gvinum.c user/ed/newcons/sbin/ifconfig/ifconfig.8 user/ed/newcons/sbin/ifconfig/ifgroup.c user/ed/newcons/sbin/iscontrol/fsm.c user/ed/newcons/sbin/iscontrol/iscsi.conf.5 user/ed/newcons/sbin/nos-tun/nos-tun.c user/ed/newcons/sbin/nvmecontrol/perftest.c user/ed/newcons/sbin/route/keywords user/ed/newcons/sbin/route/route.8 user/ed/newcons/sbin/route/route.c user/ed/newcons/share/Makefile user/ed/newcons/share/doc/psd/Makefile user/ed/newcons/share/examples/Makefile user/ed/newcons/share/examples/bhyve/vmrun.sh user/ed/newcons/share/examples/kld/random_adaptor/random_adaptor_example.c user/ed/newcons/share/man/man4/Makefile user/ed/newcons/share/man/man4/ahci.4 user/ed/newcons/share/man/man4/random.4 user/ed/newcons/share/man/man5/Makefile user/ed/newcons/share/man/man5/rc.conf.5 user/ed/newcons/share/man/man5/src.conf.5 user/ed/newcons/share/man/man7/Makefile user/ed/newcons/share/man/man8/rc.8 user/ed/newcons/share/man/man8/rc.sendmail.8 user/ed/newcons/share/man/man9/Makefile user/ed/newcons/share/man/man9/disk.9 user/ed/newcons/share/man/man9/rtentry.9 user/ed/newcons/share/misc/bsd-family-tree user/ed/newcons/share/misc/committers-src.dot user/ed/newcons/share/mk/atf.test.mk user/ed/newcons/share/mk/bsd.libnames.mk user/ed/newcons/share/mk/bsd.own.mk user/ed/newcons/share/mk/bsd.test.mk user/ed/newcons/share/syscons/keymaps/INDEX.keymaps user/ed/newcons/sys/amd64/amd64/pmap.c user/ed/newcons/sys/amd64/conf/GENERIC user/ed/newcons/sys/amd64/include/vmm.h (contents, props changed) user/ed/newcons/sys/amd64/vmm/intel/vmx.c user/ed/newcons/sys/amd64/vmm/intel/vmx.h user/ed/newcons/sys/amd64/vmm/intel/vmx_controls.h user/ed/newcons/sys/amd64/vmm/vmm_dev.c user/ed/newcons/sys/amd64/vmm/x86.c user/ed/newcons/sys/arm/allwinner/a10_wdog.c user/ed/newcons/sys/arm/arm/busdma_machdep-v6.c user/ed/newcons/sys/arm/arm/cpufunc.c user/ed/newcons/sys/arm/arm/cpufunc_asm_armv7.S user/ed/newcons/sys/arm/arm/fusu.S user/ed/newcons/sys/arm/arm/identcpu.c user/ed/newcons/sys/arm/arm/locore.S user/ed/newcons/sys/arm/arm/machdep.c user/ed/newcons/sys/arm/arm/pl310.c user/ed/newcons/sys/arm/arm/pmap-v6.c user/ed/newcons/sys/arm/arm/stack_machdep.c user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_wdog.c user/ed/newcons/sys/arm/broadcom/bcm2835/files.bcm2835 user/ed/newcons/sys/arm/freescale/imx/files.imx53 user/ed/newcons/sys/arm/freescale/imx/imx51_ccm.c user/ed/newcons/sys/arm/include/armreg.h user/ed/newcons/sys/arm/include/pmap.h user/ed/newcons/sys/arm/mv/common.c user/ed/newcons/sys/arm/mv/mv_localbus.c user/ed/newcons/sys/arm/mv/mvreg.h user/ed/newcons/sys/arm/s3c2xx0/uart_bus_s3c2410.c user/ed/newcons/sys/arm/s3c2xx0/uart_cpu_s3c2410.c user/ed/newcons/sys/arm/versatile/versatile_pci.c user/ed/newcons/sys/arm/xscale/i80321/ep80219_machdep.c user/ed/newcons/sys/arm/xscale/i80321/iq31244_machdep.c user/ed/newcons/sys/arm/xscale/i8134x/crb_machdep.c user/ed/newcons/sys/arm/xscale/ixp425/avila_machdep.c user/ed/newcons/sys/arm/xscale/ixp425/if_npe.c user/ed/newcons/sys/arm/xscale/ixp425/ixp425_mem.c user/ed/newcons/sys/arm/xscale/pxa/pxa_machdep.c user/ed/newcons/sys/boot/fdt/dts/digi-ccwmx53.dts user/ed/newcons/sys/boot/forth/loader.conf user/ed/newcons/sys/boot/i386/btx/btx/btx.S user/ed/newcons/sys/boot/i386/libi386/Makefile user/ed/newcons/sys/boot/i386/libi386/smbios.c user/ed/newcons/sys/cam/ata/ata_all.c user/ed/newcons/sys/cam/ata/ata_all.h user/ed/newcons/sys/cam/ata/ata_da.c user/ed/newcons/sys/cam/ata/ata_pmp.c user/ed/newcons/sys/cam/ata/ata_xpt.c user/ed/newcons/sys/cam/cam_ccb.h user/ed/newcons/sys/cam/cam_periph.c user/ed/newcons/sys/cam/cam_periph.h user/ed/newcons/sys/cam/cam_queue.c user/ed/newcons/sys/cam/cam_queue.h user/ed/newcons/sys/cam/cam_sim.c user/ed/newcons/sys/cam/cam_sim.h user/ed/newcons/sys/cam/cam_xpt.c user/ed/newcons/sys/cam/cam_xpt.h user/ed/newcons/sys/cam/cam_xpt_internal.h user/ed/newcons/sys/cam/cam_xpt_periph.h user/ed/newcons/sys/cam/cam_xpt_sim.h user/ed/newcons/sys/cam/ctl/ctl_frontend_cam_sim.c user/ed/newcons/sys/cam/ctl/ctl_frontend_iscsi.c user/ed/newcons/sys/cam/ctl/scsi_ctl.c user/ed/newcons/sys/cam/scsi/scsi_all.c user/ed/newcons/sys/cam/scsi/scsi_all.h user/ed/newcons/sys/cam/scsi/scsi_cd.c user/ed/newcons/sys/cam/scsi/scsi_ch.c user/ed/newcons/sys/cam/scsi/scsi_da.c user/ed/newcons/sys/cam/scsi/scsi_enc.c user/ed/newcons/sys/cam/scsi/scsi_enc_internal.h user/ed/newcons/sys/cam/scsi/scsi_enc_safte.c user/ed/newcons/sys/cam/scsi/scsi_enc_ses.c user/ed/newcons/sys/cam/scsi/scsi_pass.c user/ed/newcons/sys/cam/scsi/scsi_pt.c user/ed/newcons/sys/cam/scsi/scsi_sa.c user/ed/newcons/sys/cam/scsi/scsi_sg.c user/ed/newcons/sys/cam/scsi/scsi_targ_bh.c user/ed/newcons/sys/cam/scsi/scsi_target.c user/ed/newcons/sys/cam/scsi/scsi_xpt.c user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h user/ed/newcons/sys/cddl/contrib/opensolaris/uts/intel/dtrace/fasttrap_isa.c user/ed/newcons/sys/cddl/contrib/opensolaris/uts/powerpc/dtrace/fasttrap_isa.c user/ed/newcons/sys/cddl/contrib/opensolaris/uts/powerpc/sys/fasttrap_isa.h user/ed/newcons/sys/cddl/dev/dtrace/amd64/dtrace_isa.c user/ed/newcons/sys/cddl/dev/dtrace/dtrace_sysctl.c user/ed/newcons/sys/conf/NOTES user/ed/newcons/sys/conf/files user/ed/newcons/sys/conf/files.amd64 user/ed/newcons/sys/conf/files.i386 user/ed/newcons/sys/conf/files.powerpc user/ed/newcons/sys/conf/kmod.mk user/ed/newcons/sys/conf/newvers.sh user/ed/newcons/sys/conf/options user/ed/newcons/sys/conf/options.mips user/ed/newcons/sys/contrib/dev/run/rt2870.fw.uu user/ed/newcons/sys/contrib/ipfilter/netinet/ip_rcmd_pxy.c user/ed/newcons/sys/contrib/ipfilter/netinet/ip_tftp_pxy.c user/ed/newcons/sys/contrib/rdma/krping/getopt.c user/ed/newcons/sys/contrib/rdma/krping/krping.c user/ed/newcons/sys/contrib/rdma/krping/krping.h user/ed/newcons/sys/contrib/rdma/krping/krping_dev.c user/ed/newcons/sys/dev/aha/aha.c user/ed/newcons/sys/dev/ahci/ahci.c user/ed/newcons/sys/dev/ahci/ahci.h user/ed/newcons/sys/dev/aic7xxx/aic79xx.c user/ed/newcons/sys/dev/aic7xxx/aic7xxx.c user/ed/newcons/sys/dev/altera/sdcard/altera_sdcard.c user/ed/newcons/sys/dev/altera/sdcard/altera_sdcard_io.c user/ed/newcons/sys/dev/ata/ata-all.c user/ed/newcons/sys/dev/ata/ata-card.c user/ed/newcons/sys/dev/ath/if_ath.c user/ed/newcons/sys/dev/ath/if_ath_tx.c user/ed/newcons/sys/dev/buslogic/bt.c user/ed/newcons/sys/dev/bxe/bxe.c user/ed/newcons/sys/dev/bxe/bxe_stats.c user/ed/newcons/sys/dev/bxe/ecore_sp.h user/ed/newcons/sys/dev/cfi/cfi_bus_nexus.c user/ed/newcons/sys/dev/cfi/cfi_core.c user/ed/newcons/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb.c user/ed/newcons/sys/dev/cxgbe/adapter.h user/ed/newcons/sys/dev/cxgbe/common/common.h user/ed/newcons/sys/dev/cxgbe/firmware/t4fw_cfg.txt user/ed/newcons/sys/dev/cxgbe/firmware/t4fw_cfg_uwire.txt user/ed/newcons/sys/dev/cxgbe/firmware/t4fw_interface.h user/ed/newcons/sys/dev/cxgbe/firmware/t5fw_cfg.txt user/ed/newcons/sys/dev/cxgbe/firmware/t5fw_cfg_uwire.txt user/ed/newcons/sys/dev/cxgbe/t4_main.c user/ed/newcons/sys/dev/cxgbe/t4_sge.c user/ed/newcons/sys/dev/cxgbe/tom/t4_cpl_io.c user/ed/newcons/sys/dev/drm2/i915/i915_drv.c user/ed/newcons/sys/dev/drm2/radeon/radeon_drv.c user/ed/newcons/sys/dev/e1000/e1000_80003es2lan.c user/ed/newcons/sys/dev/e1000/e1000_80003es2lan.h user/ed/newcons/sys/dev/e1000/e1000_82571.c user/ed/newcons/sys/dev/e1000/e1000_82575.c user/ed/newcons/sys/dev/e1000/e1000_82575.h user/ed/newcons/sys/dev/e1000/e1000_api.c user/ed/newcons/sys/dev/e1000/e1000_defines.h user/ed/newcons/sys/dev/e1000/e1000_hw.h user/ed/newcons/sys/dev/e1000/e1000_i210.c user/ed/newcons/sys/dev/e1000/e1000_i210.h user/ed/newcons/sys/dev/e1000/e1000_ich8lan.c user/ed/newcons/sys/dev/e1000/e1000_ich8lan.h user/ed/newcons/sys/dev/e1000/e1000_mac.c user/ed/newcons/sys/dev/e1000/e1000_osdep.h user/ed/newcons/sys/dev/e1000/e1000_phy.c user/ed/newcons/sys/dev/e1000/e1000_phy.h user/ed/newcons/sys/dev/e1000/e1000_regs.h user/ed/newcons/sys/dev/e1000/e1000_vf.h user/ed/newcons/sys/dev/e1000/if_igb.c user/ed/newcons/sys/dev/e1000/if_igb.h user/ed/newcons/sys/dev/etherswitch/arswitch/arswitch.c user/ed/newcons/sys/dev/etherswitch/arswitch/arswitch_vlans.c user/ed/newcons/sys/dev/etherswitch/arswitch/arswitchreg.h user/ed/newcons/sys/dev/etherswitch/arswitch/arswitchvar.h user/ed/newcons/sys/dev/fdt/fdt_common.c user/ed/newcons/sys/dev/fdt/fdt_common.h user/ed/newcons/sys/dev/fdt/fdt_mips.c user/ed/newcons/sys/dev/fdt/fdt_pci.c user/ed/newcons/sys/dev/fdt/fdt_powerpc.c user/ed/newcons/sys/dev/fdt/fdtbus.c user/ed/newcons/sys/dev/fdt/simplebus.c user/ed/newcons/sys/dev/firewire/sbp_targ.c user/ed/newcons/sys/dev/glxsb/glxsb.c user/ed/newcons/sys/dev/hifn/hifn7751.c user/ed/newcons/sys/dev/hyperv/include/hyperv.h user/ed/newcons/sys/dev/hyperv/netvsc/hv_net_vsc.h user/ed/newcons/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c user/ed/newcons/sys/dev/hyperv/stordisengage/hv_ata_pci_disengage.c user/ed/newcons/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c user/ed/newcons/sys/dev/hyperv/storvsc/hv_vstorage.h user/ed/newcons/sys/dev/hyperv/vmbus/hv_channel.c user/ed/newcons/sys/dev/hyperv/vmbus/hv_hv.c user/ed/newcons/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c user/ed/newcons/sys/dev/hyperv/vmbus/hv_vmbus_priv.h user/ed/newcons/sys/dev/isci/isci_io_request.c user/ed/newcons/sys/dev/isci/isci_sysctl.c user/ed/newcons/sys/dev/isci/isci_task_request.c user/ed/newcons/sys/dev/iscsi/icl.c user/ed/newcons/sys/dev/iscsi/iscsi.c user/ed/newcons/sys/dev/isp/isp.c user/ed/newcons/sys/dev/isp/isp_freebsd.c user/ed/newcons/sys/dev/isp/isp_freebsd.h user/ed/newcons/sys/dev/isp/ispvar.h user/ed/newcons/sys/dev/ixgbe/ixgbe.c user/ed/newcons/sys/dev/md/md.c user/ed/newcons/sys/dev/mpt/mpt_cam.c user/ed/newcons/sys/dev/mvs/mvs.c user/ed/newcons/sys/dev/netmap/if_igb_netmap.h user/ed/newcons/sys/dev/nvd/nvd.c user/ed/newcons/sys/dev/nvme/nvme.c user/ed/newcons/sys/dev/nvme/nvme.h user/ed/newcons/sys/dev/nvme/nvme_ctrlr.c user/ed/newcons/sys/dev/nvme/nvme_ns.c user/ed/newcons/sys/dev/nvme/nvme_private.h user/ed/newcons/sys/dev/nvme/nvme_test.c user/ed/newcons/sys/dev/ofw/ofw_bus_subr.c user/ed/newcons/sys/dev/ofw/ofw_fdt.c user/ed/newcons/sys/dev/ofw/openfirm.c user/ed/newcons/sys/dev/ofw/openfirm.h user/ed/newcons/sys/dev/random/harvest.c user/ed/newcons/sys/dev/random/hash.h user/ed/newcons/sys/dev/random/ivy.c user/ed/newcons/sys/dev/random/nehemiah.c user/ed/newcons/sys/dev/random/random_adaptors.c user/ed/newcons/sys/dev/random/random_adaptors.h user/ed/newcons/sys/dev/random/random_harvestq.c user/ed/newcons/sys/dev/random/random_harvestq.h user/ed/newcons/sys/dev/random/randomdev.c user/ed/newcons/sys/dev/random/randomdev.h user/ed/newcons/sys/dev/random/randomdev_soft.c user/ed/newcons/sys/dev/random/randomdev_soft.h user/ed/newcons/sys/dev/random/yarrow.c user/ed/newcons/sys/dev/random/yarrow.h user/ed/newcons/sys/dev/re/if_re.c user/ed/newcons/sys/dev/rndtest/rndtest.c user/ed/newcons/sys/dev/safe/safe.c user/ed/newcons/sys/dev/siis/siis.c user/ed/newcons/sys/dev/syscons/scmouse.c user/ed/newcons/sys/dev/syscons/syscons.c user/ed/newcons/sys/dev/uart/uart_dev_pl011.c user/ed/newcons/sys/dev/ubsec/ubsec.c user/ed/newcons/sys/dev/usb/controller/musb_otg.c user/ed/newcons/sys/dev/usb/controller/musb_otg.h user/ed/newcons/sys/dev/usb/controller/xhci.c user/ed/newcons/sys/dev/usb/serial/uslcom.c user/ed/newcons/sys/dev/usb/usbdevs user/ed/newcons/sys/dev/usb/wlan/if_run.c user/ed/newcons/sys/dev/usb/wlan/if_runreg.h user/ed/newcons/sys/dev/vmware/vmxnet3/if_vmx.c user/ed/newcons/sys/dev/vmware/vmxnet3/if_vmxvar.h user/ed/newcons/sys/dev/vt/vt_sysmouse.c user/ed/newcons/sys/dev/xen/blkfront/blkfront.c user/ed/newcons/sys/dev/xen/netback/netback.c user/ed/newcons/sys/fs/devfs/devfs_vnops.c user/ed/newcons/sys/geom/concat/g_concat.c user/ed/newcons/sys/geom/concat/g_concat.h user/ed/newcons/sys/geom/gate/g_gate.c user/ed/newcons/sys/geom/geom.h user/ed/newcons/sys/geom/geom_dev.c user/ed/newcons/sys/geom/geom_disk.c user/ed/newcons/sys/geom/geom_disk.h user/ed/newcons/sys/geom/geom_int.h user/ed/newcons/sys/geom/geom_io.c user/ed/newcons/sys/geom/geom_kern.c user/ed/newcons/sys/geom/geom_slice.c user/ed/newcons/sys/geom/geom_vfs.c user/ed/newcons/sys/geom/label/g_label.c user/ed/newcons/sys/geom/mirror/g_mirror.c user/ed/newcons/sys/geom/mirror/g_mirror.h user/ed/newcons/sys/geom/multipath/g_multipath.c user/ed/newcons/sys/geom/nop/g_nop.c user/ed/newcons/sys/geom/nop/g_nop.h user/ed/newcons/sys/geom/part/g_part.c user/ed/newcons/sys/geom/part/g_part_apm.c user/ed/newcons/sys/geom/part/g_part_bsd.c user/ed/newcons/sys/geom/part/g_part_ebr.c user/ed/newcons/sys/geom/part/g_part_gpt.c user/ed/newcons/sys/geom/part/g_part_mbr.c user/ed/newcons/sys/geom/part/g_part_pc98.c user/ed/newcons/sys/geom/part/g_part_vtoc8.c user/ed/newcons/sys/geom/raid/g_raid.c user/ed/newcons/sys/geom/raid/g_raid.h user/ed/newcons/sys/geom/raid/md_ddf.c user/ed/newcons/sys/geom/raid/md_intel.c user/ed/newcons/sys/geom/raid/md_jmicron.c user/ed/newcons/sys/geom/raid/md_nvidia.c user/ed/newcons/sys/geom/raid/md_promise.c user/ed/newcons/sys/geom/raid/md_sii.c user/ed/newcons/sys/geom/raid/tr_concat.c user/ed/newcons/sys/geom/raid/tr_raid0.c user/ed/newcons/sys/geom/raid/tr_raid1.c user/ed/newcons/sys/geom/raid/tr_raid1e.c user/ed/newcons/sys/geom/raid/tr_raid5.c user/ed/newcons/sys/geom/stripe/g_stripe.c user/ed/newcons/sys/geom/stripe/g_stripe.h user/ed/newcons/sys/geom/zero/g_zero.c user/ed/newcons/sys/i386/conf/GENERIC user/ed/newcons/sys/kern/kern_conf.c user/ed/newcons/sys/kern/kern_descrip.c user/ed/newcons/sys/kern/kern_event.c user/ed/newcons/sys/kern/kern_exec.c user/ed/newcons/sys/kern/kern_intr.c user/ed/newcons/sys/kern/kern_mbuf.c user/ed/newcons/sys/kern/kern_poll.c user/ed/newcons/sys/kern/kern_resource.c user/ed/newcons/sys/kern/makesyscalls.sh user/ed/newcons/sys/kern/subr_bus.c user/ed/newcons/sys/kern/subr_devstat.c user/ed/newcons/sys/kern/subr_taskqueue.c user/ed/newcons/sys/kern/sys_generic.c user/ed/newcons/sys/kern/uipc_sockbuf.c user/ed/newcons/sys/kern/uipc_syscalls.c user/ed/newcons/sys/kern/vfs_bio.c user/ed/newcons/sys/kern/vfs_subr.c user/ed/newcons/sys/mips/atheros/apb.c user/ed/newcons/sys/mips/atheros/ar71xx_chip.c user/ed/newcons/sys/mips/atheros/ar71xx_cpudef.h user/ed/newcons/sys/mips/atheros/ar71xx_machdep.c user/ed/newcons/sys/mips/atheros/ar71xx_spi.c user/ed/newcons/sys/mips/atheros/ar71xxreg.h user/ed/newcons/sys/mips/atheros/ar724x_chip.c user/ed/newcons/sys/mips/atheros/ar91xx_chip.c user/ed/newcons/sys/mips/atheros/ar933x_chip.c user/ed/newcons/sys/mips/atheros/ar933xreg.h user/ed/newcons/sys/mips/atheros/ar934x_chip.c user/ed/newcons/sys/mips/atheros/ar934xreg.h user/ed/newcons/sys/mips/atheros/if_arge.c user/ed/newcons/sys/mips/atheros/if_argevar.h user/ed/newcons/sys/mips/beri/beri_machdep.c user/ed/newcons/sys/mips/beri/files.beri user/ed/newcons/sys/mips/beri/std.beri user/ed/newcons/sys/mips/cavium/octeon_rnd.c user/ed/newcons/sys/mips/conf/AR934X_BASE user/ed/newcons/sys/mips/conf/BERI_DE4.hints user/ed/newcons/sys/mips/conf/BERI_DE4_MDROOT user/ed/newcons/sys/mips/conf/BERI_DE4_SDROOT user/ed/newcons/sys/mips/conf/BERI_SIM_MDROOT user/ed/newcons/sys/mips/conf/BERI_TEMPLATE user/ed/newcons/sys/mips/conf/DB120 user/ed/newcons/sys/mips/conf/DB120.hints user/ed/newcons/sys/mips/include/asm.h user/ed/newcons/sys/mips/include/cpufunc.h user/ed/newcons/sys/mips/include/cpuregs.h user/ed/newcons/sys/mips/include/pcb.h user/ed/newcons/sys/mips/include/pte.h user/ed/newcons/sys/mips/mips/bcopy.S user/ed/newcons/sys/mips/mips/bus_space_generic.c user/ed/newcons/sys/mips/mips/cache.c user/ed/newcons/sys/mips/mips/cpu.c user/ed/newcons/sys/mips/mips/elf_trampoline.c user/ed/newcons/sys/mips/mips/exception.S user/ed/newcons/sys/mips/mips/fp.S user/ed/newcons/sys/mips/mips/support.S user/ed/newcons/sys/mips/mips/swtch.S user/ed/newcons/sys/mips/mips/trap.c user/ed/newcons/sys/modules/Makefile user/ed/newcons/sys/modules/cxgb/Makefile user/ed/newcons/sys/modules/cxgbe/Makefile user/ed/newcons/sys/modules/cxgbe/t4_firmware/Makefile user/ed/newcons/sys/modules/cxgbe/t5_firmware/Makefile user/ed/newcons/sys/modules/dtrace/Makefile user/ed/newcons/sys/modules/dtrace/fasttrap/Makefile user/ed/newcons/sys/modules/random/Makefile user/ed/newcons/sys/modules/rdma/Makefile user/ed/newcons/sys/net/flowtable.c user/ed/newcons/sys/net/ieee8023ad_lacp.c user/ed/newcons/sys/net/if.c user/ed/newcons/sys/net/if.h user/ed/newcons/sys/net/if_ethersubr.c user/ed/newcons/sys/net/if_lagg.c user/ed/newcons/sys/net/if_media.h user/ed/newcons/sys/net/if_tun.c user/ed/newcons/sys/net/if_var.h user/ed/newcons/sys/net/radix.c user/ed/newcons/sys/net/radix.h user/ed/newcons/sys/net/route.c user/ed/newcons/sys/net/rtsock.c user/ed/newcons/sys/net80211/ieee80211_freebsd.c user/ed/newcons/sys/netatalk/at_control.c user/ed/newcons/sys/netgraph/ng_base.c user/ed/newcons/sys/netgraph/ng_iface.c user/ed/newcons/sys/netinet/in.c user/ed/newcons/sys/netinet/in.h user/ed/newcons/sys/netinet/in_var.h user/ed/newcons/sys/netinet/ip_input.c user/ed/newcons/sys/netinet/ip_output.c user/ed/newcons/sys/netinet/sctp_constants.h user/ed/newcons/sys/netinet/sctp_usrreq.c user/ed/newcons/sys/netinet/tcp_input.c user/ed/newcons/sys/netinet6/in6.c user/ed/newcons/sys/netinet6/in6_ifattach.c user/ed/newcons/sys/netinet6/in6_var.h user/ed/newcons/sys/netinet6/ip6_input.c user/ed/newcons/sys/netinet6/ip6_output.c user/ed/newcons/sys/netipx/ipx.c user/ed/newcons/sys/netipx/ipx_if.h user/ed/newcons/sys/ofed/drivers/infiniband/core/ucm.c user/ed/newcons/sys/ofed/drivers/infiniband/hw/mlx4/main.c user/ed/newcons/sys/ofed/drivers/net/mlx4/en_netdev.c user/ed/newcons/sys/ofed/include/linux/gfp.h user/ed/newcons/sys/pci/if_rlreg.h user/ed/newcons/sys/powerpc/aim/interrupt.c user/ed/newcons/sys/powerpc/aim/machdep.c user/ed/newcons/sys/powerpc/aim/trap.c user/ed/newcons/sys/powerpc/booke/machdep.c user/ed/newcons/sys/powerpc/booke/pmap.c user/ed/newcons/sys/powerpc/conf/GENERIC64 user/ed/newcons/sys/powerpc/ofw/ofw_pci.c user/ed/newcons/sys/powerpc/ofw/ofw_pci.h user/ed/newcons/sys/powerpc/ofw/ofw_pcib_pci.c user/ed/newcons/sys/powerpc/ofw/ofw_pcibus.c user/ed/newcons/sys/powerpc/powermac/ata_kauai.c user/ed/newcons/sys/powerpc/powermac/ata_macio.c user/ed/newcons/sys/powerpc/pseries/phyp-hvcall.S user/ed/newcons/sys/sys/counter.h user/ed/newcons/sys/sys/devicestat.h user/ed/newcons/sys/sys/eventvar.h user/ed/newcons/sys/sys/param.h user/ed/newcons/sys/sys/proc.h user/ed/newcons/sys/sys/random.h user/ed/newcons/sys/sys/resource.h user/ed/newcons/sys/sys/resourcevar.h user/ed/newcons/sys/sys/sockbuf.h user/ed/newcons/sys/sys/systm.h user/ed/newcons/sys/ufs/ffs/ffs_extern.h user/ed/newcons/sys/ufs/ffs/ffs_softdep.c user/ed/newcons/sys/ufs/ffs/ffs_vfsops.c user/ed/newcons/sys/ufs/ffs/softdep.h user/ed/newcons/sys/ufs/ufs/dinode.h user/ed/newcons/sys/ufs/ufs/ufs_extern.h user/ed/newcons/sys/ufs/ufs/ufsmount.h user/ed/newcons/sys/vm/vm_phys.c user/ed/newcons/sys/xen/xen-os.h user/ed/newcons/tools/build/mk/OptionalObsoleteFiles.inc user/ed/newcons/tools/make_libdeps.sh user/ed/newcons/usr.bin/atf/Makefile user/ed/newcons/usr.bin/atf/Makefile.inc user/ed/newcons/usr.bin/limits/limits.c user/ed/newcons/usr.bin/netstat/if.c user/ed/newcons/usr.bin/netstat/main.c user/ed/newcons/usr.bin/netstat/mbuf.c user/ed/newcons/usr.bin/netstat/netstat.h user/ed/newcons/usr.bin/netstat/route.c user/ed/newcons/usr.bin/pathchk/pathchk.c user/ed/newcons/usr.bin/procstat/procstat_rlimit.c user/ed/newcons/usr.bin/rpcinfo/rpcinfo.c user/ed/newcons/usr.bin/systat/netcmds.c user/ed/newcons/usr.bin/uname/uname.1 user/ed/newcons/usr.bin/uname/uname.c user/ed/newcons/usr.sbin/Makefile user/ed/newcons/usr.sbin/bhyve/Makefile user/ed/newcons/usr.sbin/bhyve/bhyverun.c user/ed/newcons/usr.sbin/bhyve/bhyverun.h user/ed/newcons/usr.sbin/bhyve/dbgport.h user/ed/newcons/usr.sbin/bhyve/mptbl.c user/ed/newcons/usr.sbin/bhyve/pci_ahci.c user/ed/newcons/usr.sbin/bhyve/pci_emul.c user/ed/newcons/usr.sbin/bhyve/pci_hostbridge.c user/ed/newcons/usr.sbin/bhyve/pci_virtio_block.c user/ed/newcons/usr.sbin/bhyve/pci_virtio_net.c user/ed/newcons/usr.sbin/bhyve/rtc.c user/ed/newcons/usr.sbin/bhyve/spinup_ap.c user/ed/newcons/usr.sbin/bhyvectl/Makefile user/ed/newcons/usr.sbin/bhyvectl/bhyvectl.c user/ed/newcons/usr.sbin/bhyveload/Makefile user/ed/newcons/usr.sbin/bhyveload/bhyveload.8 user/ed/newcons/usr.sbin/bhyveload/bhyveload.c user/ed/newcons/usr.sbin/bootparamd/bootparamd/main.c user/ed/newcons/usr.sbin/bootparamd/callbootd/callbootd.c user/ed/newcons/usr.sbin/bsdconfig/bsdconfig user/ed/newcons/usr.sbin/bsdconfig/console/ttys user/ed/newcons/usr.sbin/bsdconfig/include/messages.subr user/ed/newcons/usr.sbin/bsdconfig/mouse/enable user/ed/newcons/usr.sbin/bsdconfig/networking/devices user/ed/newcons/usr.sbin/bsdconfig/networking/share/device.subr user/ed/newcons/usr.sbin/bsdconfig/networking/share/hostname.subr user/ed/newcons/usr.sbin/bsdconfig/networking/share/ipaddr.subr user/ed/newcons/usr.sbin/bsdconfig/networking/share/media.subr user/ed/newcons/usr.sbin/bsdconfig/networking/share/netmask.subr user/ed/newcons/usr.sbin/bsdconfig/networking/share/resolv.subr user/ed/newcons/usr.sbin/bsdconfig/networking/share/routing.subr user/ed/newcons/usr.sbin/bsdconfig/password/share/password.subr user/ed/newcons/usr.sbin/bsdconfig/security/kern_securelevel user/ed/newcons/usr.sbin/bsdconfig/security/security user/ed/newcons/usr.sbin/bsdconfig/share/Makefile user/ed/newcons/usr.sbin/bsdconfig/share/common.subr user/ed/newcons/usr.sbin/bsdconfig/share/device.subr user/ed/newcons/usr.sbin/bsdconfig/share/dialog.subr user/ed/newcons/usr.sbin/bsdconfig/share/media/any.subr user/ed/newcons/usr.sbin/bsdconfig/share/media/cdrom.subr user/ed/newcons/usr.sbin/bsdconfig/share/media/common.subr user/ed/newcons/usr.sbin/bsdconfig/share/media/dos.subr user/ed/newcons/usr.sbin/bsdconfig/share/media/floppy.subr user/ed/newcons/usr.sbin/bsdconfig/share/media/ftp.subr user/ed/newcons/usr.sbin/bsdconfig/share/media/http.subr user/ed/newcons/usr.sbin/bsdconfig/share/media/nfs.subr user/ed/newcons/usr.sbin/bsdconfig/share/media/options.subr user/ed/newcons/usr.sbin/bsdconfig/share/media/tcpip.subr user/ed/newcons/usr.sbin/bsdconfig/share/media/ufs.subr user/ed/newcons/usr.sbin/bsdconfig/share/media/usb.subr user/ed/newcons/usr.sbin/bsdconfig/share/mustberoot.subr user/ed/newcons/usr.sbin/bsdconfig/share/packages/packages.subr user/ed/newcons/usr.sbin/bsdconfig/share/strings.subr user/ed/newcons/usr.sbin/bsdconfig/share/variable.subr user/ed/newcons/usr.sbin/bsdconfig/startup/misc user/ed/newcons/usr.sbin/bsdconfig/startup/rcconf user/ed/newcons/usr.sbin/bsdconfig/startup/rcdelete user/ed/newcons/usr.sbin/bsdconfig/startup/rcvar user/ed/newcons/usr.sbin/bsdconfig/startup/share/rcconf.subr user/ed/newcons/usr.sbin/bsdconfig/startup/share/rcedit.subr user/ed/newcons/usr.sbin/bsdconfig/timezone/timezone user/ed/newcons/usr.sbin/bsdconfig/usermgmt/groupdel user/ed/newcons/usr.sbin/bsdconfig/usermgmt/groupedit user/ed/newcons/usr.sbin/bsdconfig/usermgmt/groupinput user/ed/newcons/usr.sbin/bsdconfig/usermgmt/share/group_input.subr user/ed/newcons/usr.sbin/bsdconfig/usermgmt/share/user_input.subr user/ed/newcons/usr.sbin/bsdconfig/usermgmt/userdel user/ed/newcons/usr.sbin/bsdconfig/usermgmt/useredit user/ed/newcons/usr.sbin/bsdconfig/usermgmt/userinput user/ed/newcons/usr.sbin/bsdconfig/usermgmt/usermgmt user/ed/newcons/usr.sbin/bsdinstall/bsdinstall user/ed/newcons/usr.sbin/bsdinstall/bsdinstall.8 user/ed/newcons/usr.sbin/bsdinstall/scripts/Makefile user/ed/newcons/usr.sbin/bsdinstall/scripts/auto user/ed/newcons/usr.sbin/bsdinstall/scripts/config user/ed/newcons/usr.sbin/bsdinstall/scripts/jail user/ed/newcons/usr.sbin/bsdinstall/scripts/keymap user/ed/newcons/usr.sbin/bsdinstall/scripts/netconfig user/ed/newcons/usr.sbin/bsdinstall/scripts/script user/ed/newcons/usr.sbin/bsdinstall/scripts/services user/ed/newcons/usr.sbin/ctladm/ctladm.c user/ed/newcons/usr.sbin/ctld/kernel.c user/ed/newcons/usr.sbin/ctld/login.c user/ed/newcons/usr.sbin/freebsd-update/freebsd-update.sh user/ed/newcons/usr.sbin/ifmcstat/ifmcstat.c user/ed/newcons/usr.sbin/iscsid/discovery.c user/ed/newcons/usr.sbin/jail/command.c user/ed/newcons/usr.sbin/jail/config.c user/ed/newcons/usr.sbin/jail/jail.8 user/ed/newcons/usr.sbin/jail/jail.c user/ed/newcons/usr.sbin/jail/jailp.h user/ed/newcons/usr.sbin/kldxref/kldxref.c user/ed/newcons/usr.sbin/pkg/Makefile user/ed/newcons/usr.sbin/pkg/config.c user/ed/newcons/usr.sbin/pkg/pkg.c user/ed/newcons/usr.sbin/portsnap/portsnap/portsnap.8 user/ed/newcons/usr.sbin/portsnap/portsnap/portsnap.sh user/ed/newcons/usr.sbin/ppp/mppe.c user/ed/newcons/usr.sbin/ypset/ypset.c Directory Properties: user/ed/newcons/ (props changed) user/ed/newcons/cddl/ (props changed) user/ed/newcons/cddl/contrib/opensolaris/ (props changed) user/ed/newcons/contrib/binutils/ (props changed) user/ed/newcons/contrib/ipfilter/ (props changed) user/ed/newcons/contrib/libcxxrt/ (props changed) user/ed/newcons/contrib/mtree/ (props changed) user/ed/newcons/gnu/usr.bin/cc/cc_tools/ (props changed) user/ed/newcons/lib/libc/ (props changed) user/ed/newcons/lib/libutil/ (props changed) user/ed/newcons/lib/libvmmapi/ (props changed) user/ed/newcons/lib/libz/ (props changed) user/ed/newcons/sbin/ (props changed) user/ed/newcons/share/man/man4/ (props changed) user/ed/newcons/sys/ (props changed) user/ed/newcons/sys/amd64/vmm/ (props changed) user/ed/newcons/sys/boot/ (props changed) user/ed/newcons/sys/cddl/contrib/opensolaris/ (props changed) user/ed/newcons/sys/conf/ (props changed) user/ed/newcons/sys/contrib/ipfilter/ (props changed) user/ed/newcons/sys/dev/hyperv/ (props changed) user/ed/newcons/usr.bin/procstat/ (props changed) user/ed/newcons/usr.sbin/bhyve/ (props changed) user/ed/newcons/usr.sbin/bhyvectl/ (props changed) user/ed/newcons/usr.sbin/bhyveload/ (props changed) user/ed/newcons/usr.sbin/bsdinstall/scripts/docsinstall (props changed) user/ed/newcons/usr.sbin/jail/ (props changed) Modified: user/ed/newcons/Makefile.inc1 ============================================================================== --- user/ed/newcons/Makefile.inc1 Wed Oct 23 03:59:51 2013 (r256953) +++ user/ed/newcons/Makefile.inc1 Wed Oct 23 09:21:14 2013 (r256954) @@ -128,8 +128,11 @@ OSRELDATE= 0 .endif .if !defined(VERSION) -VERSION!= uname -srp -VERSION+= ${OSRELDATE} +REVISION!= make -C ${.CURDIR}/release -V REVISION +BRANCH!= make -C ${.CURDIR}/release -V BRANCH +SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ + ${.CURDIR}/sys/sys/param.h +VERSION= FreeBSD ${REVISION}-${BRANCH} ${TARGET_ARCH} ${SRCRELDATE} .endif KNOWN_ARCHES?= amd64 arm armeb/arm armv6/arm i386 i386/pc98 ia64 mips mipsel/mips mips64el/mips mips64/mips mipsn32el/mips mipsn32/mips powerpc powerpc64/powerpc sparc64 @@ -329,7 +332,7 @@ TARGET_ABI= gnueabi .else TARGET_ABI= unknown .endif -TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd10.0 +TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd11.0 XFLAGS+= -target ${TARGET_TRIPLE} .endif .endif @@ -1377,12 +1380,10 @@ _binutils= gnu/usr.bin/binutils # If an full path to an external cross compiler is given, don't build # a cross compiler. .if ${XCC:M/*} == "" && ${MK_CROSS_COMPILER} != "no" -.if ${MK_CLANG} != "no" && (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") +.if (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") && ${TARGET} != "pc98" _clang= usr.bin/clang _clang_libs= lib/clang -.endif - -.if ${MK_GCC} != "no" && (${MK_CLANG_IS_CC} == "no" || ${TARGET} == "pc98") +.else _cc= gnu/usr.bin/cc .endif .endif @@ -1722,6 +1723,13 @@ delete-old-libs: chflags noschg "${DESTDIR}/$${file}" 2>/dev/null || true; \ rm ${RM_I} "${DESTDIR}/$${file}" <&3; \ fi; \ + for ext in debug symbols; do \ + if ! [ -e "${DESTDIR}/$${file}" ] && [ -f \ + "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ + rm ${RM_I} "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" \ + <&3; \ + fi; \ + done; \ done @echo ">>> Old libraries removed" @@ -1733,6 +1741,11 @@ check-old-libs: if [ -f "${DESTDIR}/$${file}" -o -L "${DESTDIR}/$${file}" ]; then \ echo "${DESTDIR}/$${file}"; \ fi; \ + for ext in debug symbols; do \ + if [ -f "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}" ]; then \ + echo "${DESTDIR}${DEBUGDIR}/$${file}.$${ext}"; \ + fi; \ + done; \ done delete-old-dirs: @@ -1830,7 +1843,7 @@ NOFUN=-DNO_FSCHG -DWITHOUT_HTML -DWITHOU CPUTYPE=${XDEV_CPUTYPE} XDDIR=${XDEV_ARCH}-freebsd -XDTP=/usr/${XDDIR} +XDTP=usr/${XDDIR} CDBENV=MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${XDDIR} \ INSTALL="sh ${.CURDIR}/tools/install.sh" CDENV= ${CDBENV} \ @@ -1843,8 +1856,8 @@ CD2ENV=${CDENV} CC="${CC} ${CD2CFLAGS}" CDTMP= ${MAKEOBJDIRPREFIX}/${XDDIR}/${.CURDIR}/tmp CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${PATH} ${MAKE} ${NOFUN} -CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDTP}/usr/bin:${PATH} ${MAKE} ${NOFUN} -XDDESTDIR=${DESTDIR}${XDTP} +CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN} +XDDESTDIR=${DESTDIR}/${XDTP} .if !defined(OSREL) OSREL!= uname -r | sed -e 's/[-(].*//' .endif @@ -1924,6 +1937,7 @@ _xi-libraries: _xi-links: ${_+_}cd ${XDDESTDIR}/usr/bin; \ + mkdir -p ../../../../usr/bin; \ for i in *; do \ ln -sf ../../${XDTP}/usr/bin/$$i \ ../../../../usr/bin/${XDDIR}-$$i; \ Modified: user/ed/newcons/ObsoleteFiles.inc ============================================================================== --- user/ed/newcons/ObsoleteFiles.inc Wed Oct 23 03:59:51 2013 (r256953) +++ user/ed/newcons/ObsoleteFiles.inc Wed Oct 23 09:21:14 2013 (r256954) @@ -38,29 +38,38 @@ # xargs -n1 | sort | uniq -d; # done -# 20131015: removal of RCS from base -OLD_FILES+=usr/bin/ci -OLD_FILES+=usr/bin/co -OLD_FILES+=usr/bin/ident -OLD_FILES+=usr/bin/merge -OLD_FILES+=usr/bin/rcs -OLD_FILES+=usr/bin/rcsclean -OLD_FILES+=usr/bin/rcsdiff -OLD_FILES+=usr/bin/rcsfreeze -OLD_FILES+=usr/bin/rcsmerge -OLD_FILES+=usr/bin/rlog -OLD_FILES+=usr/share/man/man1/ci.1.gz -OLD_FILES+=usr/share/man/man1/co.1.gz -OLD_FILES+=usr/share/man/man1/ident.1.gz -OLD_FILES+=usr/share/man/man1/merge.1.gz -OLD_FILES+=usr/share/man/man1/rcs.1.gz -OLD_FILES+=usr/share/man/man1/rcsclean.1.gz -OLD_FILES+=usr/share/man/man1/rcsdiff.1.gz -OLD_FILES+=usr/share/man/man1/rcsfreeze.1.gz -OLD_FILES+=usr/share/man/man1/rcsintro.1.gz -OLD_FILES+=usr/share/man/man1/rcsmerge.1.gz -OLD_FILES+=usr/share/man/man1/rlog.1.gz -OLD_FILES+=usr/share/man/man5/rcsfile.5.gz +# 20131014: libbsdyml becomes private +OLD_FILES+=usr/lib/libbsdyml.a +OLD_FILES+=usr/lib/libbsdyml.so +OLD_LIBS+=usr/lib/libbsdyml.so.0 +OLD_FILES+=usr/lib/libbsdyml_p.a +OLD_FILES+=usr/lib32/libbsdyml.a +OLD_FILES+=usr/lib32/libbsdyml.so +OLD_LIBS+=usr/lib32/libbsdyml.so.0 +OLD_FILES+=usr/lib32/libbsdyml_p.a +OLD_FILES+=usr/share/man/man3/libbsdyml.3.gz +OLD_FILES+=usr/include/bsdyml.h +# 20131013: Removal of the ATF tools +OLD_FILES+=etc/atf/FreeBSD.conf +OLD_FILES+=etc/atf/atf-run.hooks +OLD_FILES+=etc/atf/common.conf +OLD_FILES+=usr/bin/atf-config +OLD_FILES+=usr/bin/atf-report +OLD_FILES+=usr/bin/atf-run +OLD_FILES+=usr/bin/atf-version +OLD_FILES+=usr/share/atf/atf-run.hooks +OLD_FILES+=usr/share/examples/atf/atf-run.hooks +OLD_FILES+=usr/share/examples/atf/tests-results.css +OLD_FILES+=usr/share/man/man1/atf-config.1.gz +OLD_FILES+=usr/share/man/man1/atf-report.1.gz +OLD_FILES+=usr/share/man/man1/atf-run.1.gz +OLD_FILES+=usr/share/man/man1/atf-version.1.gz +OLD_FILES+=usr/share/man/man5/atf-formats.5.gz +OLD_FILES+=usr/share/man/man7/atf.7.gz +OLD_FILES+=usr/share/xml/atf/tests-results.dtd +OLD_FILES+=usr/share/xsl/atf/tests-results.xsl +# 20131009: freebsd-version moved from /libexec to /bin +OLD_FILES+=libexec/freebsd-version # 20131001: ar and ranlib from binutils not used OLD_FILES+=usr/bin/gnu-ar OLD_FILES+=usr/bin/gnu-ranlib @@ -88,7 +97,7 @@ OLD_FILES+=usr/include/lwres/result.h OLD_FILES+=usr/include/lwres/version.h OLD_FILES+=usr/lib/liblwres.a OLD_FILES+=usr/lib/liblwres.so -OLD_LIBS+=usr/lib/liblwres.so.50 +OLD_LIBS+=usr/lib/liblwres.so.90 OLD_FILES+=usr/lib/liblwres_p.a OLD_FILES+=usr/sbin/arpaname OLD_FILES+=usr/sbin/ddns-confgen @@ -98,6 +107,7 @@ OLD_FILES+=usr/sbin/dnssec-keygen OLD_FILES+=usr/sbin/dnssec-revoke OLD_FILES+=usr/sbin/dnssec-settime OLD_FILES+=usr/sbin/dnssec-signzone +OLD_FILES+=usr/sbin/dnssec-verify OLD_FILES+=usr/sbin/genrandom OLD_FILES+=usr/sbin/isc-hmac-fixup OLD_FILES+=usr/sbin/lwresd @@ -261,6 +271,7 @@ OLD_FILES+=usr/share/man/man8/dnssec-key OLD_FILES+=usr/share/man/man8/dnssec-revoke.8.gz OLD_FILES+=usr/share/man/man8/dnssec-settime.8.gz OLD_FILES+=usr/share/man/man8/dnssec-signzone.8.gz +OLD_FILES+=usr/share/man/man8/dnssec-verify.8.gz OLD_FILES+=usr/share/man/man8/genrandom.8.gz OLD_FILES+=usr/share/man/man8/isc-hmac-fixup.8.gz OLD_FILES+=usr/share/man/man8/lwresd.8.gz @@ -295,6 +306,8 @@ OLD_DIRS+=var/named/var/run OLD_DIRS+=var/named/var/run/named OLD_DIRS+=var/named/var/stats OLD_DIRS+=var/run/named +# 20130923: example moved +OLD_FILES+=usr/share/examples/bsdconfig/browse_packages.sh # 20130908: libssh becomes private OLD_FILES+=usr/lib/libssh.a OLD_FILES+=usr/lib/libssh.so @@ -6114,6 +6127,13 @@ OLD_LIBS+=usr/lib/libkse.so.1 OLD_LIBS+=usr/lib/liblwres.so.3 OLD_LIBS+=usr/lib/pam_ftp.so.2 +# 20131013: Removal of the ATF tools +OLD_DIRS+=etc/atf +OLD_DIRS+=usr/share/examples/atf +OLD_DIRS+=usr/share/xml/atf +OLD_DIRS+=usr/share/xml +OLD_DIRS+=usr/share/xsl/atf +OLD_DIRS+=usr/share/xsl # 20040925: bind9 import OLD_DIRS+=usr/share/doc/bind/html OLD_DIRS+=usr/share/doc/bind/misc Modified: user/ed/newcons/UPDATING ============================================================================== --- user/ed/newcons/UPDATING Wed Oct 23 03:59:51 2013 (r256953) +++ user/ed/newcons/UPDATING Wed Oct 23 09:21:14 2013 (r256954) @@ -16,8 +16,8 @@ from older versions of FreeBSD, try WITH head, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. -NOTE TO PEOPLE WHO THINK THAT FreeBSD 10.x IS SLOW: - FreeBSD 10.x has many debugging features turned on, in both the kernel +NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW: + FreeBSD 11.x has many debugging features turned on, in both the kernel and userland. These features attempt to detect incorrect use of system primitives, and encourage loud failure through extra sanity checking and fail stop semantics. They also substantially impact @@ -31,9 +31,33 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) -20131006: - RCS has been removed from the base system. If you need RCS - install either devel/rcs or devel/rcs57. +20131014: + libbsdyml has been renamed to libyaml and moved to /usr/lib/private. + This will break ports-mgmt/pkg. Rebuild the port, or upgrade to pkg + 1.1.4_8 and verify bsdyml not linked in, before running "make + delete-old-libs": + # make -C /usr/ports/ports-mgmt/pkg build deinstall install clean + or + # pkg install pkg; ldd /usr/local/sbin/pkg | grep bsdyml + +20131010: + The rc.d/jail script has been updated to support jail(8) + configuration file. The "jail__*" rc.conf(5) variables + for per-jail configuration are automatically converted to + /var/run/jail..conf before the jail(8) utility is invoked. + This is transparently backward compatible. See below about some + incompatibilities and rc.conf(5) manual page for more details. + + These variables are now deprecated in favor of jail(8) configuration + file. One can use "rc.d/jail config " command to generate + a jail(8) configuration file in /var/run/jail..conf without + running the jail(8) utility. The default pathname of the + configuration file is /etc/jail.conf and can be specified by + using $jail_conf or $jail__conf variables. + + Please note that jail_devfs_ruleset accepts an integer at + this moment. Please consider to rewrite the ruleset name + with an integer. 20130930: BIND has been removed from the base system. If all you need @@ -77,19 +101,6 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 10 has been updated to use this support. A new gcc is required to build the aesni module on both i386 and amd64. -20130827: - Thomas Dickey (vendor author thereof) reports that dialog(1) since - 2011/10/18 has a bug in handling --hline. Testers and I noticed the - --hline is not ignored but displayed as a NULL string, regardless of - value. This will cause confusion in some bsdconfig dialogs where the - --hline is used to inform users which keybindings to use. This will - likewise affect any other persons relying on --hline. It also looks - rather strange seeing "[]" at the bottom of dialog(1) widgets when - passing --hline "anything". Thomas said he will have a look in a few - weeks. NOTE: The "[]" brackets appear with the left-edge where it - would normally appear given the width of text to display, but the - displayed text is not there (part of the bug). - 20130821: The PADLOCK_RNG and RDRAND_RNG kernel options are now devices. Thus "device padlock_rng" and "device rdrand_rng" should be Modified: user/ed/newcons/bin/Makefile ============================================================================== --- user/ed/newcons/bin/Makefile Wed Oct 23 03:59:51 2013 (r256953) +++ user/ed/newcons/bin/Makefile Wed Oct 23 09:21:14 2013 (r256954) @@ -15,6 +15,7 @@ SUBDIR= cat \ echo \ ed \ expr \ + freebsd-version \ getfacl \ hostname \ kenv \ Modified: user/ed/newcons/bin/ps/print.c ============================================================================== --- user/ed/newcons/bin/ps/print.c Wed Oct 23 03:59:51 2013 (r256953) +++ user/ed/newcons/bin/ps/print.c Wed Oct 23 09:21:14 2013 (r256954) @@ -797,8 +797,6 @@ char * emulname(KINFO *k, VARENT *ve __unused) { - if (k->ki_p->ki_emul == NULL) - return (NULL); return (strdup(k->ki_p->ki_emul)); } @@ -827,7 +825,6 @@ out: char * loginclass(KINFO *k, VARENT *ve __unused) { - char *s; /* * Don't display login class for system processes; @@ -837,8 +834,5 @@ loginclass(KINFO *k, VARENT *ve __unused if (k->ki_p->ki_flag & P_SYSTEM) { return (strdup("-")); } - s = k->ki_p->ki_loginclass; - if (s == NULL) - return (NULL); - return (strdup(s)); + return (strdup(k->ki_p->ki_loginclass)); } Modified: user/ed/newcons/bin/sh/jobs.c ============================================================================== --- user/ed/newcons/bin/sh/jobs.c Wed Oct 23 03:59:51 2013 (r256953) +++ user/ed/newcons/bin/sh/jobs.c Wed Oct 23 09:21:14 2013 (r256954) @@ -978,7 +978,6 @@ int waitforjob(struct job *jp, int *origstatus) { #if JOBS - pid_t mypgrp = getpgrp(); int propagate_int = jp->jobctl && jp->foreground; #endif int status; @@ -992,7 +991,7 @@ waitforjob(struct job *jp, int *origstat dotrap(); #if JOBS if (jp->jobctl) { - if (tcsetpgrp(ttyfd, mypgrp) < 0) + if (tcsetpgrp(ttyfd, rootpid) < 0) error("tcsetpgrp failed, errno=%d\n", errno); } if (jp->state == JOBSTOPPED) Modified: user/ed/newcons/bin/sh/miscbltin.c ============================================================================== --- user/ed/newcons/bin/sh/miscbltin.c Wed Oct 23 03:59:51 2013 (r256953) +++ user/ed/newcons/bin/sh/miscbltin.c Wed Oct 23 09:21:14 2013 (r256954) @@ -405,6 +405,9 @@ static const struct limits limits[] = { #ifdef RLIMIT_NPTS { "pseudo-terminals", (char *)0, RLIMIT_NPTS, 1, 'p' }, #endif +#ifdef RLIMIT_KQUEUES + { "kqueues", (char *)0, RLIMIT_KQUEUES, 1, 'k' }, +#endif { (char *) 0, (char *)0, 0, 0, '\0' } }; @@ -421,7 +424,7 @@ ulimitcmd(int argc __unused, char **argv struct rlimit limit; what = 'f'; - while ((optc = nextopt("HSatfdsmcnuvlbpw")) != '\0') + while ((optc = nextopt("HSatfdsmcnuvlbpwk")) != '\0') switch (optc) { case 'H': how = HARD; Modified: user/ed/newcons/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 ============================================================================== --- user/ed/newcons/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 Wed Oct 23 03:59:51 2013 (r256953) +++ user/ed/newcons/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 Wed Oct 23 09:21:14 2013 (r256954) @@ -2,7 +2,7 @@ .\" CDDL HEADER START .\" .\" The contents of this file are subject to the terms of the -.\" Common Development and Distribution License (the "License"). +.\" Common Development and Distribution License (the "License"). .\" You may not use this file except in compliance with the License. .\" .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE @@ -18,653 +18,660 @@ .\" .\" CDDL HEADER END .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved. -.TH dtrace 1M "5 Sep 2006" "SunOS 5.11" "System Administration Commands" -.SH NAME -dtrace \- DTrace dynamic tracing compiler and tracing utility -.SH SYNOPSIS -.LP -.nf -\fBdtrace\fR [\fB-32\fR | \fB-64\fR] [\fB-aACeFGHhlqSvVwZ\fR] [\fB-b\fR \fIbufsz\fR] [\fB-c\fR \fIcmd\fR] - [\fB-D\fR \fIname\fR [\fI=value\fR]] [\fB-I\fR \fIpath\fR] [\fB-L\fR \fIpath\fR] [\fB-o\fR \fIoutput\fR] - [\fB-s\fR \fIscript\fR] [\fB-U\fR \fIname\fR] [\fB-x\fR \fIarg\fR [\fI=val\fR]] - [\fB-X\fR a | c | s | t] [\fB-p\fR \fIpid\fR] - [\fB-P\fR \fIprovider\fR [[\fIpredicate\fR] \fIaction\fR]] - [\fB-m\fR [\fIprovider:\fR] \fImodule\fR [[\fIpredicate\fR] \fIaction\fR]] - [\fB-f\fR [[\fIprovider:\fR] \fImodule:\fR] \fIfunction\fR [[\fIpredicate\fR] \fIaction\fR]] - [\fB-n\fR [[[\fIprovider:\fR] \fImodule:\fR] \fIfunction:\fR] \fIname\fR [[\fIpredicate\fR] \fIaction\fR]] - [\fB-i\fR \fIprobe-id\fR [[\fIpredicate\fR] \fIaction\fR]] -.fi - -.SH DESCRIPTION -.sp -.LP -DTrace is a comprehensive dynamic tracing framework for the Solaris Operating System. DTrace provides a powerful infrastructure that permits administrators, developers, and service personnel to concisely answer arbitrary questions about the behavior of the operating system and user programs. -.sp -.LP -The \fISolaris Dynamic Tracing Guide\fR describes how to use DTrace to observe, debug, and tune system behavior. Refer to this book for a detailed description of DTrace features, including the bundled DTrace observability -tools, instrumentation providers, and the D programming language. -.sp -.LP -The \fBdtrace\fR command provides a generic interface to the essential services provided by the DTrace facility, including: -.RS +4 -.TP -.ie t \(bu -.el o +.\" +.\" $FreeBSD$ +.\" +.Dd October 5, 2013 +.Dt DTRACE 1 +.Os +.Sh NAME +.Nm dtrace +.Nd dynamic tracing compiler and tracing utility +.Sh SYNOPSIS +.Nm +.Op Fl 32 | Fl 64 +.Op Fl aACeFGhHlqSvVwZ +.Op Fl b Ar bufsz +.Op Fl c Ar cmd +.Op Fl D Ar name Op Ns = Ns value +.Op Fl I Ar path +.Op Fl L Ar path +.Op Fl o Ar output +.Op Fl s Ar script +.Op Fl U Ar name +.Op Fl x Ar arg Op Ns = Ns value +.Op Fl X Cm a | c | s | t +.Op Fl p Ar pid +.Op Fl P Ar provider Oo Oo Ar predicate Oc Ar action Oc +.Op Fl m Oo Ar provider : Oc Ar module Oo Oo Ar predicate Oc Ar action Oc +.Op Fl f Oo Oo Ar provider : Oc Ar module : Oc Ar function Oo Oo Ar predicate \ + Oc Ar action Oc +.Op Fl n Oo Oo Oo Ar provider : Oc Ar module : Oc Ar function : Oc Ar name \ + Oo Oo Ar predicate Oc Ar action Oc +.Op Fl i Ar probe-id Oo Oo Ar predicate Oc Ar action Oc +.Sh DESCRIPTION +DTrace is a comprehensive dynamic tracing framework ported from Solaris. +DTrace provides a powerful infrastructure that permits administrators, +developers, and service personnel to concisely answer arbitrary questions about +the behavior of the operating system and user programs. +.Pp +The +.Nm +command provides a generic interface to the essential services provided by the +DTrace facility, including: +.Bl -bullet -offset indent +.It Options that list the set of probes and providers currently published by DTrace -.RE -.RS +4 -.TP -.ie t \(bu -.el o -Options that enable probes directly using any of the probe description specifiers (provider, module, function, name) -.RE -.RS +4 -.TP -.ie t \(bu -.el o -Options that run the D compiler and compile one or more D program files or programs written directly on the command line -.RE -.RS +4 -.TP -.ie t \(bu -.el o +.It +Options that enable probes directly using any of the probe description +specifiers (provider, module, function, name) +.It +Options that run the D compiler and compile one or more D program files or +programs written directly on the command line +.It Options that generate anonymous tracing programs -.RE -.RS +4 -.TP -.ie t \(bu -.el o +.It Options that generate program stability reports -.RE -.RS +4 -.TP -.ie t \(bu -.el o -Options that modify DTrace tracing and buffering behavior and enable additional D compiler features -.RE -.sp -.LP -You can use \fBdtrace\fR to create D scripts by using it in a \fB#!\fR declaration to create an interpreter file. You can also use \fBdtrace\fR to attempt to compile D programs and determine their properties without actually enabling tracing using the \fB-e\fR option. See \fBOPTIONS\fR. See the \fISolaris Dynamic Tracing Guide\fR for detailed examples of how to use the \fBdtrace\fR utility to perform these tasks. -.SH OPTIONS -.sp -.LP -The arguments accepted by the \fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, and \fB-i\fR options can include an optional D language \fIpredicate\fR enclosed in slashes \fB//\fR and optional D language \fIaction\fR statement list enclosed in braces \fB{}\fR. D program code specified on the command line must be appropriately quoted to avoid intepretation of meta-characters by the shell. -.sp -.LP +.It +Options that modify DTrace tracing and buffering behavior and enable +additional D compiler features +.El +.Pp +You can use +.Nm +to create D scripts by using it in a shebang declaration to create an +interpreter file. +You can also use +.Nm +to attempt to compile D programs and determine their properties without +actually enabling traces using the +.Fl e +option. +.Sh OPTIONS +The arguments accepted by the +.Fl P , +.Fl m , +.Fl f , +.Fl n , +and +.Fl i +options can include an optional D language +.Ar predicate +enclosed in slashes and an optional D language +.Ar action +statement list enclosed in braces. +D program code specified on the command line must be appropriately quoted to +avoid interpretation of meta-characters by the shell. +.Pp The following options are supported: -.sp -.ne 2 -.mk -.na -\fB\fB-32\fR | \fB-64\fR\fR -.ad -.sp .6 -.RS 4n -The D compiler produces programs using the native data model of the operating system kernel. You can use the \fBisainfo\fR \fB-b\fR command to determine the current operating system data model. If the \fB-32\fR option is specified, \fBdtrace\fR forces -the D compiler to compile a D program using the 32-bit data model. If the \fB-64\fR option is specified, \fBdtrace\fR forces the D compiler to compile a D program using the 64-bit data model. These options are typically not required as \fBdtrace\fR selects the -native data model as the default. The data model affects the sizes of integer types and other language properties. D programs compiled for either data model can be executed on both 32-bit and 64-bit kernels. The \fB-32\fR and \fB-64\fR options also determine the ELF file format -(ELF32 or ELF64) produced by the \fB-G\fR option. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-a\fR\fR -.ad -.sp .6 -.RS 4n -Claim anonymous tracing state and display the traced data. You can combine the \fB-a\fR option with the \fB-e\fR option to force \fBdtrace\fR to exit immediately after consuming the anonymous tracing state rather than continuing to wait for new -data. See the \fISolaris Dynamic Tracing Guide\fR for more information about anonymous tracing. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-A\fR\fR -.ad -.sp .6 -.RS 4n -Generate \fBdriver.conf\fR(4) directives for anonymous tracing. This option constructs a set of \fBdtrace\fR(7D) configuration file directives to enable the specified probes for anonymous tracing and then exits. By default, \fBdtrace\fR attempts to store the directives to the file \fB/kernel/drv/dtrace.conf\fR. You can modify this behavior if you use the \fB-o\fR option to specify an alternate output file. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-b\fR \fIbufsz\fR\fR -.ad -.sp .6 -.RS 4n -Set principal trace buffer size (\fIbufsz\fR). The trace buffer size can include any of the size suffixes \fBk\fR, \fBm\fR, \fBg\fR, or \fBt\fR. If the buffer space cannot be allocated, \fBdtrace\fR attempts -to reduce the buffer size or exit depending on the setting of the \fBbufresize\fR property. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-c\fR \fIcmd\fR\fR -.ad -.sp .6 -.RS 4n -Run the specified command \fIcmd\fR and exit upon its completion. If more than one \fB-c\fR option is present on the command line, \fBdtrace\fR exits when all commands have exited, reporting the exit status for each child process as it -terminates. The process-ID of the first command is made available to any D programs specified on the command line or using the \fB-s\fR option through the \fB$target\fR macro variable. Refer to the \fISolaris Dynamic Tracing Guide\fR for more information -on macro variables. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-C\fR\fR -.ad -.sp .6 -.RS 4n -Run the C preprocessor \fBcpp\fR(1) over D programs before compiling them. You can pass options to the C preprocessor using the \fB-D\fR, \fB-U\fR, \fB-I\fR, and \fB-H\fR options. You can select the degree of C standard conformance if you use the \fB-X\fR option. For a description of the set of tokens defined by the D compiler when invoking the C preprocessor, see \fB-X\fR. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-D\fR \fIname\fR \fB[=\fR\fIvalue\fR\fB]\fR\fR -.ad -.sp .6 -.RS 4n -Define \fIname\fR when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR option). If you specify the equals sign (\fB=\fR) -and additional \fIvalue\fR, the name is assigned the corresponding value. This option passes the \fB-D\fR option to each \fBcpp\fR invocation. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-e\fR\fR -.ad -.sp .6 -.RS 4n -Exit after compiling any requests and consuming anonymous tracing state (\fB-a\fR option) but prior to enabling any probes. You can combine this option with the \fB-a\fR option to print anonymous tracing data and exit. You can also combine this option with D -compiler options. This combination verifies that the programs compile without actually executing them and enabling the corresponding instrumentation. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-f\fR\fB[[\fR\fIprovider\fR\fB:]\fR\fImodule\fR\fB:]\fR\fIfunction\fR\fB[[\fR\fIpredicate\fR\fB]\fR\fIaction\fR\fB]]\fR\fR -.ad -.sp .6 -.RS 4n -Specify function name to trace or list (\fB-l\fR option). The corresponding argument can include any of the probe description forms \fIprovider:module:function\fR, \fImodule:function\fR, or \fIfunction\fR. -Unspecified probe description fields are left blank and match any probes regardless of the values in those fields. If no qualifiers other than \fIfunction\fR are specified in the description, all probes with the corresponding \fIfunction\fR are matched. -The \fB-f\fR argument can be suffixed with an optional D probe clause. You can specify more than one \fB-f\fR option on the command line at a time. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-F\fR\fR -.ad -.sp .6 -.RS 4n -Coalesce trace output by identifying function entry and return. Function entry probe reports are indented and their output is prefixed with \fB->\fR. Function return probe reports are unindented and their output is prefixed with \fB<-\fR\&. System call -entry probe reports are indented and their output is prefixed with \fB=>\fR. System call return probe reports are unindented and their output is prefixed with \fB<=\fR\&. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-G\fR\fR -.ad -.sp .6 -.RS 4n -Generate an ELF file containing an embedded DTrace program. The DTrace probes specified in the program are saved inside of a relocatable ELF object which can be linked into another program. If the \fB-o\fR option is present, the ELF file is saved using the pathname specified -as the argument for this operand. If the \fB-o\fR option is not present and the DTrace program is contained with a file whose name is \fB\fIfilename\fR.d\fR, then the ELF file is saved using the name \fB\fIfilename\fR.o\fR. -Otherwise the ELF file is saved using the name \fBd.out\fR. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-H\fR\fR -.ad -.sp .6 -.RS 4n -Print the pathnames of included files when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR option). This option passes the \fB-H\fR option -to each \fBcpp\fR invocation, causing it to display the list of pathnames, one for each line, to \fBstderr\fR. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-h\fR\fR -.ad -.sp .6 -.RS 4n -Generate a header file containing macros that correspond to probes in the specified provider definitions. This option should be used to generate a header file that is included by other source files for later use with the \fB-G\fR option. If the \fB-o\fR option -is present, the header file is saved using the pathname specified as the argument for that option. If the \fB-o\fR option is not present and the DTrace program is contained with a file whose name is \fIfilename\fR\fB\&.d\fR, then the header file is saved -using the name \fIfilename\fR\fB\&.h\fR. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-i\fR \fIprobe-id\fR\fB[[\fR\fIpredicate\fR] \fIaction\fR\fB]\fR\fR -.ad -.sp .6 -.RS 4n -Specify probe identifier (\fIprobe-id\fR) to trace or list (\fB-l\fR option). You can specify probe IDs using decimal integers as shown by \fBdtrace\fR \fB-l\fR. The \fB-i\fR argument can be suffixed with an optional -D probe clause. You can specify more than one \fB-i\fR option at a time. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-I\fR \fIpath\fR\fR -.ad -.sp .6 -.RS 4n -Add the specified directory \fIpath\fR to the search path for \fB#include\fR files when invoking \fBcpp\fR(1) (enabled -using the \fB-C\fR option). This option passes the \fB-I\fR option to each \fBcpp\fR invocation. The specified \fIpath\fR is inserted into the search path ahead of the default directory list. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-L\fR \fIpath\fR\fR -.ad -.sp .6 -.RS 4n -Add the specified directory \fIpath\fR to the search path for DTrace libraries. DTrace libraries are used to contain common definitions that can be used when writing D programs. The specified \fIpath\fR is added after the default library -search path. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-l\fR\fR -.ad -.sp .6 -.RS 4n -List probes instead of enabling them. If the \fB-l\fR option is specified, \fBdtrace\fR produces a report of the probes matching the descriptions given using the \fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, \fB-i\fR, -and \fB-s\fR options. If none of these options are specified, this option lists all probes. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-m\fR [[\fIprovider:\fR] \fImodule:\fR [[\fIpredicate\fR] \fIaction\fR]]\fR -.ad -.sp .6 -.RS 4n -Specify module name to trace or list (\fB-l\fR option). The corresponding argument can include any of the probe description forms \fIprovider:module\fR or \fImodule\fR. Unspecified probe description fields are left blank and match -any probes regardless of the values in those fields. If no qualifiers other than \fImodule\fR are specified in the description, all probes with a corresponding \fImodule\fR are matched. The \fB-m\fR argument can be suffixed with an optional D -probe clause. More than one \fB-m\fR option can be specified on the command line at a time. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-n\fR [[[\fIprovider:\fR] \fImodule:\fR] \fIfunction:\fR] \fIname\fR [[\fIpredicate\fR] \fIaction\fR]\fR -.ad -.sp .6 -.RS 4n -Specify probe name to trace or list (\fB-l\fR option). The corresponding argument can include any of the probe description forms \fIprovider:module:function:name\fR, \fImodule:function:name\fR, \fIfunction:name\fR, -or \fIname\fR. Unspecified probe description fields are left blank and match any probes regardless of the values in those fields. If no qualifiers other than \fIname\fR are specified in the description, all probes with a corresponding \fIname\fR are -matched. The \fB-n\fR argument can be suffixed with an optional D probe clause. More than one \fB-n\fR option can be specified on the command line at a time. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-o\fR \fIoutput\fR\fR -.ad -.sp .6 -.RS 4n -Specify the \fIoutput\fR file for the \fB-A\fR , \fB-G\fR, and \fB-l\fR options, or for the traced data itself. If the \fB-A\fR option is present and \fB-o\fR is not present, the default output file is \fB/kernel/drv/dtrace.conf\fR. If the \fB-G\fR option is present and the \fB-s\fR option's argument is of the form \fB\fIfilename\fR.d\fR and \fB-o\fR is not present, the default output file is \fB\fIfilename\fR.o\fR. -Otherwise the default output file is \fBd.out\fR. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-p\fR \fIpid\fR\fR -.ad -.sp .6 -.RS 4n -Grab the specified process-ID \fIpid\fR, cache its symbol tables, and exit upon its completion. If more than one \fB-p\fR option is present on the command line, \fBdtrace\fR exits when all commands have exited, reporting the exit status -for each process as it terminates. The first process-ID is made available to any D programs specified on the command line or using the \fB-s\fR option through the \fB$target\fR macro variable. Refer to the \fISolaris Dynamic Tracing Guide\fR for -more information on macro variables. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-P\fR \fIprovider\fR \fB[[\fR\fIpredicate\fR\fB]\fR \fIaction\fR]\fR -.ad -.sp .6 -.RS 4n -Specify provider name to trace or list (\fB-l\fR option). The remaining probe description fields module, function, and name are left blank and match any probes regardless of the values in those fields. The \fB-P\fR argument can be suffixed with an optional D -probe clause. You can specify more than one \fB-P\fR option on the command line at a time. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-q\fR\fR -.ad -.sp .6 -.RS 4n -Set quiet mode. \fBdtrace\fR suppresses messages such as the number of probes matched by the specified options and D programs and does not print column headers, the CPU ID, the probe ID, or insert newlines into the output. Only data traced and formatted by D program -statements such as \fBtrace()\fR and \fBprintf()\fR is displayed to \fBstdout\fR. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-s\fR\fR -.ad -.sp .6 -.RS 4n -Compile the specified D program source file. If the \fB-e\fR option is present, the program is compiled but instrumentation is not enabled. If the \fB-l\fR option is present, the program is compiled and the set of probes matched by it is listed, but instrumentation -is not enabled. If none of \fB-e\fR, \fB-l\fR, \fB-G\fR, or \fB-A\fR are present, the instrumentation specified by the D program is enabled and tracing begins. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-S\fR\fR -.ad -.sp .6 -.RS 4n -Show D compiler intermediate code. The D compiler produces a report of the intermediate code generated for each D program to \fBstderr\fR. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-U\fR \fIname\fR\fR -.ad -.sp .6 -.RS 4n -Undefine the specified \fIname\fR when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR option). This option passes the \fB-U\fR option to each \fBcpp\fR invocation. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-v\fR\fR -.ad -.sp .6 -.RS 4n -Set verbose mode. If the \fB-v\fR option is specified, \fBdtrace\fR produces a program stability report showing the minimum interface stability and dependency level for the specified D programs. DTrace stability levels are explained in further detail in the \fISolaris Dynamic Tracing Guide\fR. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-V\fR\fR -.ad -.sp .6 -.RS 4n -Report the highest D programming interface version supported by \fBdtrace\fR. The version information is printed to \fBstdout\fR and the \fBdtrace\fR command exits. Refer to the \fISolaris Dynamic Tracing Guide\fR for -more information about DTrace versioning features. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-w\fR\fR -.ad -.sp .6 -.RS 4n -Permit destructive actions in D programs specified using the \fB-s\fR, \fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, or \fB-i\fR options. If the \fB-w\fR option is not specified, \fBdtrace\fR does not -permit the compilation or enabling of a D program that contains destructive actions. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-x\fR \fIarg\fR [\fI=val\fR]\fR -.ad -.sp .6 -.RS 4n -Enable or modify a DTrace runtime option or D compiler option. The list of options is found in the \fISolaris Dynamic Tracing Guide\fR. Boolean options are enabled by specifying their name. Options with values are set by separating the option name and -value with an equals sign (\fB=\fR). -.RE - -.sp -.ne 2 -.mk -.na -\fB\fB-X\fR \fBa | c | s | t\fR\fR -.ad -.sp .6 -.RS 4n -Specify the degree of conformance to the ISO C standard that should be selected when invoking \fBcpp\fR(1) (enabled using the \fB-C\fR option). -The \fB-X\fR option argument affects the value and presence of the \fB__STDC__\fR macro depending upon the value of the argument letter. -.sp -The \fB-X\fR option supports the following arguments: -.sp -.ne 2 -.mk -.na -\fB\fBa\fR\fR -.ad -.RS 5n -.rt -Default. ISO C plus K&R compatibility extensions, with semantic changes required by ISO C. This is the default mode if \fB-X\fR is not specified. The predefined macro \fB__STDC__\fR has a value of 0 when \fBcpp\fR is invoked in conjunction -with the \fB-Xa\fR option. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fBc\fR\fR -.ad -.RS 5n -.rt -Conformance. Strictly conformant ISO C, without K&R C compatibility extensions. The predefined macro \fB__STDC__\fR has a value of 1 when \fBcpp\fR is invoked in conjunction with the \fB-Xc\fR option. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fBs\fR\fR -.ad -.RS 5n -.rt -K&R C only. The macro \fB__STDC__\fR is not defined when \fBcpp\fR is invoked in conjunction with the \fB-Xs\fR option. -.RE - -.sp -.ne 2 -.mk -.na -\fB\fBt\fR\fR -.ad -.RS 5n -.rt -Transition. ISO C plus K&R C compatibility extensions, without semantic changes required by ISO C. The predefined macro \fB__STDC__\fR has a value of 0 when \fBcpp\fR is invoked in conjunction with the \fB-Xt\fR option. -.RE - -As the \fB-X\fR option only affects how the D compiler invokes the C preprocessor, the \fB-Xa\fR and \fB-Xt\fR options are equivalent from the perspective of D and both are provided only to ease re-use of settings from a C build environment. -.sp -Regardless of the \fB-X\fR mode, the following additional C preprocessor definitions are always specified and valid in all modes: -.RS +4 -.TP -.ie t \(bu -.el o -\fB__sun\fR -.RE -.RS +4 -.TP -.ie t \(bu -.el o -\fB__unix\fR -.RE -.RS +4 -.TP -.ie t \(bu -.el o -\fB__SVR4\fR -.RE -.RS +4 -.TP -.ie t \(bu -.el o -\fB__sparc\fR (on SPARC systems only) -.RE -.RS +4 -.TP -.ie t \(bu -.el o -\fB__sparcv9\fR (on SPARC systems only when 64-bit programs are compiled) -.RE -.RS +4 -.TP -.ie t \(bu -.el o -\fB__i386\fR (on x86 systems only when 32-bit programs are compiled) -.RE -.RS +4 -.TP -.ie t \(bu -.el o -\fB__amd64\fR (on x86 systems only when 64-bit programs are compiled) -.RE -.RS +4 -.TP -.ie t \(bu -.el o -\fB__\fI`uname -s`\fR_\fI`uname -r`\fR\fR (for example, \fB__SunOS_5_10\fR) -.RE -.RS +4 -.TP *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Wed Oct 23 10:09:21 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id AA3889E; Wed, 23 Oct 2013 10:09:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 97F0E2252; Wed, 23 Oct 2013 10:09:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9NA9LsU016001; Wed, 23 Oct 2013 10:09:21 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9NA9LOo016000; Wed, 23 Oct 2013 10:09:21 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201310231009.r9NA9LOo016000@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 23 Oct 2013 10:09:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256957 - user/glebius/course/05.memory X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 10:09:21 -0000 Author: glebius Date: Wed Oct 23 10:09:21 2013 New Revision: 256957 URL: http://svnweb.freebsd.org/changeset/base/256957 Log: Couple more bits on uma. Modified: user/glebius/course/05.memory/lection.tex Modified: user/glebius/course/05.memory/lection.tex ============================================================================== --- user/glebius/course/05.memory/lection.tex Wed Oct 23 09:54:58 2013 (r256956) +++ user/glebius/course/05.memory/lection.tex Wed Oct 23 10:09:21 2013 (r256957) @@ -781,28 +781,70 @@ ITEM & SIZE & LIMIT & USED & FR \begin{column}{.03\paperwidth} \end{column} \begin{column}{.97\paperwidth} -m = uma\_zalloc(zone, \ldots); -\begin{tikzpicture}[node distance=5mm] - \node [name=zone, struct, rectangle split parts=4] { +\begin{tikzpicture}[node distance=5mm, font=\scriptsize] + \node [name=keg, struct, rectangle split parts=4] { + \textbf{struct uma\_keg} + \nodepart{two} LIST\_HEAD(,uma\_slab) uk\_part\_slab + \nodepart{three} LIST\_HEAD(,uma\_slab) uk\_free\_slab + \nodepart{four} LIST\_HEAD(,uma\_slab) uk\_full\_slab + }; + +\tikzset { + slab/.style = {draw, thick, rounded corners, + rectangle split, rectangle split draw splits=false, + rectangle split horizontal, + minimum width=10ex, minimum height=3ex}, + fslab/.style = {slab, + rectangle split part fill={struct!50, struct!50, struct!50, + struct!50}}, + pslab1/.style = {slab, + rectangle split part fill={struct!50, struct!50, white!50, + white!50}}, + pslab2/.style = {slab, + rectangle split part fill={struct!50, white!50, white!50, + white!50}}, + eslab/.style = {slab, + rectangle split part fill={white!50, white!50, white!50, + white!50}}, +} + + \node [name=fslab1, fslab, + below=10mm of keg.south west, anchor=north west, xshift=-8mm] {}; + \node [name=fslab2, fslab, node distance=1mm, below=of fslab1] {}; + \node [name=fslab3, fslab, node distance=1mm, below=of fslab2] {}; + \node [name=fslab4, fslab, node distance=1mm, below=of fslab3] {}; + \node [name=pslab1, pslab1, right=of fslab1] {}; + \node [name=pslab2, pslab2, node distance=1mm, below=of pslab1] {}; + \node [name=eslab, eslab, right=of pslab1] {}; + + \draw [pointer] (keg.four east) -- ++(1mm,0) -- +(0,-5mm) -| (fslab1.north); + \draw [pointer] (keg.three east) -- ++(2mm,0) -- +(0,-14mm) -| (pslab1.north); + \draw [pointer] (keg.two east) -- ++(3mm,0) -- +(0,-22mm) -| (eslab.north); + +\onslide<2-> { + \node [name=zone, left=of keg, struct, rectangle split parts=4] { \textbf{struct uma\_zone} \nodepart{two} struct uma\_cache uz\_cpu\lbrack$ncpus$\rbrack \nodepart{three} LIST\_HEAD(,uma\_bucket) uz\_buckets \nodepart{four} struct uma\_keg *uz\_keg }; - \node [name=cache, below left=5mm and 0mm of zone, + \node [name=cache, below=of zone.south west, anchor=north west, struct, rectangle split parts=3] { \textbf{struct uma\_cache} \nodepart{two} uma\_bucket\_t uc\_freebucket \nodepart{three} uma\_bucket\_t uc\_allocbucket }; - \node [name=bucket, below=of zone, struct, rectangle split parts=4] { + \node [name=bucket, below=of cache.south west, anchor=north west, + struct, rectangle split parts=4] { \textbf{struct uma\_bucket} \nodepart{two} int16\_t ub\_cnt \nodepart{three} int16\_t ub\_entries \nodepart{four} void *ub\_bucket\lbrack\rbrack }; - \draw [pointer] (zone.two west) -| (cache.north); - \draw [pointer] (cache.two east) to [out=0, in=180] (bucket.one west); + \draw [pointer] (zone.two west) -- +(-3mm,0) |- (cache.one west); + \draw [pointer] (cache.two west) -- +(-3mm,0) |- (bucket.one west); + \draw [pointer] (zone.four east) to [out=0, in=180] (keg.one west); +} \end{tikzpicture} \end{column} \end{columns} From owner-svn-src-user@FreeBSD.ORG Wed Oct 23 11:30:07 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DE8F7F45; Wed, 23 Oct 2013 11:30:07 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CC22626F1; Wed, 23 Oct 2013 11:30:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9NBU7Mm044028; Wed, 23 Oct 2013 11:30:07 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9NBU7WL044027; Wed, 23 Oct 2013 11:30:07 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310231130.r9NBU7WL044027@svn.freebsd.org> From: Aleksandr Rybalko Date: Wed, 23 Oct 2013 11:30:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256958 - user/ed/newcons/sys/arm/freescale/imx X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 11:30:07 -0000 Author: ray Date: Wed Oct 23 11:30:07 2013 New Revision: 256958 URL: http://svnweb.freebsd.org/changeset/base/256958 Log: We have to know what is CPU_CONTROL_[DI]C_ENABLE so include machine/armreg.h. Modified: user/ed/newcons/sys/arm/freescale/imx/imx51_machdep.c Modified: user/ed/newcons/sys/arm/freescale/imx/imx51_machdep.c ============================================================================== --- user/ed/newcons/sys/arm/freescale/imx/imx51_machdep.c Wed Oct 23 10:09:21 2013 (r256957) +++ user/ed/newcons/sys/arm/freescale/imx/imx51_machdep.c Wed Oct 23 11:30:07 2013 (r256958) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include /* For trapframe_t, used in */ #include From owner-svn-src-user@FreeBSD.ORG Wed Oct 23 13:35:47 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 2358B5E3; Wed, 23 Oct 2013 13:35:47 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 112C82F8B; Wed, 23 Oct 2013 13:35:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9NDZkZu089177; Wed, 23 Oct 2013 13:35:46 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9NDZk6K089176; Wed, 23 Oct 2013 13:35:46 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310231335.r9NDZk6K089176@svn.freebsd.org> From: Aleksandr Rybalko Date: Wed, 23 Oct 2013 13:35:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256964 - user/ed/newcons/sys/dev/vt X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 13:35:47 -0000 Author: ray Date: Wed Oct 23 13:35:46 2013 New Revision: 256964 URL: http://svnweb.freebsd.org/changeset/base/256964 Log: Add new vt_buf flag VBF_HISTORY_FULL - whole history filled. Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/dev/vt/vt.h Modified: user/ed/newcons/sys/dev/vt/vt.h ============================================================================== --- user/ed/newcons/sys/dev/vt/vt.h Wed Oct 23 13:32:52 2013 (r256963) +++ user/ed/newcons/sys/dev/vt/vt.h Wed Oct 23 13:35:46 2013 (r256964) @@ -120,6 +120,7 @@ struct vt_buf { #define VBF_STATIC 0x2 /* Buffer is statically allocated. */ #define VBF_MTX_INIT 0x4 /* Mutex initialized. */ #define VBF_SCROLL 0x8 /* scroll locked mode. */ +#define VBF_HISTORY_FULL 0x10 /* All rows filled. */ int vb_history_size; #define VBF_DEFAULT_HISTORY_SIZE 200 int vb_roffset; /* (b) History rows offset. */ From owner-svn-src-user@FreeBSD.ORG Wed Oct 23 13:40:55 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7A4578FE; Wed, 23 Oct 2013 13:40:55 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 656712073; Wed, 23 Oct 2013 13:40:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9NDetSS091858; Wed, 23 Oct 2013 13:40:55 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9NDeq6J091840; Wed, 23 Oct 2013 13:40:52 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310231340.r9NDeq6J091840@svn.freebsd.org> From: Aleksandr Rybalko Date: Wed, 23 Oct 2013 13:40:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256965 - in user/ed/newcons/sys: arm/broadcom/bcm2835 arm/conf boot/fdt/dts cam cam/ata cam/scsi cddl/contrib/opensolaris/uts/common/fs/zfs cddl/contrib/opensolaris/uts/common/fs/zfs/s... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 13:40:55 -0000 Author: ray Date: Wed Oct 23 13:40:52 2013 New Revision: 256965 URL: http://svnweb.freebsd.org/changeset/base/256965 Log: MFC @r256964. Added: user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_bsc.c - copied unchanged from r256964, head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_bscreg.h - copied unchanged from r256964, head/sys/arm/broadcom/bcm2835/bcm2835_bscreg.h user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h - copied unchanged from r256964, head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h Modified: user/ed/newcons/sys/arm/broadcom/bcm2835/files.bcm2835 user/ed/newcons/sys/arm/conf/RPI-B user/ed/newcons/sys/boot/fdt/dts/bcm2835.dtsi user/ed/newcons/sys/cam/ata/ata_da.c user/ed/newcons/sys/cam/cam_xpt.c user/ed/newcons/sys/cam/scsi/scsi_all.h user/ed/newcons/sys/cam/scsi/scsi_da.c user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c user/ed/newcons/sys/conf/files user/ed/newcons/sys/dev/usb/wlan/if_run.c user/ed/newcons/sys/geom/geom.h user/ed/newcons/sys/geom/geom_disk.c user/ed/newcons/sys/geom/geom_disk.h user/ed/newcons/sys/geom/geom_subr.c user/ed/newcons/sys/mips/include/pte.h user/ed/newcons/sys/netinet/in.h user/ed/newcons/sys/sys/ata.h user/ed/newcons/sys/sys/time.h Directory Properties: user/ed/newcons/ (props changed) user/ed/newcons/sys/ (props changed) user/ed/newcons/sys/boot/ (props changed) user/ed/newcons/sys/cddl/contrib/opensolaris/ (props changed) user/ed/newcons/sys/conf/ (props changed) Copied: user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_bsc.c (from r256964, head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Wed Oct 23 13:40:52 2013 (r256965, copy of r256964, head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c) @@ -0,0 +1,485 @@ +/*- + * Copyright (c) 2001 Tsubai Masanari. + * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2013 Luiz Otavio O Souza + * 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 +#include + +#include +#include +#include + +#include "iicbus_if.h" + +static void bcm_bsc_intr(void *); + +static void +bcm_bsc_modifyreg(struct bcm_bsc_softc *sc, uint32_t off, uint32_t mask, + uint32_t value) +{ + uint32_t reg; + + mtx_assert(&sc->sc_mtx, MA_OWNED); + reg = BCM_BSC_READ(sc, off); + reg &= ~mask; + reg |= value; + BCM_BSC_WRITE(sc, off, reg); +} + +static int +bcm_bsc_clock_proc(SYSCTL_HANDLER_ARGS) +{ + struct bcm_bsc_softc *sc; + uint32_t clk; + int error; + + sc = (struct bcm_bsc_softc *)arg1; + + BCM_BSC_LOCK(sc); + clk = BCM_BSC_READ(sc, BCM_BSC_CLOCK); + BCM_BSC_UNLOCK(sc); + clk &= 0xffff; + if (clk == 0) + clk = 32768; + clk = BCM_BSC_CORE_CLK / clk; + error = sysctl_handle_int(oidp, &clk, sizeof(clk), req); + if (error != 0 || req->newptr == NULL) + return (error); + + clk = BCM_BSC_CORE_CLK / clk; + if (clk % 2) + clk--; + if (clk > 0xffff) + clk = 0xffff; + BCM_BSC_LOCK(sc); + BCM_BSC_WRITE(sc, BCM_BSC_CLOCK, clk); + BCM_BSC_UNLOCK(sc); + + return (0); +} + +static int +bcm_bsc_clkt_proc(SYSCTL_HANDLER_ARGS) +{ + struct bcm_bsc_softc *sc; + uint32_t clkt; + int error; + + sc = (struct bcm_bsc_softc *)arg1; + + BCM_BSC_LOCK(sc); + clkt = BCM_BSC_READ(sc, BCM_BSC_CLKT); + BCM_BSC_UNLOCK(sc); + clkt &= 0xffff; + error = sysctl_handle_int(oidp, &clkt, sizeof(clkt), req); + if (error != 0 || req->newptr == NULL) + return (error); + + BCM_BSC_LOCK(sc); + BCM_BSC_WRITE(sc, BCM_BSC_CLKT, clkt & 0xffff); + BCM_BSC_UNLOCK(sc); + + return (0); +} + +static int +bcm_bsc_fall_proc(SYSCTL_HANDLER_ARGS) +{ + struct bcm_bsc_softc *sc; + uint32_t clk, reg; + int error; + + sc = (struct bcm_bsc_softc *)arg1; + + BCM_BSC_LOCK(sc); + reg = BCM_BSC_READ(sc, BCM_BSC_DELAY); + BCM_BSC_UNLOCK(sc); + reg >>= 16; + error = sysctl_handle_int(oidp, ®, sizeof(reg), req); + if (error != 0 || req->newptr == NULL) + return (error); + + BCM_BSC_LOCK(sc); + clk = BCM_BSC_READ(sc, BCM_BSC_CLOCK); + clk = BCM_BSC_CORE_CLK / clk; + if (reg > clk / 2) + reg = clk / 2 - 1; + bcm_bsc_modifyreg(sc, BCM_BSC_DELAY, 0xffff0000, reg << 16); + BCM_BSC_UNLOCK(sc); + + return (0); +} + +static int +bcm_bsc_rise_proc(SYSCTL_HANDLER_ARGS) +{ + struct bcm_bsc_softc *sc; + uint32_t clk, reg; + int error; + + sc = (struct bcm_bsc_softc *)arg1; + + BCM_BSC_LOCK(sc); + reg = BCM_BSC_READ(sc, BCM_BSC_DELAY); + BCM_BSC_UNLOCK(sc); + reg &= 0xffff; + error = sysctl_handle_int(oidp, ®, sizeof(reg), req); + if (error != 0 || req->newptr == NULL) + return (error); + + BCM_BSC_LOCK(sc); + clk = BCM_BSC_READ(sc, BCM_BSC_CLOCK); + clk = BCM_BSC_CORE_CLK / clk; + if (reg > clk / 2) + reg = clk / 2 - 1; + bcm_bsc_modifyreg(sc, BCM_BSC_DELAY, 0xffff, reg); + BCM_BSC_UNLOCK(sc); + + return (0); +} + +static void +bcm_bsc_sysctl_init(struct bcm_bsc_softc *sc) +{ + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree_node; + struct sysctl_oid_list *tree; + + /* + * Add system sysctl tree/handlers. + */ + ctx = device_get_sysctl_ctx(sc->sc_dev); + tree_node = device_get_sysctl_tree(sc->sc_dev); + tree = SYSCTL_CHILDREN(tree_node); + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "clock", + CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc), + bcm_bsc_clock_proc, "IU", "I2C BUS clock frequency"); + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "clock_stretch", + CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc), + bcm_bsc_clkt_proc, "IU", "I2C BUS clock stretch timeout"); + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "fall_edge_delay", + CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc), + bcm_bsc_fall_proc, "IU", "I2C BUS falling edge delay"); + SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "rise_edge_delay", + CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc), + bcm_bsc_rise_proc, "IU", "I2C BUS rising edge delay"); +} + +static void +bcm_bsc_reset(struct bcm_bsc_softc *sc) +{ + + /* Clear pending interrupts. */ + BCM_BSC_WRITE(sc, BCM_BSC_STATUS, BCM_BSC_STATUS_CLKT | + BCM_BSC_STATUS_ERR | BCM_BSC_STATUS_DONE); + /* Clear the FIFO. */ + bcm_bsc_modifyreg(sc, BCM_BSC_CTRL, BCM_BSC_CTRL_CLEAR0, + BCM_BSC_CTRL_CLEAR0); +} + +static int +bcm_bsc_probe(device_t dev) +{ + + if (!ofw_bus_is_compatible(dev, "broadcom,bcm2835-bsc")) + return (ENXIO); + + device_set_desc(dev, "BCM2708/2835 BSC controller"); + + return (BUS_PROBE_DEFAULT); +} + +static int +bcm_bsc_attach(device_t dev) +{ + struct bcm_bsc_softc *sc; + device_t gpio; + int rid; + + if (device_get_unit(dev) > 1) { + device_printf(dev, "only bsc0 and bsc1 are supported\n"); + return (ENXIO); + } + + sc = device_get_softc(dev); + sc->sc_dev = dev; + + /* + * Configure the GPIO pins to ALT0 function to enable BSC control + * over the pins. + */ + gpio = devclass_get_device(devclass_find("gpio"), 0); + if (!gpio) { + device_printf(dev, "cannot find gpio0\n"); + return (ENXIO); + } + bcm_gpio_set_alternate(gpio, bcm_bsc_pins[device_get_unit(dev)].sda, + BCM_GPIO_ALT0); + bcm_gpio_set_alternate(gpio, bcm_bsc_pins[device_get_unit(dev)].scl, + BCM_GPIO_ALT0); + + rid = 0; + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->sc_mem_res) { + device_printf(dev, "cannot allocate memory window\n"); + return (ENXIO); + } + + sc->sc_bst = rman_get_bustag(sc->sc_mem_res); + sc->sc_bsh = rman_get_bushandle(sc->sc_mem_res); + + rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE | RF_SHAREABLE); + if (!sc->sc_irq_res) { + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + device_printf(dev, "cannot allocate interrupt\n"); + return (ENXIO); + } + + /* Hook up our interrupt handler. */ + if (bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE, + NULL, bcm_bsc_intr, sc, &sc->sc_intrhand)) { + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + device_printf(dev, "cannot setup the interrupt handler\n"); + return (ENXIO); + } + + mtx_init(&sc->sc_mtx, "bcm_bsc", NULL, MTX_DEF); + + bcm_bsc_sysctl_init(sc); + + /* Enable the BSC controller. Flush the FIFO. */ + BCM_BSC_LOCK(sc); + BCM_BSC_WRITE(sc, BCM_BSC_CTRL, BCM_BSC_CTRL_I2CEN); + bcm_bsc_reset(sc); + BCM_BSC_UNLOCK(sc); + + device_add_child(dev, "iicbus", -1); + + return (bus_generic_attach(dev)); +} + +static int +bcm_bsc_detach(device_t dev) +{ + struct bcm_bsc_softc *sc; + + bus_generic_detach(dev); + + sc = device_get_softc(dev); + mtx_destroy(&sc->sc_mtx); + if (sc->sc_intrhand) + bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intrhand); + if (sc->sc_irq_res) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); + if (sc->sc_mem_res) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + + return (0); +} + +static void +bcm_bsc_intr(void *arg) +{ + struct bcm_bsc_softc *sc; + uint32_t status; + + sc = (struct bcm_bsc_softc *)arg; + + BCM_BSC_LOCK(sc); + + /* The I2C interrupt is shared among all the BSC controllers. */ + if ((sc->sc_flags & BCM_I2C_BUSY) == 0) { + BCM_BSC_UNLOCK(sc); + return; + } + + status = BCM_BSC_READ(sc, BCM_BSC_STATUS); + + /* Check for errors. */ + if (status & (BCM_BSC_STATUS_CLKT | BCM_BSC_STATUS_ERR)) { + /* Disable interrupts. */ + BCM_BSC_WRITE(sc, BCM_BSC_CTRL, BCM_BSC_CTRL_I2CEN); + sc->sc_flags |= BCM_I2C_ERROR; + bcm_bsc_reset(sc); + wakeup(sc->sc_dev); + BCM_BSC_UNLOCK(sc); + return; + } + + if (sc->sc_flags & BCM_I2C_READ) { + while (sc->sc_resid > 0 && (status & BCM_BSC_STATUS_RXD)) { + *sc->sc_data++ = BCM_BSC_READ(sc, BCM_BSC_DATA); + sc->sc_resid--; + status = BCM_BSC_READ(sc, BCM_BSC_STATUS); + } + } else { + while (sc->sc_resid > 0 && (status & BCM_BSC_STATUS_TXD)) { + BCM_BSC_WRITE(sc, BCM_BSC_DATA, *sc->sc_data++); + sc->sc_resid--; + status = BCM_BSC_READ(sc, BCM_BSC_STATUS); + } + } + + if (status & BCM_BSC_STATUS_DONE) { + /* Disable interrupts. */ + BCM_BSC_WRITE(sc, BCM_BSC_CTRL, BCM_BSC_CTRL_I2CEN); + bcm_bsc_reset(sc); + wakeup(sc->sc_dev); + } + + BCM_BSC_UNLOCK(sc); +} + +static int +bcm_bsc_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) +{ + struct bcm_bsc_softc *sc; + uint32_t intr, read, status; + int i, err; + + sc = device_get_softc(dev); + BCM_BSC_LOCK(sc); + + /* If the controller is busy wait until it is available. */ + while (sc->sc_flags & BCM_I2C_BUSY) + mtx_sleep(dev, &sc->sc_mtx, 0, "bcm_bsc", 0); + + /* Now we have control over the BSC controller. */ + sc->sc_flags = BCM_I2C_BUSY; + + /* Clear the FIFO and the pending interrupts. */ + bcm_bsc_reset(sc); + + err = 0; + for (i = 0; i < nmsgs; i++) { + + /* Write the slave address. */ + BCM_BSC_WRITE(sc, BCM_BSC_SLAVE, (msgs[i].slave >> 1) & 0x7f); + + /* Write the data length. */ + BCM_BSC_WRITE(sc, BCM_BSC_DLEN, msgs[i].len); + + sc->sc_data = msgs[i].buf; + sc->sc_resid = msgs[i].len; + if ((msgs[i].flags & IIC_M_RD) == 0) { + /* Fill up the TX FIFO. */ + status = BCM_BSC_READ(sc, BCM_BSC_STATUS); + while (sc->sc_resid > 0 && + (status & BCM_BSC_STATUS_TXD)) { + BCM_BSC_WRITE(sc, BCM_BSC_DATA, *sc->sc_data); + sc->sc_data++; + sc->sc_resid--; + status = BCM_BSC_READ(sc, BCM_BSC_STATUS); + } + read = 0; + intr = BCM_BSC_CTRL_INTT; + sc->sc_flags &= ~BCM_I2C_READ; + } else { + sc->sc_flags |= BCM_I2C_READ; + read = BCM_BSC_CTRL_READ; + intr = BCM_BSC_CTRL_INTR; + } + intr |= BCM_BSC_CTRL_INTD; + + /* Start the transfer. */ + BCM_BSC_WRITE(sc, BCM_BSC_CTRL, BCM_BSC_CTRL_I2CEN | + BCM_BSC_CTRL_ST | read | intr); + + /* Wait for the transaction to complete. */ + err = mtx_sleep(dev, &sc->sc_mtx, 0, "bcm_bsc", hz); + + /* Check if we have a timeout or an I2C error. */ + if ((sc->sc_flags & BCM_I2C_ERROR) || err == EWOULDBLOCK) { + device_printf(sc->sc_dev, "I2C error\n"); + err = EIO; + break; + } + } + + /* Clean the controller flags. */ + sc->sc_flags = 0; + + BCM_BSC_UNLOCK(sc); + + return (err); +} + +static phandle_t +bcm_bsc_get_node(device_t bus, device_t dev) +{ + + /* We only have one child, the I2C bus, which needs our own node. */ + return (ofw_bus_get_node(bus)); +} + +static device_method_t bcm_bsc_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, bcm_bsc_probe), + DEVMETHOD(device_attach, bcm_bsc_attach), + DEVMETHOD(device_detach, bcm_bsc_detach), + + /* iicbus interface */ + DEVMETHOD(iicbus_callback, iicbus_null_callback), + DEVMETHOD(iicbus_transfer, bcm_bsc_transfer), + + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_node, bcm_bsc_get_node), + + DEVMETHOD_END +}; + +static devclass_t bcm_bsc_devclass; + +static driver_t bcm_bsc_driver = { + "iichb", + bcm_bsc_methods, + sizeof(struct bcm_bsc_softc), +}; + +DRIVER_MODULE(iicbus, bcm2835_bsc, iicbus_driver, iicbus_devclass, 0, 0); +DRIVER_MODULE(bcm2835_bsc, simplebus, bcm_bsc_driver, bcm_bsc_devclass, 0, 0); Copied: user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_bscreg.h (from r256964, head/sys/arm/broadcom/bcm2835/bcm2835_bscreg.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_bscreg.h Wed Oct 23 13:40:52 2013 (r256965, copy of r256964, head/sys/arm/broadcom/bcm2835/bcm2835_bscreg.h) @@ -0,0 +1,61 @@ +/*- + * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2013 Luiz Otavio O Souza + * 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 _BCM2835_BSCREG_H_ +#define _BCM2835_BSCREG_H_ + +#define BCM_BSC_CORE_CLK 150000000U +#define BCM_BSC_CTRL 0x00 +#define BCM_BSC_CTRL_I2CEN (1 << 15) +#define BCM_BSC_CTRL_INTR (1 << 10) +#define BCM_BSC_CTRL_INTT (1 << 9) +#define BCM_BSC_CTRL_INTD (1 << 8) +#define BCM_BSC_CTRL_ST (1 << 7) +#define BCM_BSC_CTRL_CLEAR1 (1 << 5) +#define BCM_BSC_CTRL_CLEAR0 (1 << 4) +#define BCM_BSC_CTRL_READ (1 << 0) +#define BCM_BSC_STATUS 0x04 +#define BCM_BSC_STATUS_CLKT (1 << 9) +#define BCM_BSC_STATUS_ERR (1 << 8) +#define BCM_BSC_STATUS_RXF (1 << 7) +#define BCM_BSC_STATUS_TXE (1 << 6) +#define BCM_BSC_STATUS_RXD (1 << 5) +#define BCM_BSC_STATUS_TXD (1 << 4) +#define BCM_BSC_STATUS_RXR (1 << 3) +#define BCM_BSC_STATUS_TXW (1 << 2) +#define BCM_BSC_STATUS_DONE (1 << 1) +#define BCM_BSC_STATUS_TA (1 << 0) +#define BCM_BSC_DLEN 0x08 +#define BCM_BSC_SLAVE 0x0c +#define BCM_BSC_DATA 0x10 +#define BCM_BSC_CLOCK 0x14 +#define BCM_BSC_DELAY 0x18 +#define BCM_BSC_CLKT 0x1c + +#endif /* _BCM2835_BSCREG_H_ */ Copied: user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h (from r256964, head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h Wed Oct 23 13:40:52 2013 (r256965, copy of r256964, head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h) @@ -0,0 +1,68 @@ +/*- + * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2013 Luiz Otavio O Souza + * 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 _BCM2835_BSCVAR_H +#define _BCM2835_BSCVAR_H + +struct { + uint32_t sda; + uint32_t scl; +} bcm_bsc_pins[] = { + { 0, 1 }, /* BSC0 GPIO pins. */ + { 2, 3 } /* BSC1 GPIO pins. */ +}; + +struct bcm_bsc_softc { + device_t sc_dev; + struct mtx sc_mtx; + struct resource * sc_mem_res; + struct resource * sc_irq_res; + bus_space_tag_t sc_bst; + bus_space_handle_t sc_bsh; + uint16_t sc_resid; + uint8_t *sc_data; + uint8_t sc_flags; + void * sc_intrhand; +}; + +#define BCM_I2C_BUSY 0x01 +#define BCM_I2C_READ 0x02 +#define BCM_I2C_ERROR 0x04 + +#define BCM_BSC_WRITE(_sc, _off, _val) \ + bus_space_write_4(_sc->sc_bst, _sc->sc_bsh, _off, _val) +#define BCM_BSC_READ(_sc, _off) \ + bus_space_read_4(_sc->sc_bst, _sc->sc_bsh, _off) + +#define BCM_BSC_LOCK(_sc) \ + mtx_lock(&(_sc)->sc_mtx) +#define BCM_BSC_UNLOCK(_sc) \ + mtx_unlock(&(_sc)->sc_mtx) + +#endif /* _BCM2835_BSCVAR_H_ */ Modified: user/ed/newcons/sys/arm/broadcom/bcm2835/files.bcm2835 ============================================================================== --- user/ed/newcons/sys/arm/broadcom/bcm2835/files.bcm2835 Wed Oct 23 13:35:46 2013 (r256964) +++ user/ed/newcons/sys/arm/broadcom/bcm2835/files.bcm2835 Wed Oct 23 13:40:52 2013 (r256965) @@ -1,5 +1,6 @@ # $FreeBSD$ +arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc arm/broadcom/bcm2835/bcm2835_dma.c standard arm/broadcom/bcm2835/bcm2835_fb.c optional sc arm/broadcom/bcm2835/bcm2835_gpio.c optional gpio Modified: user/ed/newcons/sys/arm/conf/RPI-B ============================================================================== --- user/ed/newcons/sys/arm/conf/RPI-B Wed Oct 23 13:35:46 2013 (r256964) +++ user/ed/newcons/sys/arm/conf/RPI-B Wed Oct 23 13:40:52 2013 (r256965) @@ -79,6 +79,11 @@ device mmcsd device gpio device gpioled +# I2C +device iic +device iicbus +device bcm2835_bsc + options KDB options DDB #Enable the kernel debugger options INVARIANTS #Enable calls of extra sanity checking Modified: user/ed/newcons/sys/boot/fdt/dts/bcm2835.dtsi ============================================================================== --- user/ed/newcons/sys/boot/fdt/dts/bcm2835.dtsi Wed Oct 23 13:35:46 2013 (r256964) +++ user/ed/newcons/sys/boot/fdt/dts/bcm2835.dtsi Wed Oct 23 13:40:52 2013 (r256965) @@ -396,6 +396,22 @@ }; }; + bsc0 { + compatible = "broadcom,bcm2835-bsc", + "broadcom,bcm2708-bsc"; + reg = <0x205000 0x20>; + interrupts = <61>; + interrupt-parent = <&intc>; + }; + + bsc1 { + compatible = "broadcom,bcm2835-bsc", + "broadcom,bcm2708-bsc"; + reg = <0x804000 0x20>; + interrupts = <61>; + interrupt-parent = <&intc>; + }; + dma: dma { compatible = "broadcom,bcm2835-dma", "broadcom,bcm2708-dma"; Modified: user/ed/newcons/sys/cam/ata/ata_da.c ============================================================================== --- user/ed/newcons/sys/cam/ata/ata_da.c Wed Oct 23 13:35:46 2013 (r256964) +++ user/ed/newcons/sys/cam/ata/ata_da.c Wed Oct 23 13:40:52 2013 (r256965) @@ -1222,12 +1222,13 @@ adaregister(struct cam_periph *periph, v "kern.cam.ada.%d.write_cache", periph->unit_number); TUNABLE_INT_FETCH(announce_buf, &softc->write_cache); /* Disable queue sorting for non-rotational media by default. */ - if (cgd->ident_data.media_rotation_rate == 1) + if (cgd->ident_data.media_rotation_rate == ATA_RATE_NON_ROTATING) softc->sort_io_queue = 0; else softc->sort_io_queue = -1; adagetparams(periph, cgd); softc->disk = disk_alloc(); + softc->disk->d_rotation_rate = cgd->ident_data.media_rotation_rate; softc->disk->d_devstat = devstat_new_entry(periph->periph_name, periph->unit_number, softc->params.secsize, DEVSTAT_ALL_SUPPORTED, Modified: user/ed/newcons/sys/cam/cam_xpt.c ============================================================================== --- user/ed/newcons/sys/cam/cam_xpt.c Wed Oct 23 13:35:46 2013 (r256964) +++ user/ed/newcons/sys/cam/cam_xpt.c Wed Oct 23 13:40:52 2013 (r256965) @@ -5239,6 +5239,7 @@ xpt_done_process(struct ccb_hdr *ccb_h) } /* Call the peripheral driver's callback */ + ccb_h->pinfo.index = CAM_UNQUEUED_INDEX; (*ccb_h->cbfcnp)(ccb_h->path->periph, (union ccb *)ccb_h); if (mtx != NULL) mtx_unlock(mtx); @@ -5270,7 +5271,6 @@ xpt_done_td(void *arg) THREAD_NO_SLEEPING(); while ((ccb_h = STAILQ_FIRST(&doneq)) != NULL) { STAILQ_REMOVE_HEAD(&doneq, sim_links.stqe); - ccb_h->pinfo.index = CAM_UNQUEUED_INDEX; xpt_done_process(ccb_h); } THREAD_SLEEPING_OK(); Modified: user/ed/newcons/sys/cam/scsi/scsi_all.h ============================================================================== --- user/ed/newcons/sys/cam/scsi/scsi_all.h Wed Oct 23 13:35:46 2013 (r256964) +++ user/ed/newcons/sys/cam/scsi/scsi_all.h Wed Oct 23 13:40:52 2013 (r256965) @@ -1451,7 +1451,7 @@ struct scsi_vpd_block_characteristics u_int8_t page_length[2]; u_int8_t medium_rotation_rate[2]; #define SVPD_BDC_RATE_NOT_REPORTED 0x00 -#define SVPD_BDC_RATE_NONE_ROTATING 0x01 +#define SVPD_BDC_RATE_NON_ROTATING 0x01 u_int8_t reserved1; u_int8_t nominal_form_factor; #define SVPD_BDC_FORM_NOT_REPORTED 0x00 Modified: user/ed/newcons/sys/cam/scsi/scsi_da.c ============================================================================== --- user/ed/newcons/sys/cam/scsi/scsi_da.c Wed Oct 23 13:35:46 2013 (r256964) +++ user/ed/newcons/sys/cam/scsi/scsi_da.c Wed Oct 23 13:40:52 2013 (r256965) @@ -3377,9 +3377,18 @@ dadone(struct cam_periph *periph, union * Disable queue sorting for non-rotational media * by default. */ - if (scsi_2btoul(bdc->medium_rotation_rate) == - SVPD_BDC_RATE_NONE_ROTATING) + u_int old_rate = softc->disk->d_rotation_rate; + + softc->disk->d_rotation_rate = + scsi_2btoul(bdc->medium_rotation_rate); + if (softc->disk->d_rotation_rate == + SVPD_BDC_RATE_NON_ROTATING) { softc->sort_io_queue = 0; + } + if (softc->disk->d_rotation_rate != old_rate) { + disk_attr_changed(softc->disk, + "GEOM::rotation_rate", M_NOWAIT); + } } else { int error; error = daerror(done_ccb, CAM_RETRY_SELTO, @@ -3414,6 +3423,8 @@ dadone(struct cam_periph *periph, union ptr = (uint16_t *)ata_params; if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { + uint16_t old_rate; + for (i = 0; i < sizeof(*ata_params) / 2; i++) ptr[i] = le16toh(ptr[i]); if (ata_params->support_dsm & ATA_SUPPORT_DSM_TRIM) { @@ -3428,8 +3439,18 @@ dadone(struct cam_periph *periph, union * Disable queue sorting for non-rotational media * by default. */ - if (ata_params->media_rotation_rate == 1) + old_rate = softc->disk->d_rotation_rate; + softc->disk->d_rotation_rate = + ata_params->media_rotation_rate; + if (softc->disk->d_rotation_rate == + ATA_RATE_NON_ROTATING) { softc->sort_io_queue = 0; + } + + if (softc->disk->d_rotation_rate != old_rate) { + disk_attr_changed(softc->disk, + "GEOM::rotation_rate", M_NOWAIT); + } } else { int error; error = daerror(done_ccb, CAM_RETRY_SELTO, Modified: user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h ============================================================================== --- user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Wed Oct 23 13:35:46 2013 (r256964) +++ user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Wed Oct 23 13:40:52 2013 (r256965) @@ -120,6 +120,9 @@ extern void vdev_queue_init(vdev_t *vd); extern void vdev_queue_fini(vdev_t *vd); extern zio_t *vdev_queue_io(zio_t *zio); extern void vdev_queue_io_done(zio_t *zio); +extern int vdev_queue_length(vdev_t *vd); +extern uint64_t vdev_queue_lastoffset(vdev_t *vd); +extern void vdev_queue_register_lastoffset(vdev_t *vd, zio_t *zio); extern void vdev_config_dirty(vdev_t *vd); extern void vdev_config_clean(vdev_t *vd); Modified: user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h ============================================================================== --- user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Wed Oct 23 13:35:46 2013 (r256964) +++ user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h Wed Oct 23 13:40:52 2013 (r256965) @@ -106,6 +106,7 @@ struct vdev_queue { avl_tree_t vq_pending_tree; hrtime_t vq_io_complete_ts; kmutex_t vq_lock; + uint64_t vq_lastoffset; }; /* @@ -217,7 +218,10 @@ struct vdev { spa_aux_vdev_t *vdev_aux; /* for l2cache vdevs */ zio_t *vdev_probe_zio; /* root of current probe */ vdev_aux_t vdev_label_aux; /* on-disk aux state */ - struct trim_map *vdev_trimmap; + struct trim_map *vdev_trimmap; /* map on outstanding trims */ + uint16_t vdev_rotation_rate; /* rotational rate of the media */ +#define VDEV_RATE_UNKNOWN 0 +#define VDEV_RATE_NON_ROTATING 1 /* * For DTrace to work in userland (libzpool) context, these fields must Modified: user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Oct 23 13:35:46 2013 (r256964) +++ user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Wed Oct 23 13:40:52 2013 (r256965) @@ -42,9 +42,11 @@ * Virtual device vector for GEOM. */ +static g_attrchanged_t vdev_geom_attrchanged; struct g_class zfs_vdev_class = { .name = "ZFS::VDEV", .version = G_VERSION, + .attrchanged = vdev_geom_attrchanged, }; DECLARE_GEOM_CLASS(zfs_vdev_class, zfs_vdev); @@ -62,6 +64,34 @@ SYSCTL_INT(_vfs_zfs_vdev, OID_AUTO, bio_ &vdev_geom_bio_delete_disable, 0, "Disable BIO_DELETE"); static void +vdev_geom_set_rotation_rate(vdev_t *vd, struct g_consumer *cp) +{ + int error; + uint16_t rate; + + error = g_getattr("GEOM::rotation_rate", cp, &rate); + if (error == 0) + vd->vdev_rotation_rate = rate; + else + vd->vdev_rotation_rate = VDEV_RATE_UNKNOWN; +} + +static void +vdev_geom_attrchanged(struct g_consumer *cp, const char *attr) +{ + vdev_t *vd; + + vd = cp->private; + if (vd == NULL) + return; + + if (strcmp(attr, "GEOM::rotation_rate") == 0) { + vdev_geom_set_rotation_rate(vd, cp); + return; + } +} + +static void vdev_geom_orphan(struct g_consumer *cp) { vdev_t *vd; @@ -683,6 +713,11 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi vd->vdev_physpath = kmem_alloc(bufsize, KM_SLEEP); snprintf(vd->vdev_physpath, bufsize, "/dev/%s", pp->name); + /* + * Determine the device's rotation rate. + */ + vdev_geom_set_rotation_rate(vd, cp); + return (0); } Modified: user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c ============================================================================== --- user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Wed Oct 23 13:35:46 2013 (r256964) +++ user/ed/newcons/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c Wed Oct 23 13:40:52 2013 (r256965) @@ -41,27 +41,97 @@ typedef struct mirror_child { vdev_t *mc_vd; uint64_t mc_offset; int mc_error; + int mc_load; uint8_t mc_tried; uint8_t mc_skipped; uint8_t mc_speculative; } mirror_child_t; typedef struct mirror_map { + int *mm_preferred; + int mm_preferred_cnt; int mm_children; - int mm_replacing; - int mm_preferred; - int mm_root; - mirror_child_t mm_child[1]; + boolean_t mm_replacing; + boolean_t mm_root; + mirror_child_t mm_child[]; } mirror_map_t; -int vdev_mirror_shift = 21; +static int vdev_mirror_shift = 21; + +SYSCTL_DECL(_vfs_zfs_vdev); +static SYSCTL_NODE(_vfs_zfs_vdev, OID_AUTO, mirror, CTLFLAG_RD, 0, + "ZFS VDEV Mirror"); + +/* + * The load configuration settings below are tuned by default for + * the case where all devices are of the same rotational type. + * + * If there is a mixture of rotating and non-rotating media, setting + * non_rotating_seek_inc to 0 may well provide better results as it + * will direct more reads to the non-rotating vdevs which are more + * likely to have a higher performance. + */ + +/* Rotating media load calculation configuration. */ +static int rotating_inc = 0; +TUNABLE_INT("vfs.zfs.vdev.mirror.rotating_inc", &rotating_inc); +SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_inc, CTLFLAG_RW, + &rotating_inc, 0, "Rotating media load increment for non-seeking I/O's"); + +static int rotating_seek_inc = 5; +TUNABLE_INT("vfs.zfs.vdev.mirror.rotating_seek_inc", &rotating_seek_inc); +SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_seek_inc, CTLFLAG_RW, + &rotating_seek_inc, 0, "Rotating media load increment for seeking I/O's"); + +static int rotating_seek_offset = 1 * 1024 * 1024; +TUNABLE_INT("vfs.zfs.vdev.mirror.rotating_seek_offset", &rotating_seek_offset); +SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, rotating_seek_offset, CTLFLAG_RW, + &rotating_seek_offset, 0, "Offset in bytes from the last I/O which " + "triggers a reduced rotating media seek increment"); + +/* Non-rotating media load calculation configuration. */ +static int non_rotating_inc = 0; +TUNABLE_INT("vfs.zfs.vdev.mirror.non_rotating_inc", &non_rotating_inc); +SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, non_rotating_inc, CTLFLAG_RW, + &non_rotating_inc, 0, + "Non-rotating media load increment for non-seeking I/O's"); + +static int non_rotating_seek_inc = 1; +TUNABLE_INT("vfs.zfs.vdev.mirror.non_rotating_seek_inc", + &non_rotating_seek_inc); +SYSCTL_INT(_vfs_zfs_vdev_mirror, OID_AUTO, non_rotating_seek_inc, CTLFLAG_RW, + &non_rotating_seek_inc, 0, + "Non-rotating media load increment for seeking I/O's"); + + +static inline size_t +vdev_mirror_map_size(int children) +{ + return (offsetof(mirror_map_t, mm_child[children]) + + sizeof(int) * children); +} + +static inline mirror_map_t * +vdev_mirror_map_alloc(int children, boolean_t replacing, boolean_t root) +{ + mirror_map_t *mm; + + mm = kmem_zalloc(vdev_mirror_map_size(children), KM_SLEEP); + mm->mm_children = children; + mm->mm_replacing = replacing; + mm->mm_root = root; + mm->mm_preferred = (int *)((uintptr_t)mm + + offsetof(mirror_map_t, mm_child[children])); + + return mm; +} static void vdev_mirror_map_free(zio_t *zio) { mirror_map_t *mm = zio->io_vsd; - kmem_free(mm, offsetof(mirror_map_t, mm_child[mm->mm_children])); + kmem_free(mm, vdev_mirror_map_size(mm->mm_children)); } static const zio_vsd_ops_t vdev_mirror_vsd_ops = { @@ -69,55 +139,80 @@ static const zio_vsd_ops_t vdev_mirror_v zio_vsd_default_cksum_report }; +static int +vdev_mirror_load(mirror_map_t *mm, vdev_t *vd, uint64_t zio_offset) +{ + uint64_t lastoffset; + int load; + + /* All DVAs have equal weight at the root. */ + if (mm->mm_root) + return (INT_MAX); + + /* + * We don't return INT_MAX if the device is resilvering i.e. + * vdev_resilver_txg != 0 as when tested performance was slightly + * worse overall when resilvering with compared to without. + */ + + /* Standard load based on pending queue length. */ + load = vdev_queue_length(vd); + lastoffset = vdev_queue_lastoffset(vd); + + if (vd->vdev_rotation_rate == VDEV_RATE_NON_ROTATING) { + /* Non-rotating media. */ + if (lastoffset == zio_offset) + return (load + non_rotating_inc); + + /* *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Wed Oct 23 14:15:47 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1227C6B0; Wed, 23 Oct 2013 14:15:47 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F3BBC223A; Wed, 23 Oct 2013 14:15:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9NEFkdP003268; Wed, 23 Oct 2013 14:15:46 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9NEFkXT003267; Wed, 23 Oct 2013 14:15:46 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310231415.r9NEFkXT003267@svn.freebsd.org> From: Aleksandr Rybalko Date: Wed, 23 Oct 2013 14:15:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256970 - user/ed/newcons/sys/dev/vt X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 14:15:47 -0000 Author: ray Date: Wed Oct 23 14:15:46 2013 New Revision: 256970 URL: http://svnweb.freebsd.org/changeset/base/256970 Log: Turn off confusing rotation of scroll history. Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/dev/vt/vt_buf.c Modified: user/ed/newcons/sys/dev/vt/vt_buf.c ============================================================================== --- user/ed/newcons/sys/dev/vt/vt_buf.c Wed Oct 23 14:06:41 2013 (r256969) +++ user/ed/newcons/sys/dev/vt/vt_buf.c Wed Oct 23 14:15:46 2013 (r256970) @@ -54,7 +54,7 @@ static MALLOC_DEFINE(M_VTBUF, "vtbuf", " int vthistory_seek(struct vt_buf *vb, int offset, int whence) { - int roffset; + int top, bottom, roffset; /* No scrolling if not enabled. */ if ((vb->vb_flags & VBF_SCROLL) == 0) { @@ -64,11 +64,15 @@ vthistory_seek(struct vt_buf *vb, int of } return (0); /* No changes */ } + top = (vb->vb_flags & VBF_HISTORY_FULL)? + (vb->vb_curroffset + vb->vb_scr_size.tp_row):vb->vb_history_size; + bottom = vb->vb_curroffset + vb->vb_history_size; + /* * Operate on copy of offset value, since it temporary can be bigger * than amount of rows in buffer. */ - roffset = vb->vb_roffset; + roffset = vb->vb_roffset + vb->vb_history_size; switch (whence) { case VHS_SET: roffset = offset; @@ -82,11 +86,10 @@ vthistory_seek(struct vt_buf *vb, int of break; } - if (roffset < 0) - roffset = 0; - if (roffset >= vb->vb_history_size) - /* Still have screen_height rows. */ - roffset %= VTBUF_MAX_HEIGHT(vb); + roffset = (roffset < top)?top:roffset; + roffset = (roffset > bottom)?bottom:roffset; + + roffset %= vb->vb_history_size; if (vb->vb_roffset != roffset) { vb->vb_roffset = roffset; From owner-svn-src-user@FreeBSD.ORG Wed Oct 23 15:06:50 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 45B2711E; Wed, 23 Oct 2013 15:06:50 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-ob0-x22e.google.com (mail-ob0-x22e.google.com [IPv6:2607:f8b0:4003:c01::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D26412666; Wed, 23 Oct 2013 15:06:49 +0000 (UTC) Received: by mail-ob0-f174.google.com with SMTP id vb8so906234obc.19 for ; Wed, 23 Oct 2013 08:06:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=xsVENsM1YmTWxe1n62RU0CViuzO1Ma8FT/C4zym+uSc=; b=RlkcNjZD1m7BX1osCd2a3gv85JfYQxVfKIi2oVNRBtYibJ9ckqOFQO2o0SD6PThOap hHShnVnOe3ZWrNEfQLvyAzte/1tskb/Zr+wCp6Ccu8qvejSdu7QUmtND+06jjzWyZwh8 sNIvAZVFL5Q2RETn28MHGkRqR2EtZBA5JGtvkbDySgNy6VSqAnqxBC7LVM/s5Kuo6swF ci2BxJosRE/SaAWCVSVFGzvSYD8beO2eBRhp5mqGNQQpXtrLd7z6UQfnqph40I+KfO4H wkX8DzohkJjI7TD5jxBa4ivFbz7RFgL514O1auTRtkaaqQr3kNySpFLjIg7CeQjJq1zU czPQ== MIME-Version: 1.0 X-Received: by 10.182.22.18 with SMTP id z18mr2049254obe.42.1382540809122; Wed, 23 Oct 2013 08:06:49 -0700 (PDT) Received: by 10.182.142.101 with HTTP; Wed, 23 Oct 2013 08:06:49 -0700 (PDT) In-Reply-To: <201310231415.r9NEFkXT003267@svn.freebsd.org> References: <201310231415.r9NEFkXT003267@svn.freebsd.org> Date: Wed, 23 Oct 2013 11:06:49 -0400 Message-ID: Subject: Re: svn commit: r256970 - user/ed/newcons/sys/dev/vt From: Benjamin Kaduk To: Aleksandr Rybalko Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: "src-committers@freebsd.org" , svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 15:06:50 -0000 On Wed, Oct 23, 2013 at 10:15 AM, Aleksandr Rybalko wrote: > Author: ray > Date: Wed Oct 23 14:15:46 2013 > New Revision: 256970 > URL: http://svnweb.freebsd.org/changeset/base/256970 > > Log: > Turn off confusing rotation of scroll history. > Thanks! I saw that in the quarterly status report and was thinking to myself, "gosh, a fully cyclic history buffer might get confusing", so it's good to hear that it's fixed. -Ben From owner-svn-src-user@FreeBSD.ORG Wed Oct 23 17:59:47 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 663274A1; Wed, 23 Oct 2013 17:59:47 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 52D24217C; Wed, 23 Oct 2013 17:59:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9NHxllW080027; Wed, 23 Oct 2013 17:59:47 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9NHxlT7080026; Wed, 23 Oct 2013 17:59:47 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201310231759.r9NHxlT7080026@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 23 Oct 2013 17:59:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r256997 - user/glebius/course/05.memory X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 17:59:47 -0000 Author: glebius Date: Wed Oct 23 17:59:46 2013 New Revision: 256997 URL: http://svnweb.freebsd.org/changeset/base/256997 Log: Typo. Modified: user/glebius/course/05.memory/lection.tex Modified: user/glebius/course/05.memory/lection.tex ============================================================================== --- user/glebius/course/05.memory/lection.tex Wed Oct 23 17:59:17 2013 (r256996) +++ user/glebius/course/05.memory/lection.tex Wed Oct 23 17:59:46 2013 (r256997) @@ -784,8 +784,8 @@ ITEM & SIZE & LIMIT & USED & FR \begin{tikzpicture}[node distance=5mm, font=\scriptsize] \node [name=keg, struct, rectangle split parts=4] { \textbf{struct uma\_keg} - \nodepart{two} LIST\_HEAD(,uma\_slab) uk\_part\_slab - \nodepart{three} LIST\_HEAD(,uma\_slab) uk\_free\_slab + \nodepart{two} LIST\_HEAD(,uma\_slab) uk\_free\_slab + \nodepart{three} LIST\_HEAD(,uma\_slab) uk\_part\_slab \nodepart{four} LIST\_HEAD(,uma\_slab) uk\_full\_slab }; From owner-svn-src-user@FreeBSD.ORG Wed Oct 23 19:45:15 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 42B7FD65; Wed, 23 Oct 2013 19:45:15 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 304FD2B3A; Wed, 23 Oct 2013 19:45:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9NJjFYY018903; Wed, 23 Oct 2013 19:45:15 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9NJjEhb018900; Wed, 23 Oct 2013 19:45:14 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310231945.r9NJjEhb018900@svn.freebsd.org> From: Aleksandr Rybalko Date: Wed, 23 Oct 2013 19:45:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257013 - in user/ed/newcons/sys: dev/fb dev/vt/hw/fb sys X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 19:45:15 -0000 Author: ray Date: Wed Oct 23 19:45:14 2013 New Revision: 257013 URL: http://svnweb.freebsd.org/changeset/base/257013 Log: Use copy method which maybe defined by framebuffer provider, but not just memmove. Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/dev/fb/fbd.c user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.c user/ed/newcons/sys/sys/fbio.h Modified: user/ed/newcons/sys/dev/fb/fbd.c ============================================================================== --- user/ed/newcons/sys/dev/fb/fbd.c Wed Oct 23 19:13:39 2013 (r257012) +++ user/ed/newcons/sys/dev/fb/fbd.c Wed Oct 23 19:45:14 2013 (r257013) @@ -154,6 +154,15 @@ vt_fb_mem_wr4(struct fb_info *sc, uint32 } static void +vt_fb_mem_copy(struct fb_info *sc, uint32_t offset_to, uint32_t offset_from, + uint32_t size) +{ + + memmove((void *)(sc->fb_vbase + offset_to), (void *)(sc->fb_vbase + + offset_from), size); +} + +static void vt_fb_indir_wr1(struct fb_info *sc, uint32_t o, uint8_t v) { @@ -177,6 +186,14 @@ vt_fb_indir_wr4(struct fb_info *sc, uint sc->fb_write(sc->fb_priv, o, &v, 4); } +static void +vt_fb_indir_copy(struct fb_info *sc, uint32_t offset_to, uint32_t offset_from, + uint32_t size) +{ + + sc->copy(sc->fb_priv, offset_to, offset_from, size); +} + static int fb_probe(struct fb_info *info) { @@ -192,12 +209,14 @@ fb_probe(struct fb_info *info) info->wr1 = &vt_fb_indir_wr1; info->wr2 = &vt_fb_indir_wr2; info->wr4 = &vt_fb_indir_wr4; + info->copy = &vt_fb_indir_copy; } else if (info->fb_vbase != 0) { if (info->fb_pbase == 0) info->fb_flags |= FB_FLAG_NOMMAP; info->wr1 = &vt_fb_mem_wr1; info->wr2 = &vt_fb_mem_wr2; info->wr4 = &vt_fb_mem_wr4; + info->copy = &vt_fb_mem_copy; } else return (ENXIO); Modified: user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.c ============================================================================== --- user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.c Wed Oct 23 19:13:39 2013 (r257012) +++ user/ed/newcons/sys/dev/vt/hw/fb/vt_fb.c Wed Oct 23 19:45:14 2013 (r257013) @@ -90,9 +90,8 @@ vt_fb_blank(struct vt_device *vd, term_c } /* Copy line0 to all other lines. */ /* XXX will copy with borders. */ - for (o = 1; o < info->fb_height; o++) { - memmove((void *)(info->fb_vbase + o * info->fb_stride), - (void *)info->fb_vbase, info->fb_stride); + for (o = info->fb_stride; o < info->fb_size; o += info->fb_stride) { + info->copy(info, o, 0, info->fb_stride); } } Modified: user/ed/newcons/sys/sys/fbio.h ============================================================================== --- user/ed/newcons/sys/sys/fbio.h Wed Oct 23 19:13:39 2013 (r257012) +++ user/ed/newcons/sys/sys/fbio.h Wed Oct 23 19:45:14 2013 (r257013) @@ -119,6 +119,8 @@ typedef int fb_write_t(void *priv, int o typedef int fb_read_t(void *priv, int offset, void *data, int size); /* XXX: should use priv instead of fb_info too. */ +typedef void fb_copy_t(struct fb_info *sc, uint32_t offset_to, uint32_t offset_from, + uint32_t size); typedef void fb_wr1_t(struct fb_info *sc, uint32_t offset, uint8_t value); typedef void fb_wr2_t(struct fb_info *sc, uint32_t offset, uint16_t value); typedef void fb_wr4_t(struct fb_info *sc, uint32_t offset, uint32_t value); @@ -139,6 +141,7 @@ struct fb_info { fb_wr1_t *wr1; fb_wr2_t *wr2; fb_wr4_t *wr4; + fb_copy_t *copy; fb_enter_t *enter; fb_leave_t *leave; From owner-svn-src-user@FreeBSD.ORG Wed Oct 23 19:47:05 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1F377E8A; Wed, 23 Oct 2013 19:47:05 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0B4A82B4F; Wed, 23 Oct 2013 19:47:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9NJl4vb019124; Wed, 23 Oct 2013 19:47:04 GMT (envelope-from hiren@svn.freebsd.org) Received: (from hiren@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9NJl30a019117; Wed, 23 Oct 2013 19:47:03 GMT (envelope-from hiren@svn.freebsd.org) Message-Id: <201310231947.r9NJl30a019117@svn.freebsd.org> From: Hiren Panchasara Date: Wed, 23 Oct 2013 19:47:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257014 - in user/glebius/course: . 01.intro 02.entering_kernel 03.processes&threads 04.synchronisation 05.memory X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 19:47:05 -0000 Author: hiren Date: Wed Oct 23 19:47:03 2013 New Revision: 257014 URL: http://svnweb.freebsd.org/changeset/base/257014 Log: Adding a top-level makefile which can generate a single pdf containing all the course lectures. Adding cleanall target to delete resulting .pdf files. Discussed with: glebius Added: user/glebius/course/Makefile Modified: user/glebius/course/01.intro/Makefile user/glebius/course/02.entering_kernel/Makefile user/glebius/course/03.processes&threads/Makefile user/glebius/course/04.synchronisation/Makefile user/glebius/course/05.memory/Makefile Modified: user/glebius/course/01.intro/Makefile ============================================================================== --- user/glebius/course/01.intro/Makefile Wed Oct 23 19:45:14 2013 (r257013) +++ user/glebius/course/01.intro/Makefile Wed Oct 23 19:47:03 2013 (r257014) @@ -11,3 +11,7 @@ TMP= $(NAME).aux $(NAME).log $(NAME).nav clean: rm -f -- $(TMP) texput.log + +cleanall: + make clean + rm -f $(NAME).pdf Modified: user/glebius/course/02.entering_kernel/Makefile ============================================================================== --- user/glebius/course/02.entering_kernel/Makefile Wed Oct 23 19:45:14 2013 (r257013) +++ user/glebius/course/02.entering_kernel/Makefile Wed Oct 23 19:47:03 2013 (r257014) @@ -11,3 +11,7 @@ TMP= $(NAME).aux $(NAME).log $(NAME).nav clean: rm -f -- $(TMP) texput.log + +cleanall: + make clean + rm -f $(NAME).pdf Modified: user/glebius/course/03.processes&threads/Makefile ============================================================================== --- user/glebius/course/03.processes&threads/Makefile Wed Oct 23 19:45:14 2013 (r257013) +++ user/glebius/course/03.processes&threads/Makefile Wed Oct 23 19:47:03 2013 (r257014) @@ -11,3 +11,7 @@ TMP= $(NAME).aux $(NAME).log $(NAME).nav clean: rm -f -- $(TMP) texput.log + +cleanall: + make clean + rm -f $(NAME).pdf Modified: user/glebius/course/04.synchronisation/Makefile ============================================================================== --- user/glebius/course/04.synchronisation/Makefile Wed Oct 23 19:45:14 2013 (r257013) +++ user/glebius/course/04.synchronisation/Makefile Wed Oct 23 19:47:03 2013 (r257014) @@ -11,3 +11,7 @@ TMP= $(NAME).aux $(NAME).log $(NAME).nav clean: rm -f -- $(TMP) texput.log + +cleanall: + make clean + rm -f $(NAME).pdf Modified: user/glebius/course/05.memory/Makefile ============================================================================== --- user/glebius/course/05.memory/Makefile Wed Oct 23 19:45:14 2013 (r257013) +++ user/glebius/course/05.memory/Makefile Wed Oct 23 19:47:03 2013 (r257014) @@ -11,3 +11,7 @@ TMP= $(NAME).aux $(NAME).log $(NAME).nav clean: rm -f -- $(TMP) texput.log + +cleanall: + make clean + rm -f $(NAME).pdf Added: user/glebius/course/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/glebius/course/Makefile Wed Oct 23 19:47:03 2013 (r257014) @@ -0,0 +1,35 @@ +ALL: build + +build: + @echo "Building individual chapters..." + cd 01.intro; make + cd 02.entering_kernel; make + cd 03.processes\&threads; make + cd 04.synchronisation; make + cd 05.memory; make + +course: + @echo "Creating combined pdf..." + pdfjoin 01.intro/lection.pdf \ + 02.entering_kernel/lection.pdf \ + 03.processes\&threads/lection.pdf \ + 04.synchronisation/lection.pdf \ + 05.memory/lection.pdf \ + -o course.pdf + +clean: + @echo "Cleanup temp files..." + cd 01.intro; make clean + cd 02.entering_kernel; make clean + cd 03.processes\&threads; make clean + cd 04.synchronisation; make clean + cd 05.memory; make clean + +cleanall: + @echo "Cleanup all files..." + cd 01.intro; make cleanall + cd 02.entering_kernel; make cleanall + cd 03.processes\&threads; make cleanall + cd 04.synchronisation; make cleanall + cd 05.memory; make cleanall + rm -f course.pdf From owner-svn-src-user@FreeBSD.ORG Wed Oct 23 22:49:33 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7BCD4C69; Wed, 23 Oct 2013 22:49:33 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6A2DF26C6; Wed, 23 Oct 2013 22:49:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9NMnX8w081991; Wed, 23 Oct 2013 22:49:33 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9NMnXW0081990; Wed, 23 Oct 2013 22:49:33 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310232249.r9NMnXW0081990@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 23 Oct 2013 22:49:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257019 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 22:49:33 -0000 Author: ae Date: Wed Oct 23 22:49:32 2013 New Revision: 257019 URL: http://svnweb.freebsd.org/changeset/base/257019 Log: Remove in6_clearscope() and in6_setscope() calls from nd6_ioctl(). Modified: user/ae/inet6/sys/netinet6/nd6.c Modified: user/ae/inet6/sys/netinet6/nd6.c ============================================================================== --- user/ae/inet6/sys/netinet6/nd6.c Wed Oct 23 21:42:53 2013 (r257018) +++ user/ae/inet6/sys/netinet6/nd6.c Wed Oct 23 22:49:32 2013 (r257019) @@ -1242,8 +1242,6 @@ nd6_ioctl(u_long cmd, caddr_t data, stru if (i >= DRLSTSIZ) break; drl->defrouter[i].rtaddr = dr->rtaddr; - in6_clearscope(&drl->defrouter[i].rtaddr); - drl->defrouter[i].flags = dr->flags; drl->defrouter[i].rtlifetime = dr->rtlifetime; drl->defrouter[i].expire = dr->expire + @@ -1300,10 +1298,8 @@ nd6_ioctl(u_long cmd, caddr_t data, stru j = 0; LIST_FOREACH(pfr, &pr->ndpr_advrtrs, pfr_entry) { if (j < DRLSTSIZ) { -#define RTRADDR oprl->prefix[i].advrtr[j] - RTRADDR = pfr->router->rtaddr; - in6_clearscope(&RTRADDR); -#undef RTRADDR + oprl->prefix[i].advrtr[j] = + pfr->router->rtaddr; } j++; } @@ -1495,13 +1491,9 @@ nd6_ioctl(u_long cmd, caddr_t data, stru case SIOCGNBRINFO_IN6: { struct llentry *ln; - struct in6_addr nb_addr = nbi->addr; /* make local for safety */ - - if ((error = in6_setscope(&nb_addr, ifp, NULL)) != 0) - return (error); IF_AFDATA_RLOCK(ifp); - ln = nd6_lookup(&nb_addr, 0, ifp); + ln = nd6_lookup(&nbi->addr, 0, ifp); IF_AFDATA_RUNLOCK(ifp); if (ln == NULL) { From owner-svn-src-user@FreeBSD.ORG Wed Oct 23 22:58:28 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9567927D; Wed, 23 Oct 2013 22:58:28 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 694392746; Wed, 23 Oct 2013 22:58:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9NMwSXg085328; Wed, 23 Oct 2013 22:58:28 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9NMwSl4085327; Wed, 23 Oct 2013 22:58:28 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310232258.r9NMwSl4085327@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 23 Oct 2013 22:58:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257020 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 22:58:28 -0000 Author: ae Date: Wed Oct 23 22:58:27 2013 New Revision: 257020 URL: http://svnweb.freebsd.org/changeset/base/257020 Log: Remove sa6_recoverscope(), use in6_getscopezone() instead. Modified: user/ae/inet6/sys/netinet6/nd6.c Modified: user/ae/inet6/sys/netinet6/nd6.c ============================================================================== --- user/ae/inet6/sys/netinet6/nd6.c Wed Oct 23 22:49:32 2013 (r257019) +++ user/ae/inet6/sys/netinet6/nd6.c Wed Oct 23 22:58:27 2013 (r257020) @@ -2283,9 +2283,8 @@ nd6_sysctl_drlist(SYSCTL_HANDLER_ARGS) */ TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) { d.rtaddr.sin6_addr = dr->rtaddr; - error = sa6_recoverscope(&d.rtaddr); - if (error != 0) - return (error); + d.rtaddr.sin6_scope_id = in6_getscopezone(dr->ifp, + in6_addrscope(&dr->rtaddr)); d.flags = dr->flags; d.rtlifetime = dr->rtlifetime; d.expire = dr->expire + (time_second - time_uptime); @@ -2306,7 +2305,6 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS) struct nd_pfxrouter *pfr; time_t maxexpire; int error; - char ip6buf[INET6_ADDRSTRLEN]; if (req->newptr) return (EPERM); @@ -2322,11 +2320,8 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS) */ LIST_FOREACH(pr, &V_nd_prefix, ndpr_entry) { p.prefix = pr->ndpr_prefix; - if (sa6_recoverscope(&p.prefix)) { - log(LOG_ERR, "scope error in prefix list (%s)\n", - ip6_sprintf(ip6buf, &p.prefix.sin6_addr)); - /* XXX: press on... */ - } + p.prefix.sin6_scope_id = in6_getscopezone(pr->ndpr_ifp, + in6_addrscope(&pr->ndpr_prefix.sin6_addr)); p.raflags = pr->ndpr_raf; p.prefixlen = pr->ndpr_plen; p.vltime = pr->ndpr_vltime; @@ -2355,10 +2350,8 @@ nd6_sysctl_prlist(SYSCTL_HANDLER_ARGS) return (error); LIST_FOREACH(pfr, &pr->ndpr_advrtrs, pfr_entry) { s6.sin6_addr = pfr->router->rtaddr; - if (sa6_recoverscope(&s6)) - log(LOG_ERR, - "scope error in prefix list (%s)\n", - ip6_sprintf(ip6buf, &pfr->router->rtaddr)); + s6.sin6_scope_id = in6_getscopezone(pfr->router->ifp, + in6_addrscope(&pfr->router->rtaddr)); error = SYSCTL_OUT(req, &s6, sizeof(s6)); if (error != 0) return (error); From owner-svn-src-user@FreeBSD.ORG Wed Oct 23 23:21:12 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 386807C7; Wed, 23 Oct 2013 23:21:12 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 25C19285E; Wed, 23 Oct 2013 23:21:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9NNLBnW094836; Wed, 23 Oct 2013 23:21:11 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9NNLBG0094834; Wed, 23 Oct 2013 23:21:11 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310232321.r9NNLBG0094834@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 23 Oct 2013 23:21:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257021 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 23:21:12 -0000 Author: ae Date: Wed Oct 23 23:21:11 2013 New Revision: 257021 URL: http://svnweb.freebsd.org/changeset/base/257021 Log: Add in6ifa_ifpwithdstaddr() function. It is IPv6 optimized version of ifa_ifpwithdstaddr(). Modified: user/ae/inet6/sys/netinet6/in6.c user/ae/inet6/sys/netinet6/in6_var.h Modified: user/ae/inet6/sys/netinet6/in6.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6.c Wed Oct 23 22:58:27 2013 (r257020) +++ user/ae/inet6/sys/netinet6/in6.c Wed Oct 23 23:21:11 2013 (r257021) @@ -1814,6 +1814,25 @@ in6ifa_ifpwithaddr(struct ifnet *ifp, co return ((struct in6_ifaddr *)ifa); } +struct in6_ifaddr * +in6ifa_ifpwithdstaddr(struct ifnet *ifp, const struct in6_addr *addr) +{ + struct ifaddr *ifa; + + IF_ADDR_RLOCK(ifp); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + if (ifa->ifa_addr->sa_family != AF_INET6 || + ifa->ifa_dstaddr == NULL) + continue; + if (IN6_ARE_ADDR_EQUAL(addr, IFA_DSTIN6(ifa))) { + ifa_ref(ifa); + break; + } + } + IF_ADDR_RUNLOCK(ifp); + return ((struct in6_ifaddr *)ifa); +} + /* * Find a link-local scoped address on ifp and return it if any. */ Modified: user/ae/inet6/sys/netinet6/in6_var.h ============================================================================== --- user/ae/inet6/sys/netinet6/in6_var.h Wed Oct 23 22:58:27 2013 (r257020) +++ user/ae/inet6/sys/netinet6/in6_var.h Wed Oct 23 23:21:11 2013 (r257021) @@ -814,6 +814,8 @@ void in6_setmaxmtu(void); int in6_if2idlen(struct ifnet *); struct in6_ifaddr *in6ifa_ifpforlinklocal(struct ifnet *, int); struct in6_ifaddr *in6ifa_ifpwithaddr(struct ifnet *, const struct in6_addr *); +struct in6_ifaddr *in6ifa_ifpwithdstaddr(struct ifnet *, + const struct in6_addr *); struct in6_ifaddr *in6ifa_ifwithaddr(const struct in6_addr *, uint32_t); struct in6_ifaddr *in6ifa_llaonifp(struct ifnet *); char *ip6_sprintf(char *, const struct in6_addr *); From owner-svn-src-user@FreeBSD.ORG Wed Oct 23 23:40:49 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id BDEECE23; Wed, 23 Oct 2013 23:40:49 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 91DD02947; Wed, 23 Oct 2013 23:40:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9NNenX6001395; Wed, 23 Oct 2013 23:40:49 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9NNene7001394; Wed, 23 Oct 2013 23:40:49 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310232340.r9NNene7001394@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 23 Oct 2013 23:40:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257022 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 23:40:49 -0000 Author: ae Date: Wed Oct 23 23:40:49 2013 New Revision: 257022 URL: http://svnweb.freebsd.org/changeset/base/257022 Log: Scope related cleanup in nd6_is_new_addr_neighbor(): * since we assume that addresses doesn't contains embedded zone ids, link-local addresses are always neighbors. So, remove sa6_recoverscope() and in6_setscope() calls; * use in6_localip() to check that address matches one of our addresses; * use in6ifa_ifpwithdstaddr() instead of ifa_ifwithdstaddr(). Modified: user/ae/inet6/sys/netinet6/nd6.c Modified: user/ae/inet6/sys/netinet6/nd6.c ============================================================================== --- user/ae/inet6/sys/netinet6/nd6.c Wed Oct 23 23:21:11 2013 (r257021) +++ user/ae/inet6/sys/netinet6/nd6.c Wed Oct 23 23:40:49 2013 (r257022) @@ -874,34 +874,20 @@ static int nd6_is_new_addr_neighbor(struct sockaddr_in6 *addr, struct ifnet *ifp) { struct nd_prefix *pr; - struct ifaddr *dstaddr; + struct in6_ifaddr *ia6; /* * A link-local address is always a neighbor. - * XXX: a link does not necessarily specify a single interface. */ - if (IN6_IS_ADDR_LINKLOCAL(&addr->sin6_addr)) { - struct sockaddr_in6 sin6_copy; - u_int32_t zone; - - /* - * We need sin6_copy since sa6_recoverscope() may modify the - * content (XXX). - */ - sin6_copy = *addr; - if (sa6_recoverscope(&sin6_copy)) - return (0); /* XXX: should be impossible */ - if (in6_setscope(&sin6_copy.sin6_addr, ifp, &zone)) - return (0); - if (sin6_copy.sin6_scope_id == zone) - return (1); - else - return (0); - } - + if (IN6_IS_ADDR_LINKLOCAL(&addr->sin6_addr)) + return (1); /* * If the address matches one of our addresses, * it should be a neighbor. + */ + if (in6_localip(&addr->sin6_addr)) + return (1); + /* * If the address matches one of our on-link prefixes, it should be a * neighbor. */ @@ -944,13 +930,10 @@ nd6_is_new_addr_neighbor(struct sockaddr * If the address is assigned on the node of the other side of * a p2p interface, the address should be a neighbor. */ - dstaddr = ifa_ifwithdstaddr((struct sockaddr *)addr); - if (dstaddr != NULL) { - if (dstaddr->ifa_ifp == ifp) { - ifa_free(dstaddr); - return (1); - } - ifa_free(dstaddr); + ia6 = in6ifa_ifpwithdstaddr(ifp, &addr->sin6_addr); + if (ia6 != NULL) { + ifa_free(&ia6->ia_ifa); + return (1); } /* From owner-svn-src-user@FreeBSD.ORG Wed Oct 23 23:51:41 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 428299D; Wed, 23 Oct 2013 23:51:41 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1F05629B2; Wed, 23 Oct 2013 23:51:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9NNpe7p004863; Wed, 23 Oct 2013 23:51:40 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9NNpeom004859; Wed, 23 Oct 2013 23:51:40 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310232351.r9NNpeom004859@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 23 Oct 2013 23:51:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257023 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2013 23:51:41 -0000 Author: ae Date: Wed Oct 23 23:51:39 2013 New Revision: 257023 URL: http://svnweb.freebsd.org/changeset/base/257023 Log: Change the type of the argument of the function nd6_is_addr_neighbor() from sockaddr_in6* to in6_addr*. Modified: user/ae/inet6/sys/netinet6/icmp6.c user/ae/inet6/sys/netinet6/nd6.c user/ae/inet6/sys/netinet6/nd6.h user/ae/inet6/sys/netinet6/nd6_nbr.c Modified: user/ae/inet6/sys/netinet6/icmp6.c ============================================================================== --- user/ae/inet6/sys/netinet6/icmp6.c Wed Oct 23 23:40:49 2013 (r257022) +++ user/ae/inet6/sys/netinet6/icmp6.c Wed Oct 23 23:51:39 2013 (r257023) @@ -2466,7 +2466,6 @@ icmp6_redirect_output(struct mbuf *m0, s struct llentry *ln = NULL; size_t maxlen; u_char *p; - struct sockaddr_in6 src_sa; icmp6_errcount(ND_REDIRECT, 0); @@ -2485,11 +2484,7 @@ icmp6_redirect_output(struct mbuf *m0, s * [RFC 2461, sec 8.2] */ sip6 = mtod(m0, struct ip6_hdr *); - bzero(&src_sa, sizeof(src_sa)); - src_sa.sin6_family = AF_INET6; - src_sa.sin6_len = sizeof(src_sa); - src_sa.sin6_addr = sip6->ip6_src; - if (nd6_is_addr_neighbor(&src_sa, ifp) == 0) + if (nd6_is_addr_neighbor(&sip6->ip6_src, ifp) == 0) goto fail; if (IN6_IS_ADDR_MULTICAST(&sip6->ip6_dst)) goto fail; /* what should we do here? */ Modified: user/ae/inet6/sys/netinet6/nd6.c ============================================================================== --- user/ae/inet6/sys/netinet6/nd6.c Wed Oct 23 23:40:49 2013 (r257022) +++ user/ae/inet6/sys/netinet6/nd6.c Wed Oct 23 23:51:39 2013 (r257023) @@ -125,8 +125,7 @@ VNET_DEFINE(int, nd6_recalc_reachtm_inte int (*send_sendso_input_hook)(struct mbuf *, struct ifnet *, int, int); -static int nd6_is_new_addr_neighbor(struct sockaddr_in6 *, - struct ifnet *); +static int nd6_is_new_addr_neighbor(struct in6_addr *, struct ifnet *); static void nd6_setmtu0(struct ifnet *, struct nd_ifinfo *); static void nd6_slowtimo(void *); static int regen_tmpaddr(struct in6_ifaddr *); @@ -871,7 +870,7 @@ nd6_lookup(struct in6_addr *addr6, int f * to not reenter the routing code from within itself. */ static int -nd6_is_new_addr_neighbor(struct sockaddr_in6 *addr, struct ifnet *ifp) +nd6_is_new_addr_neighbor(struct in6_addr *addr, struct ifnet *ifp) { struct nd_prefix *pr; struct in6_ifaddr *ia6; @@ -879,13 +878,13 @@ nd6_is_new_addr_neighbor(struct sockaddr /* * A link-local address is always a neighbor. */ - if (IN6_IS_ADDR_LINKLOCAL(&addr->sin6_addr)) + if (IN6_IS_ADDR_LINKLOCAL(addr)) return (1); /* * If the address matches one of our addresses, * it should be a neighbor. */ - if (in6_localip(&addr->sin6_addr)) + if (in6_localip(addr)) return (1); /* * If the address matches one of our on-link prefixes, it should be a @@ -922,7 +921,7 @@ nd6_is_new_addr_neighbor(struct sockaddr } if (IN6_ARE_MASKED_ADDR_EQUAL(&pr->ndpr_prefix.sin6_addr, - &addr->sin6_addr, &pr->ndpr_mask)) + addr, &pr->ndpr_mask)) return (1); } @@ -930,7 +929,7 @@ nd6_is_new_addr_neighbor(struct sockaddr * If the address is assigned on the node of the other side of * a p2p interface, the address should be a neighbor. */ - ia6 = in6ifa_ifpwithdstaddr(ifp, &addr->sin6_addr); + ia6 = in6ifa_ifpwithdstaddr(ifp, addr); if (ia6 != NULL) { ifa_free(&ia6->ia_ifa); return (1); @@ -955,7 +954,7 @@ nd6_is_new_addr_neighbor(struct sockaddr * XXX: should take care of the destination of a p2p link? */ int -nd6_is_addr_neighbor(struct sockaddr_in6 *addr, struct ifnet *ifp) +nd6_is_addr_neighbor(struct in6_addr *addr, struct ifnet *ifp) { struct llentry *lle; int rc = 0; @@ -969,7 +968,7 @@ nd6_is_addr_neighbor(struct sockaddr_in6 * in the neighbor cache. */ IF_AFDATA_RLOCK(ifp); - if ((lle = nd6_lookup(&addr->sin6_addr, 0, ifp)) != NULL) { + if ((lle = nd6_lookup(addr, 0, ifp)) != NULL) { LLE_RUNLOCK(lle); rc = 1; } @@ -1869,7 +1868,7 @@ nd6_output_lle(struct ifnet *ifp, struct IF_AFDATA_LOCK(ifp); ln = lla_lookup(LLTABLE6(ifp), flags, (struct sockaddr *)dst); IF_AFDATA_UNLOCK(ifp); - if ((ln == NULL) && nd6_is_addr_neighbor(dst, ifp)) { + if (ln == NULL &&nd6_is_addr_neighbor(&dst->sin6_addr, ifp)) { /* * Since nd6_is_addr_neighbor() internally calls nd6_lookup(), * the condition below is not very efficient. But we believe Modified: user/ae/inet6/sys/netinet6/nd6.h ============================================================================== --- user/ae/inet6/sys/netinet6/nd6.h Wed Oct 23 23:40:49 2013 (r257022) +++ user/ae/inet6/sys/netinet6/nd6.h Wed Oct 23 23:51:39 2013 (r257023) @@ -391,7 +391,7 @@ void nd6_destroy(void); #endif struct nd_ifinfo *nd6_ifattach(struct ifnet *); void nd6_ifdetach(struct nd_ifinfo *); -int nd6_is_addr_neighbor(struct sockaddr_in6 *, struct ifnet *); +int nd6_is_addr_neighbor(struct in6_addr *, struct ifnet *); void nd6_option_init(void *, int, union nd_opts *); struct nd_opt_hdr *nd6_option(union nd_opts *); int nd6_options(union nd_opts *); Modified: user/ae/inet6/sys/netinet6/nd6_nbr.c ============================================================================== --- user/ae/inet6/sys/netinet6/nd6_nbr.c Wed Oct 23 23:40:49 2013 (r257022) +++ user/ae/inet6/sys/netinet6/nd6_nbr.c Wed Oct 23 23:51:39 2013 (r257023) @@ -159,19 +159,13 @@ nd6_ns_input(struct mbuf *m, int off, in goto bad; } } else if (!V_nd6_onlink_ns_rfc4861) { - struct sockaddr_in6 src_sa6; - /* * According to recent IETF discussions, it is not a good idea * to accept a NS from an address which would not be deemed * to be a neighbor otherwise. This point is expected to be * clarified in future revisions of the specification. */ - bzero(&src_sa6, sizeof(src_sa6)); - src_sa6.sin6_family = AF_INET6; - src_sa6.sin6_len = sizeof(src_sa6); - src_sa6.sin6_addr = saddr6; - if (nd6_is_addr_neighbor(&src_sa6, ifp) == 0) { + if (nd6_is_addr_neighbor(&saddr6, ifp) == 0) { nd6log((LOG_INFO, "nd6_ns_input: " "NS packet from non-neighbor\n")); goto bad; From owner-svn-src-user@FreeBSD.ORG Thu Oct 24 00:00:24 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E94BA421; Thu, 24 Oct 2013 00:00:24 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BD7E52A1F; Thu, 24 Oct 2013 00:00:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9O00OM6007777; Thu, 24 Oct 2013 00:00:24 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9O00OYW007776; Thu, 24 Oct 2013 00:00:24 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310240000.r9O00OYW007776@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 24 Oct 2013 00:00:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257024 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 00:00:25 -0000 Author: ae Date: Thu Oct 24 00:00:24 2013 New Revision: 257024 URL: http://svnweb.freebsd.org/changeset/base/257024 Log: Scope related cleanup in nd6_ns_input(): * remove in6_setscope() calls; * don't do route lookup for link-local addresses. Modified: user/ae/inet6/sys/netinet6/nd6_nbr.c Modified: user/ae/inet6/sys/netinet6/nd6_nbr.c ============================================================================== --- user/ae/inet6/sys/netinet6/nd6_nbr.c Wed Oct 23 23:51:39 2013 (r257023) +++ user/ae/inet6/sys/netinet6/nd6_nbr.c Thu Oct 24 00:00:24 2013 (r257024) @@ -134,9 +134,6 @@ nd6_ns_input(struct mbuf *m, int off, in #endif ip6 = mtod(m, struct ip6_hdr *); /* adjust pointer for safety */ taddr6 = nd_ns->nd_ns_target; - if (in6_setscope(&taddr6, ifp, NULL) != 0) - goto bad; - if (ip6->ip6_hlim != 255) { nd6log((LOG_ERR, "nd6_ns_input: invalid hlim (%d) from %s to %s on %s\n", @@ -147,8 +144,7 @@ nd6_ns_input(struct mbuf *m, int off, in if (IN6_IS_ADDR_UNSPECIFIED(&saddr6)) { /* dst has to be a solicited node multicast address. */ - if (daddr6.s6_addr16[0] == IPV6_ADDR_INT16_MLL && - /* don't check ifindex portion */ + if (daddr6.s6_addr32[0] == IPV6_ADDR_INT32_MLL && daddr6.s6_addr32[1] == 0 && daddr6.s6_addr32[2] == IPV6_ADDR_INT32_ONE && daddr6.s6_addr8[12] == 0xff) { @@ -225,7 +221,7 @@ nd6_ns_input(struct mbuf *m, int off, in ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp, &taddr6); /* (2) check. */ - if (ifa == NULL) { + if (ifa == NULL && !IN6_IS_ADDR_LINKLOCAL(&taddr6)) { struct rtentry *rt; struct sockaddr_in6 tsin6; int need_proxy; @@ -335,12 +331,7 @@ nd6_ns_input(struct mbuf *m, int off, in * S bit ("solicited") must be zero. */ if (IN6_IS_ADDR_UNSPECIFIED(&saddr6)) { - struct in6_addr in6_all; - - in6_all = in6addr_linklocal_allnodes; - if (in6_setscope(&in6_all, ifp, NULL) != 0) - goto bad; - nd6_na_output_fib(ifp, &in6_all, &taddr6, + nd6_na_output_fib(ifp, &in6addr_linklocal_allnodes, &taddr6, ((anycast || proxy || !tlladdr) ? 0 : ND_NA_FLAG_OVERRIDE) | rflag, tlladdr, proxy ? (struct sockaddr *)&proxydl : NULL, M_GETFIB(m)); From owner-svn-src-user@FreeBSD.ORG Thu Oct 24 00:09:18 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 157295E7; Thu, 24 Oct 2013 00:09:18 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DD40E2A58; Thu, 24 Oct 2013 00:09:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9O09HCT010285; Thu, 24 Oct 2013 00:09:17 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9O09HSc010284; Thu, 24 Oct 2013 00:09:17 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310240009.r9O09HSc010284@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 24 Oct 2013 00:09:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257025 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 00:09:18 -0000 Author: ae Date: Thu Oct 24 00:09:17 2013 New Revision: 257025 URL: http://svnweb.freebsd.org/changeset/base/257025 Log: Scope related cleanup in nd6_ns_output(): * remove in6_setscope() and in6_clearscope calls; * initialize sin6_scope_id before in6_selectsrc(); * use IPV6_USEROIF flag for ip6_output(). * sort variables declarations. Modified: user/ae/inet6/sys/netinet6/nd6_nbr.c Modified: user/ae/inet6/sys/netinet6/nd6_nbr.c ============================================================================== --- user/ae/inet6/sys/netinet6/nd6_nbr.c Thu Oct 24 00:00:24 2013 (r257024) +++ user/ae/inet6/sys/netinet6/nd6_nbr.c Thu Oct 24 00:09:17 2013 (r257025) @@ -380,15 +380,15 @@ void nd6_ns_output(struct ifnet *ifp, const struct in6_addr *daddr6, const struct in6_addr *taddr6, struct llentry *ln, int dad) { + struct route_in6 ro; + struct ip6_moptions im6o; struct mbuf *m; struct m_tag *mtag; struct ip6_hdr *ip6; struct nd_neighbor_solicit *nd_ns; - struct ip6_moptions im6o; int icmp6len; - int maxlen; + int maxlen, flags; caddr_t mac; - struct route_in6 ro; if (IN6_IS_ADDR_MULTICAST(taddr6)) return; @@ -412,7 +412,6 @@ nd6_ns_output(struct ifnet *ifp, const s return; bzero(&ro, sizeof(ro)); - if (daddr6 == NULL || IN6_IS_ADDR_MULTICAST(daddr6)) { m->m_flags |= M_MCAST; im6o.im6o_multicast_ifp = ifp; @@ -435,14 +434,11 @@ nd6_ns_output(struct ifnet *ifp, const s if (daddr6) ip6->ip6_dst = *daddr6; else { - ip6->ip6_dst.s6_addr16[0] = IPV6_ADDR_INT16_MLL; - ip6->ip6_dst.s6_addr16[1] = 0; + ip6->ip6_dst.s6_addr32[0] = IPV6_ADDR_INT32_MLL; ip6->ip6_dst.s6_addr32[1] = 0; ip6->ip6_dst.s6_addr32[2] = IPV6_ADDR_INT32_ONE; ip6->ip6_dst.s6_addr32[3] = taddr6->s6_addr32[3]; ip6->ip6_dst.s6_addr8[12] = 0xff; - if (in6_setscope(&ip6->ip6_dst, ifp, NULL) != 0) - goto bad; } if (!dad) { struct ifaddr *ifa; @@ -497,6 +493,8 @@ nd6_ns_output(struct ifnet *ifp, const s dst_sa.sin6_family = AF_INET6; dst_sa.sin6_len = sizeof(dst_sa); dst_sa.sin6_addr = ip6->ip6_dst; + dst_sa.sin6_scope_id = in6_getscopezone(ifp, + in6_addrscope(&ip6->ip6_dst)); oifp = ifp; error = in6_selectsrc(&dst_sa, NULL, @@ -527,7 +525,6 @@ nd6_ns_output(struct ifnet *ifp, const s nd_ns->nd_ns_code = 0; nd_ns->nd_ns_reserved = 0; nd_ns->nd_ns_target = *taddr6; - in6_clearscope(&nd_ns->nd_ns_target); /* XXX */ /* * Add source link-layer address option. @@ -570,7 +567,10 @@ nd6_ns_output(struct ifnet *ifp, const s m_tag_prepend(m, mtag); } - ip6_output(m, NULL, &ro, dad ? IPV6_UNSPECSRC : 0, &im6o, NULL, NULL); + flags = IPV6_USEROIF; + if (dad) + flags |= IPV6_UNSPECSRC; + ip6_output(m, NULL, &ro, flags, &im6o, &ifp, NULL); icmp6_ifstat_inc(ifp, ifs6_out_msg); icmp6_ifstat_inc(ifp, ifs6_out_neighborsolicit); ICMP6STAT_INC(icp6s_outhist[ND_NEIGHBOR_SOLICIT]); From owner-svn-src-user@FreeBSD.ORG Thu Oct 24 00:21:45 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 2862FA99; Thu, 24 Oct 2013 00:21:45 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id F181C2B2C; Thu, 24 Oct 2013 00:21:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9O0LirG016062; Thu, 24 Oct 2013 00:21:44 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9O0LiZs016061; Thu, 24 Oct 2013 00:21:44 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310240021.r9O0LiZs016061@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 24 Oct 2013 00:21:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257026 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 00:21:45 -0000 Author: ae Date: Thu Oct 24 00:21:44 2013 New Revision: 257026 URL: http://svnweb.freebsd.org/changeset/base/257026 Log: Scope related cleanup in nd6_na_output/nd6_na_input: * remove in6_setscope() and in6_clearscope() calls; * initialize sin6_scope_id before in6_selectsrc(); * no need to initialize ro.ro_dst, in6_selectsrc will do it; * use IPV6_USEROIF flags for ip6_output(). Modified: user/ae/inet6/sys/netinet6/nd6_nbr.c Modified: user/ae/inet6/sys/netinet6/nd6_nbr.c ============================================================================== --- user/ae/inet6/sys/netinet6/nd6_nbr.c Thu Oct 24 00:09:17 2013 (r257025) +++ user/ae/inet6/sys/netinet6/nd6_nbr.c Thu Oct 24 00:21:44 2013 (r257026) @@ -646,9 +646,6 @@ nd6_na_input(struct mbuf *m, int off, in is_override = ((flags & ND_NA_FLAG_OVERRIDE) != 0); taddr6 = nd_na->nd_na_target; - if (in6_setscope(&taddr6, ifp, NULL)) - goto bad; /* XXX: impossible */ - if (IN6_IS_ADDR_MULTICAST(&taddr6)) { nd6log((LOG_ERR, "nd6_na_input: invalid target address %s\n", @@ -1005,14 +1002,10 @@ nd6_na_output_fib(struct ifnet *ifp, con ip6->ip6_hlim = 255; if (IN6_IS_ADDR_UNSPECIFIED(&daddr6)) { /* reply to DAD */ - daddr6.s6_addr16[0] = IPV6_ADDR_INT16_MLL; - daddr6.s6_addr16[1] = 0; + daddr6.s6_addr32[0] = IPV6_ADDR_INT32_MLL; daddr6.s6_addr32[1] = 0; daddr6.s6_addr32[2] = 0; daddr6.s6_addr32[3] = IPV6_ADDR_INT32_ONE; - if (in6_setscope(&daddr6, ifp, NULL)) - goto bad; - flags &= ~ND_NA_FLAG_SOLICITED; } ip6->ip6_dst = daddr6; @@ -1020,11 +1013,10 @@ nd6_na_output_fib(struct ifnet *ifp, con dst_sa.sin6_family = AF_INET6; dst_sa.sin6_len = sizeof(struct sockaddr_in6); dst_sa.sin6_addr = daddr6; - + dst_sa.sin6_scope_id = in6_getscopezone(ifp, in6_addrscope(&daddr6)); /* * Select a source whose scope is the same as that of the dest. */ - bcopy(&dst_sa, &ro.ro_dst, sizeof(dst_sa)); oifp = ifp; error = in6_selectsrc(&dst_sa, NULL, NULL, &ro, NULL, &oifp, &src); if (error) { @@ -1039,8 +1031,6 @@ nd6_na_output_fib(struct ifnet *ifp, con nd_na->nd_na_type = ND_NEIGHBOR_ADVERT; nd_na->nd_na_code = 0; nd_na->nd_na_target = *taddr6; - in6_clearscope(&nd_na->nd_na_target); /* XXX */ - /* * "tlladdr" indicates NS's condition for adding tlladdr or not. * see nd6_ns_input() for details. @@ -1097,7 +1087,7 @@ nd6_na_output_fib(struct ifnet *ifp, con m_tag_prepend(m, mtag); } - ip6_output(m, NULL, &ro, 0, &im6o, NULL, NULL); + ip6_output(m, NULL, &ro, IPV6_USEROIF, &im6o, &ifp, NULL); icmp6_ifstat_inc(ifp, ifs6_out_msg); icmp6_ifstat_inc(ifp, ifs6_out_neighboradvert); ICMP6STAT_INC(icp6s_outhist[ND_NEIGHBOR_ADVERT]); From owner-svn-src-user@FreeBSD.ORG Thu Oct 24 00:28:52 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7CF18C5B; Thu, 24 Oct 2013 00:28:52 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6AC262B5F; Thu, 24 Oct 2013 00:28:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9O0SqeA016852; Thu, 24 Oct 2013 00:28:52 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9O0SqrY016851; Thu, 24 Oct 2013 00:28:52 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310240028.r9O0SqrY016851@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 24 Oct 2013 00:28:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257027 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 00:28:52 -0000 Author: ae Date: Thu Oct 24 00:28:51 2013 New Revision: 257027 URL: http://svnweb.freebsd.org/changeset/base/257027 Log: Remove sa6_embedscope(), use sa6_checkzone() instead. Remove in6_clearscope() calls. Modified: user/ae/inet6/sys/netinet6/ip6_output.c Modified: user/ae/inet6/sys/netinet6/ip6_output.c ============================================================================== --- user/ae/inet6/sys/netinet6/ip6_output.c Thu Oct 24 00:21:44 2013 (r257026) +++ user/ae/inet6/sys/netinet6/ip6_output.c Thu Oct 24 00:28:51 2013 (r257027) @@ -875,14 +875,6 @@ oif_found: mtu = IPV6_MMTU; } } - - /* - * clear embedded scope identifiers if necessary. - * in6_clearscope will touch the addresses only when necessary. - */ - in6_clearscope(&ip6->ip6_src); - in6_clearscope(&ip6->ip6_dst); - /* * If the outgoing packet contains a hop-by-hop options header, * it must be examined and processed even by the source node. @@ -2801,8 +2793,7 @@ ip6_setpktopt(int optname, u_char *buf, IN6_IS_ADDR_MULTICAST(&sa6->sin6_addr)) { return (EINVAL); } - if ((error = sa6_embedscope(sa6, V_ip6_use_defzone)) - != 0) { + if ((error = sa6_checkzone(sa6)) != 0) { return (error); } break; @@ -3027,7 +3018,6 @@ void ip6_mloopback(struct ifnet *ifp, struct mbuf *m, struct sockaddr_in6 *dst) { struct mbuf *copym; - struct ip6_hdr *ip6; copym = m_copy(m, 0, M_COPYALL); if (copym == NULL) @@ -3046,20 +3036,11 @@ ip6_mloopback(struct ifnet *ifp, struct } #ifdef DIAGNOSTIC - if (copym->m_len < sizeof(*ip6)) { + if (copym->m_len < sizeof(struct ip6_hdr)) { m_freem(copym); return; } #endif - - ip6 = mtod(copym, struct ip6_hdr *); - /* - * clear embedded scope identifiers if necessary. - * in6_clearscope will touch the addresses only when necessary. - */ - in6_clearscope(&ip6->ip6_src); - in6_clearscope(&ip6->ip6_dst); - (void)if_simloop(ifp, copym, dst->sin6_family, 0); } From owner-svn-src-user@FreeBSD.ORG Thu Oct 24 00:30:39 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3FF2FD7E; Thu, 24 Oct 2013 00:30:39 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2E0222B76; Thu, 24 Oct 2013 00:30:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9O0Ud59019200; Thu, 24 Oct 2013 00:30:39 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9O0UdqN019199; Thu, 24 Oct 2013 00:30:39 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310240030.r9O0UdqN019199@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 24 Oct 2013 00:30:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257028 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 00:30:39 -0000 Author: ae Date: Thu Oct 24 00:30:38 2013 New Revision: 257028 URL: http://svnweb.freebsd.org/changeset/base/257028 Log: Remove in6_clearscope() calls. Modified: user/ae/inet6/sys/netinet6/send.c Modified: user/ae/inet6/sys/netinet6/send.c ============================================================================== --- user/ae/inet6/sys/netinet6/send.c Thu Oct 24 00:28:51 2013 (r257027) +++ user/ae/inet6/sys/netinet6/send.c Thu Oct 24 00:30:38 2013 (r257028) @@ -259,7 +259,6 @@ send_close(struct socket *so) static int send_input(struct mbuf *m, struct ifnet *ifp, int direction, int msglen __unused) { - struct ip6_hdr *ip6; struct sockaddr_send sendsrc; SEND_LOCK(); @@ -268,15 +267,6 @@ send_input(struct mbuf *m, struct ifnet return (-1); } - /* - * Make sure to clear any possible internally embedded scope before - * passing the packet to user space for SeND cryptographic signature - * validation to succeed. - */ - ip6 = mtod(m, struct ip6_hdr *); - in6_clearscope(&ip6->ip6_src); - in6_clearscope(&ip6->ip6_dst); - bzero(&sendsrc, sizeof(sendsrc)); sendsrc.send_len = sizeof(sendsrc); sendsrc.send_family = AF_INET6; From owner-svn-src-user@FreeBSD.ORG Thu Oct 24 00:39:27 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 94D352AE; Thu, 24 Oct 2013 00:39:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 823E02C9C; Thu, 24 Oct 2013 00:39:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9O0dRSo020275; Thu, 24 Oct 2013 00:39:27 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9O0dRru020274; Thu, 24 Oct 2013 00:39:27 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310240039.r9O0dRru020274@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 24 Oct 2013 00:39:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257030 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 00:39:27 -0000 Author: ae Date: Thu Oct 24 00:39:27 2013 New Revision: 257030 URL: http://svnweb.freebsd.org/changeset/base/257030 Log: Scope related cleanup in rip6_output(): * remove sa6_embedscope() and in6_setscope() calls; * rip6_output() calls in6_selectsrc, so it always has outgoing interface and we can use IPV6_USEROIF when calling ip6_output. * add sa6_checkzone() to rip6_send. Application always must provide a proper scope zone id. Modified: user/ae/inet6/sys/netinet6/raw_ip6.c Modified: user/ae/inet6/sys/netinet6/raw_ip6.c ============================================================================== --- user/ae/inet6/sys/netinet6/raw_ip6.c Thu Oct 24 00:33:29 2013 (r257029) +++ user/ae/inet6/sys/netinet6/raw_ip6.c Thu Oct 24 00:39:27 2013 (r257030) @@ -389,13 +389,7 @@ rip6_ctlinput(int cmd, struct sockaddr * * may have setup with control call. */ int -#if __STDC__ rip6_output(struct mbuf *m, ...) -#else -rip6_output(m, va_alist) - struct mbuf *m; - va_dcl -#endif { struct mbuf *control; struct m_tag *mtag; @@ -409,8 +403,6 @@ rip6_output(m, va_alist) struct ip6_pktopts opt, *optp; struct ifnet *oifp = NULL; int type = 0, code = 0; /* for ICMPv6 output statistics only */ - int scope_ambiguous = 0; - int use_defzone = 0; struct in6_addr in6a; va_list ap; @@ -435,21 +427,6 @@ rip6_output(m, va_alist) optp = in6p->in6p_outputopts; /* - * Check and convert scope zone ID into internal form. - * - * XXX: we may still need to determine the zone later. - */ - if (!(so->so_state & SS_ISCONNECTED)) { - if (!optp || !optp->ip6po_pktinfo || - !optp->ip6po_pktinfo->ipi6_ifindex) - use_defzone = V_ip6_use_defzone; - if (dstsock->sin6_scope_id == 0 && !use_defzone) - scope_ambiguous = 1; - if ((error = sa6_embedscope(dstsock, use_defzone)) != 0) - goto bad; - } - - /* * For an ICMPv6 packet, we should know its type and code to update * statistics. */ @@ -483,20 +460,6 @@ rip6_output(m, va_alist) if (error != 0) goto bad; ip6->ip6_src = in6a; - - if (oifp && scope_ambiguous) { - /* - * Application should provide a proper zone ID or the use of - * default zone IDs should be enabled. Unfortunately, some - * applications do not behave as it should, so we need a - * workaround. Even if an appropriate ID is not determined - * (when it's required), if we can determine the outgoing - * interface. determine the zone ID based on the interface. - */ - error = in6_setscope(&dstsock->sin6_addr, oifp, NULL); - if (error != 0) - goto bad; - } ip6->ip6_dst = dstsock->sin6_addr; /* @@ -559,10 +522,10 @@ rip6_output(m, va_alist) } } - error = ip6_output(m, optp, NULL, 0, in6p->in6p_moptions, &oifp, in6p); + error = ip6_output(m, optp, NULL, IPV6_USEROIF, in6p->in6p_moptions, + &oifp, in6p); if (so->so_proto->pr_protocol == IPPROTO_ICMPV6) { - if (oifp) - icmp6_ifoutstat_inc(oifp, type, code); + icmp6_ifoutstat_inc(oifp, type, code); ICMP6STAT_INC(icp6s_outhist[type]); } else RIP6STAT_INC(rip6s_opackets); @@ -889,8 +852,9 @@ rip6_send(struct socket *so, int flags, tmp.sin6_family = AF_INET6; tmp.sin6_len = sizeof(struct sockaddr_in6); INP_RLOCK(inp); - bcopy(&inp->in6p_faddr, &tmp.sin6_addr, - sizeof(struct in6_addr)); + tmp.sin6_addr = inp->in6p_faddr; + if (IN6_IS_ADDR_LINKLOCAL(&tmp.sin6_addr)) + tmp.sin6_scope_id = inp->in6p_zoneid; INP_RUNLOCK(inp); dst = &tmp; } else { @@ -918,6 +882,15 @@ rip6_send(struct socket *so, int flags, m_freem(m); return(EAFNOSUPPORT); } + /* + * Application must provide a proper zone ID or the use of + * default zone IDs should be enabled. + */ + ret = sa6_checkzone(dst); + if (ret != 0) { + m_freem(m); + return (ret); + } } ret = rip6_output(m, so, dst, control); return (ret); From owner-svn-src-user@FreeBSD.ORG Thu Oct 24 00:48:31 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id CD8C9442; Thu, 24 Oct 2013 00:48:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 9FD432CF8; Thu, 24 Oct 2013 00:48:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9O0mVjg023370; Thu, 24 Oct 2013 00:48:31 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9O0mVN5023369; Thu, 24 Oct 2013 00:48:31 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310240048.r9O0mVN5023369@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 24 Oct 2013 00:48:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257031 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 00:48:31 -0000 Author: ae Date: Thu Oct 24 00:48:31 2013 New Revision: 257031 URL: http://svnweb.freebsd.org/changeset/base/257031 Log: Scope related cleanup in rip6_bind(): * remove sa6_embedscope() call, use sa6_checkzone() instead; * use in6ifa_ifwithaddr() to determine interface where address is configured. * initialize inp->in6p_zoneid. Modified: user/ae/inet6/sys/netinet6/raw_ip6.c Modified: user/ae/inet6/sys/netinet6/raw_ip6.c ============================================================================== --- user/ae/inet6/sys/netinet6/raw_ip6.c Thu Oct 24 00:39:27 2013 (r257030) +++ user/ae/inet6/sys/netinet6/raw_ip6.c Thu Oct 24 00:48:31 2013 (r257031) @@ -721,7 +721,7 @@ rip6_bind(struct socket *so, struct sock { struct inpcb *inp; struct sockaddr_in6 *addr = (struct sockaddr_in6 *)nam; - struct ifaddr *ifa = NULL; + struct in6_ifaddr *ifa = NULL; int error = 0; inp = sotoinpcb(so); @@ -733,24 +733,24 @@ rip6_bind(struct socket *so, struct sock return (error); if (TAILQ_EMPTY(&V_ifnet) || addr->sin6_family != AF_INET6) return (EADDRNOTAVAIL); - if ((error = sa6_embedscope(addr, V_ip6_use_defzone)) != 0) + if ((error = sa6_checkzone(addr)) != 0) return (error); - - if (!IN6_IS_ADDR_UNSPECIFIED(&addr->sin6_addr) && - (ifa = ifa_ifwithaddr((struct sockaddr *)addr)) == NULL) - return (EADDRNOTAVAIL); - if (ifa != NULL && - ((struct in6_ifaddr *)ifa)->ia6_flags & - (IN6_IFF_ANYCAST|IN6_IFF_NOTREADY| - IN6_IFF_DETACHED|IN6_IFF_DEPRECATED)) { - ifa_free(ifa); + if (!IN6_IS_ADDR_UNSPECIFIED(&addr->sin6_addr)) { + ifa = in6ifa_ifwithaddr(&addr->sin6_addr, addr->sin6_scope_id); + if (ifa == NULL) + return (EADDRNOTAVAIL); + } + if (ifa != NULL && ifa->ia6_flags & (IN6_IFF_ANYCAST | + IN6_IFF_NOTREADY | IN6_IFF_DETACHED | IN6_IFF_DEPRECATED)) { + ifa_free(&ifa->ia_ifa); return (EADDRNOTAVAIL); } if (ifa != NULL) - ifa_free(ifa); + ifa_free(&ifa->ia_ifa); INP_INFO_WLOCK(&V_ripcbinfo); INP_WLOCK(inp); inp->in6p_laddr = addr->sin6_addr; + inp->in6p_zoneid = addr->sin6_scope_id; INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_ripcbinfo); return (0); From owner-svn-src-user@FreeBSD.ORG Thu Oct 24 00:53:10 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 89F4A5C2; Thu, 24 Oct 2013 00:53:10 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5E5922D3B; Thu, 24 Oct 2013 00:53:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9O0rAlQ025952; Thu, 24 Oct 2013 00:53:10 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9O0rAqo025951; Thu, 24 Oct 2013 00:53:10 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310240053.r9O0rAqo025951@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 24 Oct 2013 00:53:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257032 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 00:53:10 -0000 Author: ae Date: Thu Oct 24 00:53:09 2013 New Revision: 257032 URL: http://svnweb.freebsd.org/changeset/base/257032 Log: Scope related cleanup in rip6_connect(): * remove sa6_embedscope() and in6_setscope() calls; * use sa6_checkzone() to check sin6_scope_id for correctness; * when laddr or faddr is from link-local scope, initialize in6p_zoneid. Modified: user/ae/inet6/sys/netinet6/raw_ip6.c Modified: user/ae/inet6/sys/netinet6/raw_ip6.c ============================================================================== --- user/ae/inet6/sys/netinet6/raw_ip6.c Thu Oct 24 00:48:31 2013 (r257031) +++ user/ae/inet6/sys/netinet6/raw_ip6.c Thu Oct 24 00:53:09 2013 (r257032) @@ -763,7 +763,7 @@ rip6_connect(struct socket *so, struct s struct sockaddr_in6 *addr = (struct sockaddr_in6 *)nam; struct in6_addr in6a; struct ifnet *ifp = NULL; - int error = 0, scope_ambiguous = 0; + int error = 0; inp = sotoinpcb(so); KASSERT(inp != NULL, ("rip6_connect: inp == NULL")); @@ -774,18 +774,8 @@ rip6_connect(struct socket *so, struct s return (EADDRNOTAVAIL); if (addr->sin6_family != AF_INET6) return (EAFNOSUPPORT); - - /* - * Application should provide a proper zone ID or the use of default - * zone IDs should be enabled. Unfortunately, some applications do - * not behave as it should, so we need a workaround. Even if an - * appropriate ID is not determined, we'll see if we can determine - * the outgoing interface. If we can, determine the zone ID based on - * the interface below. - */ - if (addr->sin6_scope_id == 0 && !V_ip6_use_defzone) - scope_ambiguous = 1; - if ((error = sa6_embedscope(addr, V_ip6_use_defzone)) != 0) + error = sa6_checkzone(addr); + if (error != 0) return (error); INP_INFO_WLOCK(&V_ripcbinfo); @@ -798,16 +788,12 @@ rip6_connect(struct socket *so, struct s INP_INFO_WUNLOCK(&V_ripcbinfo); return (error); } - - /* XXX: see above */ - if (ifp && scope_ambiguous && - (error = in6_setscope(&addr->sin6_addr, ifp, NULL)) != 0) { - INP_WUNLOCK(inp); - INP_INFO_WUNLOCK(&V_ripcbinfo); - return (error); - } inp->in6p_faddr = addr->sin6_addr; inp->in6p_laddr = in6a; + if (IN6_IS_ADDR_LINKLOCAL(&inp->in6p_faddr) || + IN6_IS_ADDR_LINKLOCAL(&inp->in6p_laddr)) + inp->in6p_zoneid = in6_getscopezone(ifp, + IPV6_ADDR_SCOPE_LINKLOCAL); soisconnected(so); INP_WUNLOCK(inp); INP_INFO_WUNLOCK(&V_ripcbinfo); From owner-svn-src-user@FreeBSD.ORG Thu Oct 24 01:02:40 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 38B86946; Thu, 24 Oct 2013 01:02:40 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0B3232DD5; Thu, 24 Oct 2013 01:02:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9O12daE029468; Thu, 24 Oct 2013 01:02:39 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9O12dx3029467; Thu, 24 Oct 2013 01:02:39 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310240102.r9O12dx3029467@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 24 Oct 2013 01:02:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257033 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 01:02:40 -0000 Author: ae Date: Thu Oct 24 01:02:39 2013 New Revision: 257033 URL: http://svnweb.freebsd.org/changeset/base/257033 Log: Scope releated cleanup in in6_ifattach_linklocal(): * remove in6_setscope() call; * remove in6ifa_ifpforlinklocal() call. It is redundant, since in6_update_ifa() returns error. Modified: user/ae/inet6/sys/netinet6/in6_ifattach.c Modified: user/ae/inet6/sys/netinet6/in6_ifattach.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6_ifattach.c Thu Oct 24 00:53:09 2013 (r257032) +++ user/ae/inet6/sys/netinet6/in6_ifattach.c Thu Oct 24 01:02:39 2013 (r257033) @@ -451,7 +451,6 @@ success: static int in6_ifattach_linklocal(struct ifnet *ifp, struct ifnet *altifp) { - struct in6_ifaddr *ia; struct in6_aliasreq ifra; struct nd_prefixctl pr0; int i, error; @@ -470,10 +469,8 @@ in6_ifattach_linklocal(struct ifnet *ifp ifra.ifra_addr.sin6_family = AF_INET6; ifra.ifra_addr.sin6_len = sizeof(struct sockaddr_in6); ifra.ifra_addr.sin6_addr.s6_addr32[0] = htonl(0xfe800000); - ifra.ifra_addr.sin6_addr.s6_addr32[1] = 0; if ((ifp->if_flags & IFF_LOOPBACK) != 0) { - ifra.ifra_addr.sin6_addr.s6_addr32[2] = 0; - ifra.ifra_addr.sin6_addr.s6_addr32[3] = htonl(1); + ifra.ifra_addr.sin6_addr.s6_addr32[3] = IPV6_ADDR_INT32_ONE; } else { if (get_ifid(ifp, altifp, &ifra.ifra_addr.sin6_addr) != 0) { nd6log((LOG_ERR, @@ -481,9 +478,6 @@ in6_ifattach_linklocal(struct ifnet *ifp return (-1); } } - if (in6_setscope(&ifra.ifra_addr.sin6_addr, ifp, NULL)) - return (-1); - ifra.ifra_prefixmask.sin6_len = sizeof(struct sockaddr_in6); ifra.ifra_prefixmask.sin6_family = AF_INET6; ifra.ifra_prefixmask.sin6_addr = in6mask64; @@ -512,12 +506,6 @@ in6_ifattach_linklocal(struct ifnet *ifp if_name(ifp), error)); return (-1); } - - ia = in6ifa_ifpforlinklocal(ifp, 0); /* ia must not be NULL */ - KASSERT(ia != NULL, ("%s: ia == NULL, ifp=%p", __func__, ifp)); - - ifa_free(&ia->ia_ifa); - /* * Make the link-local prefix (fe80::%link/64) as on-link. * Since we'd like to manage prefixes separately from addresses, From owner-svn-src-user@FreeBSD.ORG Thu Oct 24 09:03:51 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D6ECE52B; Thu, 24 Oct 2013 09:03:51 +0000 (UTC) (envelope-from ray@freebsd.org) Received: from smtp.dlink.ua (smtp.dlink.ua [193.138.187.146]) by mx1.freebsd.org (Postfix) with ESMTP id 93B722808; Thu, 24 Oct 2013 09:03:51 +0000 (UTC) Received: from terran (unknown [192.168.99.1]) (Authenticated sender: ray) by smtp.dlink.ua (Postfix) with ESMTPA id E7D60C493D; Thu, 24 Oct 2013 12:03:43 +0300 (EEST) Date: Thu, 24 Oct 2013 12:05:15 +0300 From: Aleksandr Rybalko To: Benjamin Kaduk Subject: Re: svn commit: r256970 - user/ed/newcons/sys/dev/vt Message-Id: <20131024120515.da8ad392b7b3849b752ae1f2@freebsd.org> In-Reply-To: References: <201310231415.r9NEFkXT003267@svn.freebsd.org> X-Mailer: Sylpheed 3.2.0 (GTK+ 2.24.6; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: "src-committers@freebsd.org" , svn-src-user@freebsd.org X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 09:03:51 -0000 On Wed, 23 Oct 2013 11:06:49 -0400 Benjamin Kaduk wrote: > On Wed, Oct 23, 2013 at 10:15 AM, Aleksandr Rybalko wrote: > > > Author: ray > > Date: Wed Oct 23 14:15:46 2013 > > New Revision: 256970 > > URL: http://svnweb.freebsd.org/changeset/base/256970 > > > > Log: > > Turn off confusing rotation of scroll history. > > > > Thanks! I saw that in the quarterly status report and was thinking to > myself, "gosh, a fully cyclic history buffer might get confusing", so it's > good to hear that it's fixed. > > -Ben np Ben! It was mostly not about how it work, but how it is implemented. So code should not care where is end of buffer, but just always write into it. WBW -- Aleksandr Rybalko From owner-svn-src-user@FreeBSD.ORG Thu Oct 24 16:42:48 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C229D937; Thu, 24 Oct 2013 16:42:48 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B07322A8E; Thu, 24 Oct 2013 16:42:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9OGgmu3047149; Thu, 24 Oct 2013 16:42:48 GMT (envelope-from hiren@svn.freebsd.org) Received: (from hiren@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9OGgmj9047148; Thu, 24 Oct 2013 16:42:48 GMT (envelope-from hiren@svn.freebsd.org) Message-Id: <201310241642.r9OGgmj9047148@svn.freebsd.org> From: Hiren Panchasara Date: Thu, 24 Oct 2013 16:42:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257063 - user/glebius/course X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 16:42:48 -0000 Author: hiren Date: Thu Oct 24 16:42:48 2013 New Revision: 257063 URL: http://svnweb.freebsd.org/changeset/base/257063 Log: Adding a README Discussed with: glebius Added: user/glebius/course/README Added: user/glebius/course/README ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/glebius/course/README Thu Oct 24 16:42:48 2013 (r257063) @@ -0,0 +1,17 @@ +Ports needed for successful build: +--------------------------------- +1) print/texlive-full - recommended as we have not yet figured out minimal set of +ports needed to build successfully. +2) print/pdfjam - needed to generate a single combined course.pdf file. + +How to build: +------------ +"make" builds all the individual chapters in side their respective directories +as lection.pdf + +"make course" concatenates all individual chapter lection.pdf files into one +course.pdf + +"make clean" deletes all temporary files. + +"make cleanall" deletes resulting pdf files in addition to all temporary files. From owner-svn-src-user@FreeBSD.ORG Thu Oct 24 21:43:18 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C9D4A3A9; Thu, 24 Oct 2013 21:43:18 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B73472D1A; Thu, 24 Oct 2013 21:43:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9OLhIBa050054; Thu, 24 Oct 2013 21:43:18 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9OLhIFG050053; Thu, 24 Oct 2013 21:43:18 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201310242143.r9OLhIFG050053@svn.freebsd.org> From: Colin Percival Date: Thu, 24 Oct 2013 21:43:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257073 - user/cperciva/portsnap-mirror X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 21:43:18 -0000 Author: cperciva Date: Thu Oct 24 21:43:18 2013 New Revision: 257073 URL: http://svnweb.freebsd.org/changeset/base/257073 Log: Sacrifice large patch files in order to avoid having mirrors run out of disk space when lots of things change at once (sweeping commits and/or changes to heavily depended-upon ports like perl). Modified: user/cperciva/portsnap-mirror/pmirror.sh Modified: user/cperciva/portsnap-mirror/pmirror.sh ============================================================================== --- user/cperciva/portsnap-mirror/pmirror.sh Thu Oct 24 20:29:29 2013 (r257072) +++ user/cperciva/portsnap-mirror/pmirror.sh Thu Oct 24 21:43:18 2013 (r257073) @@ -313,7 +313,11 @@ while read LINE; do fi gzip -9n ${X}-${Y} - mv ${X}-${Y}.gz ${PUBDIR}/tp/ + if [ `wc -c < ${X}-${Y}.gz` -lt 100000 ]; then + mv ${X}-${Y}.gz ${PUBDIR}/tp/ + else + rm ${X}-${Y}.gz + fi done echo "`date`: Removing unneeded metadata patches" From owner-svn-src-user@FreeBSD.ORG Thu Oct 24 21:43:47 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 2A9454A2; Thu, 24 Oct 2013 21:43:47 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 163292D1C; Thu, 24 Oct 2013 21:43:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9OLhkgQ050140; Thu, 24 Oct 2013 21:43:46 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9OLhkrp050139; Thu, 24 Oct 2013 21:43:46 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310242143.r9OLhkrp050139@svn.freebsd.org> From: Aleksandr Rybalko Date: Thu, 24 Oct 2013 21:43:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257074 - user/ed/newcons/sys/dev/vt X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 21:43:47 -0000 Author: ray Date: Thu Oct 24 21:43:46 2013 New Revision: 257074 URL: http://svnweb.freebsd.org/changeset/base/257074 Log: o Fix scroll calculations. o Make vthistory_seek to return amount of lines to update +on_top/-on_bottom of screen. Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/dev/vt/vt_buf.c Modified: user/ed/newcons/sys/dev/vt/vt_buf.c ============================================================================== --- user/ed/newcons/sys/dev/vt/vt_buf.c Thu Oct 24 21:43:18 2013 (r257073) +++ user/ed/newcons/sys/dev/vt/vt_buf.c Thu Oct 24 21:43:46 2013 (r257074) @@ -54,13 +54,13 @@ static MALLOC_DEFINE(M_VTBUF, "vtbuf", " int vthistory_seek(struct vt_buf *vb, int offset, int whence) { - int top, bottom, roffset; + int diff, top, bottom, roffset; /* No scrolling if not enabled. */ if ((vb->vb_flags & VBF_SCROLL) == 0) { if (vb->vb_roffset != vb->vb_curroffset) { vb->vb_roffset = vb->vb_curroffset; - return (1); + return (0xffff); } return (0); /* No changes */ } @@ -75,14 +75,14 @@ vthistory_seek(struct vt_buf *vb, int of roffset = vb->vb_roffset + vb->vb_history_size; switch (whence) { case VHS_SET: - roffset = offset; + roffset = offset + vb->vb_history_size; break; case VHS_CUR: roffset += offset; break; case VHS_END: /* Go to current offset. */ - roffset = vb->vb_curroffset; + roffset = vb->vb_curroffset + vb->vb_history_size; break; } @@ -92,8 +92,14 @@ vthistory_seek(struct vt_buf *vb, int of roffset %= vb->vb_history_size; if (vb->vb_roffset != roffset) { + diff = vb->vb_roffset - roffset; vb->vb_roffset = roffset; - return (1); /* Offset changed, please update sceen. */ + /* + * Offset changed, please update Nth lines on sceen. + * +N - Nth lines at top; + * -N - Nth lines at bottom. + */ + return (diff); } return (0); /* No changes */ } From owner-svn-src-user@FreeBSD.ORG Thu Oct 24 21:54:25 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 06402B1C; Thu, 24 Oct 2013 21:54:25 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D67722DBF; Thu, 24 Oct 2013 21:54:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9OLsOxG053581; Thu, 24 Oct 2013 21:54:24 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9OLsOUS053579; Thu, 24 Oct 2013 21:54:24 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310242154.r9OLsOUS053579@svn.freebsd.org> From: Aleksandr Rybalko Date: Thu, 24 Oct 2013 21:54:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257076 - user/ed/newcons/sys/dev/vt X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 21:54:25 -0000 Author: ray Date: Thu Oct 24 21:54:24 2013 New Revision: 257076 URL: http://svnweb.freebsd.org/changeset/base/257076 Log: o Mute keyboard input when ScrollLock mode is active. o Simplify keys handling. o Send ESC sequence for arrow keys in _cngetc, that will fix DDB history. Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/dev/vt/vt.h user/ed/newcons/sys/dev/vt/vt_core.c Modified: user/ed/newcons/sys/dev/vt/vt.h ============================================================================== --- user/ed/newcons/sys/dev/vt/vt.h Thu Oct 24 21:49:23 2013 (r257075) +++ user/ed/newcons/sys/dev/vt/vt.h Thu Oct 24 21:54:24 2013 (r257076) @@ -181,6 +181,7 @@ struct vt_window { struct vt_font *vw_font; /* (d) Graphical font. */ unsigned int vw_number; /* (c) Window number. */ int vw_kbdmode; /* (?) Keyboard mode. */ + char *vw_kbdsq; /* Escape sequence queue*/ unsigned int vw_flags; /* (d) Per-window flags. */ #define VWF_BUSY 0x1 /* Busy reconfiguring device. */ #define VWF_OPENED 0x2 /* TTY in use. */ Modified: user/ed/newcons/sys/dev/vt/vt_core.c ============================================================================== --- user/ed/newcons/sys/dev/vt/vt_core.c Thu Oct 24 21:49:23 2013 (r257075) +++ user/ed/newcons/sys/dev/vt/vt_core.c Thu Oct 24 21:54:24 2013 (r257076) @@ -274,13 +274,119 @@ vt_winsize(struct vt_device *vd, struct } } +static void +vt_scroll(struct vt_window *vw, int offset, int whence) +{ + int diff; + term_pos_t size; + + if ((vw->vw_flags & VWF_SCROLL) == 0) + return; + + vt_termsize(vw->vw_device, vw->vw_font, &size); + + diff = vthistory_seek(&vw->vw_buf, offset, whence); + /* + * Offset changed, please update Nth lines on sceen. + * +N - Nth lines at top; + * -N - Nth lines at bottom. + */ + + if (diff < -size.tp_row || diff > size.tp_row) { + vw->vw_device->vd_flags |= VDF_INVALID; + return; + } + vw->vw_device->vd_flags |= VDF_INVALID; /*XXX*/ +} + +static int +vt_machine_kbdevent(int c) +{ + + switch (c) { + case SPCLKEY | DBG: + kdb_enter(KDB_WHY_BREAK, "manual escape to debugger"); + return (1); + case SPCLKEY | RBT: + /* XXX: Make this configurable! */ + shutdown_nice(0); + return (1); + case SPCLKEY | HALT: + shutdown_nice(RB_HALT); + return (1); + case SPCLKEY | PDWN: + shutdown_nice(RB_HALT|RB_POWEROFF); + return (1); + }; + + return (0); +} + +static void +vt_scrollmode_kbdevent(struct vt_window *vw, int c, int console) +{ + struct vt_device *vd; + term_pos_t size; + + vd = vw->vw_device; + /* Only special keys handled in ScrollLock mode */ + if ((c & SPCLKEY) == 0) + return; + + c &= ~SPCLKEY; + + if (console == 0) { + if (c >= F_SCR && c <= MIN(L_SCR, F_SCR + VT_MAXWINDOWS - 1)) { + vw = vd->vd_windows[c - F_SCR]; + if (vw != NULL) + vt_proc_window_switch(vw); + return; + } + VT_LOCK(vd); + } + + switch (c) { + case SLK: { + /* Turn scrolling off. */ + vt_scroll(vw, 0, VHS_END); + VTBUF_SLCK_DISABLE(&vw->vw_buf); + vw->vw_flags &= ~VWF_SCROLL; + break; + } + case FKEY | F(49): /* Home key. */ + vt_scroll(vw, 0, VHS_END); + break; + case FKEY | F(50): /* Arrow up. */ + vt_scroll(vw, -1, VHS_CUR); + break; + case FKEY | F(51): /* Page up. */ + vt_termsize(vd, vw->vw_font, &size); + vt_scroll(vw, -size.tp_row, VHS_CUR); + break; + case FKEY | F(57): /* End key. */ + vt_scroll(vw, 0, VHS_SET); + break; + case FKEY | F(58): /* Arrow down. */ + vt_scroll(vw, 1, VHS_CUR); + break; + case FKEY | F(59): /* Page down. */ + vt_termsize(vd, vw->vw_font, &size); + vt_scroll(vw, size.tp_row, VHS_CUR); + break; + } + + if (console == 0) + VT_UNLOCK(vd); +} + static int vt_kbdevent(keyboard_t *kbd, int event, void *arg) { struct vt_device *vd = arg; struct vt_window *vw = vd->vd_curwindow; - int c; + int c, state; + state = 0; switch (event) { case KBDIO_KEYINPUT: break; @@ -298,6 +404,15 @@ vt_kbdevent(keyboard_t *kbd, int event, if (c & RELKEY) return (0); + if (vt_machine_kbdevent(c)) + return (0); + + if (vw->vw_flags & VWF_SCROLL) { + vt_scrollmode_kbdevent(vw, c, 0/* Not a console */); + /* Scroll mode keys handled, nothing to do more. */ + return (0); + } + if (c & SPCLKEY) { c &= ~SPCLKEY; @@ -309,21 +424,7 @@ vt_kbdevent(keyboard_t *kbd, int event, } switch (c) { - case DBG: - kdb_enter(KDB_WHY_BREAK, "manual escape to debugger"); - break; - case RBT: - /* XXX: Make this configurable! */ - shutdown_nice(0); - break; - case HALT: - shutdown_nice(RB_HALT); - break; - case PDWN: - shutdown_nice(RB_HALT|RB_POWEROFF); - break; case SLK: { - int state = 0; kbdd_ioctl(kbd, KDGKBSTATE, (caddr_t)&state); VT_LOCK(vd); @@ -335,8 +436,7 @@ vt_kbdevent(keyboard_t *kbd, int event, /* Turn scrolling off. */ vw->vw_flags &= ~VWF_SCROLL; VTBUF_SLCK_DISABLE(&vw->vw_buf); - vthistory_seek(&vw->vw_buf, 0, VHS_END); - vd->vd_flags |= VDF_INVALID; + vt_scroll(vw, 0, VHS_END); } VT_UNLOCK(vd); break; @@ -350,40 +450,12 @@ vt_kbdevent(keyboard_t *kbd, int event, TKEY_F1 + c - (FKEY | F(1))); break; case FKEY | F(49): /* Home key. */ - VT_LOCK(vd); - if (vw->vw_flags & VWF_SCROLL) { - if (vthistory_seek(&vw->vw_buf, 0, VHS_END)) - vd->vd_flags |= VDF_INVALID; - VT_UNLOCK(vd); - break; - } - VT_UNLOCK(vd); terminal_input_special(vw->vw_terminal, TKEY_HOME); break; case FKEY | F(50): /* Arrow up. */ - VT_LOCK(vd); - if (vw->vw_flags & VWF_SCROLL) { - if (vthistory_seek(&vw->vw_buf, -1, VHS_CUR)) - vd->vd_flags |= VDF_INVALID; - VT_UNLOCK(vd); - break; - } - VT_UNLOCK(vd); terminal_input_special(vw->vw_terminal, TKEY_UP); break; case FKEY | F(51): /* Page up. */ - VT_LOCK(vd); - if (vw->vw_flags & VWF_SCROLL) { - term_pos_t size; - - vt_termsize(vd, vw->vw_font, &size); - if (vthistory_seek(&vw->vw_buf, -size.tp_row, - VHS_CUR)) - vd->vd_flags |= VDF_INVALID; - VT_UNLOCK(vd); - break; - } - VT_UNLOCK(vd); terminal_input_special(vw->vw_terminal, TKEY_PAGE_UP); break; case FKEY | F(53): /* Arrow left. */ @@ -393,40 +465,12 @@ vt_kbdevent(keyboard_t *kbd, int event, terminal_input_special(vw->vw_terminal, TKEY_RIGHT); break; case FKEY | F(57): /* End key. */ - VT_LOCK(vd); - if (vw->vw_flags & VWF_SCROLL) { - if (vthistory_seek(&vw->vw_buf, 0, VHS_SET)) - vd->vd_flags |= VDF_INVALID; - VT_UNLOCK(vd); - break; - } - VT_UNLOCK(vd); terminal_input_special(vw->vw_terminal, TKEY_END); break; case FKEY | F(58): /* Arrow down. */ - VT_LOCK(vd); - if (vw->vw_flags & VWF_SCROLL) { - if (vthistory_seek(&vw->vw_buf, 1, VHS_CUR)) - vd->vd_flags |= VDF_INVALID; - VT_UNLOCK(vd); - break; - } - VT_UNLOCK(vd); terminal_input_special(vw->vw_terminal, TKEY_DOWN); break; case FKEY | F(59): /* Page down. */ - VT_LOCK(vd); - if (vw->vw_flags & VWF_SCROLL) { - term_pos_t size; - - vt_termsize(vd, vw->vw_font, &size); - if (vthistory_seek(&vw->vw_buf, size.tp_row, - VHS_CUR)) - vd->vd_flags |= VDF_INVALID; - VT_UNLOCK(vd); - break; - } - VT_UNLOCK(vd); terminal_input_special(vw->vw_terminal, TKEY_PAGE_DOWN); break; case FKEY | F(60): /* Insert key. */ @@ -741,8 +785,13 @@ vtterm_cngetc(struct terminal *tm) struct vt_window *vw = tm->tm_softc; struct vt_device *vd = vw->vw_device; keyboard_t *kbd; + int state; u_int c; + if (vw->vw_kbdsq && *vw->vw_kbdsq) + return (*vw->vw_kbdsq++); + + state = 0; /* Make sure the splash screen is not there. */ if (vd->vd_flags & VDF_SPLASH) { /* Remove splash */ @@ -768,14 +817,16 @@ vtterm_cngetc(struct terminal *tm) if (c & RELKEY) return (-1); + if (vw->vw_flags & VWF_SCROLL) { + vt_scrollmode_kbdevent(vw, c, 1/* Console mode */); + vt_flush(vd); + return (-1); + } + /* Stripped down handling of vt_kbdevent(), without locking, etc. */ if (c & SPCLKEY) { - c &= ~SPCLKEY; - switch (c) { - case SLK: { - int state = 0; - + case SPCLKEY | SLK: kbdd_ioctl(kbd, KDGKBSTATE, (caddr_t)&state); if (state & SLKED) { /* Turn scrolling on. */ @@ -783,52 +834,23 @@ vtterm_cngetc(struct terminal *tm) VTBUF_SLCK_ENABLE(&vw->vw_buf); } else { /* Turn scrolling off. */ + vt_scroll(vw, 0, VHS_END); vw->vw_flags &= ~VWF_SCROLL; VTBUF_SLCK_DISABLE(&vw->vw_buf); - vthistory_seek(&vw->vw_buf, 0, VHS_END); - vd->vd_flags |= VDF_INVALID; } break; - } - case FKEY | F(49): /* Home key. */ - if (vw->vw_flags & VWF_SCROLL) - if (vthistory_seek(&vw->vw_buf, 0, VHS_END)) - vd->vd_flags |= VDF_INVALID; + /* XXX: KDB can handle history. */ + case SPCLKEY | FKEY | F(50): /* Arrow up. */ + vw->vw_kbdsq = "\x1b[A"; break; - case FKEY | F(50): /* Arrow up. */ - if (vw->vw_flags & VWF_SCROLL) - if (vthistory_seek(&vw->vw_buf, -1, VHS_CUR)) - vd->vd_flags |= VDF_INVALID; + case SPCLKEY | FKEY | F(58): /* Arrow down. */ + vw->vw_kbdsq = "\x1b[B"; break; - case FKEY | F(51): /* Page up. */ - if (vw->vw_flags & VWF_SCROLL) { - term_pos_t size; - - vt_termsize(vd, vw->vw_font, &size); - if (vthistory_seek(&vw->vw_buf, -size.tp_row, - VHS_CUR)) - vd->vd_flags |= VDF_INVALID; - } + case SPCLKEY | FKEY | F(55): /* Arrow right. */ + vw->vw_kbdsq = "\x1b[C"; break; - case FKEY | F(57): /* End key. */ - if (vw->vw_flags & VWF_SCROLL) - if (vthistory_seek(&vw->vw_buf, 0, VHS_SET)) - vd->vd_flags |= VDF_INVALID; - break; - case FKEY | F(58): /* Arrow down. */ - if (vw->vw_flags & VWF_SCROLL) - if (vthistory_seek(&vw->vw_buf, 1, VHS_CUR)) - vd->vd_flags |= VDF_INVALID; - break; - case FKEY | F(59): /* Page down. */ - if (vw->vw_flags & VWF_SCROLL) { - term_pos_t size; - - vt_termsize(vd, vw->vw_font, &size); - if (vthistory_seek(&vw->vw_buf, size.tp_row, - VHS_CUR)) - vd->vd_flags |= VDF_INVALID; - } + case SPCLKEY | FKEY | F(53): /* Arrow left. */ + vw->vw_kbdsq = "\x1b[D"; break; } @@ -838,6 +860,10 @@ vtterm_cngetc(struct terminal *tm) return KEYCHAR(c); } + if (vw->vw_kbdsq && *vw->vw_kbdsq) + return (* + vw->vw_kbdsq++); + return (-1); } From owner-svn-src-user@FreeBSD.ORG Thu Oct 24 23:47:32 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 4D97DAA7; Thu, 24 Oct 2013 23:47:32 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3B8DC2822; Thu, 24 Oct 2013 23:47:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9ONlWRl090419; Thu, 24 Oct 2013 23:47:32 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9ONlVWR090417; Thu, 24 Oct 2013 23:47:31 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310242347.r9ONlVWR090417@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Thu, 24 Oct 2013 23:47:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257080 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 23:47:32 -0000 Author: ae Date: Thu Oct 24 23:47:31 2013 New Revision: 257080 URL: http://svnweb.freebsd.org/changeset/base/257080 Log: Remove in6_purgeif() function. It seems it was never used. Modified: user/ae/inet6/sys/netinet6/in6.c user/ae/inet6/sys/netinet6/in6_var.h Modified: user/ae/inet6/sys/netinet6/in6.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6.c Thu Oct 24 22:55:15 2013 (r257079) +++ user/ae/inet6/sys/netinet6/in6.c Thu Oct 24 23:47:31 2013 (r257080) @@ -1390,20 +1390,6 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st ifa_free(&ia->ia_ifa); /* in6_ifaddrhead */ } -void -in6_purgeif(struct ifnet *ifp) -{ - struct ifaddr *ifa, *nifa; - - TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, nifa) { - if (ifa->ifa_addr->sa_family != AF_INET6) - continue; - in6_purgeaddr(ifa); - } - - in6_ifdetach(ifp); -} - /* * SIOC[GAD]LIFADDR. * SIOCGLIFADDR: get first address. (?) Modified: user/ae/inet6/sys/netinet6/in6_var.h ============================================================================== --- user/ae/inet6/sys/netinet6/in6_var.h Thu Oct 24 22:55:15 2013 (r257079) +++ user/ae/inet6/sys/netinet6/in6_var.h Thu Oct 24 23:47:31 2013 (r257080) @@ -806,7 +806,6 @@ int in6_update_ifa(struct ifnet *, struc struct in6_ifaddr *, int); void in6_purgeaddr(struct ifaddr *); int in6if_do_dad(struct ifnet *); -void in6_purgeif(struct ifnet *); void in6_savemkludge(struct in6_ifaddr *); void *in6_domifattach(struct ifnet *); void in6_domifdetach(struct ifnet *, void *); From owner-svn-src-user@FreeBSD.ORG Fri Oct 25 00:24:56 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E0DFCBE2; Fri, 25 Oct 2013 00:24:55 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BF5F82A5E; Fri, 25 Oct 2013 00:24:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9P0OtuJ004495; Fri, 25 Oct 2013 00:24:55 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9P0OtYW004494; Fri, 25 Oct 2013 00:24:55 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310250024.r9P0OtYW004494@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 25 Oct 2013 00:24:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257082 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2013 00:24:56 -0000 Author: ae Date: Fri Oct 25 00:24:55 2013 New Revision: 257082 URL: http://svnweb.freebsd.org/changeset/base/257082 Log: Some cleanups in in6_ifdetach(): * remove in6_setscope() call; * remove part of code, that already done in the in6_purgeaddr(); * don't remove route to multicast, we don't keep it. Modified: user/ae/inet6/sys/netinet6/in6_ifattach.c Modified: user/ae/inet6/sys/netinet6/in6_ifattach.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6_ifattach.c Fri Oct 25 00:17:12 2013 (r257081) +++ user/ae/inet6/sys/netinet6/in6_ifattach.c Fri Oct 25 00:24:55 2013 (r257082) @@ -677,9 +677,6 @@ in6_nigroup0(struct ifnet *ifp, const ch /* Copy the first 32 bits of 128-bit hash into the address. */ bcopy(digest, &in6->s6_addr32[3], sizeof(in6->s6_addr32[3])); } - if (in6_setscope(in6, ifp, NULL)) - return (-1); /* XXX: should not fail */ - return 0; } @@ -790,12 +787,7 @@ in6_ifattach(struct ifnet *ifp, struct i void in6_ifdetach(struct ifnet *ifp) { - struct in6_ifaddr *ia; struct ifaddr *ifa, *next; - struct radix_node_head *rnh; - struct rtentry *rt; - struct sockaddr_in6 sin6; - struct in6_multi_mship *imm; if (ifp->if_afdata[AF_INET6] == NULL) return; @@ -810,39 +802,6 @@ in6_ifdetach(struct ifnet *ifp) in6_purgeaddr(ifa); } - /* undo everything done by in6_ifattach(), just in case */ - TAILQ_FOREACH_SAFE(ifa, &ifp->if_addrhead, ifa_link, next) { - if (ifa->ifa_addr->sa_family != AF_INET6 - || !IN6_IS_ADDR_LINKLOCAL(&satosin6(&ifa->ifa_addr)->sin6_addr)) { - continue; - } - - ia = (struct in6_ifaddr *)ifa; - - /* - * leave from multicast groups we have joined for the interface - */ - while ((imm = LIST_FIRST(&ia->ia6_memberships)) != NULL) { - LIST_REMOVE(imm, i6mm_chain); - in6_leavegroup(imm); - } - - /* Remove link-local from the routing table. */ - if (ia->ia_flags & IFA_ROUTE) - (void)rtinit(&ia->ia_ifa, RTM_DELETE, ia->ia_flags); - - /* remove from the linked list */ - IF_ADDR_WLOCK(ifp); - TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_WUNLOCK(ifp); - ifa_free(ifa); /* if_addrhead */ - - IN6_IFADDR_WLOCK(); - TAILQ_REMOVE(&V_in6_ifaddrhead, ia, ia_link); - IN6_IFADDR_WUNLOCK(); - ifa_free(ifa); - } - in6_pcbpurgeif0(&V_udbinfo, ifp); in6_pcbpurgeif0(&V_ripcbinfo, ifp); /* leave from all multicast groups joined */ @@ -857,31 +816,6 @@ in6_ifdetach(struct ifnet *ifp) * (Or can we just delay calling nd6_purge until at this point?) */ nd6_purge(ifp); - - /* - * Remove route to link-local allnodes multicast (ff02::1). - * These only get automatically installed for the default FIB. - */ - bzero(&sin6, sizeof(sin6)); - sin6.sin6_len = sizeof(struct sockaddr_in6); - sin6.sin6_family = AF_INET6; - sin6.sin6_addr = in6addr_linklocal_allnodes; - if (in6_setscope(&sin6.sin6_addr, ifp, NULL)) - /* XXX: should not fail */ - return; - /* XXX grab lock first to avoid LOR */ - rnh = rt_tables_get_rnh(RT_DEFAULT_FIB, AF_INET6); - if (rnh != NULL) { - RADIX_NODE_HEAD_LOCK(rnh); - rt = in6_rtalloc1((struct sockaddr *)&sin6, 0, RTF_RNH_LOCKED, - RT_DEFAULT_FIB); - if (rt) { - if (rt->rt_ifp == ifp) - rtexpunge(rt); - RTFREE_LOCKED(rt); - } - RADIX_NODE_HEAD_UNLOCK(rnh); - } } int From owner-svn-src-user@FreeBSD.ORG Fri Oct 25 00:35:27 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 37D2AFE6; Fri, 25 Oct 2013 00:35:27 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 16DE22AED; Fri, 25 Oct 2013 00:35:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9P0ZQqC007798; Fri, 25 Oct 2013 00:35:26 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9P0ZQYE007797; Fri, 25 Oct 2013 00:35:26 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310250035.r9P0ZQYE007797@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 25 Oct 2013 00:35:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257083 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2013 00:35:27 -0000 Author: ae Date: Fri Oct 25 00:35:26 2013 New Revision: 257083 URL: http://svnweb.freebsd.org/changeset/base/257083 Log: Remove all assumptions about embedded form of addresses: * cleanup comments; * remove in6_setscope(), in6_clearscope() and sa6_embedscope() calls; * use in6_getscopezone() to initialize sin6_scope_id; * use sa6_checkzone() to check addresses for correctness; * don't check unsigned ifindex for negative values. Modified: user/ae/inet6/sys/netinet6/in6_mcast.c Modified: user/ae/inet6/sys/netinet6/in6_mcast.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6_mcast.c Fri Oct 25 00:24:55 2013 (r257082) +++ user/ae/inet6/sys/netinet6/in6_mcast.c Fri Oct 25 00:35:26 2013 (r257083) @@ -330,7 +330,6 @@ im6o_match_source(const struct ip6_mopti psa = (const sockunion_t *)src; find.im6s_addr = psa->sin6.sin6_addr; - in6_clearscope(&find.im6s_addr); /* XXX */ ims = RB_FIND(ip6_msource_tree, &imf->im6f_sources, &find); return ((struct in6_msource *)ims); @@ -1162,20 +1161,8 @@ in6_mc_join_locked(struct ifnet *ifp, co char ip6tbuf[INET6_ADDRSTRLEN]; #endif -#ifdef INVARIANTS - /* - * Sanity: Check scope zone ID was set for ifp, if and - * only if group is scoped to an interface. - */ KASSERT(IN6_IS_ADDR_MULTICAST(mcaddr), ("%s: not a multicast address", __func__)); - if (IN6_IS_ADDR_MC_LINKLOCAL(mcaddr) || - IN6_IS_ADDR_MC_INTFACELOCAL(mcaddr)) { - KASSERT(mcaddr->s6_addr16[1] != 0, - ("%s: scope zone ID not set", __func__)); - } -#endif - IN6_MULTI_LOCK_ASSERT(); CTR4(KTR_MLD, "%s: join %s on %p(%s))", __func__, @@ -1375,9 +1362,6 @@ in6p_block_unblock_source(struct inpcb * if (!IN6_IS_ADDR_MULTICAST(&gsa->sin6.sin6_addr)) return (EINVAL); - - (void)in6_setscope(&gsa->sin6.sin6_addr, ifp, NULL); - /* * Check if we are actually a member of this group. */ @@ -1595,7 +1579,6 @@ in6p_get_source_filters(struct inpcb *in ifp = ifnet_byindex(msfr.msfr_ifindex); if (ifp == NULL) return (EADDRNOTAVAIL); - (void)in6_setscope(&gsa->sin6.sin6_addr, ifp, NULL); INP_WLOCK(inp); @@ -1873,25 +1856,23 @@ in6p_join_group(struct inpcb *inp, struc gsa->sin6.sin6_len != sizeof(struct sockaddr_in6)) return (EINVAL); + if (gsr.gsr_interface == 0 || V_if_index < gsr.gsr_interface) + return (EADDRNOTAVAIL); + ifp = ifnet_byindex(gsr.gsr_interface); + if (ifp == NULL) + return (EADDRNOTAVAIL); + if (sopt->sopt_name == MCAST_JOIN_SOURCE_GROUP) { if (ssa->sin6.sin6_family != AF_INET6 || ssa->sin6.sin6_len != sizeof(struct sockaddr_in6)) return (EINVAL); if (IN6_IS_ADDR_MULTICAST(&ssa->sin6.sin6_addr)) return (EINVAL); - /* - * TODO: Validate embedded scope ID in source - * list entry against passed-in ifp, if and only - * if source list filter entry is iface or node local. - */ - in6_clearscope(&ssa->sin6.sin6_addr); ssa->sin6.sin6_port = 0; - ssa->sin6.sin6_scope_id = 0; + ssa->sin6.sin6_scope_id = in6_getscopezone(ifp, + in6_addrscope(&ssa->sin6.sin6_addr)); } - if (gsr.gsr_interface == 0 || V_if_index < gsr.gsr_interface) - return (EADDRNOTAVAIL); - ifp = ifnet_byindex(gsr.gsr_interface); break; default: @@ -1908,15 +1889,12 @@ in6p_join_group(struct inpcb *inp, struc return (EADDRNOTAVAIL); gsa->sin6.sin6_port = 0; - gsa->sin6.sin6_scope_id = 0; - /* * Always set the scope zone ID on memberships created from userland. * Use the passed-in ifp to do this. - * XXX The in6_setscope() return value is meaningless. - * XXX SCOPE6_LOCK() is taken by in6_setscope(). */ - (void)in6_setscope(&gsa->sin6.sin6_addr, ifp, NULL); + gsa->sin6.sin6_scope_id = in6_getscopezone(ifp, + in6_addrscope(&gsa->sin6.sin6_addr)); imo = in6p_findmoptions(inp); idx = im6o_match_group(imo, ifp, &gsa->sa); @@ -2122,9 +2100,6 @@ in6p_leave_group(struct inpcb *inp, stru /* * Chew everything passed in up into a struct group_source_req * as that is easier to process. - * Note: Any embedded scope ID in the multicast group passed - * in by userland is ignored, the interface index is the recommended - * mechanism to specify an interface; see below. */ switch (sopt->sopt_name) { case IPV6_LEAVE_GROUP: @@ -2163,12 +2138,6 @@ in6p_leave_group(struct inpcb *inp, stru return (EINVAL); if (IN6_IS_ADDR_MULTICAST(&ssa->sin6.sin6_addr)) return (EINVAL); - /* - * TODO: Validate embedded scope ID in source - * list entry against passed-in ifp, if and only - * if source list filter entry is iface or node local. - */ - in6_clearscope(&ssa->sin6.sin6_addr); } gsa->sin6.sin6_port = 0; gsa->sin6.sin6_scope_id = 0; @@ -2190,38 +2159,26 @@ in6p_leave_group(struct inpcb *inp, stru * was provided separately, attempt to look the membership up * from the default scope as a last resort to disambiguate * the membership we are being asked to leave. - * XXX SCOPE6 lock potentially taken here. */ if (ifindex != 0) { - if (ifindex < 0 || V_if_index < ifindex) + if (V_if_index < ifindex) return (EADDRNOTAVAIL); ifp = ifnet_byindex(ifindex); if (ifp == NULL) return (EADDRNOTAVAIL); - (void)in6_setscope(&gsa->sin6.sin6_addr, ifp, NULL); } else { - error = sa6_embedscope(&gsa->sin6, V_ip6_use_defzone); + error = sa6_checkzone(&gsa->sin6); if (error) - return (EADDRNOTAVAIL); + return (error); /* * Some badly behaved applications don't pass an ifindex * or a scope ID, which is an API violation. In this case, * perform a lookup as per a v6 join. - * - * XXX For now, stomp on zone ID for the corner case. - * This is not the 'KAME way', but we need to see the ifp - * directly until such time as this implementation is - * refactored, assuming the scope IDs are the way to go. */ - ifindex = ntohs(gsa->sin6.sin6_addr.s6_addr16[1]); - if (ifindex == 0) { - CTR2(KTR_MLD, "%s: warning: no ifindex, looking up " - "ifp for group %s.", __func__, - ip6_sprintf(ip6tbuf, &gsa->sin6.sin6_addr)); - ifp = in6p_lookup_mcast_ifp(inp, &gsa->sin6); - } else { - ifp = ifnet_byindex(ifindex); - } + CTR2(KTR_MLD, "%s: warning: no ifindex, looking up " + "ifp for group %s.", __func__, ip6_sprintf(ip6tbuf, + &gsa->sin6.sin6_addr)); + ifp = in6p_lookup_mcast_ifp(inp, &gsa->sin6); if (ifp == NULL) return (EADDRNOTAVAIL); } @@ -2351,7 +2308,7 @@ in6p_set_multicast_if(struct inpcb *inp, error = sooptcopyin(sopt, &ifindex, sizeof(u_int), sizeof(u_int)); if (error) return (error); - if (ifindex < 0 || V_if_index < ifindex) + if (V_if_index < ifindex) return (EINVAL); ifp = ifnet_byindex(ifindex); @@ -2409,8 +2366,6 @@ in6p_set_source_filters(struct inpcb *in ifp = ifnet_byindex(msfr.msfr_ifindex); if (ifp == NULL) return (EADDRNOTAVAIL); - (void)in6_setscope(&gsa->sin6.sin6_addr, ifp, NULL); - /* * Take the INP write lock. * Check if this socket is a member of this group. @@ -2491,12 +2446,6 @@ in6p_set_source_filters(struct inpcb *in error = EINVAL; break; } - /* - * TODO: Validate embedded scope ID in source - * list entry against passed-in ifp, if and only - * if source list filter entry is iface or node local. - */ - in6_clearscope(&psin->sin6_addr); error = im6f_get_source(imf, psin, &lims); if (error) break; @@ -2687,7 +2636,7 @@ sysctl_ip6_mcast_filters(SYSCTL_HANDLER_ return (EINVAL); ifindex = name[0]; - if (ifindex <= 0 || ifindex > V_if_index) { + if (ifindex > V_if_index) { CTR2(KTR_MLD, "%s: ifindex %u out of range", __func__, ifindex); return (ENOENT); @@ -2706,11 +2655,6 @@ sysctl_ip6_mcast_filters(SYSCTL_HANDLER_ __func__, ifindex); return (ENOENT); } - /* - * Internal MLD lookups require that scope/zone ID is set. - */ - (void)in6_setscope(&mcaddr, ifp, NULL); - retval = sysctl_wire_old_buffer(req, sizeof(uint32_t) + (in6_mcast_maxgrpsrc * sizeof(struct in6_addr))); if (retval) From owner-svn-src-user@FreeBSD.ORG Fri Oct 25 01:47:03 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 06426892; Fri, 25 Oct 2013 01:47:03 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E5A8E2F1B; Fri, 25 Oct 2013 01:47:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9P1l2WE031890; Fri, 25 Oct 2013 01:47:02 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9P1l24q031889; Fri, 25 Oct 2013 01:47:02 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310250147.r9P1l24q031889@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 25 Oct 2013 01:47:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257086 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2013 01:47:03 -0000 Author: ae Date: Fri Oct 25 01:47:02 2013 New Revision: 257086 URL: http://svnweb.freebsd.org/changeset/base/257086 Log: Scope related cleanup in mld6.c: * cleanup comments; * remove in6_clearscope() and in6_setscope() calls; Modified: user/ae/inet6/sys/netinet6/mld6.c Modified: user/ae/inet6/sys/netinet6/mld6.c ============================================================================== --- user/ae/inet6/sys/netinet6/mld6.c Fri Oct 25 01:10:07 2013 (r257085) +++ user/ae/inet6/sys/netinet6/mld6.c Fri Oct 25 01:47:02 2013 (r257086) @@ -162,32 +162,9 @@ static int sysctl_mld_ifinfo(SYSCTL_HAND * per-link state iterators. * * XXX LOR PREVENTION - * A special case for IPv6 is the in6_setscope() routine. ip6_output() - * will not accept an ifp; it wants an embedded scope ID, unlike - * ip_output(), which happily takes the ifp given to it. The embedded - * scope ID is only used by MLD to select the outgoing interface. * * During interface attach and detach, MLD will take MLD_LOCK *after* * the IF_AFDATA_LOCK. - * As in6_setscope() takes IF_AFDATA_LOCK then SCOPE_LOCK, we can't call - * it with MLD_LOCK held without triggering an LOR. A netisr with indirect - * dispatch could work around this, but we'd rather not do that, as it - * can introduce other races. - * - * As such, we exploit the fact that the scope ID is just the interface - * index, and embed it in the IPv6 destination address accordingly. - * This is potentially NOT VALID for MLDv1 reports, as they - * are always sent to the multicast group itself; as MLDv2 - * reports are always sent to ff02::16, this is not an issue - * when MLDv2 is in use. - * - * This does not however eliminate the LOR when ip6_output() itself - * calls in6_setscope() internally whilst MLD_LOCK is held. This will - * trigger a LOR warning in WITNESS when the ifnet is detached. - * - * The right answer is probably to make IF_AFDATA_LOCK an rwlock, given - * how it's used across the network stack. Here we're simply exploiting - * the fact that MLD runs at a similar layer in the stack to scope6.c. * * VIMAGE: * * Each in6_multi corresponds to an ifp, and each ifp corresponds @@ -196,11 +173,6 @@ static int sysctl_mld_ifinfo(SYSCTL_HAND static struct mtx mld_mtx; static MALLOC_DEFINE(M_MLD, "mld", "mld state"); -#define MLD_EMBEDSCOPE(pin6, zoneid) \ - if (IN6_IS_SCOPE_LINKLOCAL(pin6) || \ - IN6_IS_ADDR_MC_INTFACELOCAL(pin6)) \ - (pin6)->s6_addr16[1] = htons((zoneid) & 0xFFFF) \ - /* * VIMAGE-wide globals. */ @@ -426,11 +398,7 @@ mld_dispatch_queue(struct ifqueue *ifq, * Filter outgoing MLD report state by group. * * Reports are ALWAYS suppressed for ALL-HOSTS (ff02::1) - * and node-local addresses. However, kernel and socket consumers - * always embed the KAME scope ID in the address provided, so strip it - * when performing comparison. - * Note: This is not the same as the *multicast* scope. - * + * and node-local addresses. * Return zero if the given group is one for which MLD reports * should be suppressed, or non-zero if reports should be issued. */ @@ -440,16 +408,9 @@ mld_is_addr_reported(const struct in6_ad KASSERT(IN6_IS_ADDR_MULTICAST(addr), ("%s: not multicast", __func__)); - if (IPV6_ADDR_MC_SCOPE(addr) == IPV6_ADDR_SCOPE_NODELOCAL) + if (IPV6_ADDR_MC_SCOPE(addr) == IPV6_ADDR_SCOPE_NODELOCAL || + IN6_ARE_ADDR_EQUAL(addr, &in6addr_linklocal_allnodes)) return (0); - - if (IPV6_ADDR_MC_SCOPE(addr) == IPV6_ADDR_SCOPE_LINKLOCAL) { - struct in6_addr tmp = *addr; - in6_clearscope(&tmp); - if (IN6_ARE_ADDR_EQUAL(&tmp, &in6addr_linklocal_allnodes)) - return (0); - } - return (1); } @@ -619,9 +580,6 @@ mli_delete_locked(const struct ifnet *if /* * Process a received MLDv1 general or address-specific query. * Assumes that the query header has been pulled up to sizeof(mld_hdr). - * - * NOTE: Can't be fully const correct as we temporarily embed scope ID in - * mld_addr. This is OK as we own the mbuf chain. */ static int mld_v1_input_query(struct ifnet *ifp, const struct ip6_hdr *ip6, @@ -665,19 +623,10 @@ mld_v1_input_query(struct ifnet *ifp, co * MLDv1 General Query. * If this was not sent to the all-nodes group, ignore it. */ - struct in6_addr dst; - - dst = ip6->ip6_dst; - in6_clearscope(&dst); - if (!IN6_ARE_ADDR_EQUAL(&dst, &in6addr_linklocal_allnodes)) + if (!IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, + &in6addr_linklocal_allnodes)) return (EINVAL); is_general_query = 1; - } else { - /* - * Embed scope ID of receiving interface in MLD query for - * lookup whilst we don't hold other locks. - */ - in6_setscope(&mld->mld_addr, ifp, NULL); } IN6_MULTI_LOCK(); @@ -722,8 +671,6 @@ mld_v1_input_query(struct ifnet *ifp, co ifp, ifp->if_xname); mld_v1_update_group(inm, timer); } - /* XXX Clear embedded scope ID as userland won't expect it. */ - in6_clearscope(&mld->mld_addr); } IF_ADDR_RUNLOCK(ifp); @@ -873,13 +820,6 @@ mld_v2_input_query(struct ifnet *ifp, co if (nsrc > 0) return (EINVAL); is_general_query = 1; - } else { - /* - * Embed scope ID of receiving interface in MLD query for - * lookup whilst we don't hold other locks (due to KAME - * locking lameness). We own this mbuf chain just now. - */ - in6_setscope(&mld->mld_addr, ifp, NULL); } IN6_MULTI_LOCK(); @@ -958,8 +898,6 @@ mld_v2_input_query(struct ifnet *ifp, co if (mli->mli_v2_timer == 0 || mli->mli_v2_timer >= timer) mld_v2_process_group_query(inm, mli, timer, m, off); - /* XXX Clear embedded scope ID as userland won't expect it. */ - in6_clearscope(&mld->mld_addr); IF_ADDR_RUNLOCK(ifp); } @@ -1086,15 +1024,11 @@ mld_v2_process_group_query(struct in6_mu /* * Process a received MLDv1 host membership report. * Assumes mld points to mld_hdr in pulled up mbuf chain. - * - * NOTE: Can't be fully const correct as we temporarily embed scope ID in - * mld_addr. This is OK as we own the mbuf chain. */ static int mld_v1_input_report(struct ifnet *ifp, const struct ip6_hdr *ip6, /*const*/ struct mld_hdr *mld) { - struct in6_addr src, dst; struct in6_ifaddr *ia; struct in6_multi *inm; #ifdef KTR @@ -1115,9 +1049,8 @@ mld_v1_input_report(struct ifnet *ifp, c * MLDv1 reports must originate from a host's link-local address, * or the unspecified address (when booting). */ - src = ip6->ip6_src; - in6_clearscope(&src); - if (!IN6_IS_SCOPE_LINKLOCAL(&src) && !IN6_IS_ADDR_UNSPECIFIED(&src)) { + if (!IN6_IS_SCOPE_LINKLOCAL(&ip6->ip6_src) && + !IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src)) { CTR3(KTR_MLD, "ignore v1 query src %s on ifp %p(%s)", ip6_sprintf(ip6tbuf, &ip6->ip6_src), ifp, ifp->if_xname); @@ -1128,10 +1061,8 @@ mld_v1_input_report(struct ifnet *ifp, c * RFC2710 Section 4: MLDv1 reports must pertain to a multicast * group, and must be directed to the group itself. */ - dst = ip6->ip6_dst; - in6_clearscope(&dst); if (!IN6_IS_ADDR_MULTICAST(&mld->mld_addr) || - !IN6_ARE_ADDR_EQUAL(&mld->mld_addr, &dst)) { + !IN6_ARE_ADDR_EQUAL(&mld->mld_addr, &ip6->ip6_dst)) { CTR3(KTR_MLD, "ignore v1 query dst %s on ifp %p(%s)", ip6_sprintf(ip6tbuf, &ip6->ip6_dst), ifp, ifp->if_xname); @@ -1150,7 +1081,7 @@ mld_v1_input_report(struct ifnet *ifp, c */ ia = in6ifa_ifpforlinklocal(ifp, IN6_IFF_NOTREADY|IN6_IFF_ANYCAST); if ((ia && IN6_ARE_ADDR_EQUAL(&ip6->ip6_src, IA6_IN6(ia))) || - (ia == NULL && IN6_IS_ADDR_UNSPECIFIED(&src))) { + (ia == NULL && IN6_IS_ADDR_UNSPECIFIED(&ip6->ip6_src))) { if (ia != NULL) ifa_free(&ia->ia_ifa); return (0); @@ -1161,13 +1092,6 @@ mld_v1_input_report(struct ifnet *ifp, c CTR3(KTR_MLD, "process v1 report %s on ifp %p(%s)", ip6_sprintf(ip6tbuf, &mld->mld_addr), ifp, ifp->if_xname); - /* - * Embed scope ID of receiving interface in MLD query for lookup - * whilst we don't hold other locks (due to KAME locking lameness). - */ - if (!IN6_IS_ADDR_UNSPECIFIED(&mld->mld_addr)) - in6_setscope(&mld->mld_addr, ifp, NULL); - IN6_MULTI_LOCK(); MLD_LOCK(); IF_ADDR_RLOCK(ifp); @@ -1221,10 +1145,6 @@ out_locked: IF_ADDR_RUNLOCK(ifp); MLD_UNLOCK(); IN6_MULTI_UNLOCK(); - - /* XXX Clear embedded scope ID as userland won't expect it. */ - in6_clearscope(&mld->mld_addr); - return (0); } @@ -1839,7 +1759,6 @@ mld_v1_transmit_report(struct in6_multi mld->mld_maxdelay = 0; mld->mld_reserved = 0; mld->mld_addr = in6m->in6m_addr; - in6_clearscope(&mld->mld_addr); mld->mld_cksum = in6_cksum(mh, IPPROTO_ICMPV6, sizeof(struct ip6_hdr), sizeof(struct mld_hdr)); @@ -2466,7 +2385,6 @@ mld_v2_enqueue_group_record(struct ifque mr.mr_datalen = 0; mr.mr_numsrc = 0; mr.mr_addr = inm->in6m_addr; - in6_clearscope(&mr.mr_addr); if (!m_append(m, sizeof(struct mldv2_record), (void *)&mr)) { if (m != m0) m_freem(m); @@ -2752,7 +2670,6 @@ mld_v2_enqueue_filter_change(struct ifqu */ memset(&mr, 0, sizeof(mr)); mr.mr_addr = inm->in6m_addr; - in6_clearscope(&mr.mr_addr); if (!m_append(m, sizeof(mr), (void *)&mr)) { if (m != m0) m_freem(m); @@ -3051,7 +2968,6 @@ mld_dispatch_packet(struct mbuf *m) struct ifnet *oifp; struct mbuf *m0; struct mbuf *md; - struct ip6_hdr *ip6; struct mld_hdr *mld; int error; int off; @@ -3101,18 +3017,6 @@ mld_dispatch_packet(struct mbuf *m) m_clrprotoflags(m); m0->m_pkthdr.rcvif = V_loif; - ip6 = mtod(m0, struct ip6_hdr *); -#if 0 - (void)in6_setscope(&ip6->ip6_dst, ifp, NULL); /* XXX LOR */ -#else - /* - * XXX XXX Break some KPI rules to prevent an LOR which would - * occur if we called in6_setscope() at transmission. - * See comments at top of file. - */ - MLD_EMBEDSCOPE(&ip6->ip6_dst, ifp->if_index); -#endif - /* * Retrieve the ICMPv6 type before handoff to ip6_output(), * so we can bump the stats. From owner-svn-src-user@FreeBSD.ORG Fri Oct 25 01:49:09 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 86B3EB3B; Fri, 25 Oct 2013 01:49:09 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5AD912F35; Fri, 25 Oct 2013 01:49:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9P1n9fO032289; Fri, 25 Oct 2013 01:49:09 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9P1n9aE032288; Fri, 25 Oct 2013 01:49:09 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310250149.r9P1n9aE032288@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 25 Oct 2013 01:49:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257087 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2013 01:49:09 -0000 Author: ae Date: Fri Oct 25 01:49:08 2013 New Revision: 257087 URL: http://svnweb.freebsd.org/changeset/base/257087 Log: Don't adjust checksum, since addresses don't contain scope id anymore. Modified: user/ae/inet6/sys/netinet6/in6_cksum.c Modified: user/ae/inet6/sys/netinet6/in6_cksum.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6_cksum.c Fri Oct 25 01:47:02 2013 (r257086) +++ user/ae/inet6/sys/netinet6/in6_cksum.c Fri Oct 25 01:49:08 2013 (r257087) @@ -68,7 +68,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include /* * Checksum routine for Internet Protocol family headers (Portable Version). @@ -84,7 +83,7 @@ static int _in6_cksum_pseudo(struct ip6_hdr *ip6, uint32_t len, uint8_t nxt, uint16_t csum) { int sum; - uint16_t scope, *w; + uint16_t *w; union { u_int16_t phs[4]; struct { @@ -108,20 +107,14 @@ _in6_cksum_pseudo(struct ip6_hdr *ip6, u sum += uph.phs[2]; sum += uph.phs[3]; /* IPv6 source address. */ - scope = in6_getscope(&ip6->ip6_src); w = (u_int16_t *)&ip6->ip6_src; sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3]; sum += w[4]; sum += w[5]; sum += w[6]; sum += w[7]; - if (scope != 0) - sum -= scope; /* IPv6 destination address. */ - scope = in6_getscope(&ip6->ip6_dst); w = (u_int16_t *)&ip6->ip6_dst; sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3]; sum += w[4]; sum += w[5]; sum += w[6]; sum += w[7]; - if (scope != 0) - sum -= scope; return (sum); } @@ -150,7 +143,7 @@ int in6_cksum(struct mbuf *m, u_int8_t nxt, u_int32_t off, u_int32_t len) { struct ip6_hdr *ip6; - u_int16_t *w, scope; + u_int16_t *w; int byte_swapped, mlen; int sum; union { @@ -188,20 +181,14 @@ in6_cksum(struct mbuf *m, u_int8_t nxt, ip6 = mtod(m, struct ip6_hdr *); /* IPv6 source address. */ - scope = in6_getscope(&ip6->ip6_src); w = (u_int16_t *)&ip6->ip6_src; sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3]; sum += w[4]; sum += w[5]; sum += w[6]; sum += w[7]; - if (scope != 0) - sum -= scope; /* IPv6 destination address. */ - scope = in6_getscope(&ip6->ip6_dst); w = (u_int16_t *)&ip6->ip6_dst; sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3]; sum += w[4]; sum += w[5]; sum += w[6]; sum += w[7]; - if (scope != 0) - sum -= scope; /* * Secondly calculate a summary of the first mbuf excluding offset. From owner-svn-src-user@FreeBSD.ORG Fri Oct 25 02:16:36 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id CD2C492E; Fri, 25 Oct 2013 02:16:36 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id BB0062113; Fri, 25 Oct 2013 02:16:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9P2GaNQ042529; Fri, 25 Oct 2013 02:16:36 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9P2GatK042528; Fri, 25 Oct 2013 02:16:36 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310250216.r9P2GatK042528@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 25 Oct 2013 02:16:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257088 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2013 02:16:37 -0000 Author: ae Date: Fri Oct 25 02:16:36 2013 New Revision: 257088 URL: http://svnweb.freebsd.org/changeset/base/257088 Log: Scope related cleanup in udp6_output(): * remove sa6_embedscope() and in6_setscope() calls; * move address validation check from udp6_output() to udp6_send(); * when address isn't specified, try to determine outgoing interface from inc->in6p_zoneid; * use IPV6_USEROIF for ip6_output() when outgoing interface is known. Modified: user/ae/inet6/sys/netinet6/udp6_usrreq.c Modified: user/ae/inet6/sys/netinet6/udp6_usrreq.c ============================================================================== --- user/ae/inet6/sys/netinet6/udp6_usrreq.c Fri Oct 25 01:49:08 2013 (r257087) +++ user/ae/inet6/sys/netinet6/udp6_usrreq.c Fri Oct 25 02:16:36 2013 (r257088) @@ -602,39 +602,17 @@ udp6_output(struct inpcb *inp, struct mb struct in6_addr *laddr, *faddr, in6a; struct sockaddr_in6 *sin6 = NULL; struct ifnet *oifp = NULL; - int scope_ambiguous = 0; u_short fport; int error = 0; struct ip6_pktopts *optp, opt; int af = AF_INET6, hlen = sizeof(struct ip6_hdr); int flags; - struct sockaddr_in6 tmp; INP_WLOCK_ASSERT(inp); INP_HASH_WLOCK_ASSERT(inp->inp_pcbinfo); - if (addr6) { - /* addr6 has been validated in udp6_send(). */ - sin6 = (struct sockaddr_in6 *)addr6; - - /* protect *sin6 from overwrites */ - tmp = *sin6; - sin6 = &tmp; - - /* - * Application should provide a proper zone ID or the use of - * default zone IDs should be enabled. Unfortunately, some - * applications do not behave as it should, so we need a - * workaround. Even if an appropriate ID is not determined, - * we'll see if we can determine the outgoing interface. If we - * can, determine the zone ID based on the interface below. - */ - if (sin6->sin6_scope_id == 0 && !V_ip6_use_defzone) - scope_ambiguous = 1; - if ((error = sa6_embedscope(sin6, V_ip6_use_defzone)) != 0) - return (error); - } - + /* addr6 has been validated in udp6_send(). */ + sin6 = (struct sockaddr_in6 *)addr6; if (control) { if ((error = ip6_setpktopts(control, &opt, inp->in6p_outputopts, td->td_ucred, IPPROTO_UDP)) != 0) @@ -700,11 +678,6 @@ udp6_output(struct inpcb *inp, struct mb 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 */ @@ -743,6 +716,8 @@ udp6_output(struct inpcb *inp, struct mb laddr = &inp->in6p_laddr; faddr = &inp->in6p_faddr; fport = inp->inp_fport; + if (inp->in6p_zoneid != 0) + oifp = in6_getlinkifnet(inp->in6p_zoneid); } if (af == AF_INET) @@ -786,12 +761,12 @@ udp6_output(struct inpcb *inp, struct mb m->m_pkthdr.csum_flags = CSUM_UDP_IPV6; m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); - flags = 0; + flags = oifp ? IPV6_USEROIF: 0; UDP_PROBE(send, NULL, inp, ip6, inp, udp6); UDPSTAT_INC(udps_opackets); error = ip6_output(m, optp, NULL, flags, inp->in6p_moptions, - NULL, inp); + &oifp, inp); break; case AF_INET: error = EAFNOSUPPORT; @@ -1094,6 +1069,13 @@ udp6_send(struct socket *so, int flags, error = EAFNOSUPPORT; goto bad; } + /* + * Application must provide a proper zone ID or the use of + * default zone IDs should be enabled. + */ + error = sa6_checkzone((struct sockaddr_in6*)addr); + if (error != 0) + goto bad; } #ifdef INET From owner-svn-src-user@FreeBSD.ORG Fri Oct 25 02:21:01 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1B881B7D; Fri, 25 Oct 2013 02:21:01 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0A2A12162; Fri, 25 Oct 2013 02:21:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9P2L0md045151; Fri, 25 Oct 2013 02:21:00 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9P2L0vS045150; Fri, 25 Oct 2013 02:21:00 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310250221.r9P2L0vS045150@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 25 Oct 2013 02:21:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257089 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2013 02:21:01 -0000 Author: ae Date: Fri Oct 25 02:21:00 2013 New Revision: 257089 URL: http://svnweb.freebsd.org/changeset/base/257089 Log: Refactor udp6_getcred(): * remove sa6_embedscope() calls, use sa6_checkzone() instead; * determine interface by zone id and pass it to in6_pcblookup. Modified: user/ae/inet6/sys/netinet6/udp6_usrreq.c Modified: user/ae/inet6/sys/netinet6/udp6_usrreq.c ============================================================================== --- user/ae/inet6/sys/netinet6/udp6_usrreq.c Fri Oct 25 02:16:36 2013 (r257088) +++ user/ae/inet6/sys/netinet6/udp6_usrreq.c Fri Oct 25 02:21:00 2013 (r257089) @@ -550,7 +550,9 @@ udp6_getcred(SYSCTL_HANDLER_ARGS) { struct xucred xuc; struct sockaddr_in6 addrs[2]; + struct ifnet *ifp; struct inpcb *inp; + uint32_t zoneid; int error; error = priv_check(req->td, PRIV_NETINET_GETCRED); @@ -564,13 +566,30 @@ udp6_getcred(SYSCTL_HANDLER_ARGS) error = SYSCTL_IN(req, addrs, sizeof(addrs)); if (error) return (error); - if ((error = sa6_embedscope(&addrs[0], V_ip6_use_defzone)) != 0 || - (error = sa6_embedscope(&addrs[1], V_ip6_use_defzone)) != 0) { + error = sa6_checkzone(&addrs[0]); + if (error) + return (error); + error = sa6_checkzone(&addrs[1]); + if (error) return (error); + + ifp = NULL; + zoneid = 0; + if (addrs[0].sin6_scope_id != 0) + zoneid = addrs[0].sin6_scope_id; + if (addrs[1].sin6_scope_id != 0) { + if (zoneid != 0 && zoneid != addrs[1].sin6_scope_id) + return (EINVAL); + zoneid = addrs[1].sin6_scope_id; + } + if (zoneid != 0) { + ifp = in6_getlinkifnet(zoneid); + if (ifp == NULL) + return (ENOENT); } inp = in6_pcblookup(&V_udbinfo, &addrs[1].sin6_addr, addrs[1].sin6_port, &addrs[0].sin6_addr, addrs[0].sin6_port, - INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB, NULL); + INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB, ifp); if (inp != NULL) { INP_RLOCK_ASSERT(inp); if (inp->inp_socket == NULL) From owner-svn-src-user@FreeBSD.ORG Fri Oct 25 02:40:56 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C71D17A6; Fri, 25 Oct 2013 02:40:56 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B582522A7; Fri, 25 Oct 2013 02:40:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9P2euk8051562; Fri, 25 Oct 2013 02:40:56 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9P2eu8D051560; Fri, 25 Oct 2013 02:40:56 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310250240.r9P2eu8D051560@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 25 Oct 2013 02:40:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257090 - user/ae/inet6/sys/netinet X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2013 02:40:56 -0000 Author: ae Date: Fri Oct 25 02:40:56 2013 New Revision: 257090 URL: http://svnweb.freebsd.org/changeset/base/257090 Log: Refactor tcp6_getcred(): * remove sa6_embedscope() calls, use sa6_checkzone() instead; * determine interface by zone id and pass it to in6_pcblookup. Modified: user/ae/inet6/sys/netinet/tcp_subr.c Modified: user/ae/inet6/sys/netinet/tcp_subr.c ============================================================================== --- user/ae/inet6/sys/netinet/tcp_subr.c Fri Oct 25 02:21:00 2013 (r257089) +++ user/ae/inet6/sys/netinet/tcp_subr.c Fri Oct 25 02:40:56 2013 (r257090) @@ -1329,7 +1329,9 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) { struct xucred xuc; struct sockaddr_in6 addrs[2]; + struct ifnet *ifp; struct inpcb *inp; + uint32_t zoneid; int error; #ifdef INET int mapped = 0; @@ -1341,9 +1343,25 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) error = SYSCTL_IN(req, addrs, sizeof(addrs)); if (error) return (error); - if ((error = sa6_embedscope(&addrs[0], V_ip6_use_defzone)) != 0 || - (error = sa6_embedscope(&addrs[1], V_ip6_use_defzone)) != 0) { + error = sa6_checkzone(&addrs[0]); + if (error) + return (error); + error = sa6_checkzone(&addrs[1]); + if (error) return (error); + ifp = NULL; + zoneid = 0; + if (addrs[0].sin6_scope_id != 0) + zoneid = addrs[0].sin6_scope_id; + if (addrs[1].sin6_scope_id != 0) { + if (zoneid != 0 && zoneid != addrs[1].sin6_scope_id) + return (EINVAL); + zoneid = addrs[1].sin6_scope_id; + } + if (zoneid != 0) { + ifp = in6_getlinkifnet(zoneid); + if (ifp == NULL) + return (ENOENT); } if (IN6_IS_ADDR_V4MAPPED(&addrs[0].sin6_addr)) { #ifdef INET @@ -1366,7 +1384,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) inp = in6_pcblookup(&V_tcbinfo, &addrs[1].sin6_addr, addrs[1].sin6_port, &addrs[0].sin6_addr, addrs[0].sin6_port, - INPLOOKUP_RLOCKPCB, NULL); + INPLOOKUP_RLOCKPCB, ifp); if (inp != NULL) { if (inp->inp_socket == NULL) error = ENOENT; From owner-svn-src-user@FreeBSD.ORG Fri Oct 25 02:55:05 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1410BED6; Fri, 25 Oct 2013 02:55:05 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0279A2353; Fri, 25 Oct 2013 02:55:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9P2t4R3055679; Fri, 25 Oct 2013 02:55:04 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9P2t4Zj055678; Fri, 25 Oct 2013 02:55:04 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310250255.r9P2t4Zj055678@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 25 Oct 2013 02:55:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257091 - user/ae/inet6/sys/netinet X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2013 02:55:05 -0000 Author: ae Date: Fri Oct 25 02:55:04 2013 New Revision: 257091 URL: http://svnweb.freebsd.org/changeset/base/257091 Log: Refactor sysctl_drop(): * remove sa6_embedscope() calls, use sa6_checkzone() instead; * determine interface by zone id and pass it to in6_pcblookup. Modified: user/ae/inet6/sys/netinet/tcp_subr.c Modified: user/ae/inet6/sys/netinet/tcp_subr.c ============================================================================== --- user/ae/inet6/sys/netinet/tcp_subr.c Fri Oct 25 02:40:56 2013 (r257090) +++ user/ae/inet6/sys/netinet/tcp_subr.c Fri Oct 25 02:55:04 2013 (r257091) @@ -2189,7 +2189,9 @@ sysctl_drop(SYSCTL_HANDLER_ARGS) struct tcptw *tw; struct sockaddr_in *fin, *lin; #ifdef INET6 + struct ifnet *ifp; struct sockaddr_in6 *fin6, *lin6; + uint32_t zoneid; #endif int error; @@ -2227,12 +2229,26 @@ sysctl_drop(SYSCTL_HANDLER_ARGS) lin = (struct sockaddr_in *)&addrs[1]; break; } - error = sa6_embedscope(fin6, V_ip6_use_defzone); + error = sa6_checkzone(fin6); if (error) return (error); - error = sa6_embedscope(lin6, V_ip6_use_defzone); + error = sa6_checkzone(lin6); if (error) return (error); + ifp = NULL; + zoneid = 0; + if (fin6->sin6_scope_id != 0) + zoneid = fin6->sin6_scope_id; + if (lin6->sin6_scope_id != 0) { + if (zoneid != 0 && zoneid != lin6->sin6_scope_id) + return (EINVAL); + zoneid = lin6->sin6_scope_id; + } + if (zoneid != 0) { + ifp = in6_getlinkifnet(zoneid); + if (ifp == NULL) + return (ENOENT); + } break; #endif #ifdef INET @@ -2253,7 +2269,7 @@ sysctl_drop(SYSCTL_HANDLER_ARGS) case AF_INET6: inp = in6_pcblookup(&V_tcbinfo, &fin6->sin6_addr, fin6->sin6_port, &lin6->sin6_addr, lin6->sin6_port, - INPLOOKUP_WLOCKPCB, NULL); + INPLOOKUP_WLOCKPCB, ifp); break; #endif #ifdef INET From owner-svn-src-user@FreeBSD.ORG Fri Oct 25 06:11:13 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0C07533F; Fri, 25 Oct 2013 06:11:13 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EEBDB2E71; Fri, 25 Oct 2013 06:11:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9P6BCr7023799; Fri, 25 Oct 2013 06:11:12 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9P6BCPQ023795; Fri, 25 Oct 2013 06:11:12 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310250611.r9P6BCPQ023795@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 25 Oct 2013 06:11:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257103 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2013 06:11:13 -0000 Author: ae Date: Fri Oct 25 06:11:12 2013 New Revision: 257103 URL: http://svnweb.freebsd.org/changeset/base/257103 Log: Remove the last remnant of in6_clearscope() Modified: user/ae/inet6/sys/netinet6/in6.c user/ae/inet6/sys/netinet6/ip6_input.c Modified: user/ae/inet6/sys/netinet6/in6.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6.c Fri Oct 25 06:04:21 2013 (r257102) +++ user/ae/inet6/sys/netinet6/in6.c Fri Oct 25 06:11:12 2013 (r257103) @@ -1584,7 +1584,6 @@ in6_lifaddr_ioctl(struct socket *so, u_l * link-local address. */ bcopy(IFA_IN6(ifa), &candidate, sizeof(candidate)); - in6_clearscope(&candidate); candidate.s6_addr32[0] &= mask.s6_addr32[0]; candidate.s6_addr32[1] &= mask.s6_addr32[1]; candidate.s6_addr32[2] &= mask.s6_addr32[2]; Modified: user/ae/inet6/sys/netinet6/ip6_input.c ============================================================================== --- user/ae/inet6/sys/netinet6/ip6_input.c Fri Oct 25 06:04:21 2013 (r257102) +++ user/ae/inet6/sys/netinet6/ip6_input.c Fri Oct 25 06:11:12 2013 (r257103) @@ -1127,7 +1127,6 @@ ip6_savecontrol_v4(struct inpcb *inp, st #endif } else { bcopy(&ip6->ip6_dst, &pi6.ipi6_addr, sizeof(struct in6_addr)); - in6_clearscope(&pi6.ipi6_addr); /* XXX */ } pi6.ipi6_ifindex = (m && m->m_pkthdr.rcvif) ? m->m_pkthdr.rcvif->if_index : 0; From owner-svn-src-user@FreeBSD.ORG Fri Oct 25 06:15:24 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 4EFF65D1; Fri, 25 Oct 2013 06:15:24 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3CCED2EA5; Fri, 25 Oct 2013 06:15:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9P6FOha024437; Fri, 25 Oct 2013 06:15:24 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9P6FOV1024436; Fri, 25 Oct 2013 06:15:24 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201310250615.r9P6FOV1024436@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Fri, 25 Oct 2013 06:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257104 - user/ae/inet6/sys/netinet6 X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2013 06:15:24 -0000 Author: ae Date: Fri Oct 25 06:15:23 2013 New Revision: 257104 URL: http://svnweb.freebsd.org/changeset/base/257104 Log: Don't do route lookup for link-local addresses. Modified: user/ae/inet6/sys/netinet6/in6.c Modified: user/ae/inet6/sys/netinet6/in6.c ============================================================================== --- user/ae/inet6/sys/netinet6/in6.c Fri Oct 25 06:11:12 2013 (r257103) +++ user/ae/inet6/sys/netinet6/in6.c Fri Oct 25 06:15:23 2013 (r257104) @@ -2381,16 +2381,17 @@ in6_lltable_prefix_free(struct lltable * } static int -in6_lltable_rtcheck(struct ifnet *ifp, - u_int flags, - const struct sockaddr *l3addr) +in6_lltable_rtcheck(struct ifnet *ifp, u_int flags, + const struct sockaddr_in6 *l3addr) { struct rtentry *rt; char ip6buf[INET6_ADDRSTRLEN]; - KASSERT(l3addr->sa_family == AF_INET6, - ("sin_family %d", l3addr->sa_family)); + KASSERT(l3addr->sin6_family == AF_INET6, + ("sin_family %d", l3addr->sin6_family)); + if (IN6_IS_ADDR_LINKLOCAL(&l3addr->sin6_addr)) + return (0); /* Our local addresses are always only installed on the default FIB. */ /* XXX rtalloc1 should take a const param */ rt = in6_rtalloc1(__DECONST(struct sockaddr *, l3addr), 0, 0, @@ -2410,7 +2411,7 @@ in6_lltable_rtcheck(struct ifnet *ifp, return 0; } log(LOG_INFO, "IPv6 address: \"%s\" is not on the network\n", - ip6_sprintf(ip6buf, &((const struct sockaddr_in6 *)l3addr)->sin6_addr)); + ip6_sprintf(ip6buf, &l3addr->sin6_addr)); if (rt != NULL) RTFREE_LOCKED(rt); return EINVAL; @@ -2453,7 +2454,7 @@ in6_lltable_lookup(struct lltable *llt, * verify this. */ if (!(flags & LLE_IFADDR) && - in6_lltable_rtcheck(ifp, flags, l3addr) != 0) + in6_lltable_rtcheck(ifp, flags, sin6) != 0) return NULL; lle = in6_lltable_new(l3addr, flags); From owner-svn-src-user@FreeBSD.ORG Fri Oct 25 08:41:42 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 178D3F8; Fri, 25 Oct 2013 08:41:42 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 01BD42688; Fri, 25 Oct 2013 08:41:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9P8ffVJ075340; Fri, 25 Oct 2013 08:41:41 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9P8fbrK075298; Fri, 25 Oct 2013 08:41:37 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310250841.r9P8fbrK075298@svn.freebsd.org> From: Aleksandr Rybalko Date: Fri, 25 Oct 2013 08:41:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257108 - in user/ed/newcons: . cddl/contrib/opensolaris/cmd/zfs contrib/gperf/src etc etc/mtree lib/libcrypt lib/libcrypt/tests sbin/fsck_ffs sbin/geom/class/part sbin/growfs sbin/mdco... X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2013 08:41:42 -0000 Author: ray Date: Fri Oct 25 08:41:36 2013 New Revision: 257108 URL: http://svnweb.freebsd.org/changeset/base/257108 Log: MFC @r257107. Added: user/ed/newcons/etc/mtree/BSD.tests.dist - copied unchanged from r257107, head/etc/mtree/BSD.tests.dist user/ed/newcons/share/man/man7/tests.7 - copied unchanged from r257107, head/share/man/man7/tests.7 user/ed/newcons/share/mk/plain.test.mk - copied unchanged from r257107, head/share/mk/plain.test.mk user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_spi.c - copied unchanged from r257107, head/sys/arm/broadcom/bcm2835/bcm2835_spi.c user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_spireg.h - copied unchanged from r257107, head/sys/arm/broadcom/bcm2835/bcm2835_spireg.h user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_spivar.h - copied unchanged from r257107, head/sys/arm/broadcom/bcm2835/bcm2835_spivar.h user/ed/newcons/sys/dev/iwn/if_iwn_debug.h - copied unchanged from r257107, head/sys/dev/iwn/if_iwn_debug.h user/ed/newcons/sys/dev/ofw/ofw_nexus.c - copied unchanged from r257107, head/sys/dev/ofw/ofw_nexus.c user/ed/newcons/sys/dev/ofw/ofw_nexus.h - copied unchanged from r257107, head/sys/dev/ofw/ofw_nexus.h user/ed/newcons/sys/dev/spibus/ofw_spibus.c - copied unchanged from r257107, head/sys/dev/spibus/ofw_spibus.c user/ed/newcons/sys/mips/conf/ALFA_HORNET_UB - copied unchanged from r257107, head/sys/mips/conf/ALFA_HORNET_UB user/ed/newcons/sys/mips/conf/ALFA_HORNET_UB.hints - copied unchanged from r257107, head/sys/mips/conf/ALFA_HORNET_UB.hints user/ed/newcons/tests/ - copied from r257107, head/tests/ user/ed/newcons/tools/build/options/WITHOUT_TESTS - copied unchanged from r257107, head/tools/build/options/WITHOUT_TESTS Deleted: user/ed/newcons/sys/kern/dtio_kdtrace.c user/ed/newcons/sys/mips/conf/BERI_SIM.hints user/ed/newcons/sys/modules/dtrace/dtio/ Modified: user/ed/newcons/Makefile.inc1 user/ed/newcons/ObsoleteFiles.inc user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/zfs.8 user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c user/ed/newcons/contrib/gperf/src/search.cc user/ed/newcons/etc/Makefile user/ed/newcons/etc/mtree/BSD.usr.dist user/ed/newcons/lib/libcrypt/Makefile user/ed/newcons/lib/libcrypt/tests/Makefile user/ed/newcons/sbin/fsck_ffs/ea.c user/ed/newcons/sbin/geom/class/part/geom_part.c user/ed/newcons/sbin/growfs/debug.c user/ed/newcons/sbin/mdconfig/mdconfig.c user/ed/newcons/share/man/man5/src.conf.5 user/ed/newcons/share/man/man7/Makefile user/ed/newcons/share/man/man7/hier.7 user/ed/newcons/share/mk/bsd.files.mk user/ed/newcons/share/mk/bsd.own.mk user/ed/newcons/share/mk/bsd.test.mk user/ed/newcons/sys/arm/broadcom/bcm2835/files.bcm2835 user/ed/newcons/sys/arm/conf/RPI-B user/ed/newcons/sys/arm/mv/gpio.c user/ed/newcons/sys/boot/fdt/dts/bcm2835.dtsi user/ed/newcons/sys/cam/ata/ata_da.c user/ed/newcons/sys/cam/cam_xpt.c user/ed/newcons/sys/cam/ctl/ctl_backend_block.c user/ed/newcons/sys/cam/scsi/scsi_da.c user/ed/newcons/sys/cddl/dev/dtrace/powerpc/dtrace_isa.c user/ed/newcons/sys/conf/NOTES user/ed/newcons/sys/conf/files user/ed/newcons/sys/conf/files.powerpc user/ed/newcons/sys/dev/fdt/fdt_common.c user/ed/newcons/sys/dev/fdt/fdt_pci.c user/ed/newcons/sys/dev/fdt/simplebus.c user/ed/newcons/sys/dev/iscsi/icl.c user/ed/newcons/sys/dev/iwn/if_iwn.c user/ed/newcons/sys/dev/iwn/if_iwnreg.h user/ed/newcons/sys/dev/oce/oce_hw.c user/ed/newcons/sys/dev/oce/oce_hw.h user/ed/newcons/sys/dev/oce/oce_if.c user/ed/newcons/sys/dev/oce/oce_if.h user/ed/newcons/sys/dev/oce/oce_mbox.c user/ed/newcons/sys/dev/oce/oce_queue.c user/ed/newcons/sys/dev/oce/oce_sysctl.c user/ed/newcons/sys/dev/oce/oce_util.c user/ed/newcons/sys/dev/ofw/ofw_bus.h user/ed/newcons/sys/dev/ofw/ofw_bus_if.m user/ed/newcons/sys/dev/ofw/ofw_bus_subr.c user/ed/newcons/sys/dev/ofw/ofw_console.c user/ed/newcons/sys/dev/ofw/ofw_fdt.c user/ed/newcons/sys/dev/ofw/ofw_iicbus.c user/ed/newcons/sys/dev/ofw/openfirm.c user/ed/newcons/sys/dev/pci/pci.c user/ed/newcons/sys/dev/pci/pci_private.h user/ed/newcons/sys/dev/pci/pcireg.h user/ed/newcons/sys/dev/pci/pcivar.h user/ed/newcons/sys/dev/spibus/spibus.c user/ed/newcons/sys/dev/spibus/spibusvar.h user/ed/newcons/sys/dev/uart/uart_dev_imx.c user/ed/newcons/sys/fs/ext2fs/ext2_vnops.c user/ed/newcons/sys/kern/subr_devstat.c user/ed/newcons/sys/mips/include/pte.h user/ed/newcons/sys/modules/dtrace/Makefile user/ed/newcons/sys/modules/dtrace/dtraceall/dtraceall.c user/ed/newcons/sys/net/if_tap.c user/ed/newcons/sys/net80211/ieee80211_output.c user/ed/newcons/sys/net80211/ieee80211_proto.c user/ed/newcons/sys/net80211/ieee80211_proto.h user/ed/newcons/sys/netinet6/icmp6.c user/ed/newcons/sys/powerpc/booke/platform_bare.c user/ed/newcons/sys/powerpc/include/intr_machdep.h user/ed/newcons/sys/powerpc/mpc85xx/atpic.c user/ed/newcons/sys/powerpc/ofw/ofw_pci.c user/ed/newcons/sys/powerpc/ofw/ofw_pcib_pci.c user/ed/newcons/sys/powerpc/ofw/ofw_pcibus.c user/ed/newcons/sys/powerpc/ofw/openpic_ofw.c user/ed/newcons/sys/powerpc/powermac/powermac_thermal.c user/ed/newcons/sys/powerpc/powerpc/intr_machdep.c user/ed/newcons/sys/powerpc/powerpc/nexus.c user/ed/newcons/sys/powerpc/powerpc/pic_if.m user/ed/newcons/sys/powerpc/pseries/vdevice.c user/ed/newcons/sys/sparc64/include/bus.h user/ed/newcons/sys/sparc64/include/bus_private.h user/ed/newcons/sys/sparc64/pci/fire.c user/ed/newcons/sys/sparc64/pci/psycho.c user/ed/newcons/sys/sparc64/pci/schizo.c user/ed/newcons/sys/sparc64/sbus/sbus.c user/ed/newcons/sys/sparc64/sparc64/bus_machdep.c user/ed/newcons/sys/sys/time.h user/ed/newcons/sys/ufs/ffs/ffs_vnops.c user/ed/newcons/sys/ufs/ufs/dinode.h user/ed/newcons/sys/x86/x86/io_apic.c user/ed/newcons/usr.sbin/bhyve/bhyverun.c user/ed/newcons/usr.sbin/bhyve/ioapic.c user/ed/newcons/usr.sbin/bhyve/pci_virtio_block.c user/ed/newcons/usr.sbin/bhyveload/bhyveload.c user/ed/newcons/usr.sbin/freebsd-update/freebsd-update.sh user/ed/newcons/usr.sbin/pkg/config.c user/ed/newcons/usr.sbin/pkg/config.h user/ed/newcons/usr.sbin/pkg/dns_utils.c user/ed/newcons/usr.sbin/pkg/dns_utils.h user/ed/newcons/usr.sbin/pkg/pkg.c Directory Properties: user/ed/newcons/ (props changed) user/ed/newcons/cddl/ (props changed) user/ed/newcons/cddl/contrib/opensolaris/ (props changed) user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/ (props changed) user/ed/newcons/sbin/ (props changed) user/ed/newcons/sys/ (props changed) user/ed/newcons/sys/boot/ (props changed) user/ed/newcons/sys/conf/ (props changed) user/ed/newcons/usr.sbin/bhyve/ (props changed) user/ed/newcons/usr.sbin/bhyveload/ (props changed) Modified: user/ed/newcons/Makefile.inc1 ============================================================================== --- user/ed/newcons/Makefile.inc1 Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/Makefile.inc1 Fri Oct 25 08:41:36 2013 (r257108) @@ -58,6 +58,7 @@ # use that new version. And the new (dynamically-linked) /bin/sh # will expect to find appropriate libraries in /lib and /libexec. # +SRCDIR?= ${.CURDIR} .if defined(SUBDIR_OVERRIDE) SUBDIR= ${SUBDIR_OVERRIDE} .else @@ -84,6 +85,9 @@ SUBDIR+=secure SUBDIR+=share .endif SUBDIR+=sys usr.bin usr.sbin +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif .if ${MK_OFED} != "no" SUBDIR+=contrib/ofed .endif @@ -128,10 +132,10 @@ OSRELDATE= 0 .endif .if !defined(VERSION) -REVISION!= make -C ${.CURDIR}/release -V REVISION -BRANCH!= make -C ${.CURDIR}/release -V BRANCH +REVISION!= make -C ${SRCDIR}/release -V REVISION +BRANCH!= make -C ${SRCDIR}/release -V BRANCH SRCRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ - ${.CURDIR}/sys/sys/param.h + ${SRCDIR}/sys/sys/param.h VERSION= FreeBSD ${REVISION}-${BRANCH} ${TARGET_ARCH} ${SRCRELDATE} .endif @@ -488,6 +492,10 @@ _worldtmp: mtree -deU -f ${.CURDIR}/etc/mtree/BSD.debug.dist \ -p ${WORLDTMP}/usr/lib >/dev/null .endif +.if ${MK_TESTS} != "no" + mtree -deU -f ${.CURDIR}/etc/mtree/BSD.tests.dist \ + -p ${WORLDTMP}${TESTSBASE} >/dev/null +.endif .for _mtree in ${LOCAL_MTREE} mtree -deU -f ${.CURDIR}/${_mtree} -p ${WORLDTMP} > /dev/null .endfor Modified: user/ed/newcons/ObsoleteFiles.inc ============================================================================== --- user/ed/newcons/ObsoleteFiles.inc Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/ObsoleteFiles.inc Fri Oct 25 08:41:36 2013 (r257108) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20131023: remove never used iscsi directory +OLD_DIRS+=usr/share/examples/iscsi # 20131014: libbsdyml becomes private OLD_FILES+=usr/lib/libbsdyml.a OLD_FILES+=usr/lib/libbsdyml.so @@ -2491,6 +2493,7 @@ OLD_FILES+=usr/sbin/zfs OLD_FILES+=usr/sbin/zpool # 20070423: rc.bluetooth (examples) removed OLD_FILES+=usr/share/examples/netgraph/bluetooth/rc.bluetooth +OLD_DIRS+=usr/share/examples/netgraph/bluetooth # 20070421: worm.4 removed OLD_FILES+=usr/share/man/man4/worm.4.gz # 20070417: trunk(4) renamed to lagg(4) Modified: user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Oct 25 08:41:36 2013 (r257108) @@ -25,10 +25,11 @@ .\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. .\" Copyright (c) 2013 Nexenta Systems, Inc. All Rights Reserved. .\" Copyright (c) 2013, Joyent, Inc. All rights reserved. +.\" Copyright (c) 2013, Steven Hartland .\" .\" $FreeBSD$ .\" -.Dd September 20, 2013 +.Dd October 23, 2013 .Dt ZFS 8 .Os .Sh NAME @@ -61,7 +62,7 @@ .Op , Ns ... .Sm on .Nm -.Cm snapshot +.Cm snapshot Ns | Ns Cm snap .Op Fl r .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ... .Ar filesystem@snapname Ns | Ns Ar volume@snapname @@ -157,7 +158,7 @@ .Op Fl o Ar property Ns Oo , Ns Ar property Oc Ns ... .Fl a | Ar filesystem .Nm -.Cm unmount +.Cm unmount Ns | Ns Cm umount .Op Fl f .Fl a | Ar filesystem Ns | Ns Ar mountpoint .Nm @@ -172,11 +173,11 @@ .Op Fl i Ar snapshot | Fl I Ar snapshot .Ar snapshot .Nm -.Cm receive +.Cm receive Ns | Ns Cm recv .Op Fl vnFu .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Nm -.Cm receive +.Cm receive Ns | Ns Cm recv .Op Fl vnFu .Op Fl d | e .Ar filesystem @@ -1653,7 +1654,7 @@ options, as they can destroy large porti behavior for mounted file systems in use. .It Xo .Nm -.Cm snapshot +.Cm snapshot Ns | Ns Cm snap .Op Fl r .Oo Fl o Ar property Ns = Ns Ar value Oc Ns ... .Ar filesystem@snapname Ns | Ns volume@snapname @@ -1865,7 +1866,7 @@ syntax. A comma-separated list of types to display, where .Ar type is one of -.Sy filesystem , snapshot , volume , No or Sy all . +.Sy filesystem , snapshot , snap, volume , No or Sy all . For example, specifying .Fl t Cm snapshot displays only snapshots. @@ -2194,7 +2195,7 @@ Mount the specified filesystem. .El .It Xo .Nm -.Cm unmount +.Cm unmount Ns | Ns Cm umount .Op Fl f .Fl a | Ar filesystem Ns | Ns Ar mountpoint .Xc @@ -2377,13 +2378,13 @@ on future versions of .Tn ZFS . .It Xo .Nm -.Cm receive +.Cm receive Ns | Ns Cm recv .Op Fl vnFu .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Xc .It Xo .Nm -.Cm receive +.Cm receive Ns | Ns Cm recv .Op Fl vnFu .Op Fl d | e .Ar filesystem Modified: user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Fri Oct 25 08:41:36 2013 (r257108) @@ -259,9 +259,9 @@ get_usage(zfs_help_t idx) case HELP_PROMOTE: return (gettext("\tpromote \n")); case HELP_RECEIVE: - return (gettext("\treceive [-vnFu] \n" - "\treceive [-vnFu] [-d | -e] \n")); + "\treceive|recv [-vnFu] [-d | -e] \n")); case HELP_RENAME: return (gettext("\trename [-f] " "\n" @@ -280,10 +280,10 @@ get_usage(zfs_help_t idx) case HELP_SHARE: return (gettext("\tshare <-a | filesystem>\n")); case HELP_SNAPSHOT: - return (gettext("\tsnapshot [-r] [-o property=value] ... " + return (gettext("\tsnapshot|snap [-r] [-o property=value] ... " " ...\n")); case HELP_UNMOUNT: - return (gettext("\tunmount [-f] " + return (gettext("\tunmount|umount [-f] " "<-a | filesystem|mountpoint>\n")); case HELP_UNSHARE: return (gettext("\tunshare " @@ -3027,7 +3027,7 @@ zfs_do_list(int argc, char **argv) flags &= ~ZFS_ITER_PROP_LISTSNAPS; while (*optarg != '\0') { static char *type_subopts[] = { "filesystem", - "volume", "snapshot", "all", NULL }; + "volume", "snapshot", "snap", "all", NULL }; switch (getsubopt(&optarg, type_subopts, &value)) { @@ -3038,9 +3038,10 @@ zfs_do_list(int argc, char **argv) types |= ZFS_TYPE_VOLUME; break; case 2: + case 3: types |= ZFS_TYPE_SNAPSHOT; break; - case 3: + case 4: types = ZFS_TYPE_DATASET; break; @@ -6726,6 +6727,12 @@ main(int argc, char **argv) cmdname = "receive"; /* + * The 'snap' command is an alias for 'snapshot' + */ + if (strcmp(cmdname, "snap") == 0) + cmdname = "snapshot"; + + /* * Special case '-?' */ if (strcmp(cmdname, "-?") == 0) Modified: user/ed/newcons/contrib/gperf/src/search.cc ============================================================================== --- user/ed/newcons/contrib/gperf/src/search.cc Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/contrib/gperf/src/search.cc Fri Oct 25 08:41:36 2013 (r257108) @@ -36,7 +36,10 @@ /* ============================== Portability ============================== */ /* Assume ISO C++ 'for' scoping rule. */ -#define for if (0) ; else for +/* This code is used to work around scoping issues with visual studio 6 from + * 1998. Comment it out here to queisce numerous -Wdangling-else warnings + * from clang. +#define for if (0) ; else for */ /* Dynamically allocated array with dynamic extent: Modified: user/ed/newcons/etc/Makefile ============================================================================== --- user/ed/newcons/etc/Makefile Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/etc/Makefile Fri Oct 25 08:41:36 2013 (r257108) @@ -139,6 +139,9 @@ BIN1+= regdomain.xml BIN2= netstart pccard_ether rc.suspend rc.resume MTREE= BSD.include.dist BSD.root.dist BSD.usr.dist BSD.var.dist +.if ${MK_TESTS} != "no" +MTREE+= BSD.tests.dist +.endif .if ${MK_SENDMAIL} != "no" MTREE+= BSD.sendmail.dist .endif @@ -314,6 +317,9 @@ MTREES+= mtree/BSD.debug.dist /usr/lib .if ${MK_GROFF} != "no" MTREES+= mtree/BSD.groff.dist /usr .endif +.if ${MK_TESTS} != "no" +MTREES+= mtree/BSD.tests.dist ${TESTSBASE} +.endif .if ${MK_SENDMAIL} != "no" MTREES+= mtree/BSD.sendmail.dist / .endif Copied: user/ed/newcons/etc/mtree/BSD.tests.dist (from r257107, head/etc/mtree/BSD.tests.dist) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ed/newcons/etc/mtree/BSD.tests.dist Fri Oct 25 08:41:36 2013 (r257108, copy of r257107, head/etc/mtree/BSD.tests.dist) @@ -0,0 +1,12 @@ +# $FreeBSD$ +# +# Please see the file src/etc/mtree/README before making changes to this file. +# + +/set type=dir uname=root gname=wheel mode=0755 +. + lib + libcrypt + .. + .. +.. Modified: user/ed/newcons/etc/mtree/BSD.usr.dist ============================================================================== --- user/ed/newcons/etc/mtree/BSD.usr.dist Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/etc/mtree/BSD.usr.dist Fri Oct 25 08:41:36 2013 (r257108) @@ -325,8 +325,6 @@ .. ipfw .. - iscsi - .. jails .. kld @@ -360,8 +358,6 @@ mdoc .. netgraph - bluetooth - .. .. pc-sysinstall .. Modified: user/ed/newcons/lib/libcrypt/Makefile ============================================================================== --- user/ed/newcons/lib/libcrypt/Makefile Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/lib/libcrypt/Makefile Fri Oct 25 08:41:36 2013 (r257108) @@ -37,4 +37,9 @@ WARNS?= 2 PRECIOUSLIB= +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include +.include Modified: user/ed/newcons/lib/libcrypt/tests/Makefile ============================================================================== --- user/ed/newcons/lib/libcrypt/tests/Makefile Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/lib/libcrypt/tests/Makefile Fri Oct 25 08:41:36 2013 (r257108) @@ -2,6 +2,8 @@ # exercise libcrypt +TESTSDIR= ${TESTSBASE}/lib/libcrypt + ATF_TESTS_C= crypt_tests CFLAGS+= -I${.CURDIR:H} Modified: user/ed/newcons/sbin/fsck_ffs/ea.c ============================================================================== --- user/ed/newcons/sbin/fsck_ffs/ea.c Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/sbin/fsck_ffs/ea.c Fri Oct 25 08:41:36 2013 (r257108) @@ -65,7 +65,7 @@ eascan(struct inodesc *idesc, struct ufs char dbuf[DIRBLKSIZ]; printf("Inode %ju extsize %ju\n", - (intmax_t)idesc->id_number, (intmax_t)dp->di_extsize); + (intmax_t)idesc->id_number, (uintmax_t)dp->di_extsize); if (dp->di_extsize == 0) return 0; if (dp->di_extsize <= sblock.fs_fsize) Modified: user/ed/newcons/sbin/geom/class/part/geom_part.c ============================================================================== --- user/ed/newcons/sbin/geom/class/part/geom_part.c Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/sbin/geom/class/part/geom_part.c Fri Oct 25 08:41:36 2013 (r257108) @@ -364,7 +364,11 @@ gpart_autofill_resize(struct gctl_req *r } offset = (pp->lg_stripeoffset / pp->lg_sectorsize) % alignment; - last = (off_t)strtoimax(find_geomcfg(gp, "last"), NULL, 0); + s = find_geomcfg(gp, "last"); + if (s == NULL) + errx(EXIT_FAILURE, "Final block not found for geom %s", + gp->lg_name); + last = (off_t)strtoimax(s, NULL, 0); LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { s = find_provcfg(pp, "index"); if (s == NULL) @@ -502,8 +506,16 @@ gpart_autofill(struct gctl_req *req) if (size > alignment) size = ALIGNDOWN(size, alignment); - first = (off_t)strtoimax(find_geomcfg(gp, "first"), NULL, 0); - last = (off_t)strtoimax(find_geomcfg(gp, "last"), NULL, 0); + s = find_geomcfg(gp, "first"); + if (s == NULL) + errx(EXIT_FAILURE, "Starting block not found for geom %s", + gp->lg_name); + first = (off_t)strtoimax(s, NULL, 0); + s = find_geomcfg(gp, "last"); + if (s == NULL) + errx(EXIT_FAILURE, "Final block not found for geom %s", + gp->lg_name); + last = (off_t)strtoimax(s, NULL, 0); grade = ~0ULL; a_first = ALIGNUP(first + offset, alignment); last = ALIGNDOWN(last + offset, alignment); @@ -587,12 +599,22 @@ gpart_show_geom(struct ggeom *gp, const int idx, wblocks, wname, wmax; scheme = find_geomcfg(gp, "scheme"); + if (scheme == NULL) + errx(EXIT_FAILURE, "Scheme not found for geom %s", gp->lg_name); s = find_geomcfg(gp, "first"); + if (s == NULL) + errx(EXIT_FAILURE, "Starting block not found for geom %s", + gp->lg_name); first = (off_t)strtoimax(s, NULL, 0); s = find_geomcfg(gp, "last"); + if (s == NULL) + errx(EXIT_FAILURE, "Final block not found for geom %s", + gp->lg_name); last = (off_t)strtoimax(s, NULL, 0); wblocks = strlen(s); s = find_geomcfg(gp, "state"); + if (s == NULL) + errx(EXIT_FAILURE, "State not found for geom %s", gp->lg_name); if (s != NULL && *s != 'C') s = NULL; wmax = strlen(gp->lg_name); @@ -748,6 +770,8 @@ gpart_backup(struct gctl_req *req, unsig abort(); pp = LIST_FIRST(&gp->lg_consumer)->lg_provider; s = find_geomcfg(gp, "last"); + if (s == NULL) + abort(); wblocks = strlen(s); wtype = 0; LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { @@ -757,6 +781,8 @@ gpart_backup(struct gctl_req *req, unsig wtype = i; } s = find_geomcfg(gp, "entries"); + if (s == NULL) + abort(); windex = strlen(s); printf("%s %s\n", scheme, s); LIST_FOREACH(pp, &gp->lg_provider, lg_provider) { @@ -1177,6 +1203,8 @@ gpart_bootcode(struct gctl_req *req, uns if (gp == NULL) errx(EXIT_FAILURE, "No such geom: %s.", s); s = find_geomcfg(gp, "scheme"); + if (s == NULL) + errx(EXIT_FAILURE, "Scheme not found for geom %s", gp->lg_name); vtoc8 = 0; if (strcmp(s, "VTOC8") == 0) vtoc8 = 1; Modified: user/ed/newcons/sbin/growfs/debug.c ============================================================================== --- user/ed/newcons/sbin/growfs/debug.c Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/sbin/growfs/debug.c Fri Oct 25 08:41:36 2013 (r257108) @@ -765,7 +765,7 @@ dbg_dump_ufs2_ino(struct fs *sb, const c fprintf(dbg_log, "gen int32_t 0x%08x\n", ino->di_gen); fprintf(dbg_log, "kernflags u_int32_t 0x%08x\n", ino->di_kernflags); fprintf(dbg_log, "flags u_int32_t 0x%08x\n", ino->di_flags); - fprintf(dbg_log, "extsize int32_t 0x%08x\n", ino->di_extsize); + fprintf(dbg_log, "extsize u_int32_t 0x%08x\n", ino->di_extsize); /* XXX: What do we do with di_extb[NXADDR]? */ Modified: user/ed/newcons/sbin/mdconfig/mdconfig.c ============================================================================== --- user/ed/newcons/sbin/mdconfig/mdconfig.c Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/sbin/mdconfig/mdconfig.c Fri Oct 25 08:41:36 2013 (r257108) @@ -481,12 +481,18 @@ md_list(const char *units, int opt, cons printf("\n"); /* XXX: Check if it's enough to clean everything. */ geom_stats_snapshot_free(sq); - if (((opt & OPT_UNIT) && (fflag == NULL) && ufound) || - ((opt & OPT_UNIT) == 0 && (fflag != NULL) && ffound) || - ((opt & OPT_UNIT) && (fflag != NULL) && ufound && ffound)) - return (0); - else - return (-1); + if (opt & OPT_UNIT) { + if (((fflag == NULL) && ufound) || + ((fflag == NULL) && (units != NULL) && ufound) || + ((fflag != NULL) && ffound) || + ((fflag != NULL) && (units != NULL) && ufound && ffound)) + return (0); + } else if (opt & OPT_LIST) { + if ((fflag == NULL) || + ((fflag != NULL) && ffound)) + return (0); + } + return (-1); } /* Modified: user/ed/newcons/share/man/man5/src.conf.5 ============================================================================== --- user/ed/newcons/share/man/man5/src.conf.5 Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/share/man/man5/src.conf.5 Fri Oct 25 08:41:36 2013 (r257108) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 255964 2013-10-01 07:22:04Z des .\" $FreeBSD$ -.Dd October 6, 2013 +.Dd October 24, 2013 .Dt SRC.CONF 5 .Os .Sh NAME @@ -208,10 +208,6 @@ When set, it also enforces the following .Va WITHOUT_CLANG_EXTRAS .It .Va WITHOUT_CLANG_FULL -.It -.Va WITHOUT_CLANG_IS_CC -.It -.Va WITHOUT_LLDB .El .It Va WITH_CLANG .\" from FreeBSD: head/tools/build/options/WITH_CLANG 221730 2011-05-10 11:14:40Z ru @@ -323,11 +319,7 @@ When set, it also enforces the following .It .Va WITHOUT_CLANG_FULL .It -.Va WITHOUT_CLANG_IS_CC -.It .Va WITHOUT_GROFF -.It -.Va WITHOUT_LLDB .El .It Va WITH_DEBUG_FILES .\" from FreeBSD: head/tools/build/options/WITH_DEBUG_FILES 251512 2013-06-07 21:40:02Z emaste @@ -910,7 +902,7 @@ This includes .Xr rsh 1 , etc. .It Va WITHOUT_RCS -.\" from FreeBSD: head/tools/build/options/WITHOUT_RCS 156932 2006-03-21 07:50:50Z ru +.\" from FreeBSD: head/tools/build/options/WITHOUT_RCS 256198 2013-10-09 17:07:20Z gjb Set to not build .Xr rcs 1 and related utilities. @@ -1030,13 +1022,9 @@ When set, it also enforces the following .It .Va WITHOUT_CLANG_FULL .It -.Va WITHOUT_CLANG_IS_CC -.It .Va WITHOUT_GCC .It .Va WITHOUT_GDB -.It -.Va WITHOUT_LLDB .El .It Va WITHOUT_UNBOUND .\" from FreeBSD: head/tools/build/options/WITHOUT_UNBOUND 255597 2013-09-15 14:51:23Z des Modified: user/ed/newcons/share/man/man7/Makefile ============================================================================== --- user/ed/newcons/share/man/man7/Makefile Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/share/man/man7/Makefile Fri Oct 25 08:41:36 2013 (r257108) @@ -29,6 +29,10 @@ MAN= adding_user.7 \ sticky.7 \ tuning.7 +.if ${MK_TESTS} != "no" +MAN+= tests.7 +.endif + MLINKS= intro.7 miscellaneous.7 MLINKS+= security.7 securelevel.7 MLINKS+= c99.7 c.7 Modified: user/ed/newcons/share/man/man7/hier.7 ============================================================================== --- user/ed/newcons/share/man/man7/hier.7 Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/share/man/man7/hier.7 Fri Oct 25 08:41:36 2013 (r257108) @@ -32,7 +32,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd January 21, 2010 +.Dd October 19, 2013 .Dt HIER 7 .Os .Sh NAME @@ -692,6 +692,12 @@ source code for files in source code for files in .Pa /usr/sbin .El +.Pp +.It Pa tests/ +The +.Fx +test suite. +See tests(7) for more details. .El .It Pa /var/ multi-purpose log, temporary, transient, and spool files Copied: user/ed/newcons/share/man/man7/tests.7 (from r257107, head/share/man/man7/tests.7) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ed/newcons/share/man/man7/tests.7 Fri Oct 25 08:41:36 2013 (r257108, copy of r257107, head/share/man/man7/tests.7) @@ -0,0 +1,199 @@ +.\" $FreeBSD$ +.\" $NetBSD: tests.kyua.7,v 1.2 2013/07/20 21:39:59 wiz Exp $ +.\" +.\" Copyright (c) 2010 The NetBSD Foundation, Inc. +.\" 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 NETBSD FOUNDATION, INC. AND +.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, +.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY +.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.Dd October 19, 2013 +.Dt TESTS 7 +.Os +.Sh NAME +.Nm tests +.Nd introduction to the FreeBSD test suite +.Sh DESCRIPTION +The +.Fx +test suite provides a collection of automated tests for two major purposes. +On the one hand, the test suite aids +.Em developers +in catching bugs and regressions in the code when they performing modifications +to the source tree. +On the other hand, the test suite allows +.Em end users +(and, in particular, system administrators) to verify that fresh installations +of the +.Fx +operating system behave correctly in their hardware platform and also to ensure +that the system does not suffer from regressions during regular system +operation and maintenance. +.Pp +The +.Fx +test suite is installed under the +.Pa /usr/tests +hierarchy. +.Pp +This manual page describes how to execute the test suite and how to configure +some of its optional features. +.Ss When to run the tests? +Before diving into the details of how to run the test suite, here are some +scenarios in which you should be running them: +.Bl -bullet -offset indent +.It +After a fresh installation of +.Fx +to ensure that the system works correctly on your hardware platform. +.It +After an upgrade of +.Fx +to a different version to ensure that the new code works well on your +hardware platform and that the upgrade did not introduce regressions in your +configuration. +.It +After performing changes to the source tree to catch any bugs and/or regressions +introduced by the modifications. +.It +Periodically, maybe from a +.Xr cron 8 +job, to ensure that any changes to the system (such as the installation of +third-party packages or manual modifications to configuration files) do not +introduce unexpected failures. +.El +.Ss Running the tests +First of all, you will need to install the +.Sq ports/devel/kyua +package. +.Pp +Use the following command to run the whole test suite: +.Bd -literal -offset indent +$ kyua test -k /usr/tests/Kyuafile +.Ed +.Pp +The above will go through all test programs in +.Pa /usr/tests +recursively, execute them, store their results and debugging data in Kyua +database (by default in +.Pa ~/.kyua/store.db ) , +and print a summary of the results. +This summary includes a brief count of all total tests run and how many of +them failed. +.Pp +It is possible to restrict which tests to run by providing their names in +the command line. +For example, this would execute the tests for the +.Xr cp 1 +and +.Xr cut 1 +utilities: +.Bd -literal -offset indent +$ kyua test -k /usr/tests/Kyuafile bin/cp usr.bin/cut +.Ed +.Ss Obtaining reports of the tests execution +Additional information of the results of the execution can be later extracted +from the database by using the various reporting commands of Kyua. +For example, the following would extract a plain-text report of the executed +tests and show which ones failed: +.Bd -literal -offset indent +$ kyua report +.Ed +.Pp +This other example would generate an HTML report ready to be published on a +web server: +.Bd -literal -offset indent +$ kyua report-html --output ~/public_html/tests +.Ed +.Pp +For further details on the command-line interface of Kyua, please refer +to its manual page +.Xr kyua 1 . +.\".Ss Configuring the tests +.\"Some test cases in the +.\".Fx +.\"test suite require the administrator to manually set up some configuration +.\"properties before they can run. +.\"Unless these properties are defined, the tests that require them will be marked +.\"as skipped and thus they will not be really executed. +.\".Pp +.\"Test suites are configured by defining the values to their configuration +.\"variables in +.\".Pa /usr/local/etc/kyua/kyua.conf . +.\"The format of this file is detailed in +.\".Xr kyua.conf 5 . +.\".Pp +.\"The following configuration variables are available in the +.\".Fx +.\"test suite: +.\".Bl -tag +.\".It NONE REGISTERED YET +.\"TBD. +.Ss What to do if something fails? +If there is +.Em any failure +during the execution of the test suite, please considering reporting it to the +.Fx +developers so that the failure can be analyzed and fixed. +To do so, either send a message to the appropriate mailing list or file a +problem report. +For more details please refer to: +.Bl -bullet -offset indent -compact +.It +.Lk http://lists.freebsd.org/ "FreeBSD Mailing Lists" +.It +.Lk http://www.freebsd.org/send-pr.html "Submit a FreeBSD Problem Report" +.El +.Sh FILES +.Bl -tag -compact -width usrXlocalXetcXkyuaXkyuaXconfXX +.It Pa /usr/local/etc/kyua/kyua.conf +System-wide configuration file for +.Xr kyua 1 . +.It Pa ~/.kyua/kyua.conf +User-specific configuration file for +.Xr kyua 1 ; +overrides the system file. +.It Pa ~/.kyua/store.db +Default database used by Kyua to maintain the data of the executed tests. +.It Pa /usr/tests/ +Location of the +.Fx +test suite. +.It Pa /usr/tests/Kyuafile +Top-level test suite definition file. +.El +.Sh SEE ALSO +.Xr kyua 1 . +.Sh HISTORY +The collection of test programs in +.Pa /usr/tests +first appeared in +.Fx 11.0 . +.Pp +The +.Nm +manual page first appeared in +.Nx 6.0 +and was later ported to +.Fx 11.0 . +.Sh AUTHORS +.An Julio Merino Aq Mt jmmv@google.com Modified: user/ed/newcons/share/mk/bsd.files.mk ============================================================================== --- user/ed/newcons/share/mk/bsd.files.mk Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/share/mk/bsd.files.mk Fri Oct 25 08:41:36 2013 (r257108) @@ -14,9 +14,9 @@ buildfiles: ${${group}} all: buildfiles -.if !target(installfiles) .for group in ${FILESGROUPS} .if defined(${group}) && !empty(${group}) +installfiles: installfiles-${group} ${group}OWN?= ${SHAREOWN} ${group}GRP?= ${SHAREGRP} @@ -37,7 +37,7 @@ ${group}NAME_${file:T}?= ${${group}NAME} .else ${group}NAME_${file:T}?= ${file:T} .endif -installfiles: _${group}INS_${file:T} +installfiles-${group}: _${group}INS_${file:T} _${group}INS_${file:T}: ${file} ${INSTALL} -o ${${group}OWN_${.ALLSRC:T}} \ -g ${${group}GRP_${.ALLSRC:T}} -m ${${group}MODE_${.ALLSRC:T}} \ @@ -48,7 +48,7 @@ _${group}FILES+= ${file} .endif .endfor .if !empty(_${group}FILES) -installfiles: _${group}INS +installfiles-${group}: _${group}INS _${group}INS: ${_${group}FILES} .if defined(${group}NAME) ${INSTALL} -o ${${group}OWN} -g ${${group}GRP} \ @@ -63,7 +63,5 @@ _${group}INS: ${_${group}FILES} .endif # defined(${group}) && !empty(${group}) .endfor -.endif # !target(installfiles) - realinstall: installfiles .ORDER: beforeinstall installfiles Modified: user/ed/newcons/share/mk/bsd.own.mk ============================================================================== --- user/ed/newcons/share/mk/bsd.own.mk Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/share/mk/bsd.own.mk Fri Oct 25 08:41:36 2013 (r257108) @@ -377,6 +377,7 @@ __DEFAULT_NO_OPTIONS = \ PKGTOOLS \ SHARED_TOOLCHAIN \ SVN \ + TESTS \ USB_GADGET_EXAMPLES # @@ -664,4 +665,8 @@ $xGRP= ${_gid} .endif # !_WITHOUT_SRCCONF +# Pointer to the top directory into which tests are installed. Should not be +# overriden by Makefiles, but the user may choose to set this in src.conf(5). +TESTSBASE?= /usr/tests + .endif # !target(____) Modified: user/ed/newcons/share/mk/bsd.test.mk ============================================================================== --- user/ed/newcons/share/mk/bsd.test.mk Fri Oct 25 06:48:57 2013 (r257107) +++ user/ed/newcons/share/mk/bsd.test.mk Fri Oct 25 08:41:36 2013 (r257108) @@ -12,10 +12,6 @@ .include -# Pointer to the top directory into which tests are installed. Should not be -# overriden by Makefiles, but the user may choose to set this in src.conf(5). -TESTSBASE?= /usr/tests - # Directory in which to install tests defined by the current Makefile. # Makefiles have to override this to point to a subdirectory of TESTSBASE. TESTSDIR?= . Copied: user/ed/newcons/share/mk/plain.test.mk (from r257107, head/share/mk/plain.test.mk) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ed/newcons/share/mk/plain.test.mk Fri Oct 25 08:41:36 2013 (r257108, copy of r257107, head/share/mk/plain.test.mk) @@ -0,0 +1,51 @@ +# $FreeBSD$ +# +# Logic to build and install plain test programs. A plain test programs it not +# supposed to use any specific testing framework: all it does is run some code +# and report the test's pass or fail status via a 0 or 1 exit code. + +.include + +# List of C, C++ and shell test programs to build. +# +# Programs listed here are built according to the semantics of bsd.prog.mk for +# PROGS, PROGS_CXX and SCRIPTS, respectively. +# +# Test programs registered in this manner are set to be installed into TESTSDIR +# (which should be overriden by the Makefile) and are not required to provide a +# manpage. +PLAIN_TESTS_C?= +PLAIN_TESTS_CXX?= +PLAIN_TESTS_SH?= + +.if !empty(PLAIN_TESTS_C) +PROGS+= ${PLAIN_TESTS_C} +_TESTS+= ${PLAIN_TESTS_C} +.for _T in ${PLAIN_TESTS_C} +BINDIR.${_T}= ${TESTSDIR} +MAN.${_T}?= # empty +TEST_INTERFACE.${_T}= plain +.endfor +.endif + +.if !empty(PLAIN_TESTS_CXX) +PROGS_CXX+= ${PLAIN_TESTS_CXX} +PROGS+= ${PLAIN_TESTS_CXX} +_TESTS+= ${PLAIN_TESTS_CXX} +.for _T in ${PLAIN_TESTS_CXX} +BINDIR.${_T}= ${TESTSDIR} +MAN.${_T}?= # empty +TEST_INTERFACE.${_T}= plain +.endfor +.endif + +.if !empty(PLAIN_TESTS_SH) +SCRIPTS+= ${PLAIN_TESTS_SH} +_TESTS+= ${PLAIN_TESTS_SH} +.for _T in ${PLAIN_TESTS_SH} +SCRIPTSDIR_${_T}= ${TESTSDIR} +TEST_INTERFACE.${_T}= plain +.endfor +.endif + +.include Copied: user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_spi.c (from r257107, head/sys/arm/broadcom/bcm2835/bcm2835_spi.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/ed/newcons/sys/arm/broadcom/bcm2835/bcm2835_spi.c Fri Oct 25 08:41:36 2013 (r257108, copy of r257107, head/sys/arm/broadcom/bcm2835/bcm2835_spi.c) @@ -0,0 +1,521 @@ +/*- + * Copyright (c) 2012 Oleksandr Tymoshenko + * Copyright (c) 2013 Luiz Otavio O Souza + * 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 +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include "spibus_if.h" + +static void bcm_spi_intr(void *); + +#ifdef BCM_SPI_DEBUG +static void +bcm_spi_printr(device_t dev) +{ + struct bcm_spi_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + reg = BCM_SPI_READ(sc, SPI_CS); + device_printf(dev, "CS=%b\n", reg, + "\20\1CS0\2CS1\3CPHA\4CPOL\7CSPOL" + "\10TA\11DMAEN\12INTD\13INTR\14ADCS\15REN\16LEN" + "\21DONE\22RXD\23TXD\24RXR\25RXF\26CSPOL0\27CSPOL1" + "\30CSPOL2\31DMA_LEN\32LEN_LONG"); + reg = BCM_SPI_READ(sc, SPI_CLK) & SPI_CLK_MASK; + if (reg % 2) + reg--; + if (reg == 0) + reg = 65536; + device_printf(dev, "CLK=%uMhz/%d=%luhz\n", + SPI_CORE_CLK / 1000000, reg, SPI_CORE_CLK / reg); + reg = BCM_SPI_READ(sc, SPI_DLEN) & SPI_DLEN_MASK; + device_printf(dev, "DLEN=%d\n", reg); + reg = BCM_SPI_READ(sc, SPI_LTOH) & SPI_LTOH_MASK; + device_printf(dev, "LTOH=%d\n", reg); + reg = BCM_SPI_READ(sc, SPI_DC); + device_printf(dev, "DC=RPANIC=%#x RDREQ=%#x TPANIC=%#x TDREQ=%#x\n", + (reg & SPI_DC_RPANIC_MASK) >> SPI_DC_RPANIC_SHIFT, + (reg & SPI_DC_RDREQ_MASK) >> SPI_DC_RDREQ_SHIFT, + (reg & SPI_DC_TPANIC_MASK) >> SPI_DC_TPANIC_SHIFT, + (reg & SPI_DC_TDREQ_MASK) >> SPI_DC_TDREQ_SHIFT); +} +#endif + +static void +bcm_spi_modifyreg(struct bcm_spi_softc *sc, uint32_t off, uint32_t mask, + uint32_t value) +{ + uint32_t reg; + + mtx_assert(&sc->sc_mtx, MA_OWNED); + reg = BCM_SPI_READ(sc, off); + reg &= ~mask; + reg |= value; + BCM_SPI_WRITE(sc, off, reg); +} + +static int +bcm_spi_clock_proc(SYSCTL_HANDLER_ARGS) +{ + struct bcm_spi_softc *sc; + uint32_t clk; + int error; + + sc = (struct bcm_spi_softc *)arg1; + + BCM_SPI_LOCK(sc); + clk = BCM_SPI_READ(sc, SPI_CLK); + BCM_SPI_UNLOCK(sc); + clk &= 0xffff; + if (clk == 0) + clk = 65536; + clk = SPI_CORE_CLK / clk; + + error = sysctl_handle_int(oidp, &clk, sizeof(clk), req); + if (error != 0 || req->newptr == NULL) + return (error); + + clk = SPI_CORE_CLK / clk; + if (clk <= 1) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-user@FreeBSD.ORG Fri Oct 25 21:57:03 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D0599D39; Fri, 25 Oct 2013 21:57:03 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A3AD824B2; Fri, 25 Oct 2013 21:57:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9PLv3qr049058; Fri, 25 Oct 2013 21:57:03 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9PLv3O1049057; Fri, 25 Oct 2013 21:57:03 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310252157.r9PLv3O1049057@svn.freebsd.org> From: Aleksandr Rybalko Date: Fri, 25 Oct 2013 21:57:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257137 - user/ed/newcons/sys/dev/vt/hw/intel X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2013 21:57:03 -0000 Author: ray Date: Fri Oct 25 21:57:03 2013 New Revision: 257137 URL: http://svnweb.freebsd.org/changeset/base/257137 Log: Remove not done and not used driver for intel video. Sponsored by: The FreeBSD Foundation Deleted: user/ed/newcons/sys/dev/vt/hw/intel/ From owner-svn-src-user@FreeBSD.ORG Sat Oct 26 14:57:08 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D67F1EB6; Sat, 26 Oct 2013 14:57:08 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AA85D21D2; Sat, 26 Oct 2013 14:57:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9QEv8P6006879; Sat, 26 Oct 2013 14:57:08 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9QEv81B006878; Sat, 26 Oct 2013 14:57:08 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310261457.r9QEv81B006878@svn.freebsd.org> From: Aleksandr Rybalko Date: Sat, 26 Oct 2013 14:57:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257163 - in user/ed/newcons: sys/dev/vt/tools tools/tools/vt X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2013 14:57:08 -0000 Author: ray Date: Sat Oct 26 14:57:08 2013 New Revision: 257163 URL: http://svnweb.freebsd.org/changeset/base/257163 Log: Move tools to proper place. Sponsored by: The FreeBSD Foundation Added: user/ed/newcons/tools/tools/vt/ - copied from r257107, user/ed/newcons/sys/dev/vt/tools/ Deleted: user/ed/newcons/sys/dev/vt/tools/