From owner-svn-src-stable-11@freebsd.org Sun Nov 27 05:58:48 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8BB92C58C99; Sun, 27 Nov 2016 05:58:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 664F51C83; Sun, 27 Nov 2016 05:58:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAR5wlIN016998; Sun, 27 Nov 2016 05:58:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAR5wl22016996; Sun, 27 Nov 2016 05:58:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201611270558.uAR5wl22016996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 27 Nov 2016 05:58:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309205 - stable/11/sys/geom/mirror X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Nov 2016 05:58:48 -0000 Author: mav Date: Sun Nov 27 05:58:47 2016 New Revision: 309205 URL: https://svnweb.freebsd.org/changeset/base/309205 Log: MFC r308608: Use providergone method to cover race between destroy and g_access(). Modified: stable/11/sys/geom/mirror/g_mirror.c stable/11/sys/geom/mirror/g_mirror.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/mirror/g_mirror.c ============================================================================== --- stable/11/sys/geom/mirror/g_mirror.c Sun Nov 27 01:44:31 2016 (r309204) +++ stable/11/sys/geom/mirror/g_mirror.c Sun Nov 27 05:58:47 2016 (r309205) @@ -78,12 +78,12 @@ SYSCTL_UINT(_kern_geom_mirror, OID_AUTO, static eventhandler_tag g_mirror_post_sync = NULL; static int g_mirror_shutdown = 0; -static int g_mirror_destroy_geom(struct gctl_req *req, struct g_class *mp, - struct g_geom *gp); +static g_ctl_destroy_geom_t g_mirror_destroy_geom; static g_taste_t g_mirror_taste; +static g_init_t g_mirror_init; +static g_fini_t g_mirror_fini; +static g_provgone_t g_mirror_providergone; static g_resize_t g_mirror_resize; -static void g_mirror_init(struct g_class *mp); -static void g_mirror_fini(struct g_class *mp); struct g_class g_mirror_class = { .name = G_MIRROR_CLASS_NAME, @@ -93,6 +93,7 @@ struct g_class g_mirror_class = { .destroy_geom = g_mirror_destroy_geom, .init = g_mirror_init, .fini = g_mirror_fini, + .providergone = g_mirror_providergone, .resize = g_mirror_resize }; @@ -507,6 +508,26 @@ g_mirror_destroy_disk(struct g_mirror_di } static void +g_mirror_free_device(struct g_mirror_softc *sc) +{ + + mtx_destroy(&sc->sc_queue_mtx); + mtx_destroy(&sc->sc_events_mtx); + mtx_destroy(&sc->sc_done_mtx); + sx_destroy(&sc->sc_lock); + free(sc, M_MIRROR); +} + +static void +g_mirror_providergone(struct g_provider *pp) +{ + struct g_mirror_softc *sc = pp->private; + + if ((--sc->sc_refcnt) == 0) + g_mirror_free_device(sc); +} + +static void g_mirror_destroy_device(struct g_mirror_softc *sc) { struct g_mirror_disk *disk; @@ -548,12 +569,10 @@ g_mirror_destroy_device(struct g_mirror_ g_wither_geom(sc->sc_sync.ds_geom, ENXIO); G_MIRROR_DEBUG(0, "Device %s destroyed.", gp->name); g_wither_geom(gp, ENXIO); - g_topology_unlock(); - mtx_destroy(&sc->sc_queue_mtx); - mtx_destroy(&sc->sc_events_mtx); - mtx_destroy(&sc->sc_done_mtx); sx_xunlock(&sc->sc_lock); - sx_destroy(&sc->sc_lock); + if ((--sc->sc_refcnt) == 0) + g_mirror_free_device(sc); + g_topology_unlock(); } static void @@ -866,7 +885,7 @@ g_mirror_flush_done(struct bio *bp) struct bio *pbp; pbp = bp->bio_parent; - sc = pbp->bio_to->geom->softc; + sc = pbp->bio_to->private; mtx_lock(&sc->sc_done_mtx); if (pbp->bio_error == 0) pbp->bio_error = bp->bio_error; @@ -903,7 +922,7 @@ g_mirror_regular_request(struct bio *bp) g_topology_assert_not(); pbp = bp->bio_parent; - sc = pbp->bio_to->geom->softc; + sc = pbp->bio_to->private; bp->bio_from->index--; if (bp->bio_cmd == BIO_WRITE) sc->sc_writes--; @@ -1027,7 +1046,7 @@ g_mirror_candelete(struct bio *bp) struct g_mirror_disk *disk; int *val; - sc = bp->bio_to->geom->softc; + sc = bp->bio_to->private; LIST_FOREACH(disk, &sc->sc_disks, d_next) { if (disk->d_flags & G_MIRROR_DISK_FLAG_CANDELETE) break; @@ -1052,7 +1071,7 @@ g_mirror_kernel_dump(struct bio *bp) * we will not be able to read the dump after the reboot if it will be * connected and synchronized later. Can we do something better? */ - sc = bp->bio_to->geom->softc; + sc = bp->bio_to->private; disk = LIST_FIRST(&sc->sc_disks); gkd = (struct g_kerneldump *)bp->bio_data; @@ -1112,7 +1131,7 @@ g_mirror_start(struct bio *bp) { struct g_mirror_softc *sc; - sc = bp->bio_to->geom->softc; + sc = bp->bio_to->private; /* * If sc == NULL or there are no valid disks, provider's error * should be set and g_mirror_start() should not be called at all. @@ -1619,7 +1638,7 @@ g_mirror_register_request(struct bio *bp { struct g_mirror_softc *sc; - sc = bp->bio_to->geom->softc; + sc = bp->bio_to->private; switch (bp->bio_cmd) { case BIO_READ: switch (sc->sc_balance) { @@ -1785,7 +1804,6 @@ g_mirror_try_destroy(struct g_mirror_sof } else { g_topology_unlock(); g_mirror_destroy_device(sc); - free(sc, M_MIRROR); } return (1); } @@ -2097,6 +2115,8 @@ g_mirror_launch_provider(struct g_mirror } } } + pp->private = sc; + sc->sc_refcnt++; sc->sc_provider = pp; g_error_provider(pp, 0); g_topology_unlock(); @@ -2871,9 +2891,7 @@ g_mirror_access(struct g_provider *pp, i G_MIRROR_DEBUG(2, "Access request for %s: r%dw%de%d.", pp->name, acr, acw, ace); - sc = pp->geom->softc; - if (sc == NULL && acr <= 0 && acw <= 0 && ace <= 0) - return (0); + sc = pp->private; KASSERT(sc != NULL, ("NULL softc (provider=%s).", pp->name)); g_topology_unlock(); @@ -2932,6 +2950,7 @@ g_mirror_create(struct g_class *mp, cons sc->sc_idle = 1; sc->sc_last_write = time_uptime; sc->sc_writes = 0; + sc->sc_refcnt = 1; sx_init(&sc->sc_lock, "gmirror:lock"); bioq_init(&sc->sc_queue); mtx_init(&sc->sc_queue_mtx, "gmirror:queue", NULL, MTX_DEF); @@ -2962,12 +2981,8 @@ g_mirror_create(struct g_class *mp, cons G_MIRROR_DEBUG(1, "Cannot create kernel thread for %s.", sc->sc_name); g_destroy_geom(sc->sc_sync.ds_geom); - mtx_destroy(&sc->sc_done_mtx); - mtx_destroy(&sc->sc_events_mtx); - mtx_destroy(&sc->sc_queue_mtx); - sx_destroy(&sc->sc_lock); g_destroy_geom(sc->sc_geom); - free(sc, M_MIRROR); + g_mirror_free_device(sc); return (NULL); } @@ -2990,8 +3005,6 @@ g_mirror_destroy(struct g_mirror_softc * struct g_mirror_disk *disk; g_topology_assert_not(); - if (sc == NULL) - return (ENXIO); sx_assert(&sc->sc_lock, SX_XLOCKED); if (sc->sc_provider_open != 0 || SCHEDULER_STOPPED()) { @@ -3041,7 +3054,6 @@ g_mirror_destroy(struct g_mirror_softc * G_MIRROR_DEBUG(4, "%s: Woken up %p.", __func__, &sc->sc_worker); sx_xlock(&sc->sc_lock); g_mirror_destroy_device(sc); - free(sc, M_MIRROR); return (0); } Modified: stable/11/sys/geom/mirror/g_mirror.h ============================================================================== --- stable/11/sys/geom/mirror/g_mirror.h Sun Nov 27 01:44:31 2016 (r309204) +++ stable/11/sys/geom/mirror/g_mirror.h Sun Nov 27 05:58:47 2016 (r309205) @@ -207,6 +207,7 @@ struct g_mirror_softc { int sc_idle; /* DIRTY flags removed. */ time_t sc_last_write; u_int sc_writes; + u_int sc_refcnt; /* Number of softc references */ TAILQ_HEAD(, g_mirror_event) sc_events; struct mtx sc_events_mtx; From owner-svn-src-stable-11@freebsd.org Sun Nov 27 09:10:35 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FCE2C58A0B; Sun, 27 Nov 2016 09:10:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D8DC3B71; Sun, 27 Nov 2016 09:10:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAR9AY8w094657; Sun, 27 Nov 2016 09:10:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAR9AXh7094655; Sun, 27 Nov 2016 09:10:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611270910.uAR9AXh7094655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 27 Nov 2016 09:10:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309207 - in stable/11/sys: kern ufs/ffs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Nov 2016 09:10:35 -0000 Author: kib Date: Sun Nov 27 09:10:33 2016 New Revision: 309207 URL: https://svnweb.freebsd.org/changeset/base/309207 Log: MFC r308618: Provide simple mutual exclusion between mount point update and unmount. In the update path in ffs_mount(), drop vfs_busy() reference around namei(). Modified: stable/11/sys/kern/vfs_mount.c stable/11/sys/ufs/ffs/ffs_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_mount.c ============================================================================== --- stable/11/sys/kern/vfs_mount.c Sun Nov 27 05:59:17 2016 (r309206) +++ stable/11/sys/kern/vfs_mount.c Sun Nov 27 09:10:33 2016 (r309207) @@ -934,6 +934,11 @@ vfs_domount_update( VOP_UNLOCK(vp, 0); MNT_ILOCK(mp); + if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0) { + MNT_IUNLOCK(mp); + error = EBUSY; + goto end; + } mp->mnt_flag &= ~MNT_UPDATEMASK; mp->mnt_flag |= fsflags & (MNT_RELOAD | MNT_FORCE | MNT_UPDATE | MNT_SNAPSHOT | MNT_ROOTFS | MNT_UPDATEMASK | MNT_RDONLY); @@ -1293,6 +1298,7 @@ dounmount(struct mount *mp, int flags, s vn_start_write(NULL, &mp, V_WAIT | V_MNTREF); MNT_ILOCK(mp); if ((mp->mnt_kern_flag & MNTK_UNMOUNT) != 0 || + (mp->mnt_flag & MNT_UPDATE) != 0 || !TAILQ_EMPTY(&mp->mnt_uppers)) { dounmount_cleanup(mp, coveredvp, 0); return (EBUSY); Modified: stable/11/sys/ufs/ffs/ffs_vfsops.c ============================================================================== --- stable/11/sys/ufs/ffs/ffs_vfsops.c Sun Nov 27 05:59:17 2016 (r309206) +++ stable/11/sys/ufs/ffs/ffs_vfsops.c Sun Nov 27 09:10:33 2016 (r309207) @@ -147,7 +147,7 @@ ffs_mount(struct mount *mp) struct ufsmount *ump = NULL; struct fs *fs; pid_t fsckpid = 0; - int error, flags; + int error, error1, flags; uint64_t mntorflags; accmode_t accmode; struct nameidata ndp; @@ -453,6 +453,11 @@ ffs_mount(struct mount *mp) */ if (mp->mnt_flag & MNT_SNAPSHOT) return (ffs_snapshot(mp, fspec)); + + /* + * Must not call namei() while owning busy ref. + */ + vfs_unbusy(mp); } /* @@ -460,7 +465,18 @@ ffs_mount(struct mount *mp) * and verify that it refers to a sensible disk device. */ NDINIT(&ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspec, td); - if ((error = namei(&ndp)) != 0) + error = namei(&ndp); + if ((mp->mnt_flag & MNT_UPDATE) != 0) { + /* + * Unmount does not start if MNT_UPDATE is set. Mount + * update busies mp before setting MNT_UPDATE. We + * must be able to retain our busy ref succesfully, + * without sleep. + */ + error1 = vfs_busy(mp, MBF_NOWAIT); + MPASS(error1 == 0); + } + if (error != 0) return (error); NDFREE(&ndp, NDF_ONLY_PNBUF); devvp = ndp.ni_vp; From owner-svn-src-stable-11@freebsd.org Mon Nov 28 17:22:46 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9AF9AC5A132; Mon, 28 Nov 2016 17:22:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 66B2F138C; Mon, 28 Nov 2016 17:22:46 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uASHMjTl081672; Mon, 28 Nov 2016 17:22:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uASHMjoP081671; Mon, 28 Nov 2016 17:22:45 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201611281722.uASHMjoP081671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 28 Nov 2016 17:22:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309254 - stable/11/sys/dev/usb/net X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Nov 2016 17:22:46 -0000 Author: hselasky Date: Mon Nov 28 17:22:45 2016 New Revision: 309254 URL: https://svnweb.freebsd.org/changeset/base/309254 Log: MFC r308730: Make sure MAC address is reprogrammed when if_init() callback is invoked. Else promiscious mode must be used to pass traffic. While at it fix a debug print macro. Modified: stable/11/sys/dev/usb/net/if_smsc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/net/if_smsc.c ============================================================================== --- stable/11/sys/dev/usb/net/if_smsc.c Mon Nov 28 17:06:35 2016 (r309253) +++ stable/11/sys/dev/usb/net/if_smsc.c Mon Nov 28 17:22:45 2016 (r309254) @@ -152,7 +152,7 @@ static const struct usb_device_id smsc_d device_printf((sc)->sc_ue.ue_dev, "debug: " fmt, ##args); \ } while(0) #else -#define smsc_dbg_printf(sc, fmt, args...) +#define smsc_dbg_printf(sc, fmt, args...) do { } while (0) #endif #define smsc_warn_printf(sc, fmt, args...) \ @@ -822,7 +822,6 @@ static int smsc_sethwcsum(struct smsc_so return (0); } - /** * smsc_setmacaddress - Sets the mac address in the device * @sc: driver soft context @@ -905,6 +904,9 @@ smsc_init(struct usb_ether *ue) SMSC_LOCK_ASSERT(sc, MA_OWNED); + if (smsc_setmacaddress(sc, IF_LLADDR(ifp))) + smsc_dbg_printf(sc, "setting MAC address failed\n"); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) return; From owner-svn-src-stable-11@freebsd.org Mon Nov 28 18:36:38 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4D3DC5990E; Mon, 28 Nov 2016 18:36:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89EA21916; Mon, 28 Nov 2016 18:36:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uASIabuq010499; Mon, 28 Nov 2016 18:36:37 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uASIabsc010497; Mon, 28 Nov 2016 18:36:37 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201611281836.uASIabsc010497@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 28 Nov 2016 18:36:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309258 - in stable: 10/include 10/sys/sys 11/include 11/sys/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Nov 2016 18:36:38 -0000 Author: jhb Date: Mon Nov 28 18:36:37 2016 New Revision: 309258 URL: https://svnweb.freebsd.org/changeset/base/309258 Log: MFC 307756: Define max_align_t for C11. libc++'s stddef.h includes an existing definition of max_align_t for C++11, but it is only defined for C++, not for C. In addition, GCC and clang both define an alternate version of max_align_t that uses a union of multiple types rather than a plain long double as in libc++. This adds a __max_align_t to that matches the GCC and clang definition that is mapped to max_align_t in . PR: 210890 Modified: stable/11/include/stddef.h stable/11/sys/sys/_types.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/include/stddef.h stable/10/sys/sys/_types.h Directory Properties: stable/10/ (props changed) Modified: stable/11/include/stddef.h ============================================================================== --- stable/11/include/stddef.h Mon Nov 28 17:55:32 2016 (r309257) +++ stable/11/include/stddef.h Mon Nov 28 18:36:37 2016 (r309258) @@ -62,6 +62,14 @@ typedef ___wchar_t wchar_t; #endif #endif +#if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L +#ifndef __CLANG_MAX_ALIGN_T_DEFINED +typedef __max_align_t max_align_t; +#define __CLANG_MAX_ALIGN_T_DEFINED +#define __GCC_MAX_ALIGN_T +#endif +#endif + #define offsetof(type, member) __offsetof(type, member) #endif /* _STDDEF_H_ */ Modified: stable/11/sys/sys/_types.h ============================================================================== --- stable/11/sys/sys/_types.h Mon Nov 28 17:55:32 2016 (r309257) +++ stable/11/sys/sys/_types.h Mon Nov 28 18:36:37 2016 (r309258) @@ -100,6 +100,11 @@ typedef __uint_least32_t __char32_t; #define _CHAR32_T_DECLARED #endif +typedef struct { + long long __max_align1 __aligned(_Alignof(long long)); + long double __max_align2 __aligned(_Alignof(long double)); +} __max_align_t; + typedef __uint32_t __dev_t; /* device number */ typedef __uint32_t __fixpt_t; /* fixed point number */ From owner-svn-src-stable-11@freebsd.org Mon Nov 28 22:19:43 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0513AC5A0DB; Mon, 28 Nov 2016 22:19:43 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C869D140F; Mon, 28 Nov 2016 22:19:42 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uASMJfa2098731; Mon, 28 Nov 2016 22:19:41 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uASMJfd9098730; Mon, 28 Nov 2016 22:19:41 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201611282219.uASMJfd9098730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 28 Nov 2016 22:19:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309272 - stable/11/usr.sbin/syslogd X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Nov 2016 22:19:43 -0000 Author: bapt Date: Mon Nov 28 22:19:41 2016 New Revision: 309272 URL: https://svnweb.freebsd.org/changeset/base/309272 Log: MFC r309194, r309216 Properly initialize nextp Reported by: Coverity via cem MFC after: 2 days CID: 1365665 Modified: stable/11/usr.sbin/syslogd/syslogd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/syslogd/syslogd.c ============================================================================== --- stable/11/usr.sbin/syslogd/syslogd.c Mon Nov 28 21:29:01 2016 (r309271) +++ stable/11/usr.sbin/syslogd/syslogd.c Mon Nov 28 22:19:41 2016 (r309272) @@ -1835,6 +1835,7 @@ init(int signo) free((char *)f); } Files = NULL; + nextp = &Files; /* open the configuration file */ if ((cf = fopen(ConfFile, "r")) == NULL) { From owner-svn-src-stable-11@freebsd.org Mon Nov 28 22:35:11 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 995E6C5A75E; Mon, 28 Nov 2016 22:35:11 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 688201058; Mon, 28 Nov 2016 22:35:11 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uASMZAb3006351; Mon, 28 Nov 2016 22:35:10 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uASMZAWG006350; Mon, 28 Nov 2016 22:35:10 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201611282235.uASMZAWG006350@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 28 Nov 2016 22:35:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309273 - stable/11/sys/cam/scsi X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Nov 2016 22:35:11 -0000 Author: asomers Date: Mon Nov 28 22:35:10 2016 New Revision: 309273 URL: https://svnweb.freebsd.org/changeset/base/309273 Log: MFC r308780 Fix "camcontrol rescan" with SATA drives behind a SAS controller A bug in CAM's serial number hash logic resulted in SATA drives behind a SAS controller getting removed and readded anytime the drive was rescanned for any reason Modified: stable/11/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_xpt.c Mon Nov 28 22:19:41 2016 (r309272) +++ stable/11/sys/cam/scsi/scsi_xpt.c Mon Nov 28 22:35:10 2016 (r309273) @@ -1600,8 +1600,8 @@ probe_device_check: sizeof(struct scsi_inquiry_data)); if (have_serialnum) - MD5Update(&context, serial_buf->serial_num, - serial_buf->length); + MD5Update(&context, path->device->serial_num, + path->device->serial_num_len); MD5Final(digest, &context); if (bcmp(softc->digest, digest, 16) == 0) From owner-svn-src-stable-11@freebsd.org Tue Nov 29 01:08:10 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4ADEC5A3F5; Tue, 29 Nov 2016 01:08:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6E33F1905; Tue, 29 Nov 2016 01:08:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAT189SM066117; Tue, 29 Nov 2016 01:08:09 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAT1890L066116; Tue, 29 Nov 2016 01:08:09 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201611290108.uAT1890L066116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 29 Nov 2016 01:08:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309275 - stable/11/lib/libc/gen X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Nov 2016 01:08:10 -0000 Author: emaste Date: Tue Nov 29 01:08:09 2016 New Revision: 309275 URL: https://svnweb.freebsd.org/changeset/base/309275 Log: MFC r309006: remove unnecessary vm includes from setproctitle vm headers were needed only for the PS_STRINGS fallback, which was removed in r297888. Modified: stable/11/lib/libc/gen/setproctitle.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/setproctitle.c ============================================================================== --- stable/11/lib/libc/gen/setproctitle.c Tue Nov 29 00:16:19 2016 (r309274) +++ stable/11/lib/libc/gen/setproctitle.c Tue Nov 29 01:08:09 2016 (r309275) @@ -23,10 +23,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include - #include #include #include From owner-svn-src-stable-11@freebsd.org Tue Nov 29 08:12:19 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5702BC5BB44; Tue, 29 Nov 2016 08:12:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25FAD19DE; Tue, 29 Nov 2016 08:12:19 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAT8CIv1040094; Tue, 29 Nov 2016 08:12:18 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAT8CIJW040093; Tue, 29 Nov 2016 08:12:18 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611290812.uAT8CIJW040093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 29 Nov 2016 08:12:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309277 - stable/11/sys/fs/udf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Nov 2016 08:12:19 -0000 Author: kib Date: Tue Nov 29 08:12:18 2016 New Revision: 309277 URL: https://svnweb.freebsd.org/changeset/base/309277 Log: MFC r308995: Do not dereference bp after bread(9) on error. Modified: stable/11/sys/fs/udf/udf_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/udf/udf_vnops.c ============================================================================== --- stable/11/sys/fs/udf/udf_vnops.c Tue Nov 29 04:32:14 2016 (r309276) +++ stable/11/sys/fs/udf/udf_vnops.c Tue Nov 29 08:12:18 2016 (r309277) @@ -487,11 +487,11 @@ udf_read(struct vop_read_args *ap) } else { error = bread(vp, lbn, size, NOCRED, &bp); } - n = min(n, size - bp->b_resid); - if (error) { + if (error != 0) { brelse(bp); return (error); } + n = min(n, size - bp->b_resid); error = uiomove(bp->b_data + on, (int)n, uio); brelse(bp); From owner-svn-src-stable-11@freebsd.org Tue Nov 29 08:15:13 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65BA9C5BCF0; Tue, 29 Nov 2016 08:15:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B30F1BB6; Tue, 29 Nov 2016 08:15:13 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAT8FC2N040331; Tue, 29 Nov 2016 08:15:12 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAT8FCiN040330; Tue, 29 Nov 2016 08:15:12 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611290815.uAT8FCiN040330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 29 Nov 2016 08:15:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309278 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Nov 2016 08:15:13 -0000 Author: kib Date: Tue Nov 29 08:15:12 2016 New Revision: 309278 URL: https://svnweb.freebsd.org/changeset/base/309278 Log: MFC r308969: Restore vnode pager statistic for buffer pagers. Modified: stable/11/sys/kern/vfs_bio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_bio.c ============================================================================== --- stable/11/sys/kern/vfs_bio.c Tue Nov 29 08:12:18 2016 (r309277) +++ stable/11/sys/kern/vfs_bio.c Tue Nov 29 08:15:12 2016 (r309278) @@ -4727,7 +4727,7 @@ vfs_bio_getpages(struct vnode *vp, vm_pa daddr_t lbn, lbnp; vm_ooffset_t la, lb, poff, poffe; long bsize; - int bo_bs, br_flags, error, i; + int bo_bs, br_flags, error, i, pgsin, pgsin_a, pgsin_b; bool redo, lpart; object = vp->v_object; @@ -4737,17 +4737,26 @@ vfs_bio_getpages(struct vnode *vp, vm_pa return (VM_PAGER_BAD); lpart = la + PAGE_SIZE > object->un_pager.vnp.vnp_size; bo_bs = get_blksize(vp, get_lblkno(vp, IDX_TO_OFF(ma[0]->pindex))); - if (rbehind != NULL) { - lb = IDX_TO_OFF(ma[0]->pindex); - *rbehind = OFF_TO_IDX(lb - rounddown2(lb, bo_bs)); - } - if (rahead != NULL) { - *rahead = OFF_TO_IDX(roundup2(la, bo_bs) - la); - if (la + IDX_TO_OFF(*rahead) >= object->un_pager.vnp.vnp_size) { - *rahead = OFF_TO_IDX(roundup2(object->un_pager. - vnp.vnp_size, PAGE_SIZE) - la); - } - } + + /* + * Calculate read-ahead, behind and total pages. + */ + pgsin = count; + lb = IDX_TO_OFF(ma[0]->pindex); + pgsin_b = OFF_TO_IDX(lb - rounddown2(lb, bo_bs)); + pgsin += pgsin_b; + if (rbehind != NULL) + *rbehind = pgsin_b; + pgsin_a = OFF_TO_IDX(roundup2(la, bo_bs) - la); + if (la + IDX_TO_OFF(pgsin_a) >= object->un_pager.vnp.vnp_size) + pgsin_a = OFF_TO_IDX(roundup2(object->un_pager.vnp.vnp_size, + PAGE_SIZE) - la); + pgsin += pgsin_a; + if (rahead != NULL) + *rahead = pgsin_a; + PCPU_INC(cnt.v_vnodein); + PCPU_ADD(cnt.v_vnodepgsin, pgsin); + br_flags = (mp != NULL && (mp->mnt_kern_flag & MNTK_UNMAPPED_BUFS) != 0) ? GB_UNMAPPED : 0; VM_OBJECT_WLOCK(object); From owner-svn-src-stable-11@freebsd.org Tue Nov 29 08:17:26 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D449C5BE03; Tue, 29 Nov 2016 08:17:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F06851D79; Tue, 29 Nov 2016 08:17:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAT8HPEO040505; Tue, 29 Nov 2016 08:17:25 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAT8HO2e040503; Tue, 29 Nov 2016 08:17:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611290817.uAT8HO2e040503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 29 Nov 2016 08:17:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309279 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Nov 2016 08:17:26 -0000 Author: kib Date: Tue Nov 29 08:17:24 2016 New Revision: 309279 URL: https://svnweb.freebsd.org/changeset/base/309279 Log: MFC r308973: Minor cleanup. Modified: stable/11/sys/fs/nfsclient/nfs_clbio.c stable/11/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clbio.c Tue Nov 29 08:15:12 2016 (r309278) +++ stable/11/sys/fs/nfsclient/nfs_clbio.c Tue Nov 29 08:17:24 2016 (r309279) @@ -96,8 +96,8 @@ ncl_getpages(struct vop_getpages_args *a vp = ap->a_vp; np = VTONFS(vp); - td = curthread; /* XXX */ - cred = curthread->td_ucred; /* XXX */ + td = curthread; + cred = curthread->td_ucred; nmp = VFSTONFS(vp->v_mount); pages = ap->a_m; npages = ap->a_count; Modified: stable/11/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clvnops.c Tue Nov 29 08:15:12 2016 (r309278) +++ stable/11/sys/fs/nfsclient/nfs_clvnops.c Tue Nov 29 08:17:24 2016 (r309279) @@ -105,15 +105,6 @@ extern int nfsrv_useacl; extern int nfscl_debuglevel; MALLOC_DECLARE(M_NEWNFSREQ); -/* - * Ifdef for FreeBSD-current merged buffer cache. It is unfortunate that these - * calls are not in getblk() and brelse() so that they would not be necessary - * here. - */ -#ifndef B_VMIO -#define vfs_busy_pages(bp, f) -#endif - static vop_read_t nfsfifo_read; static vop_write_t nfsfifo_write; static vop_close_t nfsfifo_close; From owner-svn-src-stable-11@freebsd.org Tue Nov 29 08:20:56 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E53A2C5C013; Tue, 29 Nov 2016 08:20:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A7B231FEE; Tue, 29 Nov 2016 08:20:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAT8Ktr3040781; Tue, 29 Nov 2016 08:20:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAT8KtG9040779; Tue, 29 Nov 2016 08:20:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611290820.uAT8KtG9040779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 29 Nov 2016 08:20:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309280 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Nov 2016 08:20:57 -0000 Author: kib Date: Tue Nov 29 08:20:55 2016 New Revision: 309280 URL: https://svnweb.freebsd.org/changeset/base/309280 Log: MFC r308980: Use buffer pager for NFS. MFC note: really do not, by default. Modified: stable/11/sys/fs/nfsclient/nfs_clbio.c stable/11/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clbio.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clbio.c Tue Nov 29 08:17:24 2016 (r309279) +++ stable/11/sys/fs/nfsclient/nfs_clbio.c Tue Nov 29 08:20:55 2016 (r309280) @@ -78,6 +78,40 @@ static int nfs_directio_write(struct vno /* * Vnode op for VM getpages. */ +SYSCTL_DECL(_vfs_nfs); +static int use_buf_pager = 0; +SYSCTL_INT(_vfs_nfs, OID_AUTO, use_buf_pager, CTLFLAG_RWTUN, + &use_buf_pager, 0, + "Use buffer pager instead of direct readrpc call"); + +static daddr_t +ncl_gbp_getblkno(struct vnode *vp, vm_ooffset_t off) +{ + + return (off / vp->v_bufobj.bo_bsize); +} + +static int +ncl_gbp_getblksz(struct vnode *vp, daddr_t lbn) +{ + struct nfsnode *np; + u_quad_t nsize; + int biosize, bcount; + + np = VTONFS(vp); + mtx_lock(&np->n_mtx); + nsize = np->n_size; + mtx_unlock(&np->n_mtx); + + biosize = vp->v_bufobj.bo_bsize; + bcount = biosize; + if ((off_t)lbn * biosize >= nsize) + bcount = 0; + else if ((off_t)(lbn + 1) * biosize > nsize) + bcount = nsize - (off_t)lbn * biosize; + return (bcount); +} + int ncl_getpages(struct vop_getpages_args *ap) { @@ -126,6 +160,10 @@ ncl_getpages(struct vop_getpages_args *a } else mtx_unlock(&nmp->nm_mtx); + if (use_buf_pager) + return (vfs_bio_getpages(vp, pages, npages, ap->a_rbehind, + ap->a_rahead, ncl_gbp_getblkno, ncl_gbp_getblksz)); + /* * If the requested page is partially valid, just return it and * allow the pager to zero-out the blanks. Partially valid pages Modified: stable/11/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clvnops.c Tue Nov 29 08:17:24 2016 (r309279) +++ stable/11/sys/fs/nfsclient/nfs_clvnops.c Tue Nov 29 08:20:55 2016 (r309280) @@ -2569,13 +2569,20 @@ ncl_commit(struct vnode *vp, u_quad_t of static int nfs_strategy(struct vop_strategy_args *ap) { - struct buf *bp = ap->a_bp; + struct buf *bp; + struct vnode *vp; struct ucred *cr; + bp = ap->a_bp; + vp = ap->a_vp; + KASSERT(bp->b_vp == vp, ("missing b_getvp")); KASSERT(!(bp->b_flags & B_DONE), ("nfs_strategy: buffer %p unexpectedly marked B_DONE", bp)); BUF_ASSERT_HELD(bp); + if (vp->v_type == VREG && bp->b_blkno == bp->b_lblkno) + bp->b_blkno = bp->b_lblkno * (vp->v_bufobj.bo_bsize / + DEV_BSIZE); if (bp->b_iocmd == BIO_READ) cr = bp->b_rcred; else @@ -2587,8 +2594,8 @@ nfs_strategy(struct vop_strategy_args *a * otherwise just do it ourselves. */ if ((bp->b_flags & B_ASYNC) == 0 || - ncl_asyncio(VFSTONFS(ap->a_vp->v_mount), bp, NOCRED, curthread)) - (void) ncl_doio(ap->a_vp, bp, cr, curthread, 1); + ncl_asyncio(VFSTONFS(vp->v_mount), bp, NOCRED, curthread)) + (void) ncl_doio(vp, bp, cr, curthread, 1); return (0); } From owner-svn-src-stable-11@freebsd.org Wed Nov 30 01:17:03 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B35C7C5B9C2; Wed, 30 Nov 2016 01:17:03 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8266B15CA; Wed, 30 Nov 2016 01:17:03 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAU1H2WZ053017; Wed, 30 Nov 2016 01:17:02 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAU1H2Yx053016; Wed, 30 Nov 2016 01:17:02 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201611300117.uAU1H2Yx053016@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 30 Nov 2016 01:17:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309303 - stable/11/sbin/dhclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2016 01:17:03 -0000 Author: brooks Date: Wed Nov 30 01:17:02 2016 New Revision: 309303 URL: https://svnweb.freebsd.org/changeset/base/309303 Log: MFC r309027: Allocate a struct ifreq rather than using a (wrong) computed size for the BIOCSETIF ioctl. The kernel always copies an entire struct ifreq and IPv4 addresses will always fit in an ifreq. On systems with pointers larger than 64-bits, the computed size will be less than the size of struct ifreq, potentially resulting in the kernel attempting to copyin memory from outside the allocation. Reviewed by: jhb Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8445 Modified: stable/11/sbin/dhclient/dispatch.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/dhclient/dispatch.c ============================================================================== --- stable/11/sbin/dhclient/dispatch.c Wed Nov 30 00:26:35 2016 (r309302) +++ stable/11/sbin/dhclient/dispatch.c Wed Nov 30 01:17:02 2016 (r309303) @@ -105,8 +105,8 @@ discover_interfaces(struct interface_inf if (foo.sin_addr.s_addr == htonl(INADDR_LOOPBACK)) continue; if (!iface->ifp) { - int len = IFNAMSIZ + ifa->ifa_addr->sa_len; - if ((tif = malloc(len)) == NULL) + if ((tif = calloc(1, sizeof(struct ifreq))) + == NULL) error("no space to remember ifp"); strlcpy(tif->ifr_name, ifa->ifa_name, IFNAMSIZ); memcpy(&tif->ifr_addr, ifa->ifa_addr, From owner-svn-src-stable-11@freebsd.org Wed Nov 30 06:20:45 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B40D5C5D399; Wed, 30 Nov 2016 06:20:45 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C9D01F86; Wed, 30 Nov 2016 06:20:45 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAU6KiP1073406; Wed, 30 Nov 2016 06:20:44 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAU6KiY2073398; Wed, 30 Nov 2016 06:20:44 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201611300620.uAU6KiY2073398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Wed, 30 Nov 2016 06:20:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309312 - in stable/11/sys: conf dev/hyperv/pcib dev/hyperv/vmbus modules/hyperv/pcib modules/hyperv/vmbus X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2016 06:20:45 -0000 Author: dexuan Date: Wed Nov 30 06:20:43 2016 New Revision: 309312 URL: https://svnweb.freebsd.org/changeset/base/309312 Log: MFC: 308723-308725,308793-308795,309127 Approved by: sephe (mentor) r308723 hyperv/vmbus: add a new method to get vcpu_id vcpu_id is host's representation of guest CPU. We get the mapping between vcpu_id and FreeBSD kernel's cpu id when VMBus driver is loaded. Later, when a driver, like the coming pcib driver, talks to the host and needs to refer to a guest CPU, the driver must use the vcpu_id. Reviewed by: jhb, sephe Approved by: sephe (mentor) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8410 r308724 hyperv/vmbus: add new vmbus methods to support PCIe pass-through The new methods will be used by the coming pcib driver. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8409 r308725 hyperv/pcib: enable PCIe pass-through (a.k.a. Discrete Device Assignment) The feature enables us to pass through physical PCIe devices to FreeBSD VM running on Hyper-V (Windows Server 2016) to get near-native performance with low CPU utilization. The patch implements a PCI bridge driver to support the feature: 1) The pcib driver talks to the host to discover device(s) and presents the device(s) to FreeBSD's pci driver via PCI configuration space (note: to access the configuration space, we don't use the standard I/O port 0xCF8/CFC method; instead, we use an MMIO-based method supplied by Hyper-V, which is very similar to the 0xCF8/CFC method). 2) The pcib driver allocates resources for the device(s) and initialize the related BARs, when the device driver's attach method is invoked; 3) The pcib driver talks to the host to create MSI/MSI-X interrupt remapping between the guest and the host; 4) The pcib driver supports device hot add/remove. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8332 r308793 hyperv/pcib: Fix the build for some kernel configs Add the dependency on pci explicitly for the pcib and vmbus drivers. The related Makefiles are updated accordingly too. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft r308794 hyperv/vmbus,pcib: Add MODULE_DEPEND on pci We'd better add this dependency explicitly, though usually the pci driver is built into the kernel by default. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft r308795 hyperv/pcib: change the file name: pcib.c -> vmbus_pcib.c This makes the file name and the variable naming in the file consistent. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft r309127 hyperv/vmbus,pcib: unbreak build in case NEW_PCIB is undefined vmbus_pcib requires NEW_PCIB, but in case that's not defined, we at least shouldn't break build. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft Added: stable/11/sys/dev/hyperv/pcib/ - copied from r308725, head/sys/dev/hyperv/pcib/ stable/11/sys/dev/hyperv/pcib/vmbus_pcib.c - copied, changed from r308795, head/sys/dev/hyperv/pcib/vmbus_pcib.c stable/11/sys/modules/hyperv/pcib/ - copied from r308725, head/sys/modules/hyperv/pcib/ Deleted: stable/11/sys/dev/hyperv/pcib/pcib.c Modified: stable/11/sys/conf/files.amd64 stable/11/sys/conf/files.i386 stable/11/sys/dev/hyperv/vmbus/vmbus.c stable/11/sys/dev/hyperv/vmbus/vmbus_if.m stable/11/sys/dev/hyperv/vmbus/vmbus_var.h stable/11/sys/modules/hyperv/pcib/Makefile stable/11/sys/modules/hyperv/vmbus/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/conf/files.amd64 ============================================================================== --- stable/11/sys/conf/files.amd64 Wed Nov 30 05:28:39 2016 (r309311) +++ stable/11/sys/conf/files.amd64 Wed Nov 30 06:20:43 2016 (r309312) @@ -292,6 +292,7 @@ dev/hwpmc/hwpmc_uncore.c optional hwpmc dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc +dev/hyperv/pcib/vmbus_pcib.c optional hyperv pci dev/hyperv/netvsc/hn_nvs.c optional hyperv dev/hyperv/netvsc/hn_rndis.c optional hyperv dev/hyperv/netvsc/if_hn.c optional hyperv @@ -303,7 +304,7 @@ dev/hyperv/utilities/hv_timesync.c opt dev/hyperv/utilities/hv_util.c optional hyperv dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv -dev/hyperv/vmbus/vmbus.c optional hyperv +dev/hyperv/vmbus/vmbus.c optional hyperv pci dev/hyperv/vmbus/vmbus_br.c optional hyperv dev/hyperv/vmbus/vmbus_chan.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv Modified: stable/11/sys/conf/files.i386 ============================================================================== --- stable/11/sys/conf/files.i386 Wed Nov 30 05:28:39 2016 (r309311) +++ stable/11/sys/conf/files.i386 Wed Nov 30 06:20:43 2016 (r309312) @@ -249,6 +249,7 @@ dev/hwpmc/hwpmc_piv.c optional hwpmc dev/hwpmc/hwpmc_ppro.c optional hwpmc dev/hwpmc/hwpmc_tsc.c optional hwpmc dev/hwpmc/hwpmc_x86.c optional hwpmc +dev/hyperv/pcib/vmbus_pcib.c optional hyperv pci dev/hyperv/netvsc/hn_nvs.c optional hyperv dev/hyperv/netvsc/hn_rndis.c optional hyperv dev/hyperv/netvsc/if_hn.c optional hyperv @@ -260,7 +261,7 @@ dev/hyperv/utilities/hv_timesync.c opt dev/hyperv/utilities/hv_util.c optional hyperv dev/hyperv/vmbus/hyperv.c optional hyperv dev/hyperv/vmbus/hyperv_busdma.c optional hyperv -dev/hyperv/vmbus/vmbus.c optional hyperv +dev/hyperv/vmbus/vmbus.c optional hyperv pci dev/hyperv/vmbus/vmbus_br.c optional hyperv dev/hyperv/vmbus/vmbus_chan.c optional hyperv dev/hyperv/vmbus/vmbus_et.c optional hyperv Copied and modified: stable/11/sys/dev/hyperv/pcib/vmbus_pcib.c (from r308795, head/sys/dev/hyperv/pcib/vmbus_pcib.c) ============================================================================== --- head/sys/dev/hyperv/pcib/vmbus_pcib.c Fri Nov 18 06:44:18 2016 (r308795, copy source) +++ stable/11/sys/dev/hyperv/pcib/vmbus_pcib.c Wed Nov 30 06:20:43 2016 (r309312) @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#ifdef NEW_PCIB + #include #include #include @@ -1789,3 +1791,5 @@ DEFINE_CLASS_0(pcib, vmbus_pcib_driver, DRIVER_MODULE(vmbus_pcib, vmbus, vmbus_pcib_driver, pcib_devclass, 0, 0); MODULE_DEPEND(vmbus_pcib, vmbus, 1, 1, 1); MODULE_DEPEND(vmbus_pcib, pci, 1, 1, 1); + +#endif /* NEW_PCIB */ Modified: stable/11/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus.c Wed Nov 30 05:28:39 2016 (r309311) +++ stable/11/sys/dev/hyperv/vmbus/vmbus.c Wed Nov 30 06:20:43 2016 (r309312) @@ -44,10 +44,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include +#include #include #include +#include #include #include @@ -58,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include "acpi_if.h" +#include "pcib_if.h" #include "vmbus_if.h" #define VMBUS_GPADL_START 0xe1e10 @@ -74,9 +78,25 @@ static int vmbus_read_ivar(device_t, d uintptr_t *); static int vmbus_child_pnpinfo_str(device_t, device_t, char *, size_t); +static struct resource *vmbus_alloc_resource(device_t dev, + device_t child, int type, int *rid, + rman_res_t start, rman_res_t end, + rman_res_t count, u_int flags); +static int vmbus_alloc_msi(device_t bus, device_t dev, + int count, int maxcount, int *irqs); +static int vmbus_release_msi(device_t bus, device_t dev, + int count, int *irqs); +static int vmbus_alloc_msix(device_t bus, device_t dev, + int *irq); +static int vmbus_release_msix(device_t bus, device_t dev, + int irq); +static int vmbus_map_msi(device_t bus, device_t dev, + int irq, uint64_t *addr, uint32_t *data); static uint32_t vmbus_get_version_method(device_t, device_t); static int vmbus_probe_guid_method(device_t, device_t, const struct hyperv_guid *); +static uint32_t vmbus_get_vcpu_id_method(device_t bus, + device_t dev, int cpu); static int vmbus_init(struct vmbus_softc *); static int vmbus_connect(struct vmbus_softc *, uint32_t); @@ -131,10 +151,27 @@ static device_method_t vmbus_methods[] = DEVMETHOD(bus_print_child, bus_generic_print_child), DEVMETHOD(bus_read_ivar, vmbus_read_ivar), DEVMETHOD(bus_child_pnpinfo_str, vmbus_child_pnpinfo_str), + DEVMETHOD(bus_alloc_resource, vmbus_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), +#if __FreeBSD_version >= 1100000 + DEVMETHOD(bus_get_cpus, bus_generic_get_cpus), +#endif + + /* pcib interface */ + DEVMETHOD(pcib_alloc_msi, vmbus_alloc_msi), + DEVMETHOD(pcib_release_msi, vmbus_release_msi), + DEVMETHOD(pcib_alloc_msix, vmbus_alloc_msix), + DEVMETHOD(pcib_release_msix, vmbus_release_msix), + DEVMETHOD(pcib_map_msi, vmbus_map_msi), /* Vmbus interface */ DEVMETHOD(vmbus_get_version, vmbus_get_version_method), DEVMETHOD(vmbus_probe_guid, vmbus_probe_guid_method), + DEVMETHOD(vmbus_get_vcpu_id, vmbus_get_vcpu_id_method), DEVMETHOD_END }; @@ -149,6 +186,7 @@ static devclass_t vmbus_devclass; DRIVER_MODULE(vmbus, acpi, vmbus_driver, vmbus_devclass, NULL, NULL); MODULE_DEPEND(vmbus, acpi, 1, 1, 1); +MODULE_DEPEND(vmbus, pci, 1, 1, 1); MODULE_VERSION(vmbus, 1); static __inline struct vmbus_softc * @@ -972,6 +1010,74 @@ vmbus_sysctl_version(SYSCTL_HANDLER_ARGS return sysctl_handle_string(oidp, verstr, sizeof(verstr), req); } +/* + * We need the function to make sure the MMIO resource is allocated from the + * ranges found in _CRS. + * + * For the release function, we can use bus_generic_release_resource(). + */ +static struct resource * +vmbus_alloc_resource(device_t dev, device_t child, int type, int *rid, + rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) +{ + device_t parent = device_get_parent(dev); + struct resource *res; + +#ifdef NEW_PCIB + if (type == SYS_RES_MEMORY) { + struct vmbus_softc *sc = device_get_softc(dev); + + res = pcib_host_res_alloc(&sc->vmbus_mmio_res, child, type, + rid, start, end, count, flags); + } else +#endif + { + res = BUS_ALLOC_RESOURCE(parent, child, type, rid, start, + end, count, flags); + } + + return (res); +} + +static device_t +get_nexus(device_t vmbus) +{ + device_t acpi = device_get_parent(vmbus); + device_t nexus = device_get_parent(acpi); + return (nexus); +} + +static int +vmbus_alloc_msi(device_t bus, device_t dev, int count, int maxcount, int *irqs) +{ + return (PCIB_ALLOC_MSI(get_nexus(bus), dev, count, maxcount, irqs)); +} + +static int +vmbus_release_msi(device_t bus, device_t dev, int count, int *irqs) +{ + return (PCIB_RELEASE_MSI(get_nexus(bus), dev, count, irqs)); +} + +static int +vmbus_alloc_msix(device_t bus, device_t dev, int *irq) +{ + return (PCIB_ALLOC_MSIX(get_nexus(bus), dev, irq)); +} + +static int +vmbus_release_msix(device_t bus, device_t dev, int irq) +{ + return (PCIB_RELEASE_MSIX(get_nexus(bus), dev, irq)); +} + +static int +vmbus_map_msi(device_t bus, device_t dev, int irq, uint64_t *addr, + uint32_t *data) +{ + return (PCIB_MAP_MSI(get_nexus(bus), dev, irq, addr, data)); +} + static uint32_t vmbus_get_version_method(device_t bus, device_t dev) { @@ -991,6 +1097,148 @@ vmbus_probe_guid_method(device_t bus, de return ENXIO; } +static uint32_t +vmbus_get_vcpu_id_method(device_t bus, device_t dev, int cpu) +{ + const struct vmbus_softc *sc = device_get_softc(bus); + + return (VMBUS_PCPU_GET(sc, vcpuid, cpu)); +} + +#ifdef NEW_PCIB +#define VTPM_BASE_ADDR 0xfed40000 +#define FOUR_GB (1ULL << 32) + +enum parse_pass { parse_64, parse_32 }; + +struct parse_context { + device_t vmbus_dev; + enum parse_pass pass; +}; + +static ACPI_STATUS +parse_crs(ACPI_RESOURCE *res, void *ctx) +{ + const struct parse_context *pc = ctx; + device_t vmbus_dev = pc->vmbus_dev; + + struct vmbus_softc *sc = device_get_softc(vmbus_dev); + UINT64 start, end; + + switch (res->Type) { + case ACPI_RESOURCE_TYPE_ADDRESS32: + start = res->Data.Address32.Address.Minimum; + end = res->Data.Address32.Address.Maximum; + break; + + case ACPI_RESOURCE_TYPE_ADDRESS64: + start = res->Data.Address64.Address.Minimum; + end = res->Data.Address64.Address.Maximum; + break; + + default: + /* Unused types. */ + return (AE_OK); + } + + /* + * We don't use <1MB addresses. + */ + if (end < 0x100000) + return (AE_OK); + + /* Don't conflict with vTPM. */ + if (end >= VTPM_BASE_ADDR && start < VTPM_BASE_ADDR) + end = VTPM_BASE_ADDR - 1; + + if ((pc->pass == parse_32 && start < FOUR_GB) || + (pc->pass == parse_64 && start >= FOUR_GB)) + pcib_host_res_decodes(&sc->vmbus_mmio_res, SYS_RES_MEMORY, + start, end, 0); + + return (AE_OK); +} + +static void +vmbus_get_crs(device_t dev, device_t vmbus_dev, enum parse_pass pass) +{ + struct parse_context pc; + ACPI_STATUS status; + + if (bootverbose) + device_printf(dev, "walking _CRS, pass=%d\n", pass); + + pc.vmbus_dev = vmbus_dev; + pc.pass = pass; + status = AcpiWalkResources(acpi_get_handle(dev), "_CRS", + parse_crs, &pc); + + if (bootverbose && ACPI_FAILURE(status)) + device_printf(dev, "_CRS: not found, pass=%d\n", pass); +} + +static void +vmbus_get_mmio_res_pass(device_t dev, enum parse_pass pass) +{ + device_t acpi0, pcib0 = NULL; + device_t *children; + int i, count; + + /* Try to find _CRS on VMBus device */ + vmbus_get_crs(dev, dev, pass); + + /* Try to find _CRS on VMBus device's parent */ + acpi0 = device_get_parent(dev); + vmbus_get_crs(acpi0, dev, pass); + + /* Try to locate pcib0 and find _CRS on it */ + if (device_get_children(acpi0, &children, &count) != 0) + return; + + for (i = 0; i < count; i++) { + if (!device_is_attached(children[i])) + continue; + + if (strcmp("pcib0", device_get_nameunit(children[i]))) + continue; + + pcib0 = children[i]; + break; + } + + if (pcib0) + vmbus_get_crs(pcib0, dev, pass); + + free(children, M_TEMP); +} + +static void +vmbus_get_mmio_res(device_t dev) +{ + struct vmbus_softc *sc = device_get_softc(dev); + /* + * We walk the resources twice to make sure that: in the resource + * list, the 32-bit resources appear behind the 64-bit resources. + * NB: resource_list_add() uses INSERT_TAIL. This way, when we + * iterate through the list to find a range for a 64-bit BAR in + * vmbus_alloc_resource(), we can make sure we try to use >4GB + * ranges first. + */ + pcib_host_res_init(dev, &sc->vmbus_mmio_res); + + vmbus_get_mmio_res_pass(dev, parse_64); + vmbus_get_mmio_res_pass(dev, parse_32); +} + +static void +vmbus_free_mmio_res(device_t dev) +{ + struct vmbus_softc *sc = device_get_softc(dev); + + pcib_host_res_free(dev, &sc->vmbus_mmio_res); +} +#endif /* NEW_PCIB */ + static int vmbus_probe(device_t dev) { @@ -1027,6 +1275,11 @@ vmbus_doattach(struct vmbus_softc *sc) if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED) return (0); + +#ifdef NEW_PCIB + vmbus_get_mmio_res(sc->vmbus_dev); +#endif + sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; sc->vmbus_gpadl = VMBUS_GPADL_START; @@ -1173,6 +1426,10 @@ vmbus_detach(device_t dev) mtx_destroy(&sc->vmbus_prichan_lock); mtx_destroy(&sc->vmbus_chan_lock); +#ifdef NEW_PCIB + vmbus_free_mmio_res(dev); +#endif + return (0); } Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_if.m ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_if.m Wed Nov 30 05:28:39 2016 (r309311) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_if.m Wed Nov 30 06:20:43 2016 (r309312) @@ -45,3 +45,9 @@ METHOD int probe_guid { device_t dev; const struct hyperv_guid *guid; }; + +METHOD uint32_t get_vcpu_id { + device_t bus; + device_t dev; + int cpu; +}; Modified: stable/11/sys/dev/hyperv/vmbus/vmbus_var.h ============================================================================== --- stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Wed Nov 30 05:28:39 2016 (r309311) +++ stable/11/sys/dev/hyperv/vmbus/vmbus_var.h Wed Nov 30 06:20:43 2016 (r309312) @@ -31,8 +31,11 @@ #include #include +#include #include +#include +#include /* * NOTE: DO NOT CHANGE THIS. @@ -77,6 +80,10 @@ struct vmbus_pcpu_data { struct task message_task; /* message task */ } __aligned(CACHE_LINE_SIZE); +#if __FreeBSD_version < 1100000 +typedef u_long rman_res_t; +#endif + struct vmbus_softc { void (*vmbus_event_proc)(struct vmbus_softc *, int); u_long *vmbus_tx_evtflags; @@ -120,6 +127,11 @@ struct vmbus_softc { /* Complete channel list */ struct mtx vmbus_chan_lock; TAILQ_HEAD(, vmbus_channel) vmbus_chans; + +#ifdef NEW_PCIB + /* The list of usable MMIO ranges for PCIe pass-through */ + struct pcib_host_resources vmbus_mmio_res; +#endif }; #define VMBUS_FLAG_ATTACHED 0x0001 /* vmbus was attached */ Modified: stable/11/sys/modules/hyperv/pcib/Makefile ============================================================================== --- head/sys/modules/hyperv/pcib/Makefile Wed Nov 16 09:25:00 2016 (r308725) +++ stable/11/sys/modules/hyperv/pcib/Makefile Wed Nov 30 06:20:43 2016 (r309312) @@ -4,8 +4,8 @@ ${.CURDIR}/../../../dev/hyperv/vmbus KMOD= vmbus_pcib -SRCS= pcib.c -SRCS+= bus_if.h device_if.h vmbus_if.h +SRCS= vmbus_pcib.c +SRCS+= bus_if.h device_if.h pci_if.h pcib_if.h vmbus_if.h CFLAGS+= -I${.CURDIR}/../../../dev/hyperv/pcib Modified: stable/11/sys/modules/hyperv/vmbus/Makefile ============================================================================== --- stable/11/sys/modules/hyperv/vmbus/Makefile Wed Nov 30 05:28:39 2016 (r309311) +++ stable/11/sys/modules/hyperv/vmbus/Makefile Wed Nov 30 06:20:43 2016 (r309312) @@ -13,7 +13,7 @@ SRCS= hyperv.c \ vmbus_et.c \ vmbus_if.c \ vmbus_xact.c -SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h vmbus_if.h +SRCS+= acpi_if.h bus_if.h device_if.h opt_acpi.h pci_if.h pcib_if.h vmbus_if.h # XXX: for assym.s SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h opt_compat.h From owner-svn-src-stable-11@freebsd.org Wed Nov 30 07:22:47 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0813C5C0BF; Wed, 30 Nov 2016 07:22:47 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAAAB1B1B; Wed, 30 Nov 2016 07:22:47 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAU7Mk1N001320; Wed, 30 Nov 2016 07:22:46 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAU7MkHZ001317; Wed, 30 Nov 2016 07:22:46 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201611300722.uAU7MkHZ001317@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Wed, 30 Nov 2016 07:22:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309315 - in stable/11: . share/man/man4 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2016 07:22:47 -0000 Author: dexuan Date: Wed Nov 30 07:22:46 2016 New Revision: 309315 URL: https://svnweb.freebsd.org/changeset/base/309315 Log: MFC 308797-308799, 309082 r308797 update the hv_vmbus(4) manual by adding a dependency on pci We enhanced the vmbus driver to support PCIe pass-through recently. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft r308798 remove the hv_ata_pci_disengage(4) manual A few months ago, we removed the driver, which was not necessary any longer. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft r308799 fix share/man/man4/Makefile for hv_ata_pci_disengage.4 We need to remove the line since we removed the related manual just now. Reviewed by: sephe Approved by: sephe (mentor) Sponsored by: Microsoft r309082 share/man/man4/Makefile: Only install Hyper-V man pages on amd64 and i386 We shouldn't install them on the architectures not supported by Hyper-V. And, hv_ata_pci_disengage.4.gz should be removed from all architectures: 1) It should have only applied to Hyper-V; 2) For Hyper-V platforms (amd64 and i386), the related driver was removed by r306426 | sephe | 2016-09-29 09:41:52 +0800 (Thu, 29 Sep 2016), because now we have a better mechanism to disble the ata driver for hard disks when the VM runs on Hyper-V. Reviewed by: sephe, andrew, jhb Approved by: sephe (mentor) Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D8572 Deleted: stable/11/share/man/man4/hv_ata_pci_disengage.4 Modified: stable/11/ObsoleteFiles.inc stable/11/share/man/man4/Makefile stable/11/share/man/man4/hv_vmbus.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/ObsoleteFiles.inc ============================================================================== --- stable/11/ObsoleteFiles.inc Wed Nov 30 07:16:29 2016 (r309314) +++ stable/11/ObsoleteFiles.inc Wed Nov 30 07:22:46 2016 (r309315) @@ -38,6 +38,17 @@ # xargs -n1 | sort | uniq -d; # done +# 20161121: Hyper-V manuals only apply to amd64 and i386. +.if ${TARGET_ARCH} != "amd64" && ${TARGET_ARCH} != "i386" +OLD_FILES+=usr/share/man/man4/hv_kvp.4.gz +OLD_FILES+=usr/share/man/man4/hv_netvsc.4.gz +OLD_FILES+=usr/share/man/man4/hv_storvsc.4.gz +OLD_FILES+=usr/share/man/man4/hv_utils.4.gz +OLD_FILES+=usr/share/man/man4/hv_vmbus.4.gz +OLD_FILES+=usr/share/man/man4/hv_vss.4.gz +.endif +# 20161118: Remove hv_ata_pci_disengage(4) +OLD_FILES+=usr/share/man/man4/hv_ata_pci_disengage.4.gz # 20161015: remove link to removed m_getclr(9) macro OLD_FILES+=usr/share/man/man9/m_getclr.9.gz # 20160703: POSIXify locales with variants Modified: stable/11/share/man/man4/Makefile ============================================================================== --- stable/11/share/man/man4/Makefile Wed Nov 30 07:16:29 2016 (r309314) +++ stable/11/share/man/man4/Makefile Wed Nov 30 07:22:46 2016 (r309315) @@ -187,12 +187,11 @@ MAN= aac.4 \ ${_hptmv.4} \ ${_hptnr.4} \ ${_hptrr.4} \ - hv_ata_pci_disengage.4 \ - hv_kvp.4 \ - hv_netvsc.4 \ - hv_storvsc.4 \ - hv_utils.4 \ - hv_vmbus.4 \ + ${_hv_kvp.4} \ + ${_hv_netvsc.4} \ + ${_hv_storvsc.4} \ + ${_hv_utils.4} \ + ${_hv_vmbus.4} \ hwpmc.4 \ ichsmb.4 \ ${_ichwd.4} \ @@ -776,6 +775,11 @@ _hptiop.4= hptiop.4 _hptmv.4= hptmv.4 _hptnr.4= hptnr.4 _hptrr.4= hptrr.4 +_hv_kvp.4= hv_kvp.4 +_hv_netvsc.4= hv_netvsc.4 +_hv_storvsc.4= hv_storvsc.4 +_hv_utils.4= hv_utils.4 +_hv_vmbus.4= hv_vmbus.4 _i8254.4= i8254.4 _ichwd.4= ichwd.4 _if_bxe.4= if_bxe.4 Modified: stable/11/share/man/man4/hv_vmbus.4 ============================================================================== --- stable/11/share/man/man4/hv_vmbus.4 Wed Nov 30 07:16:29 2016 (r309314) +++ stable/11/share/man/man4/hv_vmbus.4 Wed Nov 30 07:22:46 2016 (r309315) @@ -35,6 +35,7 @@ To compile this driver into the kernel, the system kernel configuration file: .Bd -ragged -offset indent .Cd "device hyperv" +.Cd "device pci" .Ed .Sh DESCRIPTION The @@ -73,7 +74,6 @@ the interface that facilitate high perfo between the VSCs and VSPs. All VSCs utilize the VMBus driver. .Sh SEE ALSO -.Xr hv_ata_pci_disengage 4 , .Xr hv_netvsc 4 , .Xr hv_storvsc 4 , .Xr hv_utils 4 From owner-svn-src-stable-11@freebsd.org Wed Nov 30 12:06:04 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6294CC5B617; Wed, 30 Nov 2016 12:06:04 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31C801C5E; Wed, 30 Nov 2016 12:06:04 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAUC63ov014679; Wed, 30 Nov 2016 12:06:03 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAUC63Lb014678; Wed, 30 Nov 2016 12:06:03 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201611301206.uAUC63Lb014678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 30 Nov 2016 12:06:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309325 - stable/11/lib/libstand X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2016 12:06:04 -0000 Author: bapt Date: Wed Nov 30 12:06:03 2016 New Revision: 309325 URL: https://svnweb.freebsd.org/changeset/base/309325 Log: MFC r308129: When issuing a PXE dhcp request, always issue a param request (DHCP option 55) with all dhcp parameters we might be interested in. Some DHCP server like the new kea (by ISC) expect it. This makes pxeboot functional with ISC kea. Submitted by: Vincent Legout Sponsored by: Gandi.net Modified: stable/11/lib/libstand/bootp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libstand/bootp.c ============================================================================== --- stable/11/lib/libstand/bootp.c Wed Nov 30 10:17:03 2016 (r309324) +++ stable/11/lib/libstand/bootp.c Wed Nov 30 12:06:03 2016 (r309325) @@ -148,7 +148,17 @@ bootp(sock, flag) bp->bp_vend[7] = TAG_CLASSID; bp->bp_vend[8] = 9; bcopy("PXEClient", &bp->bp_vend[9], 9); - bp->bp_vend[18] = TAG_END; + bp->bp_vend[18] = TAG_PARAM_REQ; + bp->bp_vend[19] = 8; + bp->bp_vend[20] = TAG_ROOTPATH; + bp->bp_vend[21] = TAG_TFTP_SERVER; + bp->bp_vend[22] = TAG_HOSTNAME; + bp->bp_vend[23] = TAG_SWAPSERVER; + bp->bp_vend[24] = TAG_GATEWAY; + bp->bp_vend[25] = TAG_SUBNET_MASK; + bp->bp_vend[26] = TAG_INTF_MTU; + bp->bp_vend[27] = TAG_SERVERID; + bp->bp_vend[28] = TAG_END; } else bp->bp_vend[7] = TAG_END; #else From owner-svn-src-stable-11@freebsd.org Wed Nov 30 18:26:23 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0E1FC5DEDD; Wed, 30 Nov 2016 18:26:23 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A5C3110A0; Wed, 30 Nov 2016 18:26:23 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAUIQMIC071607; Wed, 30 Nov 2016 18:26:22 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAUIQMTh071606; Wed, 30 Nov 2016 18:26:22 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201611301826.uAUIQMTh071606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Wed, 30 Nov 2016 18:26:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309330 - stable/11/usr.bin/locale X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2016 18:26:24 -0000 Author: vangyzen Date: Wed Nov 30 18:26:22 2016 New Revision: 309330 URL: https://svnweb.freebsd.org/changeset/base/309330 Log: MFC r308824 locale: fix display of "grouping" and "mon_grouping" values The "grouping" and "mon_grouping" values are arrays of one-byte integers, not arrays of ASCII characters. Display them in a format similar to GNU and MacOS. Sponsored by: Dell EMC Modified: stable/11/usr.bin/locale/locale.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/locale/locale.c ============================================================================== --- stable/11/usr.bin/locale/locale.c Wed Nov 30 18:11:35 2016 (r309329) +++ stable/11/usr.bin/locale/locale.c Wed Nov 30 18:26:22 2016 (r309330) @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -50,6 +51,7 @@ #include "setlocale.h" /* Local prototypes */ +char *format_grouping(const char *); void init_locales_list(void); void list_charmaps(void); void list_locales(void); @@ -488,6 +490,34 @@ showlocale(void) printf("LC_ALL=%s\n", vval); } +char * +format_grouping(const char *binary) +{ + static char rval[64]; + const char *cp; + size_t len; + + rval[0] = '\0'; + for (cp = binary; *cp != '\0'; ++cp) { + char group[sizeof("127;")]; + snprintf(group, sizeof(group), "%hhd;", *cp); + len = strlcat(rval, group, sizeof(rval)); + if (len >= sizeof(rval)) { + len = sizeof(rval) - 1; + break; + } + if (*cp == CHAR_MAX) { + break; + } + } + + /* Remove the trailing ';'. */ + rval[len - 1] = '\0'; + + return (rval); +} + + /* * keyword value lookup helper (via localeconv()) */ @@ -501,7 +531,7 @@ kwval_lconv(int id) lc = localeconv(); switch (id) { case KW_GROUPING: - rval = lc->grouping; + rval = format_grouping(lc->grouping); break; case KW_INT_CURR_SYMBOL: rval = lc->int_curr_symbol; @@ -516,7 +546,7 @@ kwval_lconv(int id) rval = lc->mon_thousands_sep; break; case KW_MON_GROUPING: - rval = lc->mon_grouping; + rval = format_grouping(lc->mon_grouping); break; case KW_POSITIVE_SIGN: rval = lc->positive_sign; From owner-svn-src-stable-11@freebsd.org Wed Nov 30 20:47:56 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AE8DC5EA71; Wed, 30 Nov 2016 20:47:56 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2B84D1E09; Wed, 30 Nov 2016 20:47:56 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAUKltBO028126; Wed, 30 Nov 2016 20:47:55 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAUKltCI028124; Wed, 30 Nov 2016 20:47:55 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201611302047.uAUKltCI028124@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Wed, 30 Nov 2016 20:47:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309333 - stable/11/lib/libc/locale X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2016 20:47:56 -0000 Author: vangyzen Date: Wed Nov 30 20:47:54 2016 New Revision: 309333 URL: https://svnweb.freebsd.org/changeset/base/309333 Log: MFC r308904 Fix error reporting from wcstof() When wcstof() skipped initial space and then parsing failed, it set endptr to the first non-space character. Fix it to correctly report failure by setting endptr to the beginning of the input string. The fix is from theraven@, who fixed this bug in wcstod() and wcstold() in r227753. While I'm here: Move assignments out of declarations in wcstod() and wcstold(). This is against my personal preference, but it is our agreed style(9). Set endptr correctly on malloc() failure in all three functions. Remove an incorrect comment: This is pointer arithmetic, so the code was not actually making that assumption. wcstold() advanced the wcp pointer beyond leading whitespace and then reset it back to the beginning of the string. Do not reset it. This seems to have no functional effect, since strtold_l() also skips leading whitespace. I'm making the change to keep this function consistent with wcstof() and wcstod(), and because the C11 spec prescribes the use of iswspace() to skip leading space. Reported by: libc++ unit test for std::stof(std::wstring) Sponsored by: Dell EMC Modified: stable/11/lib/libc/locale/wcstod.c stable/11/lib/libc/locale/wcstof.c stable/11/lib/libc/locale/wcstold.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/locale/wcstod.c ============================================================================== --- stable/11/lib/libc/locale/wcstod.c Wed Nov 30 19:06:47 2016 (r309332) +++ stable/11/lib/libc/locale/wcstod.c Wed Nov 30 20:47:54 2016 (r309333) @@ -54,11 +54,13 @@ wcstod_l(const wchar_t * __restrict nptr mbstate_t mbs; double val; char *buf, *end; - const wchar_t *wcp = nptr; + const wchar_t *wcp; size_t len; - size_t spaces = 0; + size_t spaces; FIX_LOCALE(locale); + wcp = nptr; + spaces = 0; while (iswspace_l(*wcp, locale)) { wcp++; spaces++; @@ -80,8 +82,11 @@ wcstod_l(const wchar_t * __restrict nptr *endptr = (wchar_t *)nptr; return (0.0); } - if ((buf = malloc(len + 1)) == NULL) + if ((buf = malloc(len + 1)) == NULL) { + if (endptr != NULL) + *endptr = (wchar_t *)nptr; return (0.0); + } mbs = initial; wcsrtombs_l(buf, &wcp, len + 1, &mbs, locale); @@ -95,13 +100,11 @@ wcstod_l(const wchar_t * __restrict nptr * corresponding position in the wide char string. */ if (endptr != NULL) { - /* XXX Assume each wide char is one byte. */ *endptr = (wchar_t *)nptr + (end - buf); if (buf != end) *endptr += spaces; } - free(buf); return (val); Modified: stable/11/lib/libc/locale/wcstof.c ============================================================================== --- stable/11/lib/libc/locale/wcstof.c Wed Nov 30 19:06:47 2016 (r309332) +++ stable/11/lib/libc/locale/wcstof.c Wed Nov 30 20:47:54 2016 (r309333) @@ -50,27 +50,37 @@ wcstof_l(const wchar_t * __restrict nptr char *buf, *end; const wchar_t *wcp; size_t len; + size_t spaces; FIX_LOCALE(locale); - while (iswspace_l(*nptr, locale)) - nptr++; - wcp = nptr; + spaces = 0; + while (iswspace_l(*wcp, locale)) { + wcp++; + spaces++; + } + mbs = initial; if ((len = wcsrtombs_l(NULL, &wcp, 0, &mbs, locale)) == (size_t)-1) { if (endptr != NULL) *endptr = (wchar_t *)nptr; return (0.0); } - if ((buf = malloc(len + 1)) == NULL) + if ((buf = malloc(len + 1)) == NULL) { + if (endptr != NULL) + *endptr = (wchar_t *)nptr; return (0.0); + } mbs = initial; wcsrtombs_l(buf, &wcp, len + 1, &mbs, locale); val = strtof_l(buf, &end, locale); - if (endptr != NULL) + if (endptr != NULL) { *endptr = (wchar_t *)nptr + (end - buf); + if (buf != end) + *endptr += spaces; + } free(buf); Modified: stable/11/lib/libc/locale/wcstold.c ============================================================================== --- stable/11/lib/libc/locale/wcstold.c Wed Nov 30 19:06:47 2016 (r309332) +++ stable/11/lib/libc/locale/wcstold.c Wed Nov 30 20:47:54 2016 (r309333) @@ -48,32 +48,35 @@ wcstold_l(const wchar_t * __restrict npt mbstate_t mbs; long double val; char *buf, *end; - const wchar_t *wcp = nptr; + const wchar_t *wcp; size_t len; - size_t spaces = 0; + size_t spaces; FIX_LOCALE(locale); + wcp = nptr; + spaces = 0; while (iswspace_l(*wcp, locale)) { wcp++; spaces++; } - wcp = nptr; mbs = initial; if ((len = wcsrtombs_l(NULL, &wcp, 0, &mbs, locale)) == (size_t)-1) { if (endptr != NULL) *endptr = (wchar_t *)nptr; return (0.0); } - if ((buf = malloc(len + 1)) == NULL) + if ((buf = malloc(len + 1)) == NULL) { + if (endptr != NULL) + *endptr = (wchar_t *)nptr; return (0.0); + } mbs = initial; wcsrtombs_l(buf, &wcp, len + 1, &mbs, locale); val = strtold_l(buf, &end, locale); if (endptr != NULL) { - /* XXX Assume each wide char is one byte. */ *endptr = (wchar_t *)nptr + (end - buf); if (buf != end) *endptr += spaces; From owner-svn-src-stable-11@freebsd.org Wed Nov 30 20:51:15 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77ED2C5EB86; Wed, 30 Nov 2016 20:51:15 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4709B128F; Wed, 30 Nov 2016 20:51:15 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAUKpEPS031430; Wed, 30 Nov 2016 20:51:14 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAUKpEmM031429; Wed, 30 Nov 2016 20:51:14 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201611302051.uAUKpEmM031429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Wed, 30 Nov 2016 20:51:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309335 - stable/11/usr.bin/ncal X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2016 20:51:15 -0000 Author: vangyzen Date: Wed Nov 30 20:51:14 2016 New Revision: 309335 URL: https://svnweb.freebsd.org/changeset/base/309335 Log: MFC r308340 ncal: fix a reference to an out-of-scope stack buffer PR: 214237 Submitted by: Jonathan de Boyne Pollard Sponsored by: Dell EMC Modified: stable/11/usr.bin/ncal/ncal.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/ncal/ncal.c ============================================================================== --- stable/11/usr.bin/ncal/ncal.c Wed Nov 30 20:48:44 2016 (r309334) +++ stable/11/usr.bin/ncal/ncal.c Wed Nov 30 20:51:14 2016 (r309335) @@ -1110,7 +1110,8 @@ highlight(char *dst, char *src, int len, static const char *term_so, *term_se; if (first) { - char tbuf[1024], cbuf[512], *b; + static char cbuf[512]; + char tbuf[1024], *b; term_se = term_so = NULL; From owner-svn-src-stable-11@freebsd.org Wed Nov 30 21:53:08 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 044E7C5E09A; Wed, 30 Nov 2016 21:53:08 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D314A19D5; Wed, 30 Nov 2016 21:53:07 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAULr7t7057217; Wed, 30 Nov 2016 21:53:07 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAULr6MB057213; Wed, 30 Nov 2016 21:53:06 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201611302153.uAULr6MB057213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Wed, 30 Nov 2016 21:53:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309337 - in stable/11: sys/netinet usr.sbin/arp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2016 21:53:08 -0000 Author: vangyzen Date: Wed Nov 30 21:53:06 2016 New Revision: 309337 URL: https://svnweb.freebsd.org/changeset/base/309337 Log: MFC r306577 r306652 306830 Add GARP retransmit capability A single gratuitous ARP (GARP) is always transmitted when an IPv4 address is added to an interface, and that is usually sufficient. However, in some circumstances, such as when a shared address is passed between cluster nodes, this single GARP may occasionally be dropped or lost. This can lead to neighbors on the network link working with a stale ARP cache and sending packets destined for that address to the node that previously owned the address, which may not respond. To avoid this situation, GARP retransmissions can be enabled by setting the net.link.ether.inet.garp_rexmit_count sysctl to a value greater than zero. The setting represents the maximum number of retransmissions. The interval between retransmissions is calculated using an exponential backoff algorithm, doubling each time, so the retransmission intervals are: {1, 2, 4, 8, 16, ...} (seconds). Due to the exponential backoff algorithm used for the interval between GARP retransmissions, the maximum number of retransmissions is limited to 16 for sanity. This limit corresponds to a maximum interval between retransmissions of 2^16 seconds ~= 18 hours. Increasing this limit is possible, but sending out GARPs spaced days apart would be of little use. Update arp(4) to document the net.link.ether.inet.garp_rexmit_count sysctl. Submitted by: dab Relnotes: yes Sponsored by: Dell EMC Modified: stable/11/sys/netinet/if_ether.c stable/11/sys/netinet/in.c stable/11/sys/netinet/in_var.h stable/11/usr.sbin/arp/arp.4 Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/if_ether.c ============================================================================== --- stable/11/sys/netinet/if_ether.c Wed Nov 30 20:51:51 2016 (r309336) +++ stable/11/sys/netinet/if_ether.c Wed Nov 30 21:53:06 2016 (r309337) @@ -137,6 +137,28 @@ SYSCTL_INT(_net_link_ether_inet, OID_AUT "Maximum number of remotely triggered ARP messages that can be " "logged per second"); +/* + * Due to the exponential backoff algorithm used for the interval between GARP + * retransmissions, the maximum number of retransmissions is limited for + * sanity. This limit corresponds to a maximum interval between retransmissions + * of 2^16 seconds ~= 18 hours. + * + * Making this limit more dynamic is more complicated than worthwhile, + * especially since sending out GARPs spaced days apart would be of little + * use. A maximum dynamic limit would look something like: + * + * const int max = fls(INT_MAX / hz) - 1; + */ +#define MAX_GARP_RETRANSMITS 16 +static int sysctl_garp_rexmit(SYSCTL_HANDLER_ARGS); +static int garp_rexmit_count = 0; /* GARP retransmission setting. */ + +SYSCTL_PROC(_net_link_ether_inet, OID_AUTO, garp_rexmit_count, + CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, + &garp_rexmit_count, 0, sysctl_garp_rexmit, "I", + "Number of times to retransmit GARP packets;" + " 0 to disable, maximum of 16"); + #define ARP_LOG(pri, ...) do { \ if (ppsratecheck(&arp_lastlog, &arp_curpps, arp_maxpps)) \ log((pri), "arp: " __VA_ARGS__); \ @@ -1287,6 +1309,109 @@ arp_add_ifa_lle(struct ifnet *ifp, const lltable_free_entry(LLTABLE(ifp), lle_tmp); } +/* + * Handle the garp_rexmit_count. Like sysctl_handle_int(), but limits the range + * of valid values. + */ +static int +sysctl_garp_rexmit(SYSCTL_HANDLER_ARGS) +{ + int error; + int rexmit_count = *(int *)arg1; + + error = sysctl_handle_int(oidp, &rexmit_count, 0, req); + + /* Enforce limits on any new value that may have been set. */ + if (!error && req->newptr) { + /* A new value was set. */ + if (rexmit_count < 0) { + rexmit_count = 0; + } else if (rexmit_count > MAX_GARP_RETRANSMITS) { + rexmit_count = MAX_GARP_RETRANSMITS; + } + *(int *)arg1 = rexmit_count; + } + + return (error); +} + +/* + * Retransmit a Gratuitous ARP (GARP) and, if necessary, schedule a callout to + * retransmit it again. A pending callout owns a reference to the ifa. + */ +static void +garp_rexmit(void *arg) +{ + struct in_ifaddr *ia = arg; + + if (callout_pending(&ia->ia_garp_timer) || + !callout_active(&ia->ia_garp_timer)) { + IF_ADDR_WUNLOCK(ia->ia_ifa.ifa_ifp); + ifa_free(&ia->ia_ifa); + return; + } + + /* + * Drop lock while the ARP request is generated. + */ + IF_ADDR_WUNLOCK(ia->ia_ifa.ifa_ifp); + + arprequest(ia->ia_ifa.ifa_ifp, &IA_SIN(ia)->sin_addr, + &IA_SIN(ia)->sin_addr, IF_LLADDR(ia->ia_ifa.ifa_ifp)); + + /* + * Increment the count of retransmissions. If the count has reached the + * maximum value, stop sending the GARP packets. Otherwise, schedule + * the callout to retransmit another GARP packet. + */ + ++ia->ia_garp_count; + if (ia->ia_garp_count >= garp_rexmit_count) { + ifa_free(&ia->ia_ifa); + } else { + int rescheduled; + IF_ADDR_WLOCK(ia->ia_ifa.ifa_ifp); + rescheduled = callout_reset(&ia->ia_garp_timer, + (1 << ia->ia_garp_count) * hz, + garp_rexmit, ia); + IF_ADDR_WUNLOCK(ia->ia_ifa.ifa_ifp); + if (rescheduled) { + ifa_free(&ia->ia_ifa); + } + } +} + +/* + * Start the GARP retransmit timer. + * + * A single GARP is always transmitted when an IPv4 address is added + * to an interface and that is usually sufficient. However, in some + * circumstances, such as when a shared address is passed between + * cluster nodes, this single GARP may occasionally be dropped or + * lost. This can lead to neighbors on the network link working with a + * stale ARP cache and sending packets destined for that address to + * the node that previously owned the address, which may not respond. + * + * To avoid this situation, GARP retransmits can be enabled by setting + * the net.link.ether.inet.garp_rexmit_count sysctl to a value greater + * than zero. The setting represents the maximum number of + * retransmissions. The interval between retransmissions is calculated + * using an exponential backoff algorithm, doubling each time, so the + * retransmission intervals are: {1, 2, 4, 8, 16, ...} (seconds). + */ +static void +garp_timer_start(struct ifaddr *ifa) +{ + struct in_ifaddr *ia = (struct in_ifaddr *) ifa; + + IF_ADDR_WLOCK(ia->ia_ifa.ifa_ifp); + ia->ia_garp_count = 0; + if (callout_reset(&ia->ia_garp_timer, (1 << ia->ia_garp_count) * hz, + garp_rexmit, ia) == 0) { + ifa_ref(ifa); + } + IF_ADDR_WUNLOCK(ia->ia_ifa.ifa_ifp); +} + void arp_ifinit(struct ifnet *ifp, struct ifaddr *ifa) { @@ -1302,6 +1427,9 @@ arp_ifinit(struct ifnet *ifp, struct ifa if (ntohl(dst_in->sin_addr.s_addr) == INADDR_ANY) return; arp_announce_ifaddr(ifp, dst_in->sin_addr, IF_LLADDR(ifp)); + if (garp_rexmit_count > 0) { + garp_timer_start(ifa); + } arp_add_ifa_lle(ifp, dst); } Modified: stable/11/sys/netinet/in.c ============================================================================== --- stable/11/sys/netinet/in.c Wed Nov 30 20:51:51 2016 (r309336) +++ stable/11/sys/netinet/in.c Wed Nov 30 21:53:06 2016 (r309337) @@ -397,6 +397,8 @@ in_aifaddr_ioctl(u_long cmd, caddr_t dat ifa->ifa_addr = (struct sockaddr *)&ia->ia_addr; ifa->ifa_dstaddr = (struct sockaddr *)&ia->ia_dstaddr; ifa->ifa_netmask = (struct sockaddr *)&ia->ia_sockmask; + callout_init_rw(&ia->ia_garp_timer, &ifp->if_addr_lock, + CALLOUT_RETURNUNLOCKED); ia->ia_ifp = ifp; ia->ia_addr = *addr; @@ -635,6 +637,12 @@ in_difaddr_ioctl(caddr_t data, struct if IN_MULTI_UNLOCK(); } + IF_ADDR_WLOCK(ifp); + if (callout_stop(&ia->ia_garp_timer) == 1) { + ifa_free(&ia->ia_ifa); + } + IF_ADDR_WUNLOCK(ifp); + EVENTHANDLER_INVOKE(ifaddr_event, ifp); ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ Modified: stable/11/sys/netinet/in_var.h ============================================================================== --- stable/11/sys/netinet/in_var.h Wed Nov 30 20:51:51 2016 (r309336) +++ stable/11/sys/netinet/in_var.h Wed Nov 30 21:53:06 2016 (r309337) @@ -82,6 +82,8 @@ struct in_ifaddr { struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */ #define ia_broadaddr ia_dstaddr struct sockaddr_in ia_sockmask; /* reserve space for general netmask */ + struct callout ia_garp_timer; /* timer for retransmitting GARPs */ + int ia_garp_count; /* count of retransmitted GARPs */ }; /* Modified: stable/11/usr.sbin/arp/arp.4 ============================================================================== --- stable/11/usr.sbin/arp/arp.4 Wed Nov 30 20:51:51 2016 (r309336) +++ stable/11/usr.sbin/arp/arp.4 Wed Nov 30 21:53:06 2016 (r309337) @@ -28,7 +28,7 @@ .\" @(#)arp4.4 6.5 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd November 5, 2013 +.Dd October 7, 2016 .Dt ARP 4 .Os .Sh NAME @@ -121,49 +121,65 @@ of the MIB. .Bl -tag -width "log_arp_permanent_modify" .It Va allow_multicast -Should the kernel install ARP entries with multicast bit set in -the hardware address. -Installing such entries is RFC 1812 violation, but some prorietary -load balancing techniques require routers on network to do so. +Install ARP entries with the multicast bit set in the hardware address. +Installing such entries is an RFC 1812 violation, but some proprietary load +balancing techniques require routers to do so. Turned off by default. +.It Va garp_rexmit_count +Retransmit gratuitous ARP (GARP) packets when an IPv4 address is added to an +interface. +A GARP is always transmitted when an IPv4 address is added to an interface. +A non-zero value causes the GARP packet to be retransmitted the stated number +of times. +The interval between retransmissions is doubled each time, so the +retransmission intervals are: {1, 2, 4, 8, 16, ...} (seconds). +The default value of zero means only the initial GARP is sent; no +additional GARP packets are retransmitted. +The maximum value is sixteen. +.Pp +The default behavior of a single GARP packet is usually sufficient. +However, a single GARP might be dropped or lost in some circumstances. +This is particularly harmful when a shared address is passed between cluster +nodes. +Neighbors on the network link might then work with a stale ARP cache and send +packets destined for that address to the node that previously owned the +address, which might not respond. .It Va log_arp_movements -Should the kernel log movements of IP addresses from one hardware -address to an other. +Log movements of IP addresses from one hardware address to another. See .Sx DIAGNOSTICS below. Turned on by default. .It Va log_arp_permanent_modify -Should the kernel log attempts of remote host on network to modify a -permanent ARP entry. +Log attempts by a remote host to modify a permanent ARP entry. See .Sx DIAGNOSTICS below. Turned on by default. .It Va log_arp_wrong_iface -Should the kernel log attempts to insert an ARP entry on an interface -when the IP network the address belongs to is connected to an other -interface. +Log attempts to insert an ARP entry on an interface when the IP network to +which the address belongs is connected to another interface. See .Sx DIAGNOSTICS below. Turned on by default. .It Va max_log_per_second -Limit number of remotely triggered logging events to a configured value -per second. +Limit the number of remotely triggered logging events to a configured value per +second. Default is 1 log message per second. .It Va max_age How long an ARP entry is held in the cache until it needs to be refreshed. Default is 1200 seconds. .It Va maxhold -How many packets hold in the per-entry output queue while the entry +How many packets to hold in the per-entry output queue while the entry is being resolved. Default is one packet. .It Va maxtries -Number of retransmits before host is considered down and error is returned. +Number of retransmits before a host is considered down and an error is +returned. Default is 5 tries. .It Va proxyall -Enables ARP proxying for all hosts on net. +Enables ARP proxying. Turned off by default. .It Va wait Lifetime of an incomplete ARP entry. From owner-svn-src-stable-11@freebsd.org Wed Nov 30 22:01:29 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42478C5E465; Wed, 30 Nov 2016 22:01:29 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B5B8135F; Wed, 30 Nov 2016 22:01:25 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 19B671FE156; Wed, 30 Nov 2016 23:01:23 +0100 (CET) Subject: Re: svn commit: r309337 - in stable/11: sys/netinet usr.sbin/arp To: Eric van Gyzen , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org References: <201611302153.uAULr6MB057213@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <593937db-9883-7c75-de81-761040676b62@selasky.org> Date: Wed, 30 Nov 2016 23:00:59 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <201611302153.uAULr6MB057213@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2016 22:01:29 -0000 On 11/30/16 22:53, Eric van Gyzen wrote: > +SYSCTL_PROC(_net_link_ether_inet, OID_AUTO, garp_rexmit_count, > + CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, > + &garp_rexmit_count, 0, sysctl_garp_rexmit, "I", > + "Number of times to retransmit GARP packets;" > + " 0 to disable, maximum of 16"); TIP: You can also make such sysctls tunable. --HPS From owner-svn-src-stable-11@freebsd.org Thu Dec 1 19:06:10 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88593C61D09; Thu, 1 Dec 2016 19:06:10 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 579D110D0; Thu, 1 Dec 2016 19:06:10 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB1J69CR076482; Thu, 1 Dec 2016 19:06:09 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB1J69XK076481; Thu, 1 Dec 2016 19:06:09 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201612011906.uB1J69XK076481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 1 Dec 2016 19:06:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309368 - stable/11/sys/boot/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2016 19:06:10 -0000 Author: tsoome Date: Thu Dec 1 19:06:09 2016 New Revision: 309368 URL: https://svnweb.freebsd.org/changeset/base/309368 Log: MFC r308776 loader: zfs toplevel vdev must have spa set. PR: 214375 Reported by: lstewart Reviewed by: allanjude, imp Approved by: allanjude (mentor), imp (mentor) Differential Revision: https://reviews.freebsd.org/D8487 Modified: stable/11/sys/boot/zfs/zfsimpl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/zfs/zfsimpl.c ============================================================================== --- stable/11/sys/boot/zfs/zfsimpl.c Thu Dec 1 17:36:31 2016 (r309367) +++ stable/11/sys/boot/zfs/zfsimpl.c Thu Dec 1 19:06:09 2016 (r309368) @@ -1017,8 +1017,10 @@ vdev_probe(vdev_phys_read_t *read, void STAILQ_FOREACH(pool_vdev, &spa->spa_vdevs, v_childlink) if (top_vdev == pool_vdev) break; - if (!pool_vdev && top_vdev) + if (!pool_vdev && top_vdev) { + top_vdev->spa = spa; STAILQ_INSERT_TAIL(&spa->spa_vdevs, top_vdev, v_childlink); + } /* * We should already have created an incomplete vdev for this From owner-svn-src-stable-11@freebsd.org Thu Dec 1 20:01:57 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76F7AC61154; Thu, 1 Dec 2016 20:01:57 +0000 (UTC) (envelope-from gonzo@id.bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5D33D100B; Thu, 1 Dec 2016 20:01:57 +0000 (UTC) (envelope-from gonzo@id.bluezbox.com) Received: from [208.184.220.60] (helo=nmamm-mbp2.dolby.net) by id.bluezbox.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87 (FreeBSD)) (envelope-from ) id 1cCXYF-000OSA-43; Thu, 01 Dec 2016 12:01:51 -0800 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: svn commit: r309368 - stable/11/sys/boot/zfs From: Oleksandr Tymoshenko In-Reply-To: <201612011906.uB1J69XK076481@repo.freebsd.org> Date: Thu, 1 Dec 2016 12:01:20 -0800 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <186048AF-0A74-4DCD-8A54-1DCE26CCE9D3@bluezbox.com> References: <201612011906.uB1J69XK076481@repo.freebsd.org> To: Toomas Soome X-Mailer: Apple Mail (2.3251) Sender: gonzo@id.bluezbox.com X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: > On Dec 1, 2016, at 11:06 AM, Toomas Soome wrote: > > Author: tsoome > Date: Thu Dec 1 19:06:09 2016 > New Revision: 309368 > URL: https://svnweb.freebsd.org/changeset/base/309368 > > Log: > MFC r308776 > > loader: zfs toplevel vdev must have spa set. > > PR: 214375 > Reported by: lstewart > Reviewed by: allanjude, imp > Approved by: allanjude (mentor), imp (mentor) > Differential Revision: https://reviews.freebsd.org/D8487 [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2016 20:01:57 -0000 > On Dec 1, 2016, at 11:06 AM, Toomas Soome wrote: >=20 > Author: tsoome > Date: Thu Dec 1 19:06:09 2016 > New Revision: 309368 > URL: https://svnweb.freebsd.org/changeset/base/309368 >=20 > Log: > MFC r308776 >=20 > loader: zfs toplevel vdev must have spa set. >=20 > PR: 214375 > Reported by: lstewart > Reviewed by: allanjude, imp > Approved by: allanjude (mentor), imp (mentor) > Differential Revision: https://reviews.freebsd.org/D8487 Hi Tom, Looks like this commit breaks the build: In file included from = /src/FreeBSD/11/sys/boot/efi/loader/../../zfs/zfs.c:49: /src/FreeBSD/11/sys/boot/efi/loader/../../zfs/zfsimpl.c:1021:13: error: = no membe r named 'spa' in 'struct vdev' top_vdev->spa =3D spa; ~~~~~~~~ ^ From owner-svn-src-stable-11@freebsd.org Thu Dec 1 20:05:07 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8088AC61360; Thu, 1 Dec 2016 20:05:07 +0000 (UTC) (envelope-from gonzo@id.bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5E60B1290; Thu, 1 Dec 2016 20:05:07 +0000 (UTC) (envelope-from gonzo@id.bluezbox.com) Received: from [208.184.220.60] (helo=nmamm-mbp2.dolby.net) by id.bluezbox.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87 (FreeBSD)) (envelope-from ) id 1cCXbO-000OSc-2O; Thu, 01 Dec 2016 12:05:06 -0800 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: svn commit: r309368 - stable/11/sys/boot/zfs From: Oleksandr Tymoshenko In-Reply-To: <186048AF-0A74-4DCD-8A54-1DCE26CCE9D3@bluezbox.com> Date: Thu, 1 Dec 2016 12:04:35 -0800 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201612011906.uB1J69XK076481@repo.freebsd.org> <186048AF-0A74-4DCD-8A54-1DCE26CCE9D3@bluezbox.com> To: Toomas Soome X-Mailer: Apple Mail (2.3251) Sender: gonzo@id.bluezbox.com X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: > On Dec 1, 2016, at 12:01 PM, Oleksandr Tymoshenko wrote: > > >> On Dec 1, 2016, at 11:06 AM, Toomas Soome wrote: >> >> Author: tsoome >> Date: Thu Dec 1 19:06:09 2016 >> New Revision: 309368 >> URL: https://svnweb.freebsd.org/changeset/base/309368 >> >> Log: >> MFC r308776 >> >> loader: zfs toplevel vdev must have spa set. >> >> PR: 214375 >> Reported by: lstewart >> Reviewed by: allanjude, imp >> Approved by: allanjude (mentor), imp (mentor) >> Differential Revision: https://reviews.freebsd.org/D8487 > > Hi Tom, [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2016 20:05:07 -0000 > On Dec 1, 2016, at 12:01 PM, Oleksandr Tymoshenko = wrote: >=20 >=20 >> On Dec 1, 2016, at 11:06 AM, Toomas Soome wrote: >>=20 >> Author: tsoome >> Date: Thu Dec 1 19:06:09 2016 >> New Revision: 309368 >> URL: https://svnweb.freebsd.org/changeset/base/309368 >>=20 >> Log: >> MFC r308776 >>=20 >> loader: zfs toplevel vdev must have spa set. >>=20 >> PR: 214375 >> Reported by: lstewart >> Reviewed by: allanjude, imp >> Approved by: allanjude (mentor), imp (mentor) >> Differential Revision: https://reviews.freebsd.org/D8487 >=20 > Hi Tom, I am sorry, this should have been Toomas, not Tom.=20= From owner-svn-src-stable-11@freebsd.org Thu Dec 1 20:31:38 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6F1D1C61ED0; Thu, 1 Dec 2016 20:31:38 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3E6641253; Thu, 1 Dec 2016 20:31:38 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB1KVb2x009639; Thu, 1 Dec 2016 20:31:37 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB1KVbpW009638; Thu, 1 Dec 2016 20:31:37 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201612012031.uB1KVbpW009638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 1 Dec 2016 20:31:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309370 - stable/11/sys/boot/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2016 20:31:38 -0000 Author: tsoome Date: Thu Dec 1 20:31:37 2016 New Revision: 309370 URL: https://svnweb.freebsd.org/changeset/base/309370 Log: Backing out r309368 as it got commited prematurely as we still do not provide skein feature support in boot loader. Approved by: allanjude (mentor) Modified: stable/11/sys/boot/zfs/zfsimpl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/boot/zfs/zfsimpl.c ============================================================================== --- stable/11/sys/boot/zfs/zfsimpl.c Thu Dec 1 19:19:20 2016 (r309369) +++ stable/11/sys/boot/zfs/zfsimpl.c Thu Dec 1 20:31:37 2016 (r309370) @@ -1017,10 +1017,8 @@ vdev_probe(vdev_phys_read_t *read, void STAILQ_FOREACH(pool_vdev, &spa->spa_vdevs, v_childlink) if (top_vdev == pool_vdev) break; - if (!pool_vdev && top_vdev) { - top_vdev->spa = spa; + if (!pool_vdev && top_vdev) STAILQ_INSERT_TAIL(&spa->spa_vdevs, top_vdev, v_childlink); - } /* * We should already have created an incomplete vdev for this From owner-svn-src-stable-11@freebsd.org Thu Dec 1 20:34:28 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D4D9C60101; Thu, 1 Dec 2016 20:34:28 +0000 (UTC) (envelope-from tsoome@me.com) Received: from st13p35im-asmtp003.me.com (st13p35im-asmtp003.me.com [17.164.199.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 462661654; Thu, 1 Dec 2016 20:34:28 +0000 (UTC) (envelope-from tsoome@me.com) Received: from process-dkim-sign-daemon.st13p35im-asmtp003.me.com by st13p35im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OHI00M00WV9EX00@st13p35im-asmtp003.me.com>; Thu, 01 Dec 2016 20:34:21 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=4d515a; t=1480624461; bh=mKPyQ53cBWg8XSE9UfO3r06Qs21e0rAaVuQsNM40nHU=; h=Content-type:MIME-version:Subject:From:Date:Message-id:To; b=LCwZwSkZP2RU6/3ZRczYMcV6Hm4j30c/uSIoLWhOTSYBNeeSXErMi67E4QsjtuXGP FcfVkQZMmh42gRt4C+6QHVHYhpPWfcCwOe2X4nOEN4xFZ6kfB+axeNXxXWoUnCkxYl +sQEdI7oihRs9Uu5yHYO3BGYRdEuIpjcxYhmkN/lYAoWDE/GS/CHlpu2r71paqdCuq bt7bmj5VRsrBlT6DE+vs0GH9oerVb4M1e4etPu/vcm7wTNh+exQrx/TL6MF9VI9Ua7 SOtBt0kKlWfI10NF4BgJitxT8TlKDSZqK51ImipMRroANNFp8/Vh7lG9kgXA9QmQ9Q ADDArprOvq2eg== Received: from nazgul.lan (220-90-235-80.dyn.estpak.ee [80.235.90.220]) by st13p35im-asmtp003.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OHI00JOUX563400@st13p35im-asmtp003.me.com>; Thu, 01 Dec 2016 20:34:20 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-01_18:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1603290000 definitions=main-1612010334 Content-type: text/plain; charset=utf-8 MIME-version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: svn commit: r309368 - stable/11/sys/boot/zfs From: Toomas Soome In-reply-to: <186048AF-0A74-4DCD-8A54-1DCE26CCE9D3@bluezbox.com> Date: Thu, 01 Dec 2016 22:34:17 +0200 Cc: Toomas Soome , src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-transfer-encoding: quoted-printable Message-id: <75AD339A-FECF-4C82-ADF1-FACDF0FDD2B6@me.com> References: <201612011906.uB1J69XK076481@repo.freebsd.org> <186048AF-0A74-4DCD-8A54-1DCE26CCE9D3@bluezbox.com> To: Oleksandr Tymoshenko X-Mailer: Apple Mail (2.3251) X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2016 20:34:28 -0000 > On 1. dets 2016, at 22:01, Oleksandr Tymoshenko = wrote: >=20 >=20 >> On Dec 1, 2016, at 11:06 AM, Toomas Soome wrote: >>=20 >> Author: tsoome >> Date: Thu Dec 1 19:06:09 2016 >> New Revision: 309368 >> URL: https://svnweb.freebsd.org/changeset/base/309368 >>=20 >> Log: >> MFC r308776 >>=20 >> loader: zfs toplevel vdev must have spa set. >>=20 >> PR: 214375 >> Reported by: lstewart >> Reviewed by: allanjude, imp >> Approved by: allanjude (mentor), imp (mentor) >> Differential Revision: https://reviews.freebsd.org/D8487 >=20 > Hi Tom, >=20 > Looks like this commit breaks the build: >=20 > In file included from = /src/FreeBSD/11/sys/boot/efi/loader/../../zfs/zfs.c:49: > /src/FreeBSD/11/sys/boot/efi/loader/../../zfs/zfsimpl.c:1021:13: = error: no membe > r named 'spa' in 'struct vdev' > top_vdev->spa =3D spa; > ~~~~~~~~ ^ >=20 >=20 >=20 Yes, I am so sorry for this confusion, I did back it out; somehow the = impression was the skein boot support is already in 11=E2=80=A6 my = apologies. rgds, toomas= From owner-svn-src-stable-11@freebsd.org Thu Dec 1 20:36:49 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3C8DC60275; Thu, 1 Dec 2016 20:36:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89A9F185D; Thu, 1 Dec 2016 20:36:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB1KamlP012907; Thu, 1 Dec 2016 20:36:48 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB1Kamca012905; Thu, 1 Dec 2016 20:36:48 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612012036.uB1Kamca012905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Dec 2016 20:36:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309371 - in stable: 10/libexec/rtld-elf 10/libexec/rtld-elf/sparc64 11/libexec/rtld-elf 11/libexec/rtld-elf/sparc64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2016 20:36:49 -0000 Author: jhb Date: Thu Dec 1 20:36:48 2016 New Revision: 309371 URL: https://svnweb.freebsd.org/changeset/base/309371 Log: MFC 308456: Pass the correct flag to find_symdef() from _rtld_bind(). When symbol versioning was added to rtld, the boolean 'in_plt' argument to find_symdef() was converted to a bitmask of flags. The first flag added was 'SYMLOOK_IN_PLT' which replaced the 'in_plt' bool. This happened to still work by accident as SYMLOOK_IN_PLT had the value of 1 which is the same as 'true', so there should be no functional change. Modified: stable/11/libexec/rtld-elf/rtld.c stable/11/libexec/rtld-elf/sparc64/reloc.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/libexec/rtld-elf/rtld.c stable/10/libexec/rtld-elf/sparc64/reloc.c Directory Properties: stable/10/ (props changed) Modified: stable/11/libexec/rtld-elf/rtld.c ============================================================================== --- stable/11/libexec/rtld-elf/rtld.c Thu Dec 1 20:31:37 2016 (r309370) +++ stable/11/libexec/rtld-elf/rtld.c Thu Dec 1 20:36:48 2016 (r309371) @@ -714,8 +714,8 @@ _rtld_bind(Obj_Entry *obj, Elf_Size relo rel = (const Elf_Rel *) ((caddr_t) obj->pltrela + reloff); where = (Elf_Addr *) (obj->relocbase + rel->r_offset); - def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, true, NULL, - &lockstate); + def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, SYMLOOK_IN_PLT, + NULL, &lockstate); if (def == NULL) rtld_die(); if (ELF_ST_TYPE(def->st_info) == STT_GNU_IFUNC) Modified: stable/11/libexec/rtld-elf/sparc64/reloc.c ============================================================================== --- stable/11/libexec/rtld-elf/sparc64/reloc.c Thu Dec 1 20:31:37 2016 (r309370) +++ stable/11/libexec/rtld-elf/sparc64/reloc.c Thu Dec 1 20:36:48 2016 (r309371) @@ -503,7 +503,7 @@ reloc_plt(Obj_Entry *obj) assert(ELF64_R_TYPE_ID(rela->r_info) == R_SPARC_JMP_SLOT); where = (Elf_Addr *)(obj->relocbase + rela->r_offset); def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, - true, NULL, lockstate); + SYMLOOK_IN_PLT, NULL, lockstate); value = (Elf_Addr)(defobj->relocbase + def->st_value); *where = value; } From owner-svn-src-stable-11@freebsd.org Thu Dec 1 20:43:41 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A8D60C6067D; Thu, 1 Dec 2016 20:43:41 +0000 (UTC) (envelope-from gonzo@id.bluezbox.com) Received: from id.bluezbox.com (id.bluezbox.com [45.55.20.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 869A31EC1; Thu, 1 Dec 2016 20:43:41 +0000 (UTC) (envelope-from gonzo@id.bluezbox.com) Received: from [208.184.220.60] (helo=nmamm-mbp2.dolby.net) by id.bluezbox.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87 (FreeBSD)) (envelope-from ) id 1cCYCe-000OYr-IW; Thu, 01 Dec 2016 12:43:40 -0800 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: svn commit: r309368 - stable/11/sys/boot/zfs From: Oleksandr Tymoshenko In-Reply-To: <75AD339A-FECF-4C82-ADF1-FACDF0FDD2B6@me.com> Date: Thu, 1 Dec 2016 12:43:05 -0800 Cc: Toomas Soome , src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201612011906.uB1J69XK076481@repo.freebsd.org> <186048AF-0A74-4DCD-8A54-1DCE26CCE9D3@bluezbox.com> <75AD339A-FECF-4C82-ADF1-FACDF0FDD2B6@me.com> To: Toomas Soome X-Mailer: Apple Mail (2.3251) Sender: gonzo@id.bluezbox.com X-Spam-Level: -- X-Spam-Report: Spam detection software, running on the system "id.bluezbox.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see The administrator of that system for details. Content preview: > On Dec 1, 2016, at 12:34 PM, Toomas Soome wrote: > > >> On 1. dets 2016, at 22:01, Oleksandr Tymoshenko wrote: >> >> >>> On Dec 1, 2016, at 11:06 AM, Toomas Soome wrote: >>> >>> Author: tsoome >>> Date: Thu Dec 1 19:06:09 2016 >>> New Revision: 309368 >>> URL: https://svnweb.freebsd.org/changeset/base/309368 >>> >>> Log: >>> MFC r308776 >>> >>> loader: zfs toplevel vdev must have spa set. >>> >>> PR: 214375 >>> Reported by: lstewart >>> Reviewed by: allanjude, imp >>> Approved by: allanjude (mentor), imp (mentor) >>> Differential Revision: https://reviews.freebsd.org/D8487 >> >> Hi Tom, >> >> Looks like this commit breaks the build: >> >> In file included from /src/FreeBSD/11/sys/boot/efi/loader/../../zfs/zfs.c:49: >> /src/FreeBSD/11/sys/boot/efi/loader/../../zfs/zfsimpl.c:1021:13: error: no membe >> r named 'spa' in 'struct vdev' >> top_vdev->spa = spa; >> ~~~~~~~~ ^ >> >> >> > > Yes, I am so sorry for this confusion, I did back it out; somehow the impression was the skein boot support is already in 11… my apologies. [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2016 20:43:41 -0000 > On Dec 1, 2016, at 12:34 PM, Toomas Soome wrote: >=20 >=20 >> On 1. dets 2016, at 22:01, Oleksandr Tymoshenko = wrote: >>=20 >>=20 >>> On Dec 1, 2016, at 11:06 AM, Toomas Soome = wrote: >>>=20 >>> Author: tsoome >>> Date: Thu Dec 1 19:06:09 2016 >>> New Revision: 309368 >>> URL: https://svnweb.freebsd.org/changeset/base/309368 >>>=20 >>> Log: >>> MFC r308776 >>>=20 >>> loader: zfs toplevel vdev must have spa set. >>>=20 >>> PR: 214375 >>> Reported by: lstewart >>> Reviewed by: allanjude, imp >>> Approved by: allanjude (mentor), imp (mentor) >>> Differential Revision: https://reviews.freebsd.org/D8487 >>=20 >> Hi Tom, >>=20 >> Looks like this commit breaks the build: >>=20 >> In file included from = /src/FreeBSD/11/sys/boot/efi/loader/../../zfs/zfs.c:49: >> /src/FreeBSD/11/sys/boot/efi/loader/../../zfs/zfsimpl.c:1021:13: = error: no membe >> r named 'spa' in 'struct vdev' >> top_vdev->spa =3D spa; >> ~~~~~~~~ ^ >>=20 >>=20 >>=20 >=20 > Yes, I am so sorry for this confusion, I did back it out; somehow the = impression was the skein boot support is already in 11=E2=80=A6 my = apologies. No problem. Thanks for fixing.=20= From owner-svn-src-stable-11@freebsd.org Thu Dec 1 21:06:34 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BE50C6113C; Thu, 1 Dec 2016 21:06:34 +0000 (UTC) (envelope-from tsoome@me.com) Received: from st13p35im-asmtp004.me.com (st13p35im-asmtp004.me.com [17.164.199.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 13B3B1155; Thu, 1 Dec 2016 21:06:34 +0000 (UTC) (envelope-from tsoome@me.com) Received: from process-dkim-sign-daemon.st13p35im-asmtp004.me.com by st13p35im-asmtp004.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) id <0OHI00G00VUGB600@st13p35im-asmtp004.me.com>; Thu, 01 Dec 2016 20:06:27 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=4d515a; t=1480622787; bh=w25AXsepPebbDXhThzSKe0U5fu5rJT7GToVoogtr8gI=; h=Content-type:MIME-version:Subject:From:Date:Message-id:To; b=dtFNVtbDcVS+osF8RQ83RYOXuBmkCD8NthhxhIz627DhyHn0B0lomIJrxMLstyeK9 cJdsAqKtIgw9dfRznhCRO76eX/SNlfzjyQ7I1SAfqmW4I8vH4fojPAYDqw2JcIcMcp /HhbJJmSmzEHZq4t1areriDwkg/J5AhQUpDZdoU77hjXdWzGdgb24vqHuRnMbJO5Of 81cgWuw2/RaGYOMzPpHjpDKyAG8lviinrjEK2Ffzo1p8m60gIkQTffJ4iYeUInkuVg UUqVxHl1bBEsTJXcQeC2teq59cEA5Ye9wcpH6Wa6I5ICYx5JO3XCFMji3yRlumlRco wF/9uXhBNZLvg== Received: from nazgul.lan (220-90-235-80.dyn.estpak.ee [80.235.90.220]) by st13p35im-asmtp004.me.com (Oracle Communications Messaging Server 7.0.5.38.0 64bit (built Feb 26 2016)) with ESMTPSA id <0OHI00OB8VUK8M10@st13p35im-asmtp004.me.com>; Thu, 01 Dec 2016 20:06:26 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-01_17:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1034 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1603290000 definitions=main-1612010327 Content-type: text/plain; charset=utf-8 MIME-version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: svn commit: r309368 - stable/11/sys/boot/zfs From: Toomas Soome In-reply-to: Date: Thu, 01 Dec 2016 22:06:20 +0200 Cc: Toomas Soome , src-committers , svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Content-transfer-encoding: quoted-printable Message-id: <057D89C5-C409-4540-A9FC-EC0A3F0801E5@me.com> References: <201612011906.uB1J69XK076481@repo.freebsd.org> <186048AF-0A74-4DCD-8A54-1DCE26CCE9D3@bluezbox.com> To: Oleksandr Tymoshenko X-Mailer: Apple Mail (2.3251) X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2016 21:06:34 -0000 > On 1. dets 2016, at 22:04, Oleksandr Tymoshenko = wrote: >=20 >=20 >> On Dec 1, 2016, at 12:01 PM, Oleksandr Tymoshenko = wrote: >>=20 >>=20 >>> On Dec 1, 2016, at 11:06 AM, Toomas Soome = wrote: >>>=20 >>> Author: tsoome >>> Date: Thu Dec 1 19:06:09 2016 >>> New Revision: 309368 >>> URL: https://svnweb.freebsd.org/changeset/base/309368 >>>=20 >>> Log: >>> MFC r308776 >>>=20 >>> loader: zfs toplevel vdev must have spa set. >>>=20 >>> PR: 214375 >>> Reported by: lstewart >>> Reviewed by: allanjude, imp >>> Approved by: allanjude (mentor), imp (mentor) >>> Differential Revision: https://reviews.freebsd.org/D8487 >>=20 >> Hi Tom, >=20 > I am sorry, this should have been Toomas, not Tom. no problem, and sorry, I=E2=80=99m already checking=E2=80=A6=20 rgds, toomas= From owner-svn-src-stable-11@freebsd.org Thu Dec 1 22:22:20 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD561C61E3C; Thu, 1 Dec 2016 22:22:20 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ABE7D1025; Thu, 1 Dec 2016 22:22:20 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB1MMJEv056797; Thu, 1 Dec 2016 22:22:19 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB1MMJE8056794; Thu, 1 Dec 2016 22:22:19 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201612012222.uB1MMJE8056794@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 1 Dec 2016 22:22:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309375 - in stable/11/sys: dev/gpio modules modules/bytgpio X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2016 22:22:21 -0000 Author: gonzo Date: Thu Dec 1 22:22:19 2016 New Revision: 309375 URL: https://svnweb.freebsd.org/changeset/base/309375 Log: MFC r308898, r308940, r308942, r308944, r309112 r308898: [bytgpio] Fix USB disconnect event after listsing pins on gpioc2 - Do not set input flag when reading value from GPIO pin, it is not required and for gpioc2(S5 bank) setting both input and output flags leads to some kind of electric interference (curren drop?) that causes USB devices to disconnect - Check pad configuration when attaching device and provide IN/OUT capabilities only for pads that are configured as GPIO. Do not let user code to configure or change value of non-GPIO pads. There is no information for NC bank in intel's datasheet so for now function check is ignored for pins in it Reported by: Frank H. MFC after: 3 days r308940: [bytgpio] prepare bytgpio(4) for modularization - Add detach method - module should depend on gpiobus, not gpio r308942: [bytgpio] Add module for bytgpio(4) MFC after: 3 days r308944 by hiren@: r308942 broke kernel build. Add acpi_if.h to module makefile to fix it. Submitted by: peter r309112: [bytgpio] Fix pc98 build by disabling bytgpio module for this platform Reported by: dim Added: stable/11/sys/modules/bytgpio/ - copied from r308942, head/sys/modules/bytgpio/ Modified: stable/11/sys/dev/gpio/bytgpio.c stable/11/sys/modules/Makefile stable/11/sys/modules/bytgpio/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/gpio/bytgpio.c ============================================================================== --- stable/11/sys/dev/gpio/bytgpio.c Thu Dec 1 22:20:27 2016 (r309374) +++ stable/11/sys/dev/gpio/bytgpio.c Thu Dec 1 22:22:19 2016 (r309375) @@ -60,6 +60,16 @@ __FBSDID("$FreeBSD$"); #define BYTGPIO_ASSERT_LOCKED(_sc) mtx_assert(&(_sc)->sc_mtx, MA_OWNED) #define BYTGPIO_ASSERT_UNLOCKED(_sc) mtx_assert(&(_sc)->sc_mtx, MA_NOTOWNED) +struct pinmap_info { + int reg; + int pad_func; +}; + +/* Ignore function check, no info is available at the moment */ +#define PADCONF_FUNC_ANY -1 + +#define GPIO_PIN_MAP(r, f) { .reg = (r), .pad_func = (f) } + struct bytgpio_softc { ACPI_HANDLE sc_handle; device_t sc_dev; @@ -69,44 +79,212 @@ struct bytgpio_softc { struct resource *sc_mem_res; int sc_npins; const char* sc_bank_prefix; - const int *sc_pinpad_map; + const struct pinmap_info *sc_pinpad_map; + /* List of current functions for pads shared by GPIO */ + int *sc_pad_funcs; }; static int bytgpio_probe(device_t dev); static int bytgpio_attach(device_t dev); +static int bytgpio_detach(device_t dev); -#define SCORE_UID 1 -#define SCORE_BANK_PREFIX "GPIO_S0_SC" -const int bytgpio_score_pins[] = { - 85, 89, 93, 96, 99, 102, 98, 101, 34, 37, 36, 38, 39, 35, 40, - 84, 62, 61, 64, 59, 54, 56, 60, 55, 63, 57, 51, 50, 53, 47, - 52, 49, 48, 43, 46, 41, 45, 42, 58, 44, 95, 105, 70, 68, 67, - 66, 69, 71, 65, 72, 86, 90, 88, 92, 103, 77, 79, 83, 78, 81, - 80, 82, 13, 12, 15, 14, 17, 18, 19, 16, 2, 1, 0, 4, 6, 7, 9, - 8, 33, 32, 31, 30, 29, 27, 25, 28, 26, 23, 21, 20, 24, 22, 5, - 3, 10, 11, 106, 87, 91, 104, 97, 100 +#define SCORE_UID 1 +#define SCORE_BANK_PREFIX "GPIO_S0_SC" +const struct pinmap_info bytgpio_score_pins[] = { + GPIO_PIN_MAP(85, 0), + GPIO_PIN_MAP(89, 0), + GPIO_PIN_MAP(93, 0), + GPIO_PIN_MAP(96, 0), + GPIO_PIN_MAP(99, 0), + GPIO_PIN_MAP(102, 0), + GPIO_PIN_MAP(98, 0), + GPIO_PIN_MAP(101, 0), + GPIO_PIN_MAP(34, 0), + GPIO_PIN_MAP(37, 0), + GPIO_PIN_MAP(36, 0), + GPIO_PIN_MAP(38, 0), + GPIO_PIN_MAP(39, 0), + GPIO_PIN_MAP(35, 0), + GPIO_PIN_MAP(40, 0), + GPIO_PIN_MAP(84, 0), + GPIO_PIN_MAP(62, 0), + GPIO_PIN_MAP(61, 0), + GPIO_PIN_MAP(64, 0), + GPIO_PIN_MAP(59, 0), + GPIO_PIN_MAP(54, 0), + GPIO_PIN_MAP(56, 0), + GPIO_PIN_MAP(60, 0), + GPIO_PIN_MAP(55, 0), + GPIO_PIN_MAP(63, 0), + GPIO_PIN_MAP(57, 0), + GPIO_PIN_MAP(51, 0), + GPIO_PIN_MAP(50, 0), + GPIO_PIN_MAP(53, 0), + GPIO_PIN_MAP(47, 0), + GPIO_PIN_MAP(52, 0), + GPIO_PIN_MAP(49, 0), + GPIO_PIN_MAP(48, 0), + GPIO_PIN_MAP(43, 0), + GPIO_PIN_MAP(46, 0), + GPIO_PIN_MAP(41, 0), + GPIO_PIN_MAP(45, 0), + GPIO_PIN_MAP(42, 0), + GPIO_PIN_MAP(58, 0), + GPIO_PIN_MAP(44, 0), + GPIO_PIN_MAP(95, 0), + GPIO_PIN_MAP(105, 0), + GPIO_PIN_MAP(70, 0), + GPIO_PIN_MAP(68, 0), + GPIO_PIN_MAP(67, 0), + GPIO_PIN_MAP(66, 0), + GPIO_PIN_MAP(69, 0), + GPIO_PIN_MAP(71, 0), + GPIO_PIN_MAP(65, 0), + GPIO_PIN_MAP(72, 0), + GPIO_PIN_MAP(86, 0), + GPIO_PIN_MAP(90, 0), + GPIO_PIN_MAP(88, 0), + GPIO_PIN_MAP(92, 0), + GPIO_PIN_MAP(103, 0), + GPIO_PIN_MAP(77, 0), + GPIO_PIN_MAP(79, 0), + GPIO_PIN_MAP(83, 0), + GPIO_PIN_MAP(78, 0), + GPIO_PIN_MAP(81, 0), + GPIO_PIN_MAP(80, 0), + GPIO_PIN_MAP(82, 0), + GPIO_PIN_MAP(13, 0), + GPIO_PIN_MAP(12, 0), + GPIO_PIN_MAP(15, 0), + GPIO_PIN_MAP(14, 0), + GPIO_PIN_MAP(17, 0), + GPIO_PIN_MAP(18, 0), + GPIO_PIN_MAP(19, 0), + GPIO_PIN_MAP(16, 0), + GPIO_PIN_MAP(2, 0), + GPIO_PIN_MAP(1, 0), + GPIO_PIN_MAP(0, 0), + GPIO_PIN_MAP(4, 0), + GPIO_PIN_MAP(6, 0), + GPIO_PIN_MAP(7, 0), + GPIO_PIN_MAP(9, 0), + GPIO_PIN_MAP(8, 0), + GPIO_PIN_MAP(33, 0), + GPIO_PIN_MAP(32, 0), + GPIO_PIN_MAP(31, 0), + GPIO_PIN_MAP(30, 0), + GPIO_PIN_MAP(29, 0), + GPIO_PIN_MAP(27, 0), + GPIO_PIN_MAP(25, 0), + GPIO_PIN_MAP(28, 0), + GPIO_PIN_MAP(26, 0), + GPIO_PIN_MAP(23, 0), + GPIO_PIN_MAP(21, 0), + GPIO_PIN_MAP(20, 0), + GPIO_PIN_MAP(24, 0), + GPIO_PIN_MAP(22, 0), + GPIO_PIN_MAP(5, 1), + GPIO_PIN_MAP(3, 1), + GPIO_PIN_MAP(10, 0), + GPIO_PIN_MAP(11, 0), + GPIO_PIN_MAP(106, 0), + GPIO_PIN_MAP(87, 0), + GPIO_PIN_MAP(91, 0), + GPIO_PIN_MAP(104, 0), + GPIO_PIN_MAP(97, 0), + GPIO_PIN_MAP(100, 0) }; -#define SCORE_PINS nitems(bytgpio_score_pins) -#define NCORE_UID 2 -#define NCORE_BANK_PREFIX "GPIO_S0_NC" -const int bytgpio_ncore_pins[] = { - 19, 18, 17, 20, 21, 22, 24, 25, 23, 16, 14, 15, 12, 26, 27, - 1, 4, 8, 11, 0, 3, 6, 10, 13, 2, 5, 9, 7 +#define SCORE_PINS nitems(bytgpio_score_pins) + +#define NCORE_UID 2 +#define NCORE_BANK_PREFIX "GPIO_S0_NC" +const struct pinmap_info bytgpio_ncore_pins[] = { + GPIO_PIN_MAP(19, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(18, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(17, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(20, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(21, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(22, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(24, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(25, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(23, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(16, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(14, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(15, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(12, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(26, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(27, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(1, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(4, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(8, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(11, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(0, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(3, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(6, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(10, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(13, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(2, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(5, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(9, PADCONF_FUNC_ANY), + GPIO_PIN_MAP(7, PADCONF_FUNC_ANY) }; #define NCORE_PINS nitems(bytgpio_ncore_pins) -#define SUS_UID 3 -#define SUS_BANK_PREFIX "GPIO_S5_" -const int bytgpio_sus_pins[] = { - 29, 33, 30, 31, 32, 34, 36, 35, 38, 37, 18, 7, 11, 20, 17, 1, - 8, 10, 19, 12, 0, 2, 23, 39, 28, 27, 22, 21, 24, 25, 26, 51, - 56, 54, 49, 55, 48, 57, 50, 58, 52, 53, 59, 40 +#define SUS_UID 3 +#define SUS_BANK_PREFIX "GPIO_S5_" +const struct pinmap_info bytgpio_sus_pins[] = { + GPIO_PIN_MAP(29, 0), + GPIO_PIN_MAP(33, 0), + GPIO_PIN_MAP(30, 0), + GPIO_PIN_MAP(31, 0), + GPIO_PIN_MAP(32, 0), + GPIO_PIN_MAP(34, 0), + GPIO_PIN_MAP(36, 0), + GPIO_PIN_MAP(35, 0), + GPIO_PIN_MAP(38, 0), + GPIO_PIN_MAP(37, 0), + GPIO_PIN_MAP(18, 0), + GPIO_PIN_MAP(7, 1), + GPIO_PIN_MAP(11, 1), + GPIO_PIN_MAP(20, 1), + GPIO_PIN_MAP(17, 1), + GPIO_PIN_MAP(1, 1), + GPIO_PIN_MAP(8, 1), + GPIO_PIN_MAP(10, 1), + GPIO_PIN_MAP(19, 1), + GPIO_PIN_MAP(12, 1), + GPIO_PIN_MAP(0, 1), + GPIO_PIN_MAP(2, 1), + GPIO_PIN_MAP(23, 0), + GPIO_PIN_MAP(39, 0), + GPIO_PIN_MAP(28, 0), + GPIO_PIN_MAP(27, 0), + GPIO_PIN_MAP(22, 0), + GPIO_PIN_MAP(21, 0), + GPIO_PIN_MAP(24, 0), + GPIO_PIN_MAP(25, 0), + GPIO_PIN_MAP(26, 0), + GPIO_PIN_MAP(51, 0), + GPIO_PIN_MAP(56, 0), + GPIO_PIN_MAP(54, 0), + GPIO_PIN_MAP(49, 0), + GPIO_PIN_MAP(55, 0), + GPIO_PIN_MAP(48, 0), + GPIO_PIN_MAP(57, 0), + GPIO_PIN_MAP(50, 0), + GPIO_PIN_MAP(58, 0), + GPIO_PIN_MAP(52, 0), + GPIO_PIN_MAP(53, 0), + GPIO_PIN_MAP(59, 0), + GPIO_PIN_MAP(40, 0) }; + #define SUS_PINS nitems(bytgpio_sus_pins) -#define BYGPIO_PIN_REGISTER(sc, pin, reg) ((sc)->sc_pinpad_map[(pin)] * 16 + (reg)) +#define BYGPIO_PIN_REGISTER(sc, pin, r) ((sc)->sc_pinpad_map[(pin)].reg * 16 + (r)) #define BYTGPIO_PCONF0 0x0000 +#define BYTGPIO_PCONF0_FUNC_MASK 7 #define BYTGPIO_PAD_VAL 0x0008 #define BYTGPIO_PAD_VAL_LEVEL (1 << 0) #define BYTGPIO_PAD_VAL_I_OUTPUT_ENABLED (1 << 1) @@ -158,6 +336,19 @@ bytgpio_valid_pin(struct bytgpio_softc * return (0); } +/* + * Returns true if pad configured to be used as GPIO + */ +static bool +bytgpio_pad_is_gpio(struct bytgpio_softc *sc, int pin) +{ + if ((sc->sc_pinpad_map[pin].pad_func == PADCONF_FUNC_ANY) || + (sc->sc_pad_funcs[pin] == sc->sc_pinpad_map[pin].pad_func)) + return (true); + else + return (false); +} + static int bytgpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) { @@ -167,7 +358,9 @@ bytgpio_pin_getcaps(device_t dev, uint32 if (bytgpio_valid_pin(sc, pin) != 0) return (EINVAL); - *caps = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT; + *caps = 0; + if (bytgpio_pad_is_gpio(sc, pin)) + *caps = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT; return (0); } @@ -182,11 +375,14 @@ bytgpio_pin_getflags(device_t dev, uint3 if (bytgpio_valid_pin(sc, pin) != 0) return (EINVAL); + *flags = 0; + if (!bytgpio_pad_is_gpio(sc, pin)) + return (0); + /* Get the current pin state */ BYTGPIO_LOCK(sc); reg = BYGPIO_PIN_REGISTER(sc, pin, BYTGPIO_PAD_VAL); val = bytgpio_read_4(sc, reg); - *flags = 0; if ((val & BYTGPIO_PAD_VAL_I_OUTPUT_ENABLED) == 0) *flags |= GPIO_PIN_OUTPUT; /* @@ -211,7 +407,10 @@ bytgpio_pin_setflags(device_t dev, uint3 if (bytgpio_valid_pin(sc, pin) != 0) return (EINVAL); - allowed = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT; + if (bytgpio_pad_is_gpio(sc, pin)) + allowed = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT; + else + allowed = 0; /* * Only directtion flag allowed @@ -266,6 +465,9 @@ bytgpio_pin_set(device_t dev, uint32_t p if (bytgpio_valid_pin(sc, pin) != 0) return (EINVAL); + if (!bytgpio_pad_is_gpio(sc, pin)) + return (EINVAL); + BYTGPIO_LOCK(sc); reg = BYGPIO_PIN_REGISTER(sc, pin, BYTGPIO_PAD_VAL); val = bytgpio_read_4(sc, reg); @@ -288,16 +490,17 @@ bytgpio_pin_get(device_t dev, uint32_t p sc = device_get_softc(dev); if (bytgpio_valid_pin(sc, pin) != 0) return (EINVAL); + /* + * Report non-GPIO pads as pin LOW + */ + if (!bytgpio_pad_is_gpio(sc, pin)) { + *value = GPIO_PIN_LOW; + return (0); + } BYTGPIO_LOCK(sc); reg = BYGPIO_PIN_REGISTER(sc, pin, BYTGPIO_PAD_VAL); /* - * Enable input to read current value - */ - val = bytgpio_read_4(sc, reg); - val = val & ~BYTGPIO_PAD_VAL_I_INPUT_ENABLED; - bytgpio_write_4(sc, reg, val); - /* * And read actual value */ val = bytgpio_read_4(sc, reg); @@ -320,6 +523,9 @@ bytgpio_pin_toggle(device_t dev, uint32_ if (bytgpio_valid_pin(sc, pin) != 0) return (EINVAL); + if (!bytgpio_pad_is_gpio(sc, pin)) + return (EINVAL); + /* Toggle the pin */ BYTGPIO_LOCK(sc); reg = BYGPIO_PIN_REGISTER(sc, pin, BYTGPIO_PAD_VAL); @@ -350,6 +556,8 @@ bytgpio_attach(device_t dev) struct bytgpio_softc *sc; ACPI_STATUS status; int uid; + int pin; + uint32_t reg, val; sc = device_get_softc(dev); sc->sc_dev = dev; @@ -360,6 +568,8 @@ bytgpio_attach(device_t dev) return (ENXIO); } + BYTGPIO_LOCK_INIT(sc); + switch (uid) { case SCORE_UID: sc->sc_npins = SCORE_PINS; @@ -378,8 +588,12 @@ bytgpio_attach(device_t dev) break; default: device_printf(dev, "invalid _UID value: %d\n", uid); + goto error; } + sc->sc_pad_funcs = malloc(sizeof(int)*sc->sc_npins, M_DEVBUF, + M_WAITOK | M_ZERO); + sc->sc_mem_rid = 0; sc->sc_mem_res = bus_alloc_resource_any(sc->sc_dev, SYS_RES_MEMORY, &sc->sc_mem_rid, RF_ACTIVE); @@ -388,7 +602,11 @@ bytgpio_attach(device_t dev) goto error; } - BYTGPIO_LOCK_INIT(sc); + for (pin = 0; pin < sc->sc_npins; pin++) { + reg = BYGPIO_PIN_REGISTER(sc, pin, BYTGPIO_PCONF0); + val = bytgpio_read_4(sc, reg); + sc->sc_pad_funcs[pin] = val & BYTGPIO_PCONF0_FUNC_MASK; + } sc->sc_busdev = gpiobus_attach_bus(dev); if (sc->sc_busdev == NULL) { @@ -401,13 +619,39 @@ bytgpio_attach(device_t dev) return (0); error: + BYTGPIO_LOCK_DESTROY(sc); + return (ENXIO); } + +static int +bytgpio_detach(device_t dev) +{ + struct bytgpio_softc *sc; + + sc = device_get_softc(dev); + + if (sc->sc_busdev) + gpiobus_detach_bus(dev); + + BYTGPIO_LOCK_DESTROY(sc); + + if (sc->sc_pad_funcs) + free(sc->sc_pad_funcs, M_DEVBUF); + + if (sc->sc_mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, + sc->sc_mem_rid, sc->sc_mem_res); + + return (0); +} + static device_method_t bytgpio_methods[] = { /* Device interface */ DEVMETHOD(device_probe, bytgpio_probe), DEVMETHOD(device_attach, bytgpio_attach), + DEVMETHOD(device_detach, bytgpio_detach), /* GPIO protocol */ DEVMETHOD(gpio_get_bus, bytgpio_get_bus), @@ -432,4 +676,4 @@ static driver_t bytgpio_driver = { static devclass_t bytgpio_devclass; DRIVER_MODULE(bytgpio, acpi, bytgpio_driver, bytgpio_devclass, 0, 0); MODULE_DEPEND(bytgpio, acpi, 1, 1, 1); -MODULE_DEPEND(bytgpio, gpio, 1, 1, 1); +MODULE_DEPEND(bytgpio, gpiobus, 1, 1, 1); Modified: stable/11/sys/modules/Makefile ============================================================================== --- stable/11/sys/modules/Makefile Thu Dec 1 22:20:27 2016 (r309374) +++ stable/11/sys/modules/Makefile Thu Dec 1 22:22:19 2016 (r309375) @@ -61,6 +61,7 @@ SUBDIR= \ bwi \ bwn \ bwn_pci \ + ${_bytgpio} \ cam \ ${_canbepm} \ ${_canbus} \ @@ -601,6 +602,7 @@ _amdsbwd= amdsbwd _amdtemp= amdtemp _arcmsr= arcmsr _asmc= asmc +_bytgpio= bytgpio _ciss= ciss _cmx= cmx _coretemp= coretemp Modified: stable/11/sys/modules/bytgpio/Makefile ============================================================================== --- head/sys/modules/bytgpio/Makefile Mon Nov 21 19:47:37 2016 (r308942) +++ stable/11/sys/modules/bytgpio/Makefile Thu Dec 1 22:22:19 2016 (r309375) @@ -3,6 +3,6 @@ .PATH: ${.CURDIR}/../../dev/gpio KMOD= bytgpio SRCS= bytgpio.c -SRCS+= device_if.h bus_if.h gpio_if.h +SRCS+= acpi_if.h device_if.h bus_if.h gpio_if.h .include From owner-svn-src-stable-11@freebsd.org Thu Dec 1 23:28:00 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 492B5C61755; Thu, 1 Dec 2016 23:28:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 185A41905; Thu, 1 Dec 2016 23:28:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB1NRxf8083120; Thu, 1 Dec 2016 23:27:59 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB1NRxt5083119; Thu, 1 Dec 2016 23:27:59 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612012327.uB1NRxt5083119@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 1 Dec 2016 23:27:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309376 - stable/11/sys/ofed/drivers/infiniband/core X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2016 23:28:00 -0000 Author: jhb Date: Thu Dec 1 23:27:59 2016 New Revision: 309376 URL: https://svnweb.freebsd.org/changeset/base/309376 Log: MFC 304838: Do not free an uninitialized pointer on soaccept failure in the iWARP connection manager. Sponsored by: Chelsio Communications Modified: stable/11/sys/ofed/drivers/infiniband/core/iwcm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/infiniband/core/iwcm.c ============================================================================== --- stable/11/sys/ofed/drivers/infiniband/core/iwcm.c Thu Dec 1 22:22:19 2016 (r309375) +++ stable/11/sys/ofed/drivers/infiniband/core/iwcm.c Thu Dec 1 23:27:59 2016 (r309376) @@ -438,6 +438,7 @@ dequeue_socket(struct socket *head) so->so_state |= SS_NBIO; SOCK_UNLOCK(so); ACCEPT_UNLOCK(); + remote = NULL; soaccept(so, (struct sockaddr **)&remote); free(remote, M_SONAME); From owner-svn-src-stable-11@freebsd.org Thu Dec 1 23:37:20 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 185DDC61B98; Thu, 1 Dec 2016 23:37:20 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D4F5C10D1; Thu, 1 Dec 2016 23:37:19 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB1NbJWB087222; Thu, 1 Dec 2016 23:37:19 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB1NbI8O087212; Thu, 1 Dec 2016 23:37:18 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201612012337.uB1NbI8O087212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Thu, 1 Dec 2016 23:37:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309377 - in stable/11: release/doc/en_US.ISO8859-1/hardware share/man/man4 sys/boot/forth sys/conf sys/dev/bnxt sys/modules sys/modules/bnxt X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Dec 2016 23:37:20 -0000 Author: shurd (ports committer) Date: Thu Dec 1 23:37:17 2016 New Revision: 309377 URL: https://svnweb.freebsd.org/changeset/base/309377 Log: MFC r308696, r308729, r308787, r308813, r309028, r309073, r309078: r308696: New driver for Broadcom NetXtreme-C and NetXtreme-E devices. r308729: Add bnxt(4) to the hardware notes. r308787: Add missing newline in error mesage r308813: Check link status after init r309028: Add missing break to switch statement r309073: Fix version string r309078: Add new device IDs Approved by: sbruno Relnotes: yes Sponsored by: Broadcom Limited Added: stable/11/share/man/man4/bnxt.4 - copied unchanged from r308696, head/share/man/man4/bnxt.4 stable/11/sys/dev/bnxt/ - copied from r308696, head/sys/dev/bnxt/ stable/11/sys/modules/bnxt/ - copied from r308696, head/sys/modules/bnxt/ Modified: stable/11/release/doc/en_US.ISO8859-1/hardware/article.xml stable/11/share/man/man4/Makefile stable/11/sys/boot/forth/loader.conf stable/11/sys/conf/NOTES stable/11/sys/conf/files stable/11/sys/dev/bnxt/bnxt.h stable/11/sys/dev/bnxt/bnxt_hwrm.c stable/11/sys/dev/bnxt/if_bnxt.c stable/11/sys/modules/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/release/doc/en_US.ISO8859-1/hardware/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/hardware/article.xml Thu Dec 1 23:27:59 2016 (r309376) +++ stable/11/release/doc/en_US.ISO8859-1/hardware/article.xml Thu Dec 1 23:37:17 2016 (r309377) @@ -817,6 +817,8 @@ &hwlist.bge; + &hwlist.bnxt; + &hwlist.bxe; &hwlist.cas; Modified: stable/11/share/man/man4/Makefile ============================================================================== --- stable/11/share/man/man4/Makefile Thu Dec 1 23:27:59 2016 (r309376) +++ stable/11/share/man/man4/Makefile Thu Dec 1 23:37:17 2016 (r309377) @@ -79,6 +79,7 @@ MAN= aac.4 \ bhndb.4 \ bktr.4 \ blackhole.4 \ + bnxt.4 \ bpf.4 \ bridge.4 \ bt.4 \ @@ -593,6 +594,7 @@ MLINKS+=bce.4 if_bce.4 MLINKS+=bfe.4 if_bfe.4 MLINKS+=bge.4 if_bge.4 MLINKS+=bktr.4 brooktree.4 +MLINKS+=bnxt.4 if_bnxt.4 MLINKS+=bridge.4 if_bridge.4 MLINKS+=bwi.4 if_bwi.4 MLINKS+=bwn.4 if_bwn.4 Copied: stable/11/share/man/man4/bnxt.4 (from r308696, head/share/man/man4/bnxt.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/share/man/man4/bnxt.4 Thu Dec 1 23:37:17 2016 (r309377, copy of r308696, head/share/man/man4/bnxt.4) @@ -0,0 +1,222 @@ +.\" Copyright (c) 2016 Broadcom, All Rights Reserved. +.\" The term Broadcom refers to Broadcom Limited and/or its subsidiaries +.\" +.\" 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' +.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +.\" THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd May 12, 2016 +.Dt BNXT 4 +.Os +.Sh NAME +.Nm bnxt +.Nd "Broadcom NetXtreme-C/NetXtreme-E Family Ethernet driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device bnxt" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_bnxt_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for various NICs based on the Broadcom BCM57301/2/4, +and BCM57402/4/6 Ethernet controller chips. +.Pp +For more information on configuring this device, see +.Xr ifconfig 8 . +.Sh HARDWARE +The +.Nm +driver provides support for various NICs based on the Broadcom NetXtreme-C and +NetXtreme-E families of Gigabit Ethernet controller chips, including the +following: +.Pp +.Bl -bullet -compact +.It +Broadcom BCM57301 NetXtreme-C 10Gb Ethernet Controller +.It +Broadcom BCM57302 NetXtreme-C 10Gb/25Gb Ethernet Controller +.It +Broadcom BCM57304 NetXtreme-C 10Gb/25Gb/40Gb/50Gb Ethernet Controller +.It +Broadcom BCM57402 NetXtreme-E 10Gb Ethernet Controller +.It +Broadcom BCM57404 NetXtreme-E 10Gb/25Gb Ethernet Controller +.It +Broadcom BCM57406 NetXtreme-E 10GBase-T Ethernet Controller +.It +Broadcom BCM57402 NetXtreme-E Partition +.It +Broadcom BCM57407 NetXtreme-E 10GBase-T Ethernet Controller +.It +Broadcom BCM57404 NetXtreme-E Partition +.It +Broadcom BCM57406 NetXtreme-E Partition +.It +Broadcom BCM57407 NetXtreme-E 25Gb Ethernet Controller +.It +Broadcom BCM57304 NetXtreme-C Virtual Function +.It +Broadcom BCM57404 NetXtreme-E Virtual Function +.El +.Sh SYSCTL VARIABLES +These variables must be set before loading the driver, either via +.Xr loader.conf 5 +or through the use of +.Xr kenv 1 . +These are provided by the +.Xr iflib 9 +framework, and might be better documented there. +.Bl -tag -width indent +.It Va dev.bnxt.X.iflib.override_nrxds +Override the number of RX descriptors for each queue. +The value is a comma separated list of three positive integers: the size of the +completion ring, +the size of the receive ring, and the size of the aggregation ring respectively. +The completion ring should be at least the size of the aggregation ring plus +four times the size of the receive ring. +These numbers must be powers of two, and zero means to use the default. +Defaults to 0,0,0. +.It Va dev.bnxt.X.iflib.override_ntxds +Override the number of TX descriptors for each queue. +The value is a comma separated list of two positive integers: the size of the +completion ring, and the size of the transmit ring respectively. +The completion ring should be at least twice the size of the transmit ring. +These numbers must be powers of two, and zero means to use the default. +Defaults to 0,0. +.It Va override_qs_enable +When set, allows the number of transmit and receive queues to be different. +If not set, the lower of the number of TX or RX queues will be used for both. +.It Va override_nrxqs +Set the number of RX queues. +If zero, the number of RX queues is derived from the number of cores on the +socket connected to the controller. +Defaults to 0. +.It Va override_ntxqs +Set the number of TX queues. +If zero, the number of TX queues is derived from the number of cores on the +socket connected to the controller. +.El +.Pp +These +.Xr sysctl 8 +variables can be changed at any time: +.Bl -tag -width indent +.It Va dev.bnxt.X.vlan_only +Require that incoming frames must have a VLAN tag on them that matches one that +is configured for the NIC. +Normally, both frames that have a matching VLAN tag and frames that have no +VLAN tag are accepted. +Defaults to 0. +.It Va dev.bnxt.X.vlan_strip +When non-zero the NIC strips VLAN tags on receive. +Defaults to 0. +.It Va dev.bnxt.X.rx_stall +Enable buffering rather than dropping frames when there are no available host +RX buffers for DMA. +Defaults to 0. +.It Va dev.bnxt.X.rss_type +Comma-separated list of RSS hash types to support. +Default is all types. +Defaults to ipv4,tcp_ipv4,udp_ipv4,ipv6,tcp_ipv6,udp_ipv6. +.It Va dev.bnxt.X.rss_key +Current RSS key. +Defaults to a randomly generated value which is generated for each device +during attach. +.It Va dev.bnxt.X.ver.hwrm_min_ver +Minimum HWRM (HardWare Resource Manager) firmware API to support. +If the firmware implements an older version, a warning will be printed, and the +firmware should be upgraded. +Defaults to 1.2.2. +.El +.Pp +These +.Xr sysctl 8 +variables are read-only: +.Bl -tag -width indent +.It Va dev.bnxt.X.if_name +Current interface name of the device. +This will normally be +.Va bnxtX , +but this can be changed using +.Cm ifconfig name . +This sysctl allows correlating an interface with a child of dev.bnxt. +.It Va dev.bnxt.X.nvram.* +Information about the NVRAM device which contains the device firmware. +.It Va dev.bnxt.X.ver.* +Version-related information about the device and firmware: +.It Va dev.bnxt.X.ver.hwrm_if +Supported HWRM API version of the currently running firmware. +.It Va dev.bnxt.X.ver.driver_hwrm_if +HWRM API version the driver was built to support. +.It Va dev.bnxt.X.hwstats.* +Per-queue statistics tracked by the hardware. +.It Va dev.bnxt.X.hwstats.rxq0.drop_pkts +Number of packets dropped by hardware on queue zero. +This number might seem high, but the count includes packets dropped due to +incorrect destination MAC, unsubscribed multicast address, and other normal +reasons to ignore Ethernet frames. +.El +.Sh DIAGNOSTICS +.Bl -diag +.It "bnxt%d: %s command returned %s error." +Device firmware rejected a command from the driver. +There might be a driver/firmware HWRM API mismatch. +.It "bnxt%d: Timeout sending %s (timeout: %d) seq %d\n" +Device firmware unresponsive. +A PCI device reset is likely needed. +.It "bnxt%d: Timeout sending %s (timeout: %d) msg {0x%x 0x%x} len:%d v: %d\n" +Partial firmware response. +A PCI device reset is likely needed. +.Pp +As of this writing, the system must be rebooted to initiate a PCI device reset. +.El +.Sh SEE ALSO +.Xr altq 4 , +.Xr arp 4 , +.Xr netintro 4 , +.Xr ng_ether 4 , +.Xr vlan 4 , +.Xr ifconfig 8 , +.Xr iflib 4 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 12.0 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Jack Vogel Aq Mt jfvogel@gmail.com . +and is currently maintained by +.An Stephen Hurd Aq Mt stephen.hurd@broadcom.com . Modified: stable/11/sys/boot/forth/loader.conf ============================================================================== --- stable/11/sys/boot/forth/loader.conf Thu Dec 1 23:27:59 2016 (r309376) +++ stable/11/sys/boot/forth/loader.conf Thu Dec 1 23:37:17 2016 (r309377) @@ -312,6 +312,7 @@ if_axe_load="NO" # ASIX Electronics AX8 if_bce_load="NO" # Broadcom NetXtreme II Gigabit Ethernet if_bfe_load="NO" # Broadcom BCM4401 if_bge_load="NO" # Broadcom BCM570x PCI Gigabit Ethernet +if_bnxt_load="NO" # Broadcom NetXtreme-C/NetXtreme-E if_bridge_load="NO" # if_bridge(4) devices if_bwi_load="NO" # Broadcom BCM53xx IEEE 802.11b/g wireness NICs if_bwn_load="NO" # Broadcom BCM43xx IEEE 802.11 wireless NICs Modified: stable/11/sys/conf/NOTES ============================================================================== --- stable/11/sys/conf/NOTES Thu Dec 1 23:27:59 2016 (r309376) +++ stable/11/sys/conf/NOTES Thu Dec 1 23:37:17 2016 (r309377) @@ -1900,6 +1900,7 @@ device amphy # AMD AM79c873 / Davicom device atphy # Attansic/Atheros F1 device axphy # Asix Semiconductor AX88x9x device bmtphy # Broadcom BCM5201/BCM5202 and 3Com 3c905C +device bnxt # Broadcom NetXtreme-C/NetXtreme-E device brgphy # Broadcom BCM54xx/57xx 1000baseTX device ciphy # Cicada/Vitesse CS/VSC8xxx device e1000phy # Marvell 88E1000 1000/100/10-BT @@ -1940,6 +1941,7 @@ device xmphy # XaQti XMAC II # BCM570x family of controllers, including the 3Com 3c996-T, # the Netgear GA302T, the SysKonnect SK-9D21 and SK-9D41, and # the embedded gigE NICs on Dell PowerEdge 2550 servers. +# bnxt: Broadcom NetXtreme-C and NetXtreme-E PCIe 10/25/50G Ethernet adapters. # bxe: Broadcom NetXtreme II (BCM5771X/BCM578XX) PCIe 10Gb Ethernet # adapters. # bwi: Broadcom BCM430* and BCM431* family of wireless adapters. Modified: stable/11/sys/conf/files ============================================================================== --- stable/11/sys/conf/files Thu Dec 1 23:27:59 2016 (r309376) +++ stable/11/sys/conf/files Thu Dec 1 23:37:17 2016 (r309377) @@ -1187,6 +1187,10 @@ dev/bktr/bktr_i2c.c optional bktr pci s dev/bktr/bktr_os.c optional bktr pci dev/bktr/bktr_tuner.c optional bktr pci dev/bktr/msp34xx.c optional bktr pci +dev/bnxt/bnxt_hwrm.c optional bnxt iflib pci +dev/bnxt/bnxt_sysctl.c optional bnxt iflib pci +dev/bnxt/bnxt_txrx.c optional bnxt iflib pci +dev/bnxt/if_bnxt.c optional bnxt iflib pci dev/buslogic/bt.c optional bt dev/buslogic/bt_eisa.c optional bt eisa dev/buslogic/bt_isa.c optional bt isa Modified: stable/11/sys/dev/bnxt/bnxt.h ============================================================================== --- head/sys/dev/bnxt/bnxt.h Tue Nov 15 20:35:29 2016 (r308696) +++ stable/11/sys/dev/bnxt/bnxt.h Thu Dec 1 23:37:17 2016 (r309377) @@ -52,16 +52,39 @@ __FBSDID("$FreeBSD$"); #define BCM57301 0x16c8 #define BCM57302 0x16c9 #define BCM57304 0x16ca +#define BCM57311 0x16ce +#define BCM57312 0x16cf +#define BCM57314 0x16df #define BCM57402 0x16d0 -#define BCM57404 0x16d1 -#define BCM57406 0x16d2 #define BCM57402_NPAR 0x16d4 -#define BCM57407 0x16d5 +#define BCM57404 0x16d1 #define BCM57404_NPAR 0x16e7 +#define BCM57406 0x16d2 #define BCM57406_NPAR 0x16e8 +#define BCM57407 0x16d5 +#define BCM57407_NPAR 0x16ea #define BCM57407_SFP 0x16e9 -#define BCM57304_VF 0x16cb -#define BCM57404_VF 0x16d3 +#define BCM57412 0x16d6 +#define BCM57412_NPAR1 0x16de +#define BCM57412_NPAR2 0x16eb +#define BCM57414 0x16d7 +#define BCM57414_NPAR1 0x16ec +#define BCM57414_NPAR2 0x16ed +#define BCM57416 0x16d8 +#define BCM57416_NPAR1 0x16ee +#define BCM57416_NPAR2 0x16ef +#define BCM57416_SFP 0x16e3 +#define BCM57417 0x16d9 +#define BCM57417_NPAR1 0x16c0 +#define BCM57417_NPAR2 0x16cc +#define BCM57417_SFP 0x16e2 +#define BCM58700 0x16cd +#define NETXTREME_C_VF1 0x16cb +#define NETXTREME_C_VF2 0x16e1 +#define NETXTREME_C_VF3 0x16e5 +#define NETXTREME_E_VF1 0x16c1 +#define NETXTREME_E_VF2 0x16d3 +#define NETXTREME_E_VF3 0x16dc #define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ Modified: stable/11/sys/dev/bnxt/bnxt_hwrm.c ============================================================================== --- head/sys/dev/bnxt/bnxt_hwrm.c Tue Nov 15 20:35:29 2016 (r308696) +++ stable/11/sys/dev/bnxt/bnxt_hwrm.c Thu Dec 1 23:37:17 2016 (r309377) @@ -424,7 +424,7 @@ bnxt_hwrm_func_qcaps(struct bnxt_softc * pf->max_rx_wm_flows = le32toh(resp->max_rx_wm_flows); } if (!_is_valid_ether_addr(func->mac_addr)) { - device_printf(softc->dev, "Invalid ethernet address, generating random locally administered address"); + device_printf(softc->dev, "Invalid ethernet address, generating random locally administered address\n"); get_random_ether_addr(func->mac_addr); } Modified: stable/11/sys/dev/bnxt/if_bnxt.c ============================================================================== --- head/sys/dev/bnxt/if_bnxt.c Tue Nov 15 20:35:29 2016 (r308696) +++ stable/11/sys/dev/bnxt/if_bnxt.c Thu Dec 1 23:37:17 2016 (r309377) @@ -75,26 +75,72 @@ static pci_vendor_info_t bnxt_vendor_inf "Broadcom BCM57302 NetXtreme-C 10Gb/25Gb Ethernet Controller"), PVID(BROADCOM_VENDOR_ID, BCM57304, "Broadcom BCM57304 NetXtreme-C 10Gb/25Gb/40Gb/50Gb Ethernet Controller"), + PVID(BROADCOM_VENDOR_ID, BCM57311, + "Broadcom BCM57311 NetXtreme-C 10Gb Ethernet"), + PVID(BROADCOM_VENDOR_ID, BCM57312, + "Broadcom BCM57312 NetXtreme-C 10Gb/25Gb Ethernet"), + PVID(BROADCOM_VENDOR_ID, BCM57314, + "Broadcom BCM57314 NetXtreme-C 10Gb/25Gb/40Gb/50Gb Ethernet"), PVID(BROADCOM_VENDOR_ID, BCM57402, "Broadcom BCM57402 NetXtreme-E 10Gb Ethernet Controller"), - PVID(BROADCOM_VENDOR_ID, BCM57404, - "Broadcom BCM57404 NetXtreme-E 10Gb/25Gb Ethernet Controller"), - PVID(BROADCOM_VENDOR_ID, BCM57406, - "Broadcom BCM57406 NetXtreme-E 10GBase-T Ethernet Controller"), PVID(BROADCOM_VENDOR_ID, BCM57402_NPAR, "Broadcom BCM57402 NetXtreme-E Partition"), - PVID(BROADCOM_VENDOR_ID, BCM57407, - "Broadcom BCM57407 NetXtreme-E 10GBase-T Ethernet Controller"), + PVID(BROADCOM_VENDOR_ID, BCM57404, + "Broadcom BCM57404 NetXtreme-E 10Gb/25Gb Ethernet Controller"), PVID(BROADCOM_VENDOR_ID, BCM57404_NPAR, "Broadcom BCM57404 NetXtreme-E Partition"), + PVID(BROADCOM_VENDOR_ID, BCM57406, + "Broadcom BCM57406 NetXtreme-E 10GBase-T Ethernet Controller"), PVID(BROADCOM_VENDOR_ID, BCM57406_NPAR, "Broadcom BCM57406 NetXtreme-E Partition"), + PVID(BROADCOM_VENDOR_ID, BCM57407, + "Broadcom BCM57407 NetXtreme-E 10GBase-T Ethernet Controller"), + PVID(BROADCOM_VENDOR_ID, BCM57407_NPAR, + "Broadcom BCM57407 NetXtreme-E Ethernet Partition"), PVID(BROADCOM_VENDOR_ID, BCM57407_SFP, "Broadcom BCM57407 NetXtreme-E 25Gb Ethernet Controller"), - PVID(BROADCOM_VENDOR_ID, BCM57304_VF, - "Broadcom BCM57304 NetXtreme-C Virtual Function"), - PVID(BROADCOM_VENDOR_ID, BCM57404_VF, - "Broadcom BCM57404 NetXtreme-E Virtual Function"), + PVID(BROADCOM_VENDOR_ID, BCM57412, + "Broadcom BCM57412 NetXtreme-E 10Gb Ethernet"), + PVID(BROADCOM_VENDOR_ID, BCM57412_NPAR1, + "Broadcom BCM57412 NetXtreme-E Ethernet Partition"), + PVID(BROADCOM_VENDOR_ID, BCM57412_NPAR2, + "Broadcom BCM57412 NetXtreme-E Ethernet Partition"), + PVID(BROADCOM_VENDOR_ID, BCM57414, + "Broadcom BCM57414 NetXtreme-E 10Gb/25Gb Ethernet"), + PVID(BROADCOM_VENDOR_ID, BCM57414_NPAR1, + "Broadcom BCM57414 NetXtreme-E Ethernet Partition"), + PVID(BROADCOM_VENDOR_ID, BCM57414_NPAR2, + "Broadcom BCM57414 NetXtreme-E Ethernet Partition"), + PVID(BROADCOM_VENDOR_ID, BCM57416, + "Broadcom BCM57416 NetXtreme-E 10GBase-T Ethernet"), + PVID(BROADCOM_VENDOR_ID, BCM57416_NPAR1, + "Broadcom BCM57416 NetXtreme-E Ethernet Partition"), + PVID(BROADCOM_VENDOR_ID, BCM57416_NPAR2, + "Broadcom BCM57416 NetXtreme-E Ethernet Partition"), + PVID(BROADCOM_VENDOR_ID, BCM57416_SFP, + "Broadcom BCM57416 NetXtreme-E 10Gb Ethernet"), + PVID(BROADCOM_VENDOR_ID, BCM57417, + "Broadcom BCM57417 NetXtreme-E 10GBase-T Ethernet"), + PVID(BROADCOM_VENDOR_ID, BCM57417_NPAR1, + "Broadcom BCM57417 NetXtreme-E Ethernet Partition"), + PVID(BROADCOM_VENDOR_ID, BCM57417_NPAR2, + "Broadcom BCM57417 NetXtreme-E Ethernet Partition"), + PVID(BROADCOM_VENDOR_ID, BCM57417_SFP, + "Broadcom BCM57417 NetXtreme-E 10Gb/25Gb Ethernet"), + PVID(BROADCOM_VENDOR_ID, BCM58700, + "Broadcom BCM58700 Nitro 1Gb/2.5Gb/10Gb Ethernet"), + PVID(BROADCOM_VENDOR_ID, NETXTREME_C_VF1, + "Broadcom NetXtreme-C Ethernet Virtual Function"), + PVID(BROADCOM_VENDOR_ID, NETXTREME_C_VF2, + "Broadcom NetXtreme-C Ethernet Virtual Function"), + PVID(BROADCOM_VENDOR_ID, NETXTREME_C_VF3, + "Broadcom NetXtreme-C Ethernet Virtual Function"), + PVID(BROADCOM_VENDOR_ID, NETXTREME_E_VF1, + "Broadcom NetXtreme-E Ethernet Virtual Function"), + PVID(BROADCOM_VENDOR_ID, NETXTREME_E_VF2, + "Broadcom NetXtreme-E Ethernet Virtual Function"), + PVID(BROADCOM_VENDOR_ID, NETXTREME_E_VF3, + "Broadcom NetXtreme-E Ethernet Virtual Function"), /* required last entry */ PVID_END @@ -227,7 +273,7 @@ static driver_t bnxt_iflib_driver = { * iflib shared context */ -char bnxt_driver_version[] = "https://github.com/Broadcom/freebsd-nxt/commits/bnxt-dev"; +char bnxt_driver_version[] = "FreeBSD base"; extern struct if_txrx bnxt_txrx; static struct if_shared_ctx bnxt_sctx_init = { .isc_magic = IFLIB_MAGIC, @@ -540,14 +586,26 @@ bnxt_attach_pre(if_ctx_t ctx) softc->sctx = iflib_get_sctx(ctx); scctx = softc->scctx; + /* TODO: Better way of detecting NPAR/VF is needed */ switch (softc->sctx->isc_vendor_info->pvi_device_id) { case BCM57402_NPAR: case BCM57404_NPAR: case BCM57406_NPAR: + case BCM57407_NPAR: + case BCM57412_NPAR1: + case BCM57412_NPAR2: + case BCM57414_NPAR1: + case BCM57414_NPAR2: + case BCM57416_NPAR1: + case BCM57416_NPAR2: softc->flags |= BNXT_FLAG_NPAR; break; - case BCM57304_VF: - case BCM57404_VF: + case NETXTREME_C_VF1: + case NETXTREME_C_VF2: + case NETXTREME_C_VF3: + case NETXTREME_E_VF1: + case NETXTREME_E_VF2: + case NETXTREME_E_VF3: softc->flags |= BNXT_FLAG_VF; break; } @@ -822,6 +880,7 @@ static void bnxt_init(if_ctx_t ctx) { struct bnxt_softc *softc = iflib_get_softc(ctx); + struct ifmediareq ifmr; int i, j; int rc; @@ -975,6 +1034,7 @@ bnxt_init(if_ctx_t ctx) } bnxt_do_enable_intr(&softc->def_cp_ring); + bnxt_media_status(softc->ctx, &ifmr); return; fail: @@ -1910,6 +1970,7 @@ bnxt_add_media_types(struct bnxt_softc * if (supported & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_10GB) ifmedia_add(softc->media, IFM_ETHER | IFM_10G_KR, 0, NULL); + break; case HWRM_PORT_PHY_QCFG_OUTPUT_PHY_TYPE_BASELR: if (supported & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100GB) ifmedia_add(softc->media, IFM_ETHER | IFM_100G_LR4, 0, Modified: stable/11/sys/modules/Makefile ============================================================================== --- stable/11/sys/modules/Makefile Thu Dec 1 23:27:59 2016 (r309376) +++ stable/11/sys/modules/Makefile Thu Dec 1 23:37:17 2016 (r309377) @@ -57,6 +57,7 @@ SUBDIR= \ ${_bios} \ ${_bktr} \ ${_bm} \ + bnxt \ bridgestp \ bwi \ bwn \ From owner-svn-src-stable-11@freebsd.org Fri Dec 2 01:38:42 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F32ECC6188E; Fri, 2 Dec 2016 01:38:41 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CD9D01A53; Fri, 2 Dec 2016 01:38:41 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB21cfKW036169; Fri, 2 Dec 2016 01:38:41 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB21ce3W036166; Fri, 2 Dec 2016 01:38:40 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201612020138.uB21ce3W036166@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Fri, 2 Dec 2016 01:38:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309381 - stable/11/share/man/man4 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2016 01:38:42 -0000 Author: gonzo Date: Fri Dec 2 01:38:40 2016 New Revision: 309381 URL: https://svnweb.freebsd.org/changeset/base/309381 Log: MFC r308941: [bytgpio] Add bytgpio(4) man page with general description of the driver Added: stable/11/share/man/man4/bytgpio.4 - copied unchanged from r308941, head/share/man/man4/bytgpio.4 Modified: stable/11/share/man/man4/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/Makefile ============================================================================== --- stable/11/share/man/man4/Makefile Fri Dec 2 01:25:51 2016 (r309380) +++ stable/11/share/man/man4/Makefile Fri Dec 2 01:38:40 2016 (r309381) @@ -85,6 +85,7 @@ MAN= aac.4 \ bt.4 \ bwi.4 \ bwn.4 \ + ${_bytgpio.4} \ capsicum.4 \ cardbus.4 \ carp.4 \ @@ -769,6 +770,7 @@ _amdsmb.4= amdsmb.4 _amdtemp.4= amdtemp.4 _asmc.4= asmc.4 _bxe.4= bxe.4 +_bytgpio.4= bytgpio.4 _coretemp.4= coretemp.4 _cpuctl.4= cpuctl.4 _dpms.4= dpms.4 Copied: stable/11/share/man/man4/bytgpio.4 (from r308941, head/share/man/man4/bytgpio.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/share/man/man4/bytgpio.4 Fri Dec 2 01:38:40 2016 (r309381, copy of r308941, head/share/man/man4/bytgpio.4) @@ -0,0 +1,55 @@ +.\" Copyright (c) 2016 +.\" Oleksandr Tymoshenko . All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 20, 2016 +.Dt BYTGPIO 4 +.Os +.Sh NAME +.Nm bytgpio +.Nd Intel Bay Trail SoC GPIO controller +.Sh SYNOPSIS +.Cd "device gpio" +.Cd "device bytgpio" +.Sh DESCRIPTION +The +.Nm +is a driver for GPIO controller that can be found in Intel's Bay Trail SoC family. +.Pp +Bay Trail SoC has three banks of GPIO pins exposed to userland as /dev/gpiocN, +where N is 0, 1, and 2. Pins in each bank are pre-named to match names +on boards schematics: GPIO_S0_SCnn, GPIO_S0_NCnn, and GPIO_S5_nn. +.Sh SEE ALSO +.Xr gpio 3 , +.Xr gpio 4 , +.Xr gpioctl 8 +.Sh HISTORY +The +.Nm +manual page first appeared in +.Fx 12.0 . +.Sh AUTHORS +This driver and man page was written by +.An Oleksandr Tymoshenko Aq Mt gonzo@FreeBSD.org . From owner-svn-src-stable-11@freebsd.org Fri Dec 2 05:25:34 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09568C61904; Fri, 2 Dec 2016 05:25:34 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CCD2E113C; Fri, 2 Dec 2016 05:25:33 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB25PXfQ028831; Fri, 2 Dec 2016 05:25:33 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB25PXut028830; Fri, 2 Dec 2016 05:25:33 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201612020525.uB25PXut028830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Fri, 2 Dec 2016 05:25:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309384 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2016 05:25:34 -0000 Author: julian Date: Fri Dec 2 05:25:32 2016 New Revision: 309384 URL: https://svnweb.freebsd.org/changeset/base/309384 Log: MFH: r306306 Give the user a clue as to which process hit maxfiles. Sponsored by: Panzura Modified: stable/11/sys/kern/kern_descrip.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_descrip.c ============================================================================== --- stable/11/sys/kern/kern_descrip.c Fri Dec 2 05:24:51 2016 (r309383) +++ stable/11/sys/kern/kern_descrip.c Fri Dec 2 05:25:32 2016 (r309384) @@ -1758,8 +1758,8 @@ falloc_noinstall(struct thread *td, stru priv_check(td, PRIV_MAXFILES) != 0) || openfiles >= maxfiles) { if (ppsratecheck(&lastfail, &curfail, 1)) { - printf("kern.maxfiles limit exceeded by uid %i, " - "please see tuning(7).\n", td->td_ucred->cr_ruid); + printf("kern.maxfiles limit exceeded by uid %i, (%s) " + "please see tuning(7).\n", td->td_ucred->cr_ruid, td->td_proc->p_comm); } return (ENFILE); } From owner-svn-src-stable-11@freebsd.org Fri Dec 2 05:36:38 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 601C7C61BF2; Fri, 2 Dec 2016 05:36:38 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 28963167A; Fri, 2 Dec 2016 05:36:38 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB25abcK032947; Fri, 2 Dec 2016 05:36:37 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB25abkk032945; Fri, 2 Dec 2016 05:36:37 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201612020536.uB25abkk032945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Fri, 2 Dec 2016 05:36:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309385 - in stable/11/sys: modules/netgraph/checksum netgraph X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2016 05:36:38 -0000 Author: julian Date: Fri Dec 2 05:36:37 2016 New Revision: 309385 URL: https://svnweb.freebsd.org/changeset/base/309385 Log: MFH: r303612 netgraph module for reconstructing checksums PR: 206108 Submitted by: Dmitry Vagin daemon.hammer@ya.ru Added: stable/11/sys/modules/netgraph/checksum/ - copied from r303612, head/sys/modules/netgraph/checksum/ stable/11/sys/netgraph/ng_checksum.c - copied unchanged from r303612, head/sys/netgraph/ng_checksum.c stable/11/sys/netgraph/ng_checksum.h - copied unchanged from r303612, head/sys/netgraph/ng_checksum.h Modified: Directory Properties: stable/11/ (props changed) Copied: stable/11/sys/netgraph/ng_checksum.c (from r303612, head/sys/netgraph/ng_checksum.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/netgraph/ng_checksum.c Fri Dec 2 05:36:37 2016 (r309385, copy of r303612, head/sys/netgraph/ng_checksum.c) @@ -0,0 +1,729 @@ +/*- + * Copyright (c) 2015 Dmitry Vagin + * 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 "opt_inet.h" +#include "opt_inet6.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +/* private data */ +struct ng_checksum_priv { + hook_p in; + hook_p out; + uint8_t dlt; /* DLT_XXX from bpf.h */ + struct ng_checksum_config *conf; + struct ng_checksum_stats stats; +}; + +typedef struct ng_checksum_priv *priv_p; + +/* Netgraph methods */ +static ng_constructor_t ng_checksum_constructor; +static ng_rcvmsg_t ng_checksum_rcvmsg; +static ng_shutdown_t ng_checksum_shutdown; +static ng_newhook_t ng_checksum_newhook; +static ng_rcvdata_t ng_checksum_rcvdata; +static ng_disconnect_t ng_checksum_disconnect; + +#define ERROUT(x) { error = (x); goto done; } + +static const struct ng_parse_struct_field ng_checksum_config_type_fields[] + = NG_CHECKSUM_CONFIG_TYPE; +static const struct ng_parse_type ng_checksum_config_type = { + &ng_parse_struct_type, + &ng_checksum_config_type_fields +}; + +static const struct ng_parse_struct_field ng_checksum_stats_fields[] + = NG_CHECKSUM_STATS_TYPE; +static const struct ng_parse_type ng_checksum_stats_type = { + &ng_parse_struct_type, + &ng_checksum_stats_fields +}; + +static const struct ng_cmdlist ng_checksum_cmdlist[] = { + { + NGM_CHECKSUM_COOKIE, + NGM_CHECKSUM_GETDLT, + "getdlt", + NULL, + &ng_parse_uint8_type + }, + { + NGM_CHECKSUM_COOKIE, + NGM_CHECKSUM_SETDLT, + "setdlt", + &ng_parse_uint8_type, + NULL + }, + { + NGM_CHECKSUM_COOKIE, + NGM_CHECKSUM_GETCONFIG, + "getconfig", + NULL, + &ng_checksum_config_type + }, + { + NGM_CHECKSUM_COOKIE, + NGM_CHECKSUM_SETCONFIG, + "setconfig", + &ng_checksum_config_type, + NULL + }, + { + NGM_CHECKSUM_COOKIE, + NGM_CHECKSUM_GET_STATS, + "getstats", + NULL, + &ng_checksum_stats_type + }, + { + NGM_CHECKSUM_COOKIE, + NGM_CHECKSUM_CLR_STATS, + "clrstats", + NULL, + NULL + }, + { + NGM_CHECKSUM_COOKIE, + NGM_CHECKSUM_GETCLR_STATS, + "getclrstats", + NULL, + &ng_checksum_stats_type + }, + { 0 } +}; + +static struct ng_type typestruct = { + .version = NG_ABI_VERSION, + .name = NG_CHECKSUM_NODE_TYPE, + .constructor = ng_checksum_constructor, + .rcvmsg = ng_checksum_rcvmsg, + .shutdown = ng_checksum_shutdown, + .newhook = ng_checksum_newhook, + .rcvdata = ng_checksum_rcvdata, + .disconnect = ng_checksum_disconnect, + .cmdlist = ng_checksum_cmdlist, +}; + +NETGRAPH_INIT(checksum, &typestruct); + +static int +ng_checksum_constructor(node_p node) +{ + priv_p priv; + + priv = malloc(sizeof(*priv), M_NETGRAPH, M_WAITOK|M_ZERO); + priv->dlt = DLT_RAW; + + NG_NODE_SET_PRIVATE(node, priv); + + return (0); +} + +static int +ng_checksum_newhook(node_p node, hook_p hook, const char *name) +{ + const priv_p priv = NG_NODE_PRIVATE(node); + + if (strncmp(name, NG_CHECKSUM_HOOK_IN, strlen(NG_CHECKSUM_HOOK_IN)) == 0) { + priv->in = hook; + } else if (strncmp(name, NG_CHECKSUM_HOOK_OUT, strlen(NG_CHECKSUM_HOOK_OUT)) == 0) { + priv->out = hook; + } else + return (EINVAL); + + return (0); +} + +static int +ng_checksum_rcvmsg(node_p node, item_p item, hook_p lasthook) +{ + const priv_p priv = NG_NODE_PRIVATE(node); + struct ng_checksum_config *conf, *newconf; + struct ng_mesg *msg; + struct ng_mesg *resp = NULL; + int error = 0; + + NGI_GET_MSG(item, msg); + + if (msg->header.typecookie != NGM_CHECKSUM_COOKIE) + ERROUT(EINVAL); + + switch (msg->header.cmd) + { + case NGM_CHECKSUM_GETDLT: + NG_MKRESPONSE(resp, msg, sizeof(uint8_t), M_WAITOK); + + if (resp == NULL) + ERROUT(ENOMEM); + + *((uint8_t *) resp->data) = priv->dlt; + + break; + + case NGM_CHECKSUM_SETDLT: + if (msg->header.arglen != sizeof(uint8_t)) + ERROUT(EINVAL); + + switch (*(uint8_t *) msg->data) + { + case DLT_EN10MB: + case DLT_RAW: + priv->dlt = *(uint8_t *) msg->data; + break; + + default: + ERROUT(EINVAL); + } + + break; + + case NGM_CHECKSUM_GETCONFIG: + if (priv->conf == NULL) + ERROUT(0); + + NG_MKRESPONSE(resp, msg, sizeof(struct ng_checksum_config), M_WAITOK); + + if (resp == NULL) + ERROUT(ENOMEM); + + bcopy(priv->conf, resp->data, sizeof(struct ng_checksum_config)); + + break; + + case NGM_CHECKSUM_SETCONFIG: + conf = (struct ng_checksum_config *) msg->data; + + if (msg->header.arglen != sizeof(struct ng_checksum_config)) + ERROUT(EINVAL); + + conf->csum_flags &= NG_CHECKSUM_CSUM_IPV4|NG_CHECKSUM_CSUM_IPV6; + conf->csum_offload &= NG_CHECKSUM_CSUM_IPV4|NG_CHECKSUM_CSUM_IPV6; + + newconf = malloc(sizeof(struct ng_checksum_config), M_NETGRAPH, M_WAITOK|M_ZERO); + + bcopy(conf, newconf, sizeof(struct ng_checksum_config)); + + if (priv->conf) + free(priv->conf, M_NETGRAPH); + + priv->conf = newconf; + + break; + + case NGM_CHECKSUM_GET_STATS: + case NGM_CHECKSUM_CLR_STATS: + case NGM_CHECKSUM_GETCLR_STATS: + if (msg->header.cmd != NGM_CHECKSUM_CLR_STATS) { + NG_MKRESPONSE(resp, msg, sizeof(struct ng_checksum_stats), M_WAITOK); + + if (resp == NULL) + ERROUT(ENOMEM); + + bcopy(&(priv->stats), resp->data, sizeof(struct ng_checksum_stats)); + } + + if (msg->header.cmd != NGM_CHECKSUM_GET_STATS) + bzero(&(priv->stats), sizeof(struct ng_checksum_stats)); + + break; + + default: + ERROUT(EINVAL); + } + +done: + NG_RESPOND_MSG(error, node, item, resp); + NG_FREE_MSG(msg); + + return (error); +} + +#define PULLUP_CHECK(mbuf, length) do { \ + pullup_len += length; \ + if (((mbuf)->m_pkthdr.len < pullup_len) || \ + (pullup_len > MHLEN)) { \ + return (EINVAL); \ + } \ + if ((mbuf)->m_len < pullup_len && \ + (((mbuf) = m_pullup((mbuf), pullup_len)) == NULL)) { \ + return (ENOBUFS); \ + } \ +} while (0) + +#ifdef INET +static int +checksum_ipv4(priv_p priv, struct mbuf *m, int l3_offset) +{ + struct ip *ip4; + int pullup_len; + int hlen, plen; + int processed = 0; + + pullup_len = l3_offset; + + PULLUP_CHECK(m, sizeof(struct ip)); + ip4 = (struct ip *) mtodo(m, l3_offset); + + if (ip4->ip_v != IPVERSION) + return (EOPNOTSUPP); + + hlen = ip4->ip_hl << 2; + plen = ntohs(ip4->ip_len); + + if (hlen < sizeof(struct ip) || m->m_pkthdr.len < l3_offset + plen) + return (EINVAL); + + if (m->m_pkthdr.csum_flags & CSUM_IP) { + ip4->ip_sum = 0; + + if ((priv->conf->csum_offload & CSUM_IP) == 0) { + if (hlen == sizeof(struct ip)) + ip4->ip_sum = in_cksum_hdr(ip4); + else + ip4->ip_sum = in_cksum_skip(m, l3_offset + hlen, l3_offset); + + m->m_pkthdr.csum_flags &= ~CSUM_IP; + } + + processed = 1; + } + + pullup_len = l3_offset + hlen; + + /* We can not calculate a checksum fragmented packets */ + if (ip4->ip_off & htons(IP_MF|IP_OFFMASK)) { + m->m_pkthdr.csum_flags &= ~(CSUM_TCP|CSUM_UDP); + return (0); + } + + switch (ip4->ip_p) + { + case IPPROTO_TCP: + if (m->m_pkthdr.csum_flags & CSUM_TCP) { + struct tcphdr *th; + + PULLUP_CHECK(m, sizeof(struct tcphdr)); + th = (struct tcphdr *) mtodo(m, l3_offset + hlen); + + th->th_sum = in_pseudo(ip4->ip_src.s_addr, + ip4->ip_dst.s_addr, htons(ip4->ip_p + plen - hlen)); + + if ((priv->conf->csum_offload & CSUM_TCP) == 0) { + th->th_sum = in_cksum_skip(m, l3_offset + plen, l3_offset + hlen); + m->m_pkthdr.csum_flags &= ~CSUM_TCP; + } + + processed = 1; + } + + m->m_pkthdr.csum_flags &= ~CSUM_UDP; + break; + + case IPPROTO_UDP: + if (m->m_pkthdr.csum_flags & CSUM_UDP) { + struct udphdr *uh; + + PULLUP_CHECK(m, sizeof(struct udphdr)); + uh = (struct udphdr *) mtodo(m, l3_offset + hlen); + + uh->uh_sum = in_pseudo(ip4->ip_src.s_addr, + ip4->ip_dst.s_addr, htons(ip4->ip_p + plen - hlen)); + + if ((priv->conf->csum_offload & CSUM_UDP) == 0) { + uh->uh_sum = in_cksum_skip(m, + l3_offset + plen, l3_offset + hlen); + + if (uh->uh_sum == 0) + uh->uh_sum = 0xffff; + + m->m_pkthdr.csum_flags &= ~CSUM_UDP; + } + + processed = 1; + } + + m->m_pkthdr.csum_flags &= ~CSUM_TCP; + break; + + default: + m->m_pkthdr.csum_flags &= ~(CSUM_TCP|CSUM_UDP); + break; + } + + m->m_pkthdr.csum_flags &= ~NG_CHECKSUM_CSUM_IPV6; + + if (processed) + priv->stats.processed++; + + return (0); +} +#endif /* INET */ + +#ifdef INET6 +static int +checksum_ipv6(priv_p priv, struct mbuf *m, int l3_offset) +{ + struct ip6_hdr *ip6; + struct ip6_ext *ip6e = NULL; + int pullup_len; + int hlen, plen; + int nxt; + int processed = 0; + + pullup_len = l3_offset; + + PULLUP_CHECK(m, sizeof(struct ip6_hdr)); + ip6 = (struct ip6_hdr *) mtodo(m, l3_offset); + + if ((ip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) + return (EOPNOTSUPP); + + hlen = sizeof(struct ip6_hdr); + plen = ntohs(ip6->ip6_plen) + hlen; + + if (m->m_pkthdr.len < l3_offset + plen) + return (EINVAL); + + nxt = ip6->ip6_nxt; + + for (;;) { + switch (nxt) + { + case IPPROTO_DSTOPTS: + case IPPROTO_HOPOPTS: + case IPPROTO_ROUTING: + PULLUP_CHECK(m, sizeof(struct ip6_ext)); + ip6e = (struct ip6_ext *) mtodo(m, l3_offset + hlen); + nxt = ip6e->ip6e_nxt; + hlen += (ip6e->ip6e_len + 1) << 3; + pullup_len = l3_offset + hlen; + break; + + case IPPROTO_AH: + PULLUP_CHECK(m, sizeof(struct ip6_ext)); + ip6e = (struct ip6_ext *) mtodo(m, l3_offset + hlen); + nxt = ip6e->ip6e_nxt; + hlen += (ip6e->ip6e_len + 2) << 2; + pullup_len = l3_offset + hlen; + break; + + case IPPROTO_FRAGMENT: + /* We can not calculate a checksum fragmented packets */ + m->m_pkthdr.csum_flags &= ~(CSUM_TCP_IPV6|CSUM_UDP_IPV6); + return (0); + + default: + goto loopend; + } + + if (nxt == 0) + return (EINVAL); + } + +loopend: + + switch (nxt) + { + case IPPROTO_TCP: + if (m->m_pkthdr.csum_flags & CSUM_TCP_IPV6) { + struct tcphdr *th; + + PULLUP_CHECK(m, sizeof(struct tcphdr)); + th = (struct tcphdr *) mtodo(m, l3_offset + hlen); + + th->th_sum = in6_cksum_pseudo(ip6, plen - hlen, nxt, 0); + + if ((priv->conf->csum_offload & CSUM_TCP_IPV6) == 0) { + th->th_sum = in_cksum_skip(m, l3_offset + plen, l3_offset + hlen); + m->m_pkthdr.csum_flags &= ~CSUM_TCP_IPV6; + } + + processed = 1; + } + + m->m_pkthdr.csum_flags &= ~CSUM_UDP_IPV6; + break; + + case IPPROTO_UDP: + if (m->m_pkthdr.csum_flags & CSUM_UDP_IPV6) { + struct udphdr *uh; + + PULLUP_CHECK(m, sizeof(struct udphdr)); + uh = (struct udphdr *) mtodo(m, l3_offset + hlen); + + uh->uh_sum = in6_cksum_pseudo(ip6, plen - hlen, nxt, 0); + + if ((priv->conf->csum_offload & CSUM_UDP_IPV6) == 0) { + uh->uh_sum = in_cksum_skip(m, + l3_offset + plen, l3_offset + hlen); + + if (uh->uh_sum == 0) + uh->uh_sum = 0xffff; + + m->m_pkthdr.csum_flags &= ~CSUM_UDP_IPV6; + } + + processed = 1; + } + + m->m_pkthdr.csum_flags &= ~CSUM_TCP_IPV6; + break; + + default: + m->m_pkthdr.csum_flags &= ~(CSUM_TCP_IPV6|CSUM_UDP_IPV6); + break; + } + + m->m_pkthdr.csum_flags &= ~NG_CHECKSUM_CSUM_IPV4; + + if (processed) + priv->stats.processed++; + + return (0); +} +#endif /* INET6 */ + +#undef PULLUP_CHECK + +static int +ng_checksum_rcvdata(hook_p hook, item_p item) +{ + const priv_p priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); + struct mbuf *m; + hook_p out; + int error = 0; + + priv->stats.received++; + + NGI_GET_M(item, m); + +#define PULLUP_CHECK(mbuf, length) do { \ + pullup_len += length; \ + if (((mbuf)->m_pkthdr.len < pullup_len) || \ + (pullup_len > MHLEN)) { \ + error = EINVAL; \ + goto bypass; \ + } \ + if ((mbuf)->m_len < pullup_len && \ + (((mbuf) = m_pullup((mbuf), pullup_len)) == NULL)) { \ + error = ENOBUFS; \ + goto drop; \ + } \ +} while (0) + + if (!(priv->conf && hook == priv->in && m && (m->m_flags & M_PKTHDR))) + goto bypass; + + m->m_pkthdr.csum_flags |= priv->conf->csum_flags; + + if (m->m_pkthdr.csum_flags & (NG_CHECKSUM_CSUM_IPV4|NG_CHECKSUM_CSUM_IPV6)) + { + struct ether_header *eh; + struct ng_checksum_vlan_header *vh; + int pullup_len = 0; + uint16_t etype; + + m = m_unshare(m, M_NOWAIT); + + if (m == NULL) + ERROUT(ENOMEM); + + switch (priv->dlt) + { + case DLT_EN10MB: + PULLUP_CHECK(m, sizeof(struct ether_header)); + eh = mtod(m, struct ether_header *); + etype = ntohs(eh->ether_type); + + for (;;) { /* QinQ support */ + switch (etype) + { + case 0x8100: + case 0x88A8: + case 0x9100: + PULLUP_CHECK(m, sizeof(struct ng_checksum_vlan_header)); + vh = (struct ng_checksum_vlan_header *) mtodo(m, + pullup_len - sizeof(struct ng_checksum_vlan_header)); + etype = ntohs(vh->etype); + break; + + default: + goto loopend; + } + } +loopend: +#ifdef INET + if (etype == ETHERTYPE_IP && + (m->m_pkthdr.csum_flags & NG_CHECKSUM_CSUM_IPV4)) { + error = checksum_ipv4(priv, m, pullup_len); + if (error == ENOBUFS) + goto drop; + } else +#endif +#ifdef INET6 + if (etype == ETHERTYPE_IPV6 && + (m->m_pkthdr.csum_flags & NG_CHECKSUM_CSUM_IPV6)) { + error = checksum_ipv6(priv, m, pullup_len); + if (error == ENOBUFS) + goto drop; + } else +#endif + { + m->m_pkthdr.csum_flags &= + ~(NG_CHECKSUM_CSUM_IPV4|NG_CHECKSUM_CSUM_IPV6); + } + + break; + + case DLT_RAW: +#ifdef INET + if (m->m_pkthdr.csum_flags & NG_CHECKSUM_CSUM_IPV4) + { + error = checksum_ipv4(priv, m, pullup_len); + + if (error == 0) + goto bypass; + else if (error == ENOBUFS) + goto drop; + } +#endif +#ifdef INET6 + if (m->m_pkthdr.csum_flags & NG_CHECKSUM_CSUM_IPV6) + { + error = checksum_ipv6(priv, m, pullup_len); + + if (error == 0) + goto bypass; + else if (error == ENOBUFS) + goto drop; + } +#endif + if (error) + m->m_pkthdr.csum_flags &= + ~(NG_CHECKSUM_CSUM_IPV4|NG_CHECKSUM_CSUM_IPV6); + + break; + + default: + ERROUT(EINVAL); + } + } + +#undef PULLUP_CHECK + +bypass: + out = NULL; + + if (hook == priv->in) { + /* return frames on 'in' hook if 'out' not connected */ + out = priv->out ? priv->out : priv->in; + } else if (hook == priv->out && priv->in) { + /* pass frames on 'out' hook if 'in' connected */ + out = priv->in; + } + + if (out == NULL) + ERROUT(0); + + NG_FWD_NEW_DATA(error, item, out, m); + + return (error); + +done: +drop: + NG_FREE_ITEM(item); + NG_FREE_M(m); + + priv->stats.dropped++; + + return (error); +} + +static int +ng_checksum_shutdown(node_p node) +{ + const priv_p priv = NG_NODE_PRIVATE(node); + + NG_NODE_SET_PRIVATE(node, NULL); + NG_NODE_UNREF(node); + + if (priv->conf) + free(priv->conf, M_NETGRAPH); + + free(priv, M_NETGRAPH); + + return (0); +} + +static int +ng_checksum_disconnect(hook_p hook) +{ + priv_p priv; + + priv = NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); + + if (hook == priv->in) + priv->in = NULL; + + if (hook == priv->out) + priv->out = NULL; + + if (NG_NODE_NUMHOOKS(NG_HOOK_NODE(hook)) == 0 && + NG_NODE_IS_VALID(NG_HOOK_NODE(hook))) /* already shutting down? */ + ng_rmnode_self(NG_HOOK_NODE(hook)); + + return (0); +} Copied: stable/11/sys/netgraph/ng_checksum.h (from r303612, head/sys/netgraph/ng_checksum.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/netgraph/ng_checksum.h Fri Dec 2 05:36:37 2016 (r309385, copy of r303612, head/sys/netgraph/ng_checksum.h) @@ -0,0 +1,88 @@ +/*- + * Copyright (c) 2015 Dmitry Vagin + * 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 _NETGRAPH_NG_CHECKSUM_H_ +#define _NETGRAPH_NG_CHECKSUM_H_ + +/* Node type name. */ +#define NG_CHECKSUM_NODE_TYPE "checksum" + +/* Node type cookie. */ +#define NGM_CHECKSUM_COOKIE 439419912 + +/* Hook names */ +#define NG_CHECKSUM_HOOK_IN "in" +#define NG_CHECKSUM_HOOK_OUT "out" + +/* Checksum flags */ +#define NG_CHECKSUM_CSUM_IPV4 (CSUM_IP|CSUM_TCP|CSUM_UDP) +#define NG_CHECKSUM_CSUM_IPV6 (CSUM_TCP_IPV6|CSUM_UDP_IPV6) + +/* Netgraph commands understood by this node type */ +enum { + NGM_CHECKSUM_GETDLT = 1, + NGM_CHECKSUM_SETDLT, + NGM_CHECKSUM_GETCONFIG, + NGM_CHECKSUM_SETCONFIG, + NGM_CHECKSUM_GETCLR_STATS, + NGM_CHECKSUM_GET_STATS, + NGM_CHECKSUM_CLR_STATS, +}; + +/* Parsing declarations */ + +#define NG_CHECKSUM_CONFIG_TYPE { \ + { "csum_flags", &ng_parse_uint64_type }, \ + { "csum_offload", &ng_parse_uint64_type }, \ + { NULL } \ +} + +#define NG_CHECKSUM_STATS_TYPE { \ + { "Received", &ng_parse_uint64_type }, \ + { "Processed", &ng_parse_uint64_type }, \ + { "Dropped", &ng_parse_uint64_type }, \ + { NULL } \ +} + +struct ng_checksum_config { + uint64_t csum_flags; + uint64_t csum_offload; +}; + +struct ng_checksum_stats { + uint64_t received; + uint64_t processed; + uint64_t dropped; +}; + +struct ng_checksum_vlan_header { + u_int16_t tag; + u_int16_t etype; +}; + +#endif /* _NETGRAPH_NG_CHECKSUM_H_ */ From owner-svn-src-stable-11@freebsd.org Fri Dec 2 05:37:33 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2B30C61CA4; Fri, 2 Dec 2016 05:37:33 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 73892180C; Fri, 2 Dec 2016 05:37:33 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB25bWmG033068; Fri, 2 Dec 2016 05:37:32 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB25bW7W033067; Fri, 2 Dec 2016 05:37:32 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201612020537.uB25bW7W033067@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Fri, 2 Dec 2016 05:37:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309386 - stable/11/share/man/man4 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2016 05:37:33 -0000 Author: julian Date: Fri Dec 2 05:37:32 2016 New Revision: 309386 URL: https://svnweb.freebsd.org/changeset/base/309386 Log: MFH: r303613 Man page for the new checksum netgraph module. PR: 206186 Submitted by: Dmitry Vagin Added: stable/11/share/man/man4/ng_checksum.4 - copied unchanged from r303613, head/share/man/man4/ng_checksum.4 Modified: Directory Properties: stable/11/ (props changed) Copied: stable/11/share/man/man4/ng_checksum.4 (from r303613, head/share/man/man4/ng_checksum.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/share/man/man4/ng_checksum.4 Fri Dec 2 05:37:32 2016 (r309386, copy of r303613, head/share/man/man4/ng_checksum.4) @@ -0,0 +1,141 @@ +.\" Copyright (c) 2015 Dmitry Vagin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 29, 2015 +.Dt NG_CHECKSUM 4 +.Os +.Sh NAME +.Nm ng_checksum +.Nd IP checksum node type +.Sh SYNOPSIS +.In netgraph/ng_checksum.h +.Sh DESCRIPTION +The +.Nm checksum +node can calculate and prepare for calculation in hardware +IPv4 header, TCP, UDP checksum. +.Sh HOOKS +This node type has two hooks: +.Bl -tag -width ".Va out" +.It Va in +Packets received on this hook are processed according to settings specified +in config and then forwarded to +.Ar out +hook, if it exists and connected. Otherwise they are reflected back to the +.Ar in +hook. +.It Va out +Packets received on this hook are forwarded to +.Ar in +hook without any changes. +.El +.Sh CONTROL MESSAGES +This node type supports the generic control messages, plus the following: +.Bl -tag -width foo +.It Dv NGM_CHECKSUM_SETDLT Pq Ic setdlt +Sets data link type on the +.Va in +hook. Currently, supported types are +.Cm DLT_RAW +(raw IP datagrams) and +.Cm DLT_EN10MB +(Ethernet). DLT_ definitions can be found in +.In net/bpf.h +header. Currently used values are +.Cm DLT_EN10MB += 1 and +.Cm DLT_RAW += 12. +.It Dv NGM_CHECKSUM_GETDLT Pq Ic getdlt +This control message obtains data link type on the +.Va in +hook. +.It Dv NGM_CHECKSUM_SETCONFIG Pq Ic setconfig +Sets node configuration. The following +.Vt "struct ng_checksum_config" +must be supplied as an argument: +.Bd -literal -offset 4n +struct ng_checksum_config { + uint64_t csum_flags; + uint64_t csum_offload; +}; +.Ed +.Pp +The +.Va csum_flags +can be set to any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 and CSUM_UDP_IPV6 +(other values are ignored) for instructing node need calculate the corresponding checksum. +.Pp +The +.Va csum_offload +can be set to any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 and CSUM_UDP_IPV6 +(other values are ignored) for instructing node what checksum can calculate in hardware. +.Pp +Also processed any combination of CSUM_IP, CSUM_TCP, CSUM_UDP, CSUM_TCP_IPV6 and CSUM_UDP_IPV6 sets before on mbuf. +.It Dv NGM_CHECKSUM_GETCONFIG Pq Ic getconfig +This control message obtains current node configuration, +returned as +.Vt "struct ng_checksum_config" . +.It Dv NGM_CHECKSUM_GET_STATS Pq Ic getstats +Returns node statistics as a +.Vt "struct ng_checksum_stats" . +.It Dv NGM_CHECKSUM_CLR_STATS Pq Ic clrstats +Clear node statistics. +.It Dv NGM_CHECKSUM_GETCLR_STATS Pq Ic getclrstats +This command is identical to +.Dv NGM_CHECKSUM_GET_STATS , +except that the statistics are also atomically cleared. +.El +.Sh SHUTDOWN +This node shuts down upon receipt of a +.Dv NGM_SHUTDOWN +control message, or when all hooks have been disconnected. +.Sh EXAMPLES +.Xr ngctl 8 +script: +.Bd -literal -offset 4n +/usr/sbin/ngctl -f- <<-SEQ + msg checksum-1: "setdlt 1" + ngctl msg checksum-1: "setconfig { csum_flags=0 csum_offload=6 }" +.Ed +.Pp +Set data link type to +.Cm DLT_EN10MB +(Ethernet), not set additional checksum flags, set hardware +can calculate CSUM_IP_UDP|CSUM_IP_TCP. +.Sh SEE ALSO +.Xr netgraph 4 , +.Xr ng_patch 4 , +.Xr ngctl 8 +.Sh HISTORY +The +.Nm +node type was implemented in +.Fx 10.2 +and first submitted in +.Fx 12.0 . +.Sh AUTHORS +.An "Dmitry Vagin" Aq daemon.hammer@ya.ru . From owner-svn-src-stable-11@freebsd.org Fri Dec 2 05:42:50 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACA91C5E362; Fri, 2 Dec 2016 05:42:50 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 875A11366; Fri, 2 Dec 2016 05:42:50 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB25gnSC037308; Fri, 2 Dec 2016 05:42:49 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB25gnTc037305; Fri, 2 Dec 2016 05:42:49 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201612020542.uB25gnTc037305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Fri, 2 Dec 2016 05:42:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309390 - stable/11/sys/netgraph X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2016 05:42:50 -0000 Author: julian Date: Fri Dec 2 05:42:49 2016 New Revision: 309390 URL: https://svnweb.freebsd.org/changeset/base/309390 Log: MFH: r303611 slite style changes. There is an incoming patch that rewrites a lot of this module and I want to get the style and whitespace changes in a separate commit (or maybe more). PR: 206185 Submitted by: Dmitry Vagin Modified: stable/11/sys/netgraph/ng_patch.c stable/11/sys/netgraph/ng_patch.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netgraph/ng_patch.c ============================================================================== --- stable/11/sys/netgraph/ng_patch.c Fri Dec 2 05:42:04 2016 (r309389) +++ stable/11/sys/netgraph/ng_patch.c Fri Dec 2 05:42:49 2016 (r309390) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 2010 by Maxim Ignatenko + * Copyright (c) 2010 Maxim Ignatenko * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -50,11 +50,12 @@ static int ng_patch_config_getlen(const struct ng_parse_type *type, const u_char *start, const u_char *buf) { - const struct ng_patch_config *p; + const struct ng_patch_config *conf; - p = (const struct ng_patch_config *)(buf - + conf = (const struct ng_patch_config *)(buf - offsetof(struct ng_patch_config, ops)); - return (p->count); + + return (conf->count); } static const struct ng_parse_struct_field ng_patch_op_type_fields[] @@ -64,13 +65,13 @@ static const struct ng_parse_type ng_pat &ng_patch_op_type_fields }; -static const struct ng_parse_array_info ng_patch_confarr_info = { +static const struct ng_parse_array_info ng_patch_ops_array_info = { &ng_patch_op_type, &ng_patch_config_getlen }; -static const struct ng_parse_type ng_patch_confarr_type = { +static const struct ng_parse_type ng_patch_ops_array_type = { &ng_parse_array_type, - &ng_patch_confarr_info + &ng_patch_ops_array_info }; static const struct ng_parse_struct_field ng_patch_config_type_fields[] @@ -137,6 +138,7 @@ static struct ng_type typestruct = { .disconnect = ng_patch_disconnect, .cmdlist = ng_patch_cmdlist, }; + NETGRAPH_INIT(patch, &typestruct); union patch_val { @@ -146,6 +148,7 @@ union patch_val { uint64_t v8; }; +/* private data */ struct ng_patch_priv { hook_p in; hook_p out; Modified: stable/11/sys/netgraph/ng_patch.h ============================================================================== --- stable/11/sys/netgraph/ng_patch.h Fri Dec 2 05:42:04 2016 (r309389) +++ stable/11/sys/netgraph/ng_patch.h Fri Dec 2 05:42:49 2016 (r309390) @@ -57,7 +57,7 @@ enum { NG_PATCH_MODE_DIV = 5, NG_PATCH_MODE_NEG = 6, NG_PATCH_MODE_AND = 7, - NG_PATCH_MODE_OR = 8, + NG_PATCH_MODE_OR = 8, NG_PATCH_MODE_XOR = 9, NG_PATCH_MODE_SHL = 10, NG_PATCH_MODE_SHR = 11 @@ -66,16 +66,16 @@ enum { struct ng_patch_op { uint64_t value; uint32_t offset; - uint16_t length; /* 1,2,4 or 8 (bytes) */ + uint16_t length; /* 1, 2, 4 or 8 (bytes) */ uint16_t mode; }; -#define NG_PATCH_OP_TYPE_INFO { \ - { "value", &ng_parse_uint64_type }, \ - { "offset", &ng_parse_uint32_type }, \ - { "length", &ng_parse_uint16_type }, \ - { "mode", &ng_parse_uint16_type }, \ - { NULL } \ +#define NG_PATCH_OP_TYPE_INFO { \ + { "value", &ng_parse_uint64_type }, \ + { "offset", &ng_parse_uint32_type }, \ + { "length", &ng_parse_uint16_type }, \ + { "mode", &ng_parse_uint16_type }, \ + { NULL } \ } struct ng_patch_config { @@ -84,11 +84,11 @@ struct ng_patch_config { struct ng_patch_op ops[]; }; -#define NG_PATCH_CONFIG_TYPE_INFO { \ - { "count", &ng_parse_uint32_type }, \ - { "csum_flags", &ng_parse_uint32_type }, \ - { "ops", &ng_patch_confarr_type }, \ - { NULL } \ +#define NG_PATCH_CONFIG_TYPE_INFO { \ + { "count", &ng_parse_uint32_type }, \ + { "csum_flags", &ng_parse_uint64_type }, \ + { "ops", &ng_patch_ops_array_type }, \ + { NULL } \ } struct ng_patch_stats { @@ -97,11 +97,11 @@ struct ng_patch_stats { uint64_t dropped; }; -#define NG_PATCH_STATS_TYPE_INFO { \ - { "received", &ng_parse_uint64_type }, \ - { "patched", &ng_parse_uint64_type }, \ - { "dropped", &ng_parse_uint64_type }, \ - { NULL } \ +#define NG_PATCH_STATS_TYPE_INFO { \ + { "Received", &ng_parse_uint64_type }, \ + { "Patched", &ng_parse_uint64_type }, \ + { "Dropped", &ng_parse_uint64_type }, \ + { NULL } \ } #endif /* _NETGRAPH_NG_PATCH_H_ */ From owner-svn-src-stable-11@freebsd.org Fri Dec 2 05:47:53 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74FFEC5E569; Fri, 2 Dec 2016 05:47:53 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4416916FE; Fri, 2 Dec 2016 05:47:53 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB25lq59037574; Fri, 2 Dec 2016 05:47:52 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB25lqEL037573; Fri, 2 Dec 2016 05:47:52 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201612020547.uB25lqEL037573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Fri, 2 Dec 2016 05:47:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309391 - stable/11/sys/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2016 05:47:53 -0000 Author: julian Date: Fri Dec 2 05:47:52 2016 New Revision: 309391 URL: https://svnweb.freebsd.org/changeset/base/309391 Log: MFH: r303287 Split MAKE_SYSENT into two parts so that the initializer part can be used separately if one wants to embed the sysent into a larger structure. Modified: stable/11/sys/sys/sysent.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/sysent.h ============================================================================== --- stable/11/sys/sys/sysent.h Fri Dec 2 05:42:49 2016 (r309390) +++ stable/11/sys/sys/sysent.h Fri Dec 2 05:47:52 2016 (r309391) @@ -175,13 +175,21 @@ struct syscall_module_data { int flags; /* flags for syscall_register */ }; -#define MAKE_SYSENT(syscallname) \ -static struct sysent syscallname##_sysent = { \ - (sizeof(struct syscallname ## _args ) \ +/* separate initialization vector so it can be used in a substructure */ +#define SYSENT_INIT_VALS(_syscallname) { \ + .sy_narg = (sizeof(struct _syscallname ## _args ) \ / sizeof(register_t)), \ - (sy_call_t *)& sys_##syscallname, \ - SYS_AUE_##syscallname \ -} + .sy_call = (sy_call_t *)&sys_##_syscallname, \ + .sy_auevent = SYS_AUE_##_syscallname, \ + .sy_systrace_args_func = NULL, \ + .sy_entry = 0, \ + .sy_return = 0, \ + .sy_flags = 0, \ + .sy_thrcnt = 0 \ +} + +#define MAKE_SYSENT(syscallname) \ +static struct sysent syscallname##_sysent = SYSENT_INIT_VALS(syscallname); #define MAKE_SYSENT_COMPAT(syscallname) \ static struct sysent syscallname##_sysent = { \ From owner-svn-src-stable-11@freebsd.org Fri Dec 2 08:24:01 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9EF9AC621EA; Fri, 2 Dec 2016 08:24:01 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 543FA1809; Fri, 2 Dec 2016 08:24:01 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB28O0Wr001824; Fri, 2 Dec 2016 08:24:00 GMT (envelope-from julian@FreeBSD.org) Received: (from julian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB28O0Qv001823; Fri, 2 Dec 2016 08:24:00 GMT (envelope-from julian@FreeBSD.org) Message-Id: <201612020824.uB28O0Qv001823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: julian set sender to julian@FreeBSD.org using -f From: Julian Elischer Date: Fri, 2 Dec 2016 08:24:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309402 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2016 08:24:01 -0000 Author: julian Date: Fri Dec 2 08:24:00 2016 New Revision: 309402 URL: https://svnweb.freebsd.org/changeset/base/309402 Log: MFH: r309295 bhyve: stability and performance improvement for dbgport The TCP server implementation in dbgport does not track clients, so it may try to write to a disconected socket resulting in SIGPIPE. Avoid that by setting SO_NOSIGPIPE socket option. Because dbgport emulates an I/O port to guest, the communication is done byte by byte. Reduce latency of the TCP/IP transfers by using TCP_NODELAY option. In my tests that change improves performance of kgdb commands with lots of output (e.g. info threads) by two orders of magnitude. A general note. Since we have a uart emulation in bhyve, that can be used for the console and gdb access to guests. So, bvmconsole and bvmdebug could be de-orbited now. But there are many existing deployments that still dependend on those. Discussed with: julian, jhb Sponsored by: Panzura Modified: stable/11/usr.sbin/bhyve/dbgport.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/dbgport.c ============================================================================== --- stable/11/usr.sbin/bhyve/dbgport.c Fri Dec 2 08:21:25 2016 (r309401) +++ stable/11/usr.sbin/bhyve/dbgport.c Fri Dec 2 08:24:00 2016 (r309402) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -55,8 +56,9 @@ static int dbg_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, uint32_t *eax, void *arg) { - char ch; int nwritten, nread, printonce; + int on = 1; + char ch; if (bytes == 2 && in) { *eax = BVM_DBG_SIG; @@ -74,8 +76,16 @@ again: printonce = 1; } conn_fd = accept4(listen_fd, NULL, NULL, SOCK_NONBLOCK); - if (conn_fd < 0 && errno != EINTR) + if (conn_fd >= 0) { + /* Avoid EPIPE after the client drops off. */ + (void)setsockopt(conn_fd, SOL_SOCKET, SO_NOSIGPIPE, + &on, sizeof(on)); + /* Improve latency for one byte at a time tranfers. */ + (void)setsockopt(conn_fd, IPPROTO_TCP, TCP_NODELAY, + &on, sizeof(on)); + } else if (errno != EINTR) { perror("accept"); + } } if (in) { From owner-svn-src-stable-11@freebsd.org Fri Dec 2 19:02:14 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B001EC63ED0; Fri, 2 Dec 2016 19:02:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D57C1F38; Fri, 2 Dec 2016 19:02:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB2J2DWO070369; Fri, 2 Dec 2016 19:02:13 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB2J2Dn0070366; Fri, 2 Dec 2016 19:02:13 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612021902.uB2J2Dn0070366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 2 Dec 2016 19:02:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309426 - in stable: 10/sys/amd64/amd64 10/sys/amd64/include 10/sys/i386/i386 10/sys/i386/include 11/sys/amd64/amd64 11/sys/i386/i386 11/sys/x86/include X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2016 19:02:14 -0000 Author: jhb Date: Fri Dec 2 19:02:12 2016 New Revision: 309426 URL: https://svnweb.freebsd.org/changeset/base/309426 Log: MFC 303753,308004: Add bounds checking on addresses used with /dev/mem. 303753: Don't permit mappings of invalid physical addresses on amd64 via /dev/mem. 308004: MFamd64: Add bounds checks on addresses used with /dev/mem. Reject attempts to read from or memory map offsets in /dev/mem that are beyond the maximum-supported physical address of the current CPU. Modified: stable/11/sys/amd64/amd64/mem.c stable/11/sys/i386/i386/mem.c stable/11/sys/x86/include/x86_var.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/amd64/amd64/mem.c stable/10/sys/amd64/include/md_var.h stable/10/sys/i386/i386/mem.c stable/10/sys/i386/include/md_var.h Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/amd64/amd64/mem.c ============================================================================== --- stable/11/sys/amd64/amd64/mem.c Fri Dec 2 18:03:15 2016 (r309425) +++ stable/11/sys/amd64/amd64/mem.c Fri Dec 2 19:02:12 2016 (r309426) @@ -140,7 +140,7 @@ memrw(struct cdev *dev, struct uio *uio, error = uiomove((void *)vd, c, uio); break; } - if (v >= (1ULL << cpu_maxphyaddr)) { + if (v > cpu_getmaxphyaddr()) { error = EFAULT; break; } @@ -168,9 +168,11 @@ int memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int prot __unused, vm_memattr_t *memattr __unused) { - if (dev2unit(dev) == CDEV_MINOR_MEM) + if (dev2unit(dev) == CDEV_MINOR_MEM) { + if (offset > cpu_getmaxphyaddr()) + return (-1); *paddr = offset; - else if (dev2unit(dev) == CDEV_MINOR_KMEM) + } else if (dev2unit(dev) == CDEV_MINOR_KMEM) *paddr = vtophys(offset); /* else panic! */ return (0); Modified: stable/11/sys/i386/i386/mem.c ============================================================================== --- stable/11/sys/i386/i386/mem.c Fri Dec 2 18:03:15 2016 (r309425) +++ stable/11/sys/i386/i386/mem.c Fri Dec 2 19:02:12 2016 (r309426) @@ -108,8 +108,11 @@ memrw(struct cdev *dev, struct uio *uio, continue; } if (dev2unit(dev) == CDEV_MINOR_MEM) { - pa = uio->uio_offset; - pa &= ~PAGE_MASK; + if (uio->uio_offset > cpu_getmaxphyaddr()) { + error = EFAULT; + break; + } + pa = trunc_page(uio->uio_offset); } else { /* * Extract the physical page since the mapping may @@ -161,9 +164,11 @@ int memmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int prot __unused, vm_memattr_t *memattr __unused) { - if (dev2unit(dev) == CDEV_MINOR_MEM) + if (dev2unit(dev) == CDEV_MINOR_MEM) { + if (offset > cpu_getmaxphyaddr()) + return (-1); *paddr = offset; - else if (dev2unit(dev) == CDEV_MINOR_KMEM) + } else if (dev2unit(dev) == CDEV_MINOR_KMEM) *paddr = vtophys(offset); /* else panic! */ return (0); Modified: stable/11/sys/x86/include/x86_var.h ============================================================================== --- stable/11/sys/x86/include/x86_var.h Fri Dec 2 18:03:15 2016 (r309425) +++ stable/11/sys/x86/include/x86_var.h Fri Dec 2 19:02:12 2016 (r309426) @@ -94,6 +94,20 @@ struct trapframe; */ typedef void alias_for_inthand_t(void); +/* + * Returns the maximum physical address that can be used with the + * current system. + */ +static __inline vm_paddr_t +cpu_getmaxphyaddr(void) +{ +#if defined(__i386__) && !defined(PAE) + return (0xffffffff); +#else + return ((1ULL << cpu_maxphyaddr) - 1); +#endif +} + void *alloc_fpusave(int flags); void busdma_swi(void); bool cpu_mwait_usable(void); From owner-svn-src-stable-11@freebsd.org Fri Dec 2 21:35:16 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FBFFC63654; Fri, 2 Dec 2016 21:35:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0527B1BC0; Fri, 2 Dec 2016 21:35:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB2LZFHA032193; Fri, 2 Dec 2016 21:35:15 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB2LZFOF032192; Fri, 2 Dec 2016 21:35:15 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612022135.uB2LZFOF032192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 2 Dec 2016 21:35:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309443 - in stable: 10/sys/x86/cpufreq 11/sys/x86/cpufreq X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2016 21:35:16 -0000 Author: jhb Date: Fri Dec 2 21:35:14 2016 New Revision: 309443 URL: https://svnweb.freebsd.org/changeset/base/309443 Log: MFC 308005: Add powerd(8) support for several families of AMD CPUs. Use the same logic to calculate the nominal CPU frequency from the P-state MSRs on family 0x12, 0x15, and 0x16 CPUs as is used for family 0x10. Family 0x14 was included in the original patch in the PR but I left that out as the BIOS writer's guide for family 0x14 CPUs show a different layout for the relevant MSR and include a different formulate for calculating the frequency. While here, simplify a few expressions and print out the family of unsupported CPUs in hex rather than decimal. PR: 212020 Modified: stable/11/sys/x86/cpufreq/hwpstate.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/x86/cpufreq/hwpstate.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/x86/cpufreq/hwpstate.c ============================================================================== --- stable/11/sys/x86/cpufreq/hwpstate.c Fri Dec 2 21:29:52 2016 (r309442) +++ stable/11/sys/x86/cpufreq/hwpstate.c Fri Dec 2 21:35:14 2016 (r309443) @@ -408,25 +408,27 @@ hwpstate_get_info_from_msr(device_t dev) hwpstate_set = sc->hwpstate_settings; for (i = 0; i < sc->cfnum; i++) { msr = rdmsr(MSR_AMD_10H_11H_CONFIG + i); - if ((msr & ((uint64_t)1 << 63)) != ((uint64_t)1 << 63)) { + if ((msr & ((uint64_t)1 << 63)) == 0) { HWPSTATE_DEBUG(dev, "msr is not valid.\n"); return (ENXIO); } did = AMD_10H_11H_CUR_DID(msr); fid = AMD_10H_11H_CUR_FID(msr); + + /* Convert fid/did to frequency. */ switch(family) { case 0x11: - /* fid/did to frequency */ - hwpstate_set[i].freq = 100 * (fid + 0x08) / (1 << did); + hwpstate_set[i].freq = (100 * (fid + 0x08)) >> did; break; case 0x10: - /* fid/did to frequency */ - hwpstate_set[i].freq = 100 * (fid + 0x10) / (1 << did); + case 0x12: + case 0x15: + case 0x16: + hwpstate_set[i].freq = (100 * (fid + 0x10)) >> did; break; default: - HWPSTATE_DEBUG(dev, "get_info_from_msr: AMD family %d CPU's are not implemented yet. sorry.\n", family); + HWPSTATE_DEBUG(dev, "get_info_from_msr: AMD family 0x%02x CPU's are not implemented yet. sorry.\n", family); return (ENXIO); - break; } hwpstate_set[i].pstate_id = i; /* There was volts calculation, but deleted it. */ From owner-svn-src-stable-11@freebsd.org Fri Dec 2 22:27:56 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11A92C62AC0; Fri, 2 Dec 2016 22:27:56 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E09221F75; Fri, 2 Dec 2016 22:27:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB2MRt9G052950; Fri, 2 Dec 2016 22:27:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB2MRt2q052949; Fri, 2 Dec 2016 22:27:55 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612022227.uB2MRt2q052949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 2 Dec 2016 22:27:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309446 - in stable: 10/sys/kern 11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Dec 2016 22:27:56 -0000 Author: jhb Date: Fri Dec 2 22:27:54 2016 New Revision: 309446 URL: https://svnweb.freebsd.org/changeset/base/309446 Log: MFC 308564: Don't place threads on the run queue after waking up other CPUs. The other CPU might resume and see a still-empty runq and go back to sleep before sched_add() adds the thread to the runq. This results in a lost wakeup and a potential hang if the system is otherwise completely idle. The race originated due to a micro-optimization (my fault) in 4BSD in that it avoided putting a thread on the run queue if the scheduler was going to preempt to the new thread. To avoid complexity while fixing this race, just drop this optimization. 4BSD now always sets the "owepreempt" flag when a preemption is warranted and defers the actual preemption to the thread_unlock of the caller the same as ULE. Modified: stable/11/sys/kern/sched_4bsd.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/kern/sched_4bsd.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/kern/sched_4bsd.c ============================================================================== --- stable/11/sys/kern/sched_4bsd.c Fri Dec 2 22:25:11 2016 (r309445) +++ stable/11/sys/kern/sched_4bsd.c Fri Dec 2 22:27:54 2016 (r309446) @@ -308,9 +308,8 @@ maybe_resched(struct thread *td) /* * This function is called when a thread is about to be put on run queue * because it has been made runnable or its priority has been adjusted. It - * determines if the new thread should be immediately preempted to. If so, - * it switches to it and eventually returns true. If not, it returns false - * so that the caller may place the thread on an appropriate run queue. + * determines if the new thread should preempt the current thread. If so, + * it sets td_owepreempt to request a preemption. */ int maybe_preempt(struct thread *td) @@ -356,29 +355,8 @@ maybe_preempt(struct thread *td) return (0); #endif - if (ctd->td_critnest > 1) { - CTR1(KTR_PROC, "maybe_preempt: in critical section %d", - ctd->td_critnest); - ctd->td_owepreempt = 1; - return (0); - } - /* - * Thread is runnable but not yet put on system run queue. - */ - MPASS(ctd->td_lock == td->td_lock); - MPASS(TD_ON_RUNQ(td)); - TD_SET_RUNNING(td); - CTR3(KTR_PROC, "preempting to thread %p (pid %d, %s)\n", td, - td->td_proc->p_pid, td->td_name); - mi_switch(SW_INVOL | SW_PREEMPT | SWT_PREEMPT, td); - /* - * td's lock pointer may have changed. We have to return with it - * locked. - */ - spinlock_enter(); - thread_unlock(ctd); - thread_lock(td); - spinlock_exit(); + CTR0(KTR_PROC, "maybe_preempt: scheduling preemption"); + ctd->td_owepreempt = 1; return (1); #else return (0); @@ -1332,6 +1310,12 @@ sched_add(struct thread *td, int flags) ts->ts_runq = &runq; } + if ((td->td_flags & TDF_NOLOAD) == 0) + sched_load_add(); + runq_add(ts->ts_runq, td, flags); + if (cpu != NOCPU) + runq_length[cpu]++; + cpuid = PCPU_GET(cpuid); if (single_cpu && cpu != cpuid) { kick_other_cpu(td->td_priority, cpu); @@ -1348,18 +1332,10 @@ sched_add(struct thread *td, int flags) } if (!forwarded) { - if ((flags & SRQ_YIELDING) == 0 && maybe_preempt(td)) - return; - else + if (!maybe_preempt(td)) maybe_resched(td); } } - - if ((td->td_flags & TDF_NOLOAD) == 0) - sched_load_add(); - runq_add(ts->ts_runq, td, flags); - if (cpu != NOCPU) - runq_length[cpu]++; } #else /* SMP */ { @@ -1393,23 +1369,11 @@ sched_add(struct thread *td, int flags) CTR2(KTR_RUNQ, "sched_add: adding td_sched:%p (td:%p) to runq", ts, td); ts->ts_runq = &runq; - /* - * If we are yielding (on the way out anyhow) or the thread - * being saved is US, then don't try be smart about preemption - * or kicking off another CPU as it won't help and may hinder. - * In the YIEDLING case, we are about to run whoever is being - * put in the queue anyhow, and in the OURSELF case, we are - * putting ourself on the run queue which also only happens - * when we are about to yield. - */ - if ((flags & SRQ_YIELDING) == 0) { - if (maybe_preempt(td)) - return; - } if ((td->td_flags & TDF_NOLOAD) == 0) sched_load_add(); runq_add(ts->ts_runq, td, flags); - maybe_resched(td); + if (!maybe_preempt(td)) + maybe_resched(td); } #endif /* SMP */ From owner-svn-src-stable-11@freebsd.org Sat Dec 3 00:18:40 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E88CDC624BC; Sat, 3 Dec 2016 00:18:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA7D619C8; Sat, 3 Dec 2016 00:18:40 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB30Idn5098142; Sat, 3 Dec 2016 00:18:39 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB30Idm0098137; Sat, 3 Dec 2016 00:18:39 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612030018.uB30Idm0098137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 3 Dec 2016 00:18:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309450 - in stable: 10/contrib/ofed/libcxgb4/src 10/sys/dev/cxgbe/iw_cxgbe 11/contrib/ofed/libcxgb4/src 11/sys/dev/cxgbe/iw_cxgbe X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 00:18:41 -0000 Author: jhb Date: Sat Dec 3 00:18:38 2016 New Revision: 309450 URL: https://svnweb.freebsd.org/changeset/base/309450 Log: MFC 304854: cxgbe/iw_cxgbe: Various fixes to the iWARP driver. - Return appropriate error code instead of ENOMEM when sosend() fails in send_mpa_req. - Fix for problematic race during destroy_qp. - Abortive close in the failure of send_mpa_reject() instead of normal close. - Remove the unnecessary doorbell flowcontrol logic. Sponsored by: Chelsio Communications Modified: stable/11/contrib/ofed/libcxgb4/src/qp.c stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c stable/11/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h stable/11/sys/dev/cxgbe/iw_cxgbe/qp.c stable/11/sys/dev/cxgbe/iw_cxgbe/t4.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/ofed/libcxgb4/src/qp.c stable/10/sys/dev/cxgbe/iw_cxgbe/cm.c stable/10/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h stable/10/sys/dev/cxgbe/iw_cxgbe/qp.c stable/10/sys/dev/cxgbe/iw_cxgbe/t4.h Directory Properties: stable/10/ (props changed) Modified: stable/11/contrib/ofed/libcxgb4/src/qp.c ============================================================================== --- stable/11/contrib/ofed/libcxgb4/src/qp.c Fri Dec 2 23:05:14 2016 (r309449) +++ stable/11/contrib/ofed/libcxgb4/src/qp.c Sat Dec 3 00:18:38 2016 (r309450) @@ -392,11 +392,9 @@ int c4iw_post_send(struct ibv_qp *ibqp, t4_sq_produce(&qhp->wq, len16); idx += DIV_ROUND_UP(len16*16, T4_EQ_ENTRY_SIZE); } - if (t4_wq_db_enabled(&qhp->wq)) { - t4_ring_sq_db(&qhp->wq, idx, dev_is_t5(qhp->rhp), - len16, wqe); - } else - ring_kernel_db(qhp, qhp->wq.sq.qid, idx); + + t4_ring_sq_db(&qhp->wq, idx, dev_is_t5(qhp->rhp), + len16, wqe); qhp->wq.sq.queue[qhp->wq.sq.size].status.host_wq_pidx = \ (qhp->wq.sq.wq_pidx); pthread_spin_unlock(&qhp->lock); @@ -458,11 +456,9 @@ int c4iw_post_receive(struct ibv_qp *ibq wr = wr->next; num_wrs--; } - if (t4_wq_db_enabled(&qhp->wq)) - t4_ring_rq_db(&qhp->wq, idx, dev_is_t5(qhp->rhp), - len16, wqe); - else - ring_kernel_db(qhp, qhp->wq.rq.qid, idx); + + t4_ring_rq_db(&qhp->wq, idx, dev_is_t5(qhp->rhp), + len16, wqe); qhp->wq.rq.queue[qhp->wq.rq.size].status.host_wq_pidx = \ (qhp->wq.rq.wq_pidx); pthread_spin_unlock(&qhp->lock); Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c ============================================================================== --- stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c Fri Dec 2 23:05:14 2016 (r309449) +++ stable/11/sys/dev/cxgbe/iw_cxgbe/cm.c Sat Dec 3 00:18:38 2016 (r309450) @@ -83,6 +83,8 @@ static void process_req(struct work_stru static void start_ep_timer(struct c4iw_ep *ep); static int stop_ep_timer(struct c4iw_ep *ep); static int set_tcpinfo(struct c4iw_ep *ep); +static void process_timeout(struct c4iw_ep *ep); +static void process_timedout_eps(void); static enum c4iw_ep_state state_read(struct c4iw_ep_common *epc); static void __state_set(struct c4iw_ep_common *epc, enum c4iw_ep_state tostate); static void state_set(struct c4iw_ep_common *epc, enum c4iw_ep_state tostate); @@ -93,7 +95,7 @@ static int find_route(__be32 local_ip, _ static int close_socket(struct c4iw_ep_common *epc, int close); static int shutdown_socket(struct c4iw_ep_common *epc); static void abort_socket(struct c4iw_ep *ep); -static void send_mpa_req(struct c4iw_ep *ep); +static int send_mpa_req(struct c4iw_ep *ep); static int send_mpa_reject(struct c4iw_ep *ep, const void *pdata, u8 plen); static int send_mpa_reply(struct c4iw_ep *ep, const void *pdata, u8 plen); static void close_complete_upcall(struct c4iw_ep *ep, int status); @@ -176,20 +178,91 @@ static void ref_qp(struct c4iw_ep *ep) c4iw_qp_add_ref(&ep->com.qp->ibqp); } +static void process_timeout(struct c4iw_ep *ep) +{ + struct c4iw_qp_attributes attrs; + int abort = 1; + + mutex_lock(&ep->com.mutex); + CTR4(KTR_IW_CXGBE, "%s ep :%p, tid:%u, state %d", __func__, + ep, ep->hwtid, ep->com.state); + set_bit(TIMEDOUT, &ep->com.history); + switch (ep->com.state) { + case MPA_REQ_SENT: + connect_reply_upcall(ep, -ETIMEDOUT); + break; + case MPA_REQ_WAIT: + case MPA_REQ_RCVD: + case MPA_REP_SENT: + case FPDU_MODE: + break; + case CLOSING: + case MORIBUND: + if (ep->com.cm_id && ep->com.qp) { + attrs.next_state = C4IW_QP_STATE_ERROR; + c4iw_modify_qp(ep->com.dev, ep->com.qp, + C4IW_QP_ATTR_NEXT_STATE, &attrs, 1); + } + close_complete_upcall(ep, -ETIMEDOUT); + break; + case ABORTING: + case DEAD: + /* + * These states are expected if the ep timed out at the same + * time as another thread was calling stop_ep_timer(). + * So we silently do nothing for these states. + */ + abort = 0; + break; + default: + CTR4(KTR_IW_CXGBE, "%s unexpected state ep %p tid %u state %u\n" + , __func__, ep, ep->hwtid, ep->com.state); + abort = 0; + } + mutex_unlock(&ep->com.mutex); + if (abort) + c4iw_ep_disconnect(ep, 1, GFP_KERNEL); + c4iw_put_ep(&ep->com); + return; +} + +static void process_timedout_eps(void) +{ + struct c4iw_ep *ep; + + spin_lock(&timeout_lock); + while (!list_empty(&timeout_list)) { + struct list_head *tmp; + tmp = timeout_list.next; + list_del(tmp); + tmp->next = tmp->prev = NULL; + spin_unlock(&timeout_lock); + ep = list_entry(tmp, struct c4iw_ep, entry); + process_timeout(ep); + spin_lock(&timeout_lock); + } + spin_unlock(&timeout_lock); + return; +} + static void process_req(struct work_struct *ctx) { struct c4iw_ep_common *epc; + process_timedout_eps(); spin_lock(&req_lock); while (!TAILQ_EMPTY(&req_list)) { epc = TAILQ_FIRST(&req_list); TAILQ_REMOVE(&req_list, epc, entry); epc->entry.tqe_prev = NULL; spin_unlock(&req_lock); + CTR3(KTR_IW_CXGBE, "%s so :%p, ep:%p", __func__, + epc->so, epc); if (epc->so) process_socket_event((struct c4iw_ep *)epc); c4iw_put_ep(epc); + process_timedout_eps(); spin_lock(&req_lock); } spin_unlock(&req_lock); @@ -252,8 +325,17 @@ close_socket(struct c4iw_ep_common *epc, struct socket *so = epc->so; int rc; - CTR4(KTR_IW_CXGBE, "%s: so %p, ep %p, state %s", __func__, epc, so, - states[epc->state]); + CTR5(KTR_IW_CXGBE, "%s:csoB so %p, ep %p, state %s, tid %d", __func__, + so, epc, states[epc->state], + ((struct c4iw_ep *)epc)->hwtid); + mutex_lock(&epc->so_mutex); + if ((so == NULL) || (so->so_count == 0)) { + mutex_unlock(&epc->so_mutex); + CTR5(KTR_IW_CXGBE, "%s:cso1 so %p, ep %p, state %s, tid %d", + __func__, so, epc, states[epc->state], + ((struct c4iw_ep *)epc)->hwtid); + return -EINVAL; + } SOCK_LOCK(so); soupcall_clear(so, SO_RCV); @@ -265,6 +347,7 @@ close_socket(struct c4iw_ep_common *epc, rc = soshutdown(so, SHUT_WR | SHUT_RD); epc->so = NULL; + mutex_unlock(&epc->so_mutex); return (rc); } @@ -272,10 +355,23 @@ static int shutdown_socket(struct c4iw_ep_common *epc) { - CTR4(KTR_IW_CXGBE, "%s: so %p, ep %p, state %s", __func__, epc->so, epc, - states[epc->state]); + struct socket *so = epc->so; + int rc; - return (soshutdown(epc->so, SHUT_WR)); + CTR5(KTR_IW_CXGBE, "%s:ssoB so %p, ep %p, state %s, tid %d", __func__, + epc->so, epc, states[epc->state], + ((struct c4iw_ep *)epc)->hwtid); + mutex_lock(&epc->so_mutex); + if ((so == NULL) || (so->so_count == 0)) { + mutex_unlock(&epc->so_mutex); + CTR5(KTR_IW_CXGBE, "%s:sso1 so %p, ep %p, state %s, tid %d", + __func__, epc->so, epc, states[epc->state], + ((struct c4iw_ep *)epc)->hwtid); + return -EINVAL; + } + rc = soshutdown(so, SHUT_WR); + mutex_unlock(&epc->so_mutex); + return rc; } static void @@ -285,9 +381,9 @@ abort_socket(struct c4iw_ep *ep) int rc; struct linger l; - CTR4(KTR_IW_CXGBE, "%s ep %p so %p state %s", __func__, ep, ep->com.so, - states[ep->com.state]); - + CTR5(KTR_IW_CXGBE, "%s ep %p so %p state %s tid %d", __func__, ep, + ep->com.so, states[ep->com.state], ep->hwtid); + mutex_lock(&ep->com.so_mutex); l.l_onoff = 1; l.l_linger = 0; @@ -303,6 +399,7 @@ abort_socket(struct c4iw_ep *ep) log(LOG_ERR, "%s: can't set linger to 0, no RST! err %d\n", __func__, rc); } + mutex_unlock(&ep->com.so_mutex); } static void @@ -431,7 +528,8 @@ process_conn_error(struct c4iw_ep *ep) int ret; int state; - state = state_read(&ep->com); + mutex_lock(&ep->com.mutex); + state = ep->com.state; CTR5(KTR_IW_CXGBE, "%s:pceB ep %p so %p so->so_error %u state %s", __func__, ep, ep->com.so, ep->com.so->so_error, states[ep->com.state]); @@ -488,6 +586,7 @@ process_conn_error(struct c4iw_ep *ep) case DEAD: CTR2(KTR_IW_CXGBE, "%s so_error %d IN DEAD STATE!!!!", __func__, ep->com.so->so_error); + mutex_unlock(&ep->com.mutex); return; default: @@ -496,12 +595,18 @@ process_conn_error(struct c4iw_ep *ep) } if (state != ABORTING) { + if (ep->parent_ep) { + CTR2(KTR_IW_CXGBE, "%s:pce1 %p", __func__, ep); + close_socket(&ep->com, 1); + } else { + CTR2(KTR_IW_CXGBE, "%s:pce2 %p", __func__, ep); + close_socket(&ep->com, 0); + } - CTR2(KTR_IW_CXGBE, "%s:pce1 %p", __func__, ep); - close_socket(&ep->com, 0); - state_set(&ep->com, DEAD); + __state_set(&ep->com, DEAD); c4iw_put_ep(&ep->com); } + mutex_unlock(&ep->com.mutex); CTR2(KTR_IW_CXGBE, "%s:pceE %p", __func__, ep); return; } @@ -563,16 +668,19 @@ process_close_complete(struct c4iw_ep *e break; case DEAD: - default: CTR2(KTR_IW_CXGBE, "%s:pcc6 %p DEAD", __func__, ep); - panic("%s:pcc6 %p DEAD", __func__, ep); + break; + default: + CTR2(KTR_IW_CXGBE, "%s:pcc7 %p unknown ep state", + __func__, ep); + panic("%s:pcc6 %p unknown ep state", __func__, ep); break; } mutex_unlock(&ep->com.mutex); if (release) { - CTR2(KTR_IW_CXGBE, "%s:pcc7 %p", __func__, ep); + CTR2(KTR_IW_CXGBE, "%s:pcc8 %p", __func__, ep); c4iw_put_ep(&ep->com); } CTR2(KTR_IW_CXGBE, "%s:pccE %p", __func__, ep); @@ -587,6 +695,14 @@ init_sock(struct c4iw_ep_common *epc) struct socket *so = epc->so; int on = 1; + mutex_lock(&epc->so_mutex); + if ((so == NULL) || (so->so_count == 0)) { + mutex_unlock(&epc->so_mutex); + CTR5(KTR_IW_CXGBE, "%s:iso1 so %p, ep %p, state %s, tid %d", + __func__, so, epc, states[epc->state], + ((struct c4iw_ep *)epc)->hwtid); + return; + } SOCK_LOCK(so); soupcall_set(so, SO_RCV, c4iw_so_upcall, epc); so->so_state |= SS_NBIO; @@ -602,6 +718,7 @@ init_sock(struct c4iw_ep_common *epc) log(LOG_ERR, "%s: can't set TCP_NODELAY on so %p (%d)\n", __func__, so, rc); } + mutex_unlock(&epc->so_mutex); } static void @@ -643,14 +760,20 @@ static void process_connected(struct c4iw_ep *ep) { - if ((ep->com.so->so_state & SS_ISCONNECTED) && !ep->com.so->so_error) - send_mpa_req(ep); + if ((ep->com.so->so_state & SS_ISCONNECTED) && !ep->com.so->so_error) { + if (send_mpa_req(ep)) + goto err; + } else { connect_reply_upcall(ep, -ep->com.so->so_error); - close_socket(&ep->com, 0); - state_set(&ep->com, DEAD); - c4iw_put_ep(&ep->com); + goto err; } + return; +err: + close_socket(&ep->com, 0); + state_set(&ep->com, DEAD); + c4iw_put_ep(&ep->com); + return; } void @@ -660,6 +783,7 @@ process_newconn(struct iw_cm_id *parent_ struct sockaddr_in *local; struct sockaddr_in *remote; struct c4iw_ep *parent_ep = parent_cm_id->provider_data; + int ret = 0; if (!child_so) { CTR4(KTR_IW_CXGBE, @@ -703,7 +827,14 @@ process_newconn(struct iw_cm_id *parent_ START_EP_TIMER(child_ep); /* maybe the request has already been queued up on the socket... */ - process_mpa_request(child_ep); + ret = process_mpa_request(child_ep); + if (ret == 2) + /* ABORT */ + c4iw_ep_disconnect(child_ep, 1, GFP_KERNEL); + else if (ret == 1) + /* CLOSE */ + c4iw_ep_disconnect(child_ep, 0, GFP_KERNEL); + return; } @@ -762,7 +893,12 @@ process_socket_event(struct c4iw_ep *ep) /* peer close */ if ((so->so_rcv.sb_state & SBS_CANTRCVMORE) && state <= CLOSING) { process_peer_close(ep); - return; + /* + * check whether socket disconnect event is pending before + * returning. Fallthrough if yes. + */ + if (!(so->so_state & SS_ISDISCONNECTED)) + return; } /* close complete */ @@ -777,10 +913,6 @@ process_socket_event(struct c4iw_ep *ep) SYSCTL_NODE(_hw, OID_AUTO, iw_cxgbe, CTLFLAG_RD, 0, "iw_cxgbe driver parameters"); -int db_delay_usecs = 1; -SYSCTL_INT(_hw_iw_cxgbe, OID_AUTO, db_delay_usecs, CTLFLAG_RWTUN, &db_delay_usecs, 0, - "Usecs to delay awaiting db fifo to drain"); - static int dack_mode = 0; SYSCTL_INT(_hw_iw_cxgbe, OID_AUTO, dack_mode, CTLFLAG_RWTUN, &dack_mode, 0, "Delayed ack mode (default = 0)"); @@ -837,10 +969,6 @@ static int snd_win = 128 * 1024; SYSCTL_INT(_hw_iw_cxgbe, OID_AUTO, snd_win, CTLFLAG_RWTUN, &snd_win, 0, "TCP send window in bytes (default = 128KB)"); -int db_fc_threshold = 2000; -SYSCTL_INT(_hw_iw_cxgbe, OID_AUTO, db_fc_threshold, CTLFLAG_RWTUN, &db_fc_threshold, 0, - "QP count/threshold that triggers automatic"); - static void start_ep_timer(struct c4iw_ep *ep) { @@ -910,6 +1038,7 @@ alloc_ep(int size, gfp_t gfp) kref_init(&epc->kref); mutex_init(&epc->mutex); + mutex_init(&epc->so_mutex); c4iw_init_wr_wait(&epc->wr_wait); return (epc); @@ -947,7 +1076,7 @@ static void release_ep_resources(struct CTR2(KTR_IW_CXGBE, "%s:rerE %p", __func__, ep); } -static void +static int send_mpa_req(struct c4iw_ep *ep) { int mpalen; @@ -955,7 +1084,7 @@ send_mpa_req(struct c4iw_ep *ep) struct mpa_v2_conn_params mpa_v2_params; struct mbuf *m; char mpa_rev_to_use = mpa_rev; - int err; + int err = 0; if (ep->retry_with_mpa_v1) mpa_rev_to_use = 1; @@ -965,9 +1094,10 @@ send_mpa_req(struct c4iw_ep *ep) mpa = malloc(mpalen, M_CXGBE, M_NOWAIT); if (mpa == NULL) { -failed: - connect_reply_upcall(ep, -ENOMEM); - return; + err = -ENOMEM; + CTR3(KTR_IW_CXGBE, "%s:smr1 ep: %p , error: %d", + __func__, ep, err); + goto err; } memset(mpa, 0, mpalen); @@ -1019,20 +1149,32 @@ failed: m = m_getm(NULL, mpalen, M_NOWAIT, MT_DATA); if (m == NULL) { + err = -ENOMEM; + CTR3(KTR_IW_CXGBE, "%s:smr2 ep: %p , error: %d", + __func__, ep, err); free(mpa, M_CXGBE); - goto failed; + goto err; } m_copyback(m, 0, mpalen, (void *)mpa); free(mpa, M_CXGBE); - err = sosend(ep->com.so, NULL, NULL, m, NULL, MSG_DONTWAIT, - ep->com.thread); - if (err) - goto failed; + err = -sosend(ep->com.so, NULL, NULL, m, NULL, MSG_DONTWAIT, + ep->com.thread); + if (err) { + CTR3(KTR_IW_CXGBE, "%s:smr3 ep: %p , error: %d", + __func__, ep, err); + goto err; + } START_EP_TIMER(ep); state_set(&ep->com, MPA_REQ_SENT); ep->mpa_attr.initiator = 1; + CTR3(KTR_IW_CXGBE, "%s:smrE %p, error: %d", __func__, ep, err); + return 0; +err: + connect_reply_upcall(ep, err); + CTR3(KTR_IW_CXGBE, "%s:smrE %p, error: %d", __func__, ep, err); + return err; } static int send_mpa_reject(struct c4iw_ep *ep, const void *pdata, u8 plen) @@ -1283,10 +1425,11 @@ static void connect_reply_upcall(struct { struct iw_cm_event event; - CTR3(KTR_IW_CXGBE, "%s:cruB %p", __func__, ep, status); + CTR3(KTR_IW_CXGBE, "%s:cruB %p, status: %d", __func__, ep, status); memset(&event, 0, sizeof(event)); event.event = IW_CM_EVENT_CONNECT_REPLY; - event.status = (status ==-ECONNABORTED)?-ECONNRESET: status; + event.status = ((status == -ECONNABORTED) || (status == -EPIPE)) ? + -ECONNRESET : status; event.local_addr = ep->com.local_addr; event.remote_addr = ep->com.remote_addr; @@ -1636,6 +1779,7 @@ static int process_mpa_reply(struct c4iw CTR2(KTR_IW_CXGBE, "%s:pmrl %p", __func__, ep); printf("%s set_tcpinfo error\n", __func__); + err = -ECONNRESET; goto err; } @@ -1901,32 +2045,31 @@ int c4iw_reject_cr(struct iw_cm_id *cm_i int err; struct c4iw_ep *ep = to_ep(cm_id); CTR2(KTR_IW_CXGBE, "%s:crcB %p", __func__, ep); - int disconnect = 0; + int abort = 0; - if (state_read(&ep->com) == DEAD) { + if ((state_read(&ep->com) == DEAD) || + (state_read(&ep->com) != MPA_REQ_RCVD)) { CTR2(KTR_IW_CXGBE, "%s:crc1 %p", __func__, ep); c4iw_put_ep(&ep->com); return -ECONNRESET; } set_bit(ULP_REJECT, &ep->com.history); - BUG_ON(state_read(&ep->com) != MPA_REQ_RCVD); if (mpa_rev == 0) { CTR2(KTR_IW_CXGBE, "%s:crc2 %p", __func__, ep); - disconnect = 2; + abort = 1; } else { CTR2(KTR_IW_CXGBE, "%s:crc3 %p", __func__, ep); - err = send_mpa_reject(ep, pdata, pdata_len); - err = soshutdown(ep->com.so, 3); + abort = send_mpa_reject(ep, pdata, pdata_len); } + stop_ep_timer(ep); + err = c4iw_ep_disconnect(ep, abort != 0, GFP_KERNEL); c4iw_put_ep(&ep->com); - if (disconnect) - err = c4iw_ep_disconnect(ep, disconnect == 2, GFP_KERNEL); - CTR2(KTR_IW_CXGBE, "%s:crc4 %p", __func__, ep); + CTR3(KTR_IW_CXGBE, "%s:crc4 %p, err: %d", __func__, ep, err); return 0; } Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h ============================================================================== --- stable/11/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Fri Dec 2 23:05:14 2016 (r309449) +++ stable/11/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Sat Dec 3 00:18:38 2016 (r309450) @@ -131,10 +131,6 @@ struct c4iw_stats { struct c4iw_stat stag; struct c4iw_stat pbl; struct c4iw_stat rqt; - u64 db_full; - u64 db_empty; - u64 db_drop; - u64 db_state_transitions; }; struct c4iw_rdev { @@ -207,12 +203,6 @@ c4iw_wait_for_reply(struct c4iw_rdev *rd return (wr_waitp->ret); } -enum db_state { - NORMAL = 0, - FLOW_CONTROL = 1, - RECOVERY = 2 -}; - struct c4iw_dev { struct ib_device ibdev; struct c4iw_rdev rdev; @@ -222,8 +212,6 @@ struct c4iw_dev { struct idr mmidr; spinlock_t lock; struct dentry *debugfs_root; - enum db_state db_state; - int qpcnt; }; static inline struct c4iw_dev *to_c4iw_dev(struct ib_device *ibdev) @@ -766,6 +754,7 @@ struct c4iw_ep_common { int rpl_done; struct thread *thread; struct socket *so; + struct mutex so_mutex; }; struct c4iw_listen_ep { Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/qp.c ============================================================================== --- stable/11/sys/dev/cxgbe/iw_cxgbe/qp.c Fri Dec 2 23:05:14 2016 (r309449) +++ stable/11/sys/dev/cxgbe/iw_cxgbe/qp.c Sat Dec 3 00:18:38 2016 (r309450) @@ -64,8 +64,6 @@ struct cpl_set_tcb_rpl; #include "iw_cxgbe.h" #include "user.h" -extern int db_delay_usecs; -extern int db_fc_threshold; static void creds(struct toepcb *toep, size_t wrsize); @@ -689,8 +687,8 @@ int c4iw_post_send(struct ib_qp *ibqp, s t4_sq_produce(&qhp->wq, len16); idx += DIV_ROUND_UP(len16*16, T4_EQ_ENTRY_SIZE); } - if (t4_wq_db_enabled(&qhp->wq)) - t4_ring_sq_db(&qhp->wq, idx); + + t4_ring_sq_db(&qhp->wq, idx); spin_unlock_irqrestore(&qhp->lock, flag); return err; } @@ -751,8 +749,8 @@ int c4iw_post_receive(struct ib_qp *ibqp wr = wr->next; num_wrs--; } - if (t4_wq_db_enabled(&qhp->wq)) - t4_ring_rq_db(&qhp->wq, idx); + + t4_ring_rq_db(&qhp->wq, idx); spin_unlock_irqrestore(&qhp->lock, flag); return err; } @@ -1392,14 +1390,6 @@ out: return ret; } -static int enable_qp_db(int id, void *p, void *data) -{ - struct c4iw_qp *qp = p; - - t4_enable_wq_db(&qp->wq); - return 0; -} - int c4iw_destroy_qp(struct ib_qp *ib_qp) { struct c4iw_dev *rhp; @@ -1420,13 +1410,6 @@ int c4iw_destroy_qp(struct ib_qp *ib_qp) spin_lock_irq(&rhp->lock); remove_handle_nolock(rhp, &rhp->qpidr, qhp->wq.sq.qid); - rhp->qpcnt--; - BUG_ON(rhp->qpcnt < 0); - if (rhp->qpcnt <= db_fc_threshold && rhp->db_state == FLOW_CONTROL) { - rhp->rdev.stats.db_state_transitions++; - rhp->db_state = NORMAL; - idr_for_each(&rhp->qpidr, enable_qp_db, NULL); - } spin_unlock_irq(&rhp->lock); atomic_dec(&qhp->refcnt); wait_event(qhp->wait, !atomic_read(&qhp->refcnt)); @@ -1442,14 +1425,6 @@ int c4iw_destroy_qp(struct ib_qp *ib_qp) return 0; } -static int disable_qp_db(int id, void *p, void *data) -{ - struct c4iw_qp *qp = p; - - t4_disable_wq_db(&qp->wq); - return 0; -} - struct ib_qp * c4iw_create_qp(struct ib_pd *pd, struct ib_qp_init_attr *attrs, struct ib_udata *udata) @@ -1539,13 +1514,6 @@ c4iw_create_qp(struct ib_pd *pd, struct atomic_set(&qhp->refcnt, 1); spin_lock_irq(&rhp->lock); - if (rhp->db_state != NORMAL) - t4_disable_wq_db(&qhp->wq); - if (++rhp->qpcnt > db_fc_threshold && rhp->db_state == NORMAL) { - rhp->rdev.stats.db_state_transitions++; - rhp->db_state = FLOW_CONTROL; - idr_for_each(&rhp->qpidr, disable_qp_db, NULL); - } ret = insert_handle_nolock(rhp, &rhp->qpidr, qhp, qhp->wq.sq.qid); spin_unlock_irq(&rhp->lock); if (ret) @@ -1679,15 +1647,6 @@ int c4iw_ib_modify_qp(struct ib_qp *ibqp C4IW_QP_ATTR_ENABLE_RDMA_WRITE | C4IW_QP_ATTR_ENABLE_RDMA_BIND) : 0; - /* - * Use SQ_PSN and RQ_PSN to pass in IDX_INC values for - * ringing the queue db when we're in DB_FULL mode. - */ - attrs.sq_db_inc = attr->sq_psn; - attrs.rq_db_inc = attr->rq_psn; - mask |= (attr_mask & IB_QP_SQ_PSN) ? C4IW_QP_ATTR_SQ_DB : 0; - mask |= (attr_mask & IB_QP_RQ_PSN) ? C4IW_QP_ATTR_RQ_DB : 0; - return c4iw_modify_qp(rhp, qhp, mask, &attrs, 0); } Modified: stable/11/sys/dev/cxgbe/iw_cxgbe/t4.h ============================================================================== --- stable/11/sys/dev/cxgbe/iw_cxgbe/t4.h Fri Dec 2 23:05:14 2016 (r309449) +++ stable/11/sys/dev/cxgbe/iw_cxgbe/t4.h Sat Dec 3 00:18:38 2016 (r309450) @@ -453,21 +453,6 @@ static inline void t4_set_wq_in_error(st wq->rq.queue[wq->rq.size].status.qp_err = 1; } -static inline void t4_disable_wq_db(struct t4_wq *wq) -{ - wq->rq.queue[wq->rq.size].status.db_off = 1; -} - -static inline void t4_enable_wq_db(struct t4_wq *wq) -{ - wq->rq.queue[wq->rq.size].status.db_off = 0; -} - -static inline int t4_wq_db_enabled(struct t4_wq *wq) -{ - return !wq->rq.queue[wq->rq.size].status.db_off; -} - struct t4_cq { struct t4_cqe *queue; bus_addr_t dma_addr; From owner-svn-src-stable-11@freebsd.org Sat Dec 3 00:37:02 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08B2AC62964; Sat, 3 Dec 2016 00:37:02 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C10636E8; Sat, 3 Dec 2016 00:37:01 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB30b0sB006438; Sat, 3 Dec 2016 00:37:00 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB30b0lW006437; Sat, 3 Dec 2016 00:37:00 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612030037.uB30b0lW006437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 3 Dec 2016 00:37:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309452 - stable/11/tools/build/mk X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 00:37:02 -0000 Author: ngie Date: Sat Dec 3 00:37:00 2016 New Revision: 309452 URL: https://svnweb.freebsd.org/changeset/base/309452 Log: MFC r307713: Remove /usr/libexec/bsdinstall/hardening if MK_BSDINSTALL == no Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/11/tools/build/mk/OptionalObsoleteFiles.inc Sat Dec 3 00:24:34 2016 (r309451) +++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc Sat Dec 3 00:37:00 2016 (r309452) @@ -682,6 +682,7 @@ OLD_FILES+=usr/libexec/bsdinstall/distex OLD_FILES+=usr/libexec/bsdinstall/distfetch OLD_FILES+=usr/libexec/bsdinstall/docsinstall OLD_FILES+=usr/libexec/bsdinstall/entropy +OLD_FILES+=usr/libexec/bsdinstall/hardening OLD_FILES+=usr/libexec/bsdinstall/hostname OLD_FILES+=usr/libexec/bsdinstall/jail OLD_FILES+=usr/libexec/bsdinstall/keymap From owner-svn-src-stable-11@freebsd.org Sat Dec 3 00:38:36 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0608C62A12; Sat, 3 Dec 2016 00:38:36 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F8CB8BE; Sat, 3 Dec 2016 00:38:36 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB30cZXn006559; Sat, 3 Dec 2016 00:38:35 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB30cZct006558; Sat, 3 Dec 2016 00:38:35 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612030038.uB30cZct006558@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 3 Dec 2016 00:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309453 - stable/11/lib/libc/tests X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 00:38:36 -0000 Author: ngie Date: Sat Dec 3 00:38:35 2016 New Revision: 309453 URL: https://svnweb.freebsd.org/changeset/base/309453 Log: MFC r307700: Only build lib/libc/tests/iconv if MK_ICONV != no Modified: stable/11/lib/libc/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/tests/Makefile ============================================================================== --- stable/11/lib/libc/tests/Makefile Sat Dec 3 00:37:00 2016 (r309452) +++ stable/11/lib/libc/tests/Makefile Sat Dec 3 00:38:35 2016 (r309453) @@ -8,7 +8,6 @@ TESTS_SUBDIRS= c063 TESTS_SUBDIRS+= db TESTS_SUBDIRS+= gen TESTS_SUBDIRS+= hash -TESTS_SUBDIRS+= iconv TESTS_SUBDIRS+= inet TESTS_SUBDIRS+= net TESTS_SUBDIRS+= nss @@ -26,6 +25,10 @@ TESTS_SUBDIRS+= ttyio SUBDIR_DEPEND_tls= tls_dso +.if ${MK_ICONV} != "no" +TESTS_SUBDIRS+= iconv +.endif + .if ${MK_LOCALES} != "no" TESTS_SUBDIRS+= locale .endif From owner-svn-src-stable-11@freebsd.org Sat Dec 3 00:43:12 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B1F5C62D57; Sat, 3 Dec 2016 00:43:12 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0A6FDEC5; Sat, 3 Dec 2016 00:43:11 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB30hBi1010579; Sat, 3 Dec 2016 00:43:11 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB30hBOc010578; Sat, 3 Dec 2016 00:43:11 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201612030043.uB30hBOc010578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 3 Dec 2016 00:43:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309455 - stable/11/sys/fs/ext2fs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 00:43:12 -0000 Author: pfg Date: Sat Dec 3 00:43:11 2016 New Revision: 309455 URL: https://svnweb.freebsd.org/changeset/base/309455 Log: MFC r309179: ext2fs: avoid possible overflow when calculating malloc size. This is inspired on r308064 for the case of mounting UFS. Modified: stable/11/sys/fs/ext2fs/ext2_vfsops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- stable/11/sys/fs/ext2fs/ext2_vfsops.c Sat Dec 3 00:40:08 2016 (r309454) +++ stable/11/sys/fs/ext2fs/ext2_vfsops.c Sat Dec 3 00:43:11 2016 (r309455) @@ -537,7 +537,8 @@ ext2_mountfs(struct vnode *devvp, struct struct csum *sump; int error; int ronly; - int i, size; + int i; + u_long size; int32_t *lp; int32_t e2fs_maxcontig; From owner-svn-src-stable-11@freebsd.org Sat Dec 3 01:05:01 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC129C63281; Sat, 3 Dec 2016 01:05:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A99611BA3; Sat, 3 Dec 2016 01:05:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB3150ud018794; Sat, 3 Dec 2016 01:05:00 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB3150I8018788; Sat, 3 Dec 2016 01:05:00 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612030105.uB3150I8018788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 3 Dec 2016 01:05:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309458 - in stable: 10/sys/dev/cxgbe 10/sys/dev/cxgbe/common 10/sys/dev/cxgbe/firmware 11/sys/dev/cxgbe 11/sys/dev/cxgbe/common 11/sys/dev/cxgbe/firmware X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 01:05:02 -0000 Author: jhb Date: Sat Dec 3 01:04:59 2016 New Revision: 309458 URL: https://svnweb.freebsd.org/changeset/base/309458 Log: MFC 302440,304873,305704,305985,306787,307531: Fixes for sysctls. 302440: cxgbe(4): Add sysctl to display the RSS indirection table size for an interface. dev.cxl..rss_size dev.vcxl..rss_size 304873: cxgbe(4): Provide more details about the card in the sysctl MIB. dev.t5nex.0.%desc: Chelsio T580-CR dev.t5nex.0.hw_revision: 1 dev.t5nex.0.sn: PT13140042 dev.t5nex.0.pn: 110117150A0 dev.t5nex.0.ec: 0000000000000000 dev.t5nex.0.na: 0007432AF490 dev.t5nex.0.vpd_version: 3 dev.t5nex.0.scfg_version: 53255 dev.t5nex.0.bs_version: 1.1.0.0 dev.t5nex.0.er_version: 1.0.0.68 dev.t5nex.0.tp_version: 0.1.4.9 dev.t5nex.0.firmware_version: 1.16.2.0 305704: cxgbe(4): Rename the debug_flags driver tunable/sysctl to dflags. Tunables that end with _flags are special. 305985: cxgbe(4): Fixes to wrq stats. - Increment tx_wrs_copied in the correct place. - Add tx_wrs_sspace to the sysctl MIB. 306787: cxgbe(4): Fix whitespace in the pm_stats display. 307531: cxgbe(4): Adjust whitespace to line up the column titles in cim_qcfg with the values displayed. Sponsored by: Chelsio Communications Modified: stable/11/sys/dev/cxgbe/adapter.h stable/11/sys/dev/cxgbe/common/common.h stable/11/sys/dev/cxgbe/common/t4_hw.c stable/11/sys/dev/cxgbe/firmware/t4fw_interface.h stable/11/sys/dev/cxgbe/t4_main.c stable/11/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/dev/cxgbe/adapter.h stable/10/sys/dev/cxgbe/common/common.h stable/10/sys/dev/cxgbe/common/t4_hw.c stable/10/sys/dev/cxgbe/firmware/t4fw_interface.h stable/10/sys/dev/cxgbe/t4_main.c stable/10/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/dev/cxgbe/adapter.h ============================================================================== --- stable/11/sys/dev/cxgbe/adapter.h Sat Dec 3 00:46:18 2016 (r309457) +++ stable/11/sys/dev/cxgbe/adapter.h Sat Dec 3 01:04:59 2016 (r309458) @@ -821,7 +821,8 @@ struct adapter { char fw_version[16]; char tp_version[16]; - char exprom_version[16]; + char er_version[16]; + char bs_version[16]; char cfg_file[32]; u_int cfcsum; struct adapter_params params; Modified: stable/11/sys/dev/cxgbe/common/common.h ============================================================================== --- stable/11/sys/dev/cxgbe/common/common.h Sat Dec 3 00:46:18 2016 (r309457) +++ stable/11/sys/dev/cxgbe/common/common.h Sat Dec 3 01:04:59 2016 (r309458) @@ -330,9 +330,12 @@ struct adapter_params { unsigned int sf_size; /* serial flash size in bytes */ unsigned int sf_nsec; /* # of flash sectors */ - unsigned int fw_vers; - unsigned int tp_vers; - unsigned int exprom_vers; + unsigned int fw_vers; /* firmware version */ + unsigned int bs_vers; /* bootstrap version */ + unsigned int tp_vers; /* TP microcode version */ + unsigned int er_vers; /* expansion ROM version */ + unsigned int scfg_vers; /* Serial Configuration version */ + unsigned int vpd_vers; /* VPD version */ unsigned short mtus[NMTUS]; unsigned short a_wnd[NCCTRL_WIN]; @@ -548,8 +551,12 @@ int t4_flash_erase_sectors(struct adapte int t4_flash_cfg_addr(struct adapter *adapter); int t4_load_cfg(struct adapter *adapter, const u8 *cfg_data, unsigned int size); int t4_get_fw_version(struct adapter *adapter, u32 *vers); +int t4_get_bs_version(struct adapter *adapter, u32 *vers); int t4_get_tp_version(struct adapter *adapter, u32 *vers); int t4_get_exprom_version(struct adapter *adapter, u32 *vers); +int t4_get_scfg_version(struct adapter *adapter, u32 *vers); +int t4_get_vpd_version(struct adapter *adapter, u32 *vers); +int t4_get_version_info(struct adapter *adapter); int t4_init_hw(struct adapter *adapter, u32 fw_params); const struct chip_params *t4_get_chip_params(int chipid); int t4_prep_adapter(struct adapter *adapter, u8 *buf); Modified: stable/11/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- stable/11/sys/dev/cxgbe/common/t4_hw.c Sat Dec 3 00:46:18 2016 (r309457) +++ stable/11/sys/dev/cxgbe/common/t4_hw.c Sat Dec 3 01:04:59 2016 (r309458) @@ -3234,6 +3234,20 @@ int t4_get_fw_version(struct adapter *ad } /** + * t4_get_bs_version - read the firmware bootstrap version + * @adapter: the adapter + * @vers: where to place the version + * + * Reads the FW Bootstrap version from flash. + */ +int t4_get_bs_version(struct adapter *adapter, u32 *vers) +{ + return t4_read_flash(adapter, FLASH_FWBOOTSTRAP_START + + offsetof(struct fw_hdr, fw_ver), 1, + vers, 0); +} + +/** * t4_get_tp_version - read the TP microcode version * @adapter: the adapter * @vers: where to place the version @@ -3285,6 +3299,110 @@ int t4_get_exprom_version(struct adapter } /** + * t4_get_scfg_version - return the Serial Configuration version + * @adapter: the adapter + * @vers: where to place the version + * + * Reads the Serial Configuration Version via the Firmware interface + * (thus this can only be called once we're ready to issue Firmware + * commands). The format of the Serial Configuration version is + * adapter specific. Returns 0 on success, an error on failure. + * + * Note that early versions of the Firmware didn't include the ability + * to retrieve the Serial Configuration version, so we zero-out the + * return-value parameter in that case to avoid leaving it with + * garbage in it. + * + * Also note that the Firmware will return its cached copy of the Serial + * Initialization Revision ID, not the actual Revision ID as written in + * the Serial EEPROM. This is only an issue if a new VPD has been written + * and the Firmware/Chip haven't yet gone through a RESET sequence. So + * it's best to defer calling this routine till after a FW_RESET_CMD has + * been issued if the Host Driver will be performing a full adapter + * initialization. + */ +int t4_get_scfg_version(struct adapter *adapter, u32 *vers) +{ + u32 scfgrev_param; + int ret; + + scfgrev_param = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_SCFGREV)); + ret = t4_query_params(adapter, adapter->mbox, adapter->pf, 0, + 1, &scfgrev_param, vers); + if (ret) + *vers = 0; + return ret; +} + +/** + * t4_get_vpd_version - return the VPD version + * @adapter: the adapter + * @vers: where to place the version + * + * Reads the VPD via the Firmware interface (thus this can only be called + * once we're ready to issue Firmware commands). The format of the + * VPD version is adapter specific. Returns 0 on success, an error on + * failure. + * + * Note that early versions of the Firmware didn't include the ability + * to retrieve the VPD version, so we zero-out the return-value parameter + * in that case to avoid leaving it with garbage in it. + * + * Also note that the Firmware will return its cached copy of the VPD + * Revision ID, not the actual Revision ID as written in the Serial + * EEPROM. This is only an issue if a new VPD has been written and the + * Firmware/Chip haven't yet gone through a RESET sequence. So it's best + * to defer calling this routine till after a FW_RESET_CMD has been issued + * if the Host Driver will be performing a full adapter initialization. + */ +int t4_get_vpd_version(struct adapter *adapter, u32 *vers) +{ + u32 vpdrev_param; + int ret; + + vpdrev_param = (V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | + V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_VPDREV)); + ret = t4_query_params(adapter, adapter->mbox, adapter->pf, 0, + 1, &vpdrev_param, vers); + if (ret) + *vers = 0; + return ret; +} + +/** + * t4_get_version_info - extract various chip/firmware version information + * @adapter: the adapter + * + * Reads various chip/firmware version numbers and stores them into the + * adapter Adapter Parameters structure. If any of the efforts fails + * the first failure will be returned, but all of the version numbers + * will be read. + */ +int t4_get_version_info(struct adapter *adapter) +{ + int ret = 0; + + #define FIRST_RET(__getvinfo) \ + do { \ + int __ret = __getvinfo; \ + if (__ret && !ret) \ + ret = __ret; \ + } while (0) + + FIRST_RET(t4_get_fw_version(adapter, &adapter->params.fw_vers)); + FIRST_RET(t4_get_bs_version(adapter, &adapter->params.bs_vers)); + FIRST_RET(t4_get_tp_version(adapter, &adapter->params.tp_vers)); + FIRST_RET(t4_get_exprom_version(adapter, &adapter->params.er_vers)); + FIRST_RET(t4_get_scfg_version(adapter, &adapter->params.scfg_vers)); + FIRST_RET(t4_get_vpd_version(adapter, &adapter->params.vpd_vers)); + + #undef FIRST_RET + + return ret; +} + +/** * t4_flash_erase_sectors - erase a range of flash sectors * @adapter: the adapter * @start: the first sector to erase Modified: stable/11/sys/dev/cxgbe/firmware/t4fw_interface.h ============================================================================== --- stable/11/sys/dev/cxgbe/firmware/t4fw_interface.h Sat Dec 3 00:46:18 2016 (r309457) +++ stable/11/sys/dev/cxgbe/firmware/t4fw_interface.h Sat Dec 3 01:04:59 2016 (r309458) @@ -4206,6 +4206,8 @@ enum fw_params_param_dev { FW_PARAMS_PARAM_DEV_ULPTX_MEMWRITE_DSGL = 0x17, FW_PARAMS_PARAM_DEV_FWCACHE = 0x18, FW_PARAMS_PARAM_DEV_RSSINFO = 0x19, + FW_PARAMS_PARAM_DEV_SCFGREV = 0x1A, + FW_PARAMS_PARAM_DEV_VPDREV = 0x1B, }; /* Modified: stable/11/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_main.c Sat Dec 3 00:46:18 2016 (r309457) +++ stable/11/sys/dev/cxgbe/t4_main.c Sat Dec 3 01:04:59 2016 (r309458) @@ -675,7 +675,7 @@ t4_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; - TUNABLE_INT_FETCH("hw.cxgbe.debug_flags", &sc->debug_flags); + TUNABLE_INT_FETCH("hw.cxgbe.dflags", &sc->debug_flags); if ((pci_get_device(dev) & 0xff00) == 0x5400) t5_attribute_workaround(dev); @@ -2897,32 +2897,6 @@ prep_firmware(struct adapter *sc) goto done; } - /* We're using whatever's on the card and it's known to be good. */ - sc->params.fw_vers = ntohl(card_fw->fw_ver); - snprintf(sc->fw_version, sizeof(sc->fw_version), "%u.%u.%u.%u", - G_FW_HDR_FW_VER_MAJOR(sc->params.fw_vers), - G_FW_HDR_FW_VER_MINOR(sc->params.fw_vers), - G_FW_HDR_FW_VER_MICRO(sc->params.fw_vers), - G_FW_HDR_FW_VER_BUILD(sc->params.fw_vers)); - - t4_get_tp_version(sc, &sc->params.tp_vers); - snprintf(sc->tp_version, sizeof(sc->tp_version), "%u.%u.%u.%u", - G_FW_HDR_FW_VER_MAJOR(sc->params.tp_vers), - G_FW_HDR_FW_VER_MINOR(sc->params.tp_vers), - G_FW_HDR_FW_VER_MICRO(sc->params.tp_vers), - G_FW_HDR_FW_VER_BUILD(sc->params.tp_vers)); - - if (t4_get_exprom_version(sc, &sc->params.exprom_vers) != 0) - sc->params.exprom_vers = 0; - else { - snprintf(sc->exprom_version, sizeof(sc->exprom_version), - "%u.%u.%u.%u", - G_FW_HDR_FW_VER_MAJOR(sc->params.exprom_vers), - G_FW_HDR_FW_VER_MINOR(sc->params.exprom_vers), - G_FW_HDR_FW_VER_MICRO(sc->params.exprom_vers), - G_FW_HDR_FW_VER_BUILD(sc->params.exprom_vers)); - } - /* Reset device */ if (need_fw_reset && (rc = -t4_fw_reset(sc, sc->mbox, F_PIORSTMODE | F_PIORST)) != 0) { @@ -3167,6 +3141,32 @@ get_params__pre_init(struct adapter *sc) int rc; uint32_t param[2], val[2]; + t4_get_version_info(sc); + + snprintf(sc->fw_version, sizeof(sc->fw_version), "%u.%u.%u.%u", + G_FW_HDR_FW_VER_MAJOR(sc->params.fw_vers), + G_FW_HDR_FW_VER_MINOR(sc->params.fw_vers), + G_FW_HDR_FW_VER_MICRO(sc->params.fw_vers), + G_FW_HDR_FW_VER_BUILD(sc->params.fw_vers)); + + snprintf(sc->bs_version, sizeof(sc->bs_version), "%u.%u.%u.%u", + G_FW_HDR_FW_VER_MAJOR(sc->params.bs_vers), + G_FW_HDR_FW_VER_MINOR(sc->params.bs_vers), + G_FW_HDR_FW_VER_MICRO(sc->params.bs_vers), + G_FW_HDR_FW_VER_BUILD(sc->params.bs_vers)); + + snprintf(sc->tp_version, sizeof(sc->tp_version), "%u.%u.%u.%u", + G_FW_HDR_FW_VER_MAJOR(sc->params.tp_vers), + G_FW_HDR_FW_VER_MINOR(sc->params.tp_vers), + G_FW_HDR_FW_VER_MICRO(sc->params.tp_vers), + G_FW_HDR_FW_VER_BUILD(sc->params.tp_vers)); + + snprintf(sc->er_version, sizeof(sc->er_version), "%u.%u.%u.%u", + G_FW_HDR_FW_VER_MAJOR(sc->params.er_vers), + G_FW_HDR_FW_VER_MINOR(sc->params.er_vers), + G_FW_HDR_FW_VER_MICRO(sc->params.er_vers), + G_FW_HDR_FW_VER_BUILD(sc->params.er_vers)); + param[0] = FW_PARAM_DEV(PORTVEC); param[1] = FW_PARAM_DEV(CCLK); rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 2, param, val); @@ -3380,9 +3380,7 @@ t4_set_desc(struct adapter *sc) char buf[128]; struct adapter_params *p = &sc->params; - snprintf(buf, sizeof(buf), "Chelsio %s %sNIC (rev %d), S/N:%s, " - "P/N:%s, E/C:%s", p->vpd.id, is_offload(sc) ? "R" : "", - chip_rev(sc), p->vpd.sn, p->vpd.pn, p->vpd.ec); + snprintf(buf, sizeof(buf), "Chelsio %s", p->vpd.id); device_set_desc_copy(sc->dev, buf); } @@ -4643,7 +4641,7 @@ t4_sysctls(struct adapter *sc) SYSCTL_ADD_INT(ctx, children, OID_AUTO, "lro_timeout", CTLFLAG_RW, &sc->lro_timeout, 0, "lro inactive-flush timeout (in us)"); - SYSCTL_ADD_INT(ctx, children, OID_AUTO, "debug_flags", CTLFLAG_RW, + SYSCTL_ADD_INT(ctx, children, OID_AUTO, "dflags", CTLFLAG_RW, &sc->debug_flags, 0, "flags to enable runtime debugging"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "tp_version", @@ -4658,10 +4656,29 @@ t4_sysctls(struct adapter *sc) SYSCTL_ADD_INT(ctx, children, OID_AUTO, "hw_revision", CTLFLAG_RD, NULL, chip_rev(sc), "chip hardware revision"); - if (sc->params.exprom_vers != 0) { - SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "exprom_version", - CTLFLAG_RD, sc->exprom_version, 0, "expansion ROM version"); - } + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "sn", + CTLFLAG_RD, sc->params.vpd.sn, 0, "serial number"); + + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "pn", + CTLFLAG_RD, sc->params.vpd.pn, 0, "part number"); + + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "ec", + CTLFLAG_RD, sc->params.vpd.ec, 0, "engineering change"); + + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "na", + CTLFLAG_RD, sc->params.vpd.na, 0, "network address"); + + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "er_version", CTLFLAG_RD, + sc->er_version, 0, "expansion ROM version"); + + SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "bs_version", CTLFLAG_RD, + sc->bs_version, 0, "bootstrap firmware version"); + + SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "scfg_version", CTLFLAG_RD, + NULL, sc->params.scfg_vers, "serial config version"); + + SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "vpd_version", CTLFLAG_RD, + NULL, sc->params.vpd_vers, "VPD version"); SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "cf", CTLFLAG_RD, sc->cfg_file, 0, "configuration file"); @@ -4672,7 +4689,7 @@ t4_sysctls(struct adapter *sc) #define SYSCTL_CAP(name, n, text) \ SYSCTL_ADD_PROC(ctx, children, OID_AUTO, #name, \ CTLTYPE_STRING | CTLFLAG_RD, caps_decoder[n], sc->name, \ - sysctl_bitfield, "A", "available " text "capabilities") + sysctl_bitfield, "A", "available " text " capabilities") SYSCTL_CAP(nbmcaps, 0, "NBM"); SYSCTL_CAP(linkcaps, 1, "link"); @@ -4970,6 +4987,8 @@ vi_sysctls(struct vi_info *vi) &vi->first_rxq, 0, "index of first rx queue"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "first_txq", CTLFLAG_RD, &vi->first_txq, 0, "index of first tx queue"); + SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "rss_size", CTLFLAG_RD, NULL, + vi->rss_size, "size of RSS indirection table"); if (IS_MAIN_VI(vi)) { SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rsrv_noflowq", @@ -5914,7 +5933,8 @@ sysctl_cim_qcfg(SYSCTL_HANDLER_ARGS) if (sb == NULL) return (ENOMEM); - sbuf_printf(sb, "Queue Base Size Thres RdPtr WrPtr SOP EOP Avail"); + sbuf_printf(sb, + " Queue Base Size Thres RdPtr WrPtr SOP EOP Avail"); for (i = 0; i < CIM_NUM_IBQ; i++, p += 4) sbuf_printf(sb, "\n%7s %5x %5u %5u %6x %4x %4u %4u %5u", @@ -6858,7 +6878,7 @@ sysctl_pm_stats(SYSCTL_HANDLER_ARGS) }; static const char *rx_stats[MAX_PM_NSTATS] = { "Read:", "Write bypass:", "Write mem:", "Flush:", - " Rx FIFO wait", NULL, "Rx latency" + "Rx FIFO wait", NULL, "Rx latency" }; rc = sysctl_wire_old_buffer(req, 0); Modified: stable/11/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_sge.c Sat Dec 3 00:46:18 2016 (r309457) +++ stable/11/sys/dev/cxgbe/t4_sge.c Sat Dec 3 01:04:59 2016 (r309458) @@ -1890,6 +1890,7 @@ drain_wrq_wr_list(struct adapter *sc, st } eq->pidx = n - (eq->sidx - eq->pidx); } + wrq->tx_wrs_copied++; if (available < eq->sidx / 4 && atomic_cmpset_int(&eq->equiq, 0, 1)) { @@ -3545,6 +3546,8 @@ alloc_wrq(struct adapter *sc, struct vi_ &wrq->tx_wrs_direct, "# of work requests (direct)"); SYSCTL_ADD_UQUAD(ctx, children, OID_AUTO, "tx_wrs_copied", CTLFLAG_RD, &wrq->tx_wrs_copied, "# of work requests (copied)"); + SYSCTL_ADD_UQUAD(ctx, children, OID_AUTO, "tx_wrs_sspace", CTLFLAG_RD, + &wrq->tx_wrs_ss, "# of work requests (copied from scratch space)"); return (rc); } From owner-svn-src-stable-11@freebsd.org Sat Dec 3 01:10:47 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 18C70C634F1; Sat, 3 Dec 2016 01:10:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D209F1F6E; Sat, 3 Dec 2016 01:10:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB31AkhH021347; Sat, 3 Dec 2016 01:10:46 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB31AkE8021346; Sat, 3 Dec 2016 01:10:46 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201612030110.uB31AkE8021346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 3 Dec 2016 01:10:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309459 - in stable: 10/sys/dev/cxgbe 11/sys/dev/cxgbe X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 01:10:47 -0000 Author: jhb Date: Sat Dec 3 01:10:45 2016 New Revision: 309459 URL: https://svnweb.freebsd.org/changeset/base/309459 Log: MFC 303348: cxgbe(4): Initialize the adapter queues (fwq and mgmtq) instead of returning EAGAIN if they aren't available when the user tries to program a filter. Do this after validating the filter so that the driver doesn't bring up the queues if it doesn't have to. Modified: stable/11/sys/dev/cxgbe/t4_main.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/dev/cxgbe/t4_main.c Directory Properties: stable/10/ (props changed) Modified: stable/11/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_main.c Sat Dec 3 01:04:59 2016 (r309458) +++ stable/11/sys/dev/cxgbe/t4_main.c Sat Dec 3 01:10:45 2016 (r309459) @@ -7960,11 +7960,6 @@ set_filter(struct adapter *sc, struct t4 goto done; } - if (!(sc->flags & FULL_INIT_DONE)) { - rc = EAGAIN; - goto done; - } - if (t->idx >= nfilters) { rc = EINVAL; goto done; @@ -7998,6 +7993,10 @@ set_filter(struct adapter *sc, struct t4 goto done; } + if (!(sc->flags & FULL_INIT_DONE) && + ((rc = adapter_full_init(sc)) != 0)) + goto done; + if (sc->tids.ftid_tab == NULL) { KASSERT(sc->tids.ftids_in_use == 0, ("%s: no memory allocated but filters_in_use > 0", From owner-svn-src-stable-11@freebsd.org Sat Dec 3 02:47:18 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ACDC7C633FE; Sat, 3 Dec 2016 02:47:18 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5108683F; Sat, 3 Dec 2016 02:47:18 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB32lHAU059394; Sat, 3 Dec 2016 02:47:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB32lGtU059384; Sat, 3 Dec 2016 02:47:16 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612030247.uB32lGtU059384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 3 Dec 2016 02:47:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309466 - in stable/11: bin/cat/tests contrib/netbsd-tests contrib/netbsd-tests/bin/cat contrib/netbsd-tests/bin/sh contrib/netbsd-tests/bin/sh/dotcmd contrib/netbsd-tests/crypto/opencr... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 02:47:18 -0000 Author: ngie Date: Sat Dec 3 02:47:16 2016 New Revision: 309466 URL: https://svnweb.freebsd.org/changeset/base/309466 Log: MFC r305358: Update contrib/netbsd-tests with new content from NetBSD This updates the snapshot from 09/30/2014 to 08/11/2016 This brings in a number of new testcases from upstream, most notably: - bin/cat - lib/libc - lib/msun - lib/libthr - usr.bin/sort lib/libc/tests/stdio/open_memstream_test.c was moved to lib/libc/tests/stdio/open_memstream2_test.c to accomodate the new open_memstream test from NetBSD. Tested on: amd64 (VMware fusion VM; various bare metal platforms); i386 (VMware fusion VM); make tinderbox Added: stable/11/contrib/netbsd-tests/bin/cat/d_se_output.in - copied unchanged from r305358, head/contrib/netbsd-tests/bin/cat/d_se_output.in stable/11/contrib/netbsd-tests/bin/cat/d_se_output.out - copied unchanged from r305358, head/contrib/netbsd-tests/bin/cat/d_se_output.out stable/11/contrib/netbsd-tests/bin/sh/t_arith.sh - copied unchanged from r305358, head/contrib/netbsd-tests/bin/sh/t_arith.sh stable/11/contrib/netbsd-tests/bin/sh/t_cmdsub.sh - copied unchanged from r305358, head/contrib/netbsd-tests/bin/sh/t_cmdsub.sh stable/11/contrib/netbsd-tests/bin/sh/t_option.sh - copied unchanged from r305358, head/contrib/netbsd-tests/bin/sh/t_option.sh stable/11/contrib/netbsd-tests/bin/sh/t_redir.sh - copied unchanged from r305358, head/contrib/netbsd-tests/bin/sh/t_redir.sh stable/11/contrib/netbsd-tests/bin/sh/t_redircloexec.sh - copied unchanged from r305358, head/contrib/netbsd-tests/bin/sh/t_redircloexec.sh stable/11/contrib/netbsd-tests/bin/sh/t_shift.sh - copied unchanged from r305358, head/contrib/netbsd-tests/bin/sh/t_shift.sh stable/11/contrib/netbsd-tests/bin/sh/t_varval.sh - copied unchanged from r305358, head/contrib/netbsd-tests/bin/sh/t_varval.sh stable/11/contrib/netbsd-tests/dev/fss/ - copied from r305358, head/contrib/netbsd-tests/dev/fss/ stable/11/contrib/netbsd-tests/dev/usb/ - copied from r305358, head/contrib/netbsd-tests/dev/usb/ stable/11/contrib/netbsd-tests/include/sys/t_pslist.c - copied unchanged from r305358, head/contrib/netbsd-tests/include/sys/t_pslist.c stable/11/contrib/netbsd-tests/kernel/kqueue/t_vnode.c - copied unchanged from r305358, head/contrib/netbsd-tests/kernel/kqueue/t_vnode.c stable/11/contrib/netbsd-tests/lib/libc/db/h_lfsr.c - copied unchanged from r305358, head/contrib/netbsd-tests/lib/libc/db/h_lfsr.c stable/11/contrib/netbsd-tests/lib/libc/db/t_db_hash_seq.c - copied unchanged from r305358, head/contrib/netbsd-tests/lib/libc/db/t_db_hash_seq.c stable/11/contrib/netbsd-tests/lib/libc/inet/t_inet_addr.c - copied unchanged from r305358, head/contrib/netbsd-tests/lib/libc/inet/t_inet_addr.c stable/11/contrib/netbsd-tests/lib/libc/stdio/t_open_memstream.c - copied unchanged from r305358, head/contrib/netbsd-tests/lib/libc/stdio/t_open_memstream.c stable/11/contrib/netbsd-tests/lib/libc/stdlib/t_strtoi.c - copied unchanged from r305358, head/contrib/netbsd-tests/lib/libc/stdlib/t_strtoi.c stable/11/contrib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc - copied unchanged from r305358, head/contrib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc stable/11/contrib/netbsd-tests/lib/libc/sys/t_bind.c - copied unchanged from r305358, head/contrib/netbsd-tests/lib/libc/sys/t_bind.c stable/11/contrib/netbsd-tests/lib/libc/sys/t_getsockname.c - copied unchanged from r305358, head/contrib/netbsd-tests/lib/libc/sys/t_getsockname.c stable/11/contrib/netbsd-tests/lib/libc/sys/t_posix_fallocate.c - copied unchanged from r305358, head/contrib/netbsd-tests/lib/libc/sys/t_posix_fallocate.c stable/11/contrib/netbsd-tests/lib/libc/sys/t_wait.c - copied unchanged from r305358, head/contrib/netbsd-tests/lib/libc/sys/t_wait.c stable/11/contrib/netbsd-tests/lib/libm/t_fenv.c - copied unchanged from r305358, head/contrib/netbsd-tests/lib/libm/t_fenv.c stable/11/contrib/netbsd-tests/lib/libm/t_hypot.c - copied unchanged from r305358, head/contrib/netbsd-tests/lib/libm/t_hypot.c stable/11/contrib/netbsd-tests/lib/libusbhid/ - copied from r305358, head/contrib/netbsd-tests/lib/libusbhid/ stable/11/contrib/netbsd-tests/net/arp/ - copied from r305358, head/contrib/netbsd-tests/net/arp/ stable/11/contrib/netbsd-tests/net/icmp/t_icmp6_redirect.sh - copied unchanged from r305358, head/contrib/netbsd-tests/net/icmp/t_icmp6_redirect.sh stable/11/contrib/netbsd-tests/net/icmp/t_icmp_redirect.sh - copied unchanged from r305358, head/contrib/netbsd-tests/net/icmp/t_icmp_redirect.sh stable/11/contrib/netbsd-tests/net/if/ifconf.c - copied unchanged from r305358, head/contrib/netbsd-tests/net/if/ifconf.c stable/11/contrib/netbsd-tests/net/if/t_ifconf.sh - copied unchanged from r305358, head/contrib/netbsd-tests/net/if/t_ifconf.sh stable/11/contrib/netbsd-tests/net/if/t_ifconfig.sh - copied unchanged from r305358, head/contrib/netbsd-tests/net/if/t_ifconfig.sh stable/11/contrib/netbsd-tests/net/if_gif/ - copied from r305358, head/contrib/netbsd-tests/net/if_gif/ stable/11/contrib/netbsd-tests/net/if_pppoe/ - copied from r305358, head/contrib/netbsd-tests/net/if_pppoe/ stable/11/contrib/netbsd-tests/net/if_tap/ - copied from r305358, head/contrib/netbsd-tests/net/if_tap/ stable/11/contrib/netbsd-tests/net/in_cksum/ - copied from r305358, head/contrib/netbsd-tests/net/in_cksum/ stable/11/contrib/netbsd-tests/net/mcast/ - copied from r305358, head/contrib/netbsd-tests/net/mcast/ stable/11/contrib/netbsd-tests/net/mpls/t_mpls_fw6.sh - copied unchanged from r305358, head/contrib/netbsd-tests/net/mpls/t_mpls_fw6.sh stable/11/contrib/netbsd-tests/net/mpls/t_mpls_fw64.sh - copied unchanged from r305358, head/contrib/netbsd-tests/net/mpls/t_mpls_fw64.sh stable/11/contrib/netbsd-tests/net/ndp/ - copied from r305358, head/contrib/netbsd-tests/net/ndp/ stable/11/contrib/netbsd-tests/net/net/t_forwarding.sh - copied unchanged from r305358, head/contrib/netbsd-tests/net/net/t_forwarding.sh stable/11/contrib/netbsd-tests/net/net/t_ipaddress.sh - copied unchanged from r305358, head/contrib/netbsd-tests/net/net/t_ipaddress.sh stable/11/contrib/netbsd-tests/net/net/t_ipv6_lifetime.sh - copied unchanged from r305358, head/contrib/netbsd-tests/net/net/t_ipv6_lifetime.sh stable/11/contrib/netbsd-tests/net/net/t_ipv6address.sh - copied unchanged from r305358, head/contrib/netbsd-tests/net/net/t_ipv6address.sh stable/11/contrib/netbsd-tests/net/route/t_flags.sh - copied unchanged from r305358, head/contrib/netbsd-tests/net/route/t_flags.sh stable/11/contrib/netbsd-tests/net/route/t_flags6.sh - copied unchanged from r305358, head/contrib/netbsd-tests/net/route/t_flags6.sh stable/11/contrib/netbsd-tests/net/route/t_route.sh - copied unchanged from r305358, head/contrib/netbsd-tests/net/route/t_route.sh stable/11/contrib/netbsd-tests/sbin/gpt/ - copied from r305358, head/contrib/netbsd-tests/sbin/gpt/ stable/11/contrib/netbsd-tests/sbin/resize_ffs/t_check.sh - copied unchanged from r305358, head/contrib/netbsd-tests/sbin/resize_ffs/t_check.sh stable/11/contrib/netbsd-tests/sys/net/ - copied from r305358, head/contrib/netbsd-tests/sys/net/ stable/11/contrib/netbsd-tests/sys/netatalk/ - copied from r305358, head/contrib/netbsd-tests/sys/netatalk/ stable/11/contrib/netbsd-tests/sys/netinet/ - copied from r305358, head/contrib/netbsd-tests/sys/netinet/ stable/11/contrib/netbsd-tests/sys/netinet6/ - copied from r305358, head/contrib/netbsd-tests/sys/netinet6/ stable/11/contrib/netbsd-tests/usr.bin/config/d_min - copied unchanged from r305358, head/contrib/netbsd-tests/usr.bin/config/d_min stable/11/contrib/netbsd-tests/usr.bin/gdb/ - copied from r305358, head/contrib/netbsd-tests/usr.bin/gdb/ stable/11/contrib/netbsd-tests/usr.bin/ld/ - copied from r305358, head/contrib/netbsd-tests/usr.bin/ld/ stable/11/contrib/netbsd-tests/usr.bin/netpgpverify/Testspec - copied unchanged from r305358, head/contrib/netbsd-tests/usr.bin/netpgpverify/Testspec stable/11/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_struct.c - copied unchanged from r305358, head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_struct.c stable/11/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_compound_literal_comma.c - copied unchanged from r305358, head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_compound_literal_comma.c stable/11/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_flex_array_packed.c - copied unchanged from r305358, head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_flex_array_packed.c stable/11/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_nested_struct.c - copied unchanged from r305358, head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_nested_struct.c stable/11/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_init4.c - copied unchanged from r305358, head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_init4.c stable/11/contrib/netbsd-tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c - copied unchanged from r305358, head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c stable/11/contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c - copied unchanged from r305358, head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c stable/11/contrib/netbsd-tests/usr.bin/xlint/lint1/d_typefun.c - copied unchanged from r305358, head/contrib/netbsd-tests/usr.bin/xlint/lint1/d_typefun.c stable/11/lib/libc/tests/stdio/open_memstream2_test.c - copied unchanged from r305358, head/lib/libc/tests/stdio/open_memstream2_test.c Deleted: stable/11/contrib/netbsd-tests/bin/sh/t_compexit.sh stable/11/contrib/netbsd-tests/fs/nfs/nfsservice/mountd.c stable/11/contrib/netbsd-tests/fs/nfs/nfsservice/nfsd.c stable/11/lib/libc/tests/stdio/open_memstream_test.c Modified: stable/11/bin/cat/tests/Makefile stable/11/contrib/netbsd-tests/bin/cat/d_align.in stable/11/contrib/netbsd-tests/bin/cat/d_align.out stable/11/contrib/netbsd-tests/bin/cat/t_cat.sh stable/11/contrib/netbsd-tests/bin/sh/dotcmd/scoped_command stable/11/contrib/netbsd-tests/bin/sh/dotcmd/t_dotcmd.sh stable/11/contrib/netbsd-tests/bin/sh/t_evaltested.sh stable/11/contrib/netbsd-tests/bin/sh/t_exit.sh stable/11/contrib/netbsd-tests/bin/sh/t_expand.sh stable/11/contrib/netbsd-tests/bin/sh/t_fsplit.sh stable/11/contrib/netbsd-tests/bin/sh/t_here.sh stable/11/contrib/netbsd-tests/bin/sh/t_set_e.sh stable/11/contrib/netbsd-tests/bin/sh/t_ulimit.sh stable/11/contrib/netbsd-tests/bin/sh/t_varquote.sh stable/11/contrib/netbsd-tests/bin/sh/t_wait.sh stable/11/contrib/netbsd-tests/crypto/opencrypto/t_opencrypto.sh stable/11/contrib/netbsd-tests/dev/audio/t_pad_output.bz2.uue stable/11/contrib/netbsd-tests/dev/dm/h_dm.c stable/11/contrib/netbsd-tests/dev/sysmon/t_swsensor.sh stable/11/contrib/netbsd-tests/dev/sysmon/t_swwdog.c stable/11/contrib/netbsd-tests/fs/common/fstest_lfs.c stable/11/contrib/netbsd-tests/fs/common/h_fsmacros.h stable/11/contrib/netbsd-tests/fs/nfs/nfsservice/rumpnfsd.c stable/11/contrib/netbsd-tests/fs/nfs/t_rquotad.sh stable/11/contrib/netbsd-tests/fs/tmpfs/t_vnd.sh stable/11/contrib/netbsd-tests/fs/vfs/t_io.c stable/11/contrib/netbsd-tests/fs/vfs/t_renamerace.c stable/11/contrib/netbsd-tests/fs/vfs/t_unpriv.c stable/11/contrib/netbsd-tests/fs/vfs/t_vnops.c stable/11/contrib/netbsd-tests/games/t_factor.sh stable/11/contrib/netbsd-tests/h_macros.h stable/11/contrib/netbsd-tests/include/sys/t_bitops.c stable/11/contrib/netbsd-tests/include/sys/t_cdefs.c stable/11/contrib/netbsd-tests/include/sys/t_socket.c stable/11/contrib/netbsd-tests/include/t_paths.c stable/11/contrib/netbsd-tests/ipf/expected/n14 stable/11/contrib/netbsd-tests/ipf/expected/n14_6 stable/11/contrib/netbsd-tests/ipf/t_filter_parse.sh stable/11/contrib/netbsd-tests/ipf/t_nat_exec.sh stable/11/contrib/netbsd-tests/kernel/kqueue/t_ioctl.c stable/11/contrib/netbsd-tests/kernel/kqueue/t_proc1.c stable/11/contrib/netbsd-tests/kernel/kqueue/t_proc2.c stable/11/contrib/netbsd-tests/kernel/kqueue/t_proc3.c stable/11/contrib/netbsd-tests/kernel/t_rnd.c stable/11/contrib/netbsd-tests/lib/libbpfjit/t_bpfjit.c stable/11/contrib/netbsd-tests/lib/libc/arch/ia64/return_one.S stable/11/contrib/netbsd-tests/lib/libc/arch/powerpc/return_one.S stable/11/contrib/netbsd-tests/lib/libc/arch/riscv/return_one.S stable/11/contrib/netbsd-tests/lib/libc/db/t_db.sh stable/11/contrib/netbsd-tests/lib/libc/gen/execve/t_execve.c stable/11/contrib/netbsd-tests/lib/libc/gen/isqemu.h stable/11/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawn.c stable/11/contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c stable/11/contrib/netbsd-tests/lib/libc/gen/t_fpsetmask.c stable/11/contrib/netbsd-tests/lib/libc/gen/t_randomid.c stable/11/contrib/netbsd-tests/lib/libc/gen/t_siginfo.c stable/11/contrib/netbsd-tests/lib/libc/gen/t_sleep.c stable/11/contrib/netbsd-tests/lib/libc/gen/t_time.c stable/11/contrib/netbsd-tests/lib/libc/gen/t_vis.c stable/11/contrib/netbsd-tests/lib/libc/inet/t_inet_network.c stable/11/contrib/netbsd-tests/lib/libc/net/t_servent.sh stable/11/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c stable/11/contrib/netbsd-tests/lib/libc/stdlib/t_getenv.c stable/11/contrib/netbsd-tests/lib/libc/stdlib/t_posix_memalign.c stable/11/contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c stable/11/contrib/netbsd-tests/lib/libc/stdlib/t_strtol.c stable/11/contrib/netbsd-tests/lib/libc/string/t_memset.c stable/11/contrib/netbsd-tests/lib/libc/sys/t_connect.c stable/11/contrib/netbsd-tests/lib/libc/sys/t_getrusage.c stable/11/contrib/netbsd-tests/lib/libc/sys/t_kevent.c stable/11/contrib/netbsd-tests/lib/libc/sys/t_mlock.c stable/11/contrib/netbsd-tests/lib/libc/sys/t_mmap.c stable/11/contrib/netbsd-tests/lib/libc/sys/t_mprotect.c stable/11/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c stable/11/contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c stable/11/contrib/netbsd-tests/lib/libc/time/t_strptime.c stable/11/contrib/netbsd-tests/lib/libcurses/director/testlang_parse.y stable/11/contrib/netbsd-tests/lib/libm/t_exp.c stable/11/contrib/netbsd-tests/lib/libm/t_fmod.c stable/11/contrib/netbsd-tests/lib/libm/t_log.c stable/11/contrib/netbsd-tests/lib/libm/t_pow.c stable/11/contrib/netbsd-tests/lib/libpthread/t_cond.c stable/11/contrib/netbsd-tests/lib/libpthread/t_mutex.c stable/11/contrib/netbsd-tests/lib/libpthread/t_rwlock.c stable/11/contrib/netbsd-tests/lib/librumpclient/t_exec.sh stable/11/contrib/netbsd-tests/lib/librumpclient/t_fd.c stable/11/contrib/netbsd-tests/lib/librumphijack/t_tcpip.sh stable/11/contrib/netbsd-tests/lib/libutil/t_parsedate.c stable/11/contrib/netbsd-tests/net/bpfilter/t_bpfilter.c stable/11/contrib/netbsd-tests/net/bpfjit/t_bpfjit.c stable/11/contrib/netbsd-tests/net/icmp/t_forward.c stable/11/contrib/netbsd-tests/net/icmp/t_ping.c stable/11/contrib/netbsd-tests/net/icmp/t_ping2.sh stable/11/contrib/netbsd-tests/net/if_bridge/t_bridge.sh stable/11/contrib/netbsd-tests/net/mpls/t_ldp_regen.sh stable/11/contrib/netbsd-tests/net/mpls/t_mpls_fw.sh stable/11/contrib/netbsd-tests/net/mpls/t_rfc4182.sh stable/11/contrib/netbsd-tests/net/net/t_tcp.c stable/11/contrib/netbsd-tests/net/route/t_change.sh stable/11/contrib/netbsd-tests/rump/modautoload/t_modautoload.c stable/11/contrib/netbsd-tests/rump/rumpkern/h_server/h_simpleserver.c stable/11/contrib/netbsd-tests/rump/rumpkern/t_lwproc.c stable/11/contrib/netbsd-tests/rump/rumpkern/t_sp.sh stable/11/contrib/netbsd-tests/rump/rumpnet/t_shmif.sh stable/11/contrib/netbsd-tests/rump/rumpvfs/t_p2kifs.c stable/11/contrib/netbsd-tests/sbin/resize_ffs/common.sh stable/11/contrib/netbsd-tests/sbin/resize_ffs/t_grow.sh stable/11/contrib/netbsd-tests/sbin/resize_ffs/t_grow_swapped.sh stable/11/contrib/netbsd-tests/sbin/resize_ffs/t_shrink.sh stable/11/contrib/netbsd-tests/sbin/resize_ffs/t_shrink_swapped.sh stable/11/contrib/netbsd-tests/sbin/sysctl/t_perm.sh stable/11/contrib/netbsd-tests/share/mk/t_lib.sh stable/11/contrib/netbsd-tests/share/mk/t_prog.sh stable/11/contrib/netbsd-tests/share/mk/t_test.sh stable/11/contrib/netbsd-tests/usr.bin/cc/t_hello.sh stable/11/contrib/netbsd-tests/usr.bin/config/support/conf/files stable/11/contrib/netbsd-tests/usr.bin/config/t_config.sh stable/11/contrib/netbsd-tests/usr.bin/make/t_make.sh stable/11/contrib/netbsd-tests/usr.bin/netpgpverify/t_netpgpverify.sh stable/11/contrib/netbsd-tests/usr.bin/sed/t_sed.sh stable/11/contrib/netbsd-tests/usr.bin/sort/d_any_char_dflag_out.txt (contents, props changed) stable/11/contrib/netbsd-tests/usr.bin/sort/d_any_char_fflag_out.txt (contents, props changed) stable/11/contrib/netbsd-tests/usr.bin/sort/d_any_char_iflag_out.txt (contents, props changed) stable/11/contrib/netbsd-tests/usr.sbin/traceroute/t_traceroute.sh stable/11/lib/libc/tests/db/Makefile stable/11/lib/libc/tests/hash/Makefile stable/11/lib/libc/tests/inet/Makefile stable/11/lib/libc/tests/stdio/Makefile stable/11/lib/libc/tests/stdlib/Makefile stable/11/lib/libc/tests/sys/Makefile stable/11/lib/msun/tests/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/bin/cat/tests/Makefile ============================================================================== --- stable/11/bin/cat/tests/Makefile Sat Dec 3 02:45:18 2016 (r309465) +++ stable/11/bin/cat/tests/Makefile Sat Dec 3 02:47:16 2016 (r309466) @@ -6,7 +6,15 @@ NETBSD_ATF_TESTS_SH= cat_test ${PACKAGE}FILES+= d_align.in ${PACKAGE}FILES+= d_align.out +${PACKAGE}FILES+= d_se_output.in +${PACKAGE}FILES+= d_se_output.out .include +d_align.out: ${TESTSRC}/d_align.out + sed -E -e 's,^[[:space:]]{7}\$$$$,\$$,' < ${.ALLSRC} > ${.TARGET}.tmp + mv ${.TARGET}.tmp ${.TARGET} + +CLEANFILES+= d_align.out d_align.out.tmp + .include Modified: stable/11/contrib/netbsd-tests/bin/cat/d_align.in ============================================================================== --- stable/11/contrib/netbsd-tests/bin/cat/d_align.in Sat Dec 3 02:45:18 2016 (r309465) +++ stable/11/contrib/netbsd-tests/bin/cat/d_align.in Sat Dec 3 02:47:16 2016 (r309466) @@ -1,3 +1,5 @@ a b c + 1 2 3 + x y z Modified: stable/11/contrib/netbsd-tests/bin/cat/d_align.out ============================================================================== --- stable/11/contrib/netbsd-tests/bin/cat/d_align.out Sat Dec 3 02:45:18 2016 (r309465) +++ stable/11/contrib/netbsd-tests/bin/cat/d_align.out Sat Dec 3 02:47:16 2016 (r309466) @@ -1,3 +1,5 @@ 1 a b c$ + $ 2 1 2 3$ + $ 3 x y z$ Copied: stable/11/contrib/netbsd-tests/bin/cat/d_se_output.in (from r305358, head/contrib/netbsd-tests/bin/cat/d_se_output.in) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/bin/cat/d_se_output.in Sat Dec 3 02:47:16 2016 (r309466, copy of r305358, head/contrib/netbsd-tests/bin/cat/d_se_output.in) @@ -0,0 +1,3 @@ + +Of course it runs NetBSD + Copied: stable/11/contrib/netbsd-tests/bin/cat/d_se_output.out (from r305358, head/contrib/netbsd-tests/bin/cat/d_se_output.out) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/contrib/netbsd-tests/bin/cat/d_se_output.out Sat Dec 3 02:47:16 2016 (r309466, copy of r305358, head/contrib/netbsd-tests/bin/cat/d_se_output.out) @@ -0,0 +1,3 @@ +$ +Of course it runs NetBSD$ +$ Modified: stable/11/contrib/netbsd-tests/bin/cat/t_cat.sh ============================================================================== --- stable/11/contrib/netbsd-tests/bin/cat/t_cat.sh Sat Dec 3 02:45:18 2016 (r309465) +++ stable/11/contrib/netbsd-tests/bin/cat/t_cat.sh Sat Dec 3 02:47:16 2016 (r309466) @@ -1,4 +1,4 @@ -# $NetBSD: t_cat.sh,v 1.2 2012/03/27 17:57:02 jruoho Exp $ +# $NetBSD: t_cat.sh,v 1.3 2016/06/16 01:04:58 sevan Exp $ # # Copyright (c) 2012 The NetBSD Foundation, Inc. # All rights reserved. @@ -52,8 +52,20 @@ nonexistent_body() { -x "cat /some/name/that/does/not/exist" } +atf_test_case se_output +se_output_head() { + atf_set "descr" "Test that cat(1) prints a $ sign " \ + "on blank lines with options '-se' (PR bin/51250)" +} + +se_output_body() { + atf_check -s ignore -o file:$(atf_get_srcdir)/d_se_output.out \ + -x "cat -se $(atf_get_srcdir)/d_se_output.in" +} + atf_init_test_cases() { atf_add_test_case align atf_add_test_case nonexistent + atf_add_test_case se_output } Modified: stable/11/contrib/netbsd-tests/bin/sh/dotcmd/scoped_command ============================================================================== --- stable/11/contrib/netbsd-tests/bin/sh/dotcmd/scoped_command Sat Dec 3 02:45:18 2016 (r309465) +++ stable/11/contrib/netbsd-tests/bin/sh/dotcmd/scoped_command Sat Dec 3 02:47:16 2016 (r309466) @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: scoped_command,v 1.1 2014/05/31 14:29:06 christos Exp $ +# $NetBSD: scoped_command,v 1.2 2016/03/27 14:57:50 christos Exp $ # # Copyright (c) 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -30,6 +30,27 @@ # POSSIBILITY OF SUCH DAMAGE. # +: ${TEST_SH:=/bin/sh} + +sane_sh() +{ + set -- ${TEST_SH} + case "$#" in + (0) set /bin/sh;; + (1|2) ;; + (*) set "$1";; # Just ignore options if we cannot make them work + esac + + case "$1" in + /*) TEST_SH="$1${2+ }$2";; + ./*) TEST_SH="${PWD}${1#.}${2+ }$2";; + */*) TEST_SH="${PWD}/$1${2+ }$2";; + *) TEST_SH="$( command -v "$1" )${2+ }$2";; + esac +} + +sane_sh + set -e # USAGE: @@ -52,7 +73,7 @@ cmd="echo 'before ${3}' ${2} echo 'after ${3}, return value:' ${?}" -echo "#!/bin/sh" +echo "#!${TEST_SH}" [ 'func' = "${1}" ] && cat </dev/null + then + # 16 bits or less, or hex unsupported, just give up... + return + fi + test $( ${TEST_SH} -c 'echo $(( 0x1FFFF ))' ) = 131071 || return + + # when attempting to exceed the number of available bits + # the shell may react in any of 3 (rational) ways + # 1. syntax error (maybe even core dump...) and fail + # 2. represent a positive number input as negative value + # 3. keep the number positive, but not the value expected + # (perhaps pegged at the max possible value) + # any of those may be accompanied by a message to stderr + + # Must check all 3 possibilities for each plausible size + # Tests do not use 0x8000... because that value can have weird + # other side effects that are not relevant to discover here. + # But we do want to try and force the sign bit set. + + if ! ${TEST_SH} -c ': $(( 0xC0000000 ))' 2>/dev/null + then + # proobably shell detected overflow and complained + ARITH_BITS=32 + return + fi + if ${TEST_SH} 2>/dev/null \ + -c 'case $(( 0xC0000000 )); in (-*) exit 0;; esac; exit 1' + then + ARITH_BITS=32 + return + fi + if ${TEST_SH} -c '[ $(( 0xC0000000 )) != 3221225472 ]' 2>/dev/null + then + ARITH_BITS=32 + return + fi + + if ! ${TEST_SH} -c ': $(( 0xC000000000000000 ))' 2>/dev/null + then + ARITH_BITS=64 + return + fi + if ${TEST_SH} 2>/dev/null \ + -c 'case $(( 0xC000000000000000 )); in (-*) exit 0;; esac; exit 1' + then + ARITH_BITS=64 + return + fi + if ${TEST_SH} 2>/dev/null \ + -c '[ $((0xC000000000000000)) != 13835058055282163712 ]' + then + ARITH_BITS=64 + return + fi + + if ${TEST_SH} 2>/dev/null -c \ + '[ $((0x123456781234567812345678)) = 5634002657842756053938493048 ]' + then + # just assume... (for now anyway, revisit when it happens...) + ARITH_BITS=96 + return + fi +} + +atf_test_case constants +constants_head() +{ + atf_set "descr" "Tests that arithmetic expansion can handle constants" +} +constants_body() +{ + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $((0x0))' + + # atf_expect_fail "PR bin/50959" + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $((0X0))' + # atf_expect_pass + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $((000))' + + atf_check -s exit:0 -o inline:'1\n' -e empty \ + ${TEST_SH} -c 'echo $(( 000000001 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty \ + ${TEST_SH} -c 'echo $(( 0x000000 ))' + + atf_check -s exit:0 -o inline:'99999\n' -e empty \ + ${TEST_SH} -c 'echo $((99999))' + + [ ${ARITH_BITS} -gt 44 ] && + atf_check -s exit:0 -o inline:'9191919191919\n' -e empty \ + ${TEST_SH} -c 'echo $((9191919191919))' + + atf_check -s exit:0 -o inline:'13\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xD ))' + atf_check -s exit:0 -o inline:'11\n' -e empty ${TEST_SH} -c \ + 'echo $(( 013 ))' + atf_check -s exit:0 -o inline:'7\n' -e empty ${TEST_SH} -c \ + 'x=7;echo $(($x))' + atf_check -s exit:0 -o inline:'9\n' -e empty ${TEST_SH} -c \ + 'x=9;echo $((x))' + + atf_check -s exit:0 -o inline:'11\n' -e empty \ + ${TEST_SH} -c 'x=0xB; echo $(( $x ))' + atf_check -s exit:0 -o inline:'27\n' -e empty \ + ${TEST_SH} -c 'x=0X1B; echo $(( x ))' + atf_check -s exit:0 -o inline:'27\n' -e empty \ + ${TEST_SH} -c 'X=033; echo $(( $X ))' + atf_check -s exit:0 -o inline:'219\n' -e empty \ + ${TEST_SH} -c 'X=0333; echo $(( X ))' + atf_check -s exit:0 -o inline:'0\n' -e empty \ + ${TEST_SH} -c 'NULL=; echo $(( NULL ))' + + # Not clear if this is 0, nothing, or an error, so omit for now + # atf_check -s exit:0 -o inline:'0\n' -e empty \ + # ${TEST_SH} -c 'echo $(( ))' + + # not clear whether this should return 0 or an error, so omit for now + # atf_check -s exit:0 -o inline:'0\n' -e empty \ + # ${TEST_SH} -c 'echo $(( UNDEFINED_VAR ))' +} + + +atf_test_case do_unary_plus +do_unary_plus_head() +{ + atf_set "descr" "Tests that unary plus works as expected" +} +do_unary_plus_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( +0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( +1 ))' + atf_check -s exit:0 -o inline:'6\n' -e empty ${TEST_SH} -c \ + 'echo $(( + 6 ))' + atf_check -s exit:0 -o inline:'4321\n' -e empty ${TEST_SH} -c \ + 'echo $(( + 4321 ))' + atf_check -s exit:0 -o inline:'17185\n' -e empty ${TEST_SH} -c \ + 'echo $(( + 0x4321 ))' +} + +atf_test_case do_unary_minus +do_unary_minus_head() +{ + atf_set "descr" "Tests that unary minus works as expected" +} +do_unary_minus_body() +{ + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ + 'echo $(( -1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( - 0 ))' + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ + 'echo $(( - 1 ))' + atf_check -s exit:0 -o inline:'-6\n' -e empty ${TEST_SH} -c \ + 'echo $(( - 6 ))' + atf_check -s exit:0 -o inline:'-4321\n' -e empty ${TEST_SH} -c \ + 'echo $(( - 4321 ))' + atf_check -s exit:0 -o inline:'-2257\n' -e empty ${TEST_SH} -c \ + 'echo $(( - 04321 ))' + atf_check -s exit:0 -o inline:'-7\n' -e empty ${TEST_SH} -c \ + 'echo $((-7))' +} + +atf_test_case do_unary_not +do_unary_not_head() +{ + atf_set "descr" "Tests that unary not (boolean) works as expected" +} +do_unary_not_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( ! 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( ! 0 ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( !1234 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( !0xFFFF ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( ! 000000 ))' +} + +atf_test_case do_unary_tilde +do_unary_tilde_head() +{ + atf_set "descr" "Tests that unary not (bitwise) works as expected" +} +do_unary_tilde_body() +{ + # definitely 2's complement arithmetic here... + + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ + 'echo $(( ~ 0 ))' + atf_check -s exit:0 -o inline:'-2\n' -e empty ${TEST_SH} -c \ + 'echo $(( ~ 1 ))' + + atf_check -s exit:0 -o inline:'-1235\n' -e empty ${TEST_SH} -c \ + 'echo $(( ~1234 ))' + atf_check -s exit:0 -o inline:'-256\n' -e empty ${TEST_SH} -c \ + 'echo $(( ~0xFF ))' +} + +atf_test_case elementary_add +elementary_add_head() +{ + atf_set "descr" "Tests that simple addition works as expected" +} +elementary_add_body() +{ + # some of these tests actually test unary ops & op precedence... + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 + 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 + 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 + 1 ))' + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 + 1 ))' + atf_check -s exit:0 -o inline:'10\n' -e empty ${TEST_SH} -c \ + 'echo $(( 4 + 6 ))' + atf_check -s exit:0 -o inline:'10\n' -e empty ${TEST_SH} -c \ + 'echo $(( 6 + 4 ))' + atf_check -s exit:0 -o inline:'5555\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1234 + 4321 ))' + atf_check -s exit:0 -o inline:'3333\n' -e empty ${TEST_SH} -c \ + 'echo $((1111+2222))' + atf_check -s exit:0 -o inline:'5555\n' -e empty ${TEST_SH} -c \ + 'echo $((+3333+2222))' + atf_check -s exit:0 -o inline:'7777\n' -e empty ${TEST_SH} -c \ + 'echo $((+3333 + +4444))' + atf_check -s exit:0 -o inline:'-7777\n' -e empty ${TEST_SH} -c \ + 'echo -$((+4125+ +3652))' +} + +atf_test_case elementary_sub +elementary_sub_head() +{ + atf_set "descr" "Tests that simple subtraction works as expected" +} +elementary_sub_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 - 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 - 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 - 1 ))' + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 - 1 ))' + atf_check -s exit:0 -o inline:'488\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1066 - 578 ))' + atf_check -s exit:0 -o inline:'-3662\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2016-5678 ))' + atf_check -s exit:0 -o inline:'-3662\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2016+-5678 ))' + atf_check -s exit:0 -o inline:'-3662\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2016-+5678 ))' + atf_check -s exit:0 -o inline:'-7694\n' -e empty ${TEST_SH} -c \ + 'echo $(( -2016-5678 ))' + atf_check -s exit:0 -o inline:'--1\n' -e empty ${TEST_SH} -c \ + 'echo -$(( -1018 - -1017 ))' +} + +atf_test_case elementary_mul +elementary_mul_head() +{ + atf_set "descr" "Tests that simple multiplication works as expected" +} +elementary_mul_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 * 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 * 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 * 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 * 1 ))' + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ + 'echo $(( -1 * 1 ))' + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 * -1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( -1 * -1 ))' + atf_check -s exit:0 -o inline:'391\n' -e empty ${TEST_SH} -c \ + 'echo $(( 17 * 23 ))' + atf_check -s exit:0 -o inline:'169\n' -e empty ${TEST_SH} -c \ + 'echo $(( 13*13 ))' + atf_check -s exit:0 -o inline:'-11264\n' -e empty ${TEST_SH} -c \ + 'echo $(( -11 *1024 ))' + atf_check -s exit:0 -o inline:'-16983\n' -e empty ${TEST_SH} -c \ + 'echo $(( 17* -999 ))' + atf_check -s exit:0 -o inline:'9309\n' -e empty ${TEST_SH} -c \ + 'echo $(( -29*-321 ))' +} + +atf_test_case elementary_div +elementary_div_head() +{ + atf_set "descr" "Tests that simple division works as expected" +} +elementary_div_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 / 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 / 1 ))' + test ${ARITH_BITS} -ge 38 && + atf_check -s exit:0 -o inline:'99999999999\n' -e empty \ + ${TEST_SH} -c 'echo $(( 99999999999 / 1 ))' + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2 / 1 ))' + + atf_check -s exit:0 -o inline:'3\n' -e empty ${TEST_SH} -c \ + 'echo $(( 3 / 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 3 / 2 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 3 / 3 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 3 / 4 ))' + + atf_check -s exit:0 -o inline:'173\n' -e empty ${TEST_SH} -c \ + 'echo $(( 123456 / 713 ))' + atf_check -s exit:0 -o inline:'13\n' -e empty ${TEST_SH} -c \ + 'echo $(( 169 / 13 ))' +} + +atf_test_case elementary_rem +elementary_rem_head() +{ + atf_set "descr" "Tests that simple modulus works as expected" +} +elementary_rem_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 % 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 % 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2 % 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 9999 % 1 ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 % 2 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 % 2 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2 % 2 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xFFFF % 2 ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 % 3 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 % 3 ))' + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2 % 3 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 3 % 3 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 3123 % 3 ))' + + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 9999 % 2 ))' + + atf_check -s exit:0 -o inline:'107\n' -e empty ${TEST_SH} -c \ + 'echo $(( 123456%173 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $((169%13))' +} + +atf_test_case elementary_shl +elementary_shl_head() +{ + atf_set "descr" "Tests that simple shift left works as expected" +} +elementary_shl_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 << 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 << 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 << 17 ))' + + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 << 0 ))' + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 << 1 ))' + atf_check -s exit:0 -o inline:'131072\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 << 17 ))' + + atf_check -s exit:0 -o inline:'2021161080\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x3C3C3C3C << 1 ))' + + test "${ARITH_BITS}" -ge 40 && + atf_check -s exit:0 -o inline:'129354309120\n' -e empty \ + ${TEST_SH} -c 'echo $(( 0x3C3C3C3C << 7 ))' + test "${ARITH_BITS}" -ge 72 && + atf_check -s exit:0 -o inline:'1111145054534149079040\n' \ + -e empty ${TEST_SH} -c 'echo $(( 0x3C3C3C3C << 40 ))' + + return 0 +} + +atf_test_case elementary_shr +elementary_shr_head() +{ + atf_set "descr" "Tests that simple shift right works as expected" +} +elementary_shr_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 >> 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 >> 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 >> 17 ))' + + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 >> 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 >> 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2 >> 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 3 >> 1 ))' + + atf_check -s exit:0 -o inline:'4\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x10 >> 2 ))' + atf_check -s exit:0 -o inline:'4\n' -e empty ${TEST_SH} -c \ + 'echo $(( 022 >> 2 ))' + + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 131072 >> 17 ))' + + test ${ARITH_BITS} -ge 40 && + atf_check -s exit:0 -o inline:'8\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x4000000000 >> 35 ))' + test ${ARITH_BITS} -ge 80 && + atf_check -s exit:0 -o inline:'4464\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x93400FACE005C871000 >> 64 ))' + + return 0 +} + +atf_test_case elementary_eq +elementary_eq_head() +{ + atf_set "descr" "Tests that simple equality test works as expected" +} +elementary_eq_body() +{ + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 == 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 == 0000 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 == 0x00 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 == 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'X=30; Y=0x1E; echo $(( X == Y ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x1234 == 4660 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x1234 == 011064 ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 == 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 == 0000000000000001 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 == 0x10000000000000 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 == 2 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'X=3; Y=7; echo $(( X == Y ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1234 == 0x4660 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 01234 == 0x11064 ))' +} +atf_test_case elementary_ne +elementary_ne_head() +{ + atf_set "descr" "Tests that simple inequality test works as expected" +} +elementary_ne_body() +{ + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 != 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x71 != 17 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1234 != 01234 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x1234 != 01234 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'X=3; echo $(( X != 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'X=3; Y=0x11; echo $(( X != Y ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 3 != 3 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 != 0x0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xA != 012 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'X=1; echo $(( X != 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'X=0xC; Y=014; echo $(( X != Y ))' +} +atf_test_case elementary_lt +elementary_lt_head() +{ + atf_set "descr" "Tests that simple less than test works as expected" +} +elementary_lt_body() +{ + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 < 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( -1 < 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 < 10 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 100 < 101 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xA1 < 200 ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 < 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 < 0 ))' + + test ${ARITH_BITS} -ge 40 && + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x1BEEFF00D < 0x1FACECAFE ))' + + return 0 +} +atf_test_case elementary_le +elementary_le_head() +{ + atf_set "descr" "Tests that simple less or equal test works as expected" +} +elementary_le_body() +{ + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 <= 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( -1 <= 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 <= 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 <= 10 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 100 <= 101 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xA1 <= 161 ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 <= 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( -100 <= -200 ))' + + test ${ARITH_BITS} -ge 40 && + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'cost=; AUD=; echo $(( $cost 0x2FEEDBABE <= $AUD 12866927294 ))' + + return 0 +} +atf_test_case elementary_gt +elementary_gt_head() +{ + atf_set "descr" "Tests that simple greater than works as expected" +} +elementary_gt_body() +{ + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 > 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 > -1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 11 > 012 ))' + + # atf_expect_fail "PR bin/50959" + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2147483647 > 0X7FFFFF0 ))' + # atf_expect_pass + + test ${ARITH_BITS} -gt 32 && + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x80000000 > 0x7FFFFFFF ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 > 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 > 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( -1 > 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 > 10 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2015 > 2016 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xA1 > 200 ))' + + test ${ARITH_BITS} -ge 44 && + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x7F07F07F0 > 34099628014 ))' + + return 0 +} +atf_test_case elementary_ge +elementary_ge_head() +{ + atf_set "descr" "Tests that simple greater or equal works as expected" +} +elementary_ge_body() +{ + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 >= 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 >= 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( -100 >= -101 ))' + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( -1 >= 0 ))' +} + +atf_test_case fiddle_bits_and +fiddle_bits_and_head() +{ + atf_set "descr" "Test bitwise and operations in arithmetic expressions" +} +fiddle_bits_and_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 & 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 & 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 & 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 & 1 ))' + + atf_check -s exit:0 -o inline:'255\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xFF & 0xFF ))' + atf_check -s exit:0 -o inline:'255\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xFFFF & 0377 ))' + + test "${ARITH_BITS}" -ge 48 && + atf_check -s exit:0 -o inline:'70377641607203\n' -e empty \ + ${TEST_SH} -c 'echo $(( 0x5432FEDC0123 & 0x42871357BAB3 ))' + + return 0 +} +atf_test_case fiddle_bits_or +fiddle_bits_or_head() +{ + atf_set "descr" "Test bitwise or operations in arithmetic expressions" +} +fiddle_bits_or_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 | 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 | 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 | 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 | 1 ))' + + atf_check -s exit:0 -o inline:'4369\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x1111 | 0x1111 ))' + atf_check -s exit:0 -o inline:'255\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xAA | 0125 ))' + + test "${ARITH_BITS}" -ge 48 && + atf_check -s exit:0 -o inline:'95348271856563\n' -e empty \ + ${TEST_SH} -c 'echo $(( 0x5432FEDC0123 | 0x42871357BAB3 ))' + + return 0 +} +atf_test_case fiddle_bits_xor +fiddle_bits_xor_head() +{ + atf_set "descr" "Test bitwise xor operations in arithmetic expressions" +} +fiddle_bits_xor_body() +{ + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 ^ 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 ^ 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 ^ 1 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 ^ 1 ))' + + atf_check -s exit:0 -o inline:'255\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xF0 ^ 0x0F ))' + atf_check -s exit:0 -o inline:'15\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xF0 ^ 0xFF ))' + + test "${ARITH_BITS}" -ge 48 && + atf_check -s exit:0 -o inline:'24970630249360\n' -e empty \ + ${TEST_SH} -c 'echo $(( 0x5432FEDC0123 ^ 0x42871357BAB3 ))' + + return 0 +} + +atf_test_case logical_and +logical_and_head() +{ + atf_set "descr" "Test logical and operations in arithmetic expressions" +} +logical_and_body() +{ + # cannot test short-circuit eval until sh implements side effects... + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 && 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 && 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 && 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 && 1 ))' + + # atf_expect_fail "PR bin/50960" + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x1111 && 01234 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0xFFFF && 0xF0F0 ))' +} +atf_test_case logical_or +logical_or_head() +{ + atf_set "descr" "Test logical or operations in arithmetic expressions" +} +logical_or_body() +{ + # cannot test short-circuit eval until sh implements side effects... + + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 || 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 || 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 || 1 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 || 1 ))' + + # atf_expect_fail "PR bin/50960" + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x1111 || 01234 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x33 || 0xF0F0 ))' +} + +atf_test_case make_selection +make_selection_head() +{ + atf_set "descr" "Test ?: operator in arithmetic expressions" +} +make_selection_body() +{ + # atf_expect_fail "PR bin/50958" + + atf_check -s exit:0 -o inline:'3\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0 ? 2 : 3 ))' + atf_check -s exit:0 -o inline:'2\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 ? 2 : 3 ))' + + atf_check -s exit:0 -o inline:'111\n' -e empty ${TEST_SH} -c \ + 'echo $(( 0x1234 ? 111 : 222 ))' + + atf_check -s exit:0 -o inline:'-1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 < 2 ? -1 : 1 > 2 ? 1 : 0 ))' + atf_check -s exit:0 -o inline:'0\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 < 1 ? -1 : 1 > 1 ? 1 : 0 ))' + atf_check -s exit:0 -o inline:'1\n' -e empty ${TEST_SH} -c \ + 'echo $(( 2 < 1 ? -1 : 2 > 1 ? 1 : 0 ))' +} + +atf_test_case operator_precedence +operator_precedence_head() +{ + atf_set "descr" "Test operator precedence without parentheses" +} +operator_precedence_body() +{ + # NB: apart from $(( )) ** NO ** parentheses in the expressions. + + atf_check -s exit:0 -o inline:'6\n' -e empty ${TEST_SH} -c \ + 'echo $(( 1 + 2 + 3 ))' *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Sat Dec 3 02:48:57 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FEB6C635AC; Sat, 3 Dec 2016 02:48:57 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1257AB80; Sat, 3 Dec 2016 02:48:57 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB32mu6R059567; Sat, 3 Dec 2016 02:48:56 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB32muUC059565; Sat, 3 Dec 2016 02:48:56 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612030248.uB32muUC059565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 3 Dec 2016 02:48:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309468 - stable/11/lib/libc/tests/stdio X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 02:48:57 -0000 Author: ngie Date: Sat Dec 3 02:48:55 2016 New Revision: 309468 URL: https://svnweb.freebsd.org/changeset/base/309468 Log: MFC r305921: Similar to r305920, remove spurious newlines from ATF_REQUIRE_MSG calls Modified: stable/11/lib/libc/tests/stdio/open_memstream2_test.c stable/11/lib/libc/tests/stdio/open_wmemstream_test.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/tests/stdio/open_memstream2_test.c ============================================================================== --- stable/11/lib/libc/tests/stdio/open_memstream2_test.c Sat Dec 3 02:47:41 2016 (r309467) +++ stable/11/lib/libc/tests/stdio/open_memstream2_test.c Sat Dec 3 02:48:55 2016 (r309468) @@ -159,11 +159,11 @@ ATF_TC_BODY(seek_tests, tc) #define SEEK_FAIL(offset, whence, error) do { \ errno = 0; \ ATF_REQUIRE_MSG(fseeko(fp, (offset), (whence)) != 0, \ - "fseeko(%s, %s) did not fail, set pos to %jd\n", \ + "fseeko(%s, %s) did not fail, set pos to %jd", \ __STRING(offset), __STRING(whence), \ (intmax_t)ftello(fp)); \ ATF_REQUIRE_MSG(errno == (error), \ - "fseeko(%s, %s) failed with %d rather than %s\n", \ + "fseeko(%s, %s) failed with %d rather than %s", \ __STRING(offset), __STRING(whence), errno, \ __STRING(error)); \ } while (0) @@ -173,7 +173,7 @@ ATF_TC_BODY(seek_tests, tc) "fseeko(%s, %s) failed: %s", \ __STRING(offset), __STRING(whence), strerror(errno)); \ ATF_REQUIRE_MSG(ftello(fp) == (result), \ - "fseeko(%s, %s) seeked to %jd rather than %s\n", \ + "fseeko(%s, %s) seeked to %jd rather than %s", \ __STRING(offset), __STRING(whence), \ (intmax_t)ftello(fp), __STRING(result)); \ } while (0) Modified: stable/11/lib/libc/tests/stdio/open_wmemstream_test.c ============================================================================== --- stable/11/lib/libc/tests/stdio/open_wmemstream_test.c Sat Dec 3 02:47:41 2016 (r309467) +++ stable/11/lib/libc/tests/stdio/open_wmemstream_test.c Sat Dec 3 02:48:55 2016 (r309468) @@ -159,11 +159,11 @@ ATF_TC_BODY(seek_tests, tc) #define SEEK_FAIL(offset, whence, error) do { \ errno = 0; \ ATF_REQUIRE_MSG(fseeko(fp, (offset), (whence)) != 0, \ - "fseeko(%s, %s) did not fail, set pos to %jd\n", \ + "fseeko(%s, %s) did not fail, set pos to %jd", \ __STRING(offset), __STRING(whence), \ (intmax_t)ftello(fp)); \ ATF_REQUIRE_MSG(errno == (error), \ - "fseeko(%s, %s) failed with %d rather than %s\n", \ + "fseeko(%s, %s) failed with %d rather than %s", \ __STRING(offset), __STRING(whence), errno, \ __STRING(error)); \ } while (0) @@ -173,7 +173,7 @@ ATF_TC_BODY(seek_tests, tc) "fseeko(%s, %s) failed: %s", \ __STRING(offset), __STRING(whence), strerror(errno)); \ ATF_REQUIRE_MSG(ftello(fp) == (result), \ - "fseeko(%s, %s) seeked to %jd rather than %s\n", \ + "fseeko(%s, %s) seeked to %jd rather than %s", \ __STRING(offset), __STRING(whence), \ (intmax_t)ftello(fp), __STRING(result)); \ } while (0) From owner-svn-src-stable-11@freebsd.org Sat Dec 3 02:55:21 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA985C63986; Sat, 3 Dec 2016 02:55:21 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82A701032; Sat, 3 Dec 2016 02:55:21 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB32tKjf063527; Sat, 3 Dec 2016 02:55:20 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB32tJN5063515; Sat, 3 Dec 2016 02:55:19 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612030255.uB32tJN5063515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 3 Dec 2016 02:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309469 - in stable/11: . contrib/netbsd-tests/kernel/kqueue contrib/netbsd-tests/kernel/kqueue/read etc/mtree tests/sys/kqueue tests/sys/kqueue/libkqueue X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 02:55:21 -0000 Author: ngie Date: Sat Dec 3 02:55:19 2016 New Revision: 309469 URL: https://svnweb.freebsd.org/changeset/base/309469 Log: MFC r304797,r305467,r305468,r305483: r304797 (by jmmv): Make use of Kyua's work directories. Change the vnode tests to use the current directory when creating temporary files, which we can assume is a volatile work directory, and then make the kqueue_test.sh driver _not_ abandon the directory created by Kyua. This makes the various kqueue tests independent of each other, and ensures the temporary file is cleaned up on failure. Problem spotted by asomers@ when reviewing D4254. r305467: Move tests/sys/kqueue/... to tests/sys/kqueue/libkqueue/... This is being done to clearly distinguish the libkqueue tests from the (soon to be imported) NetBSD tests. r305468: Port contrib/netbsd-tests/kernel/kqueue/... as tests/sys/kqueue/... proc2_test must be skipped because the invariant tested (`ke.fflags & NOTE_TRACKERR`) doesn't pass. r305483: Fix tests/sys/kqueue NetBSD tests on 32-bit platforms by using proper format specifier for pointers when printing them out with printf(3) Pointyhat to: ngie Added: stable/11/tests/sys/kqueue/libkqueue/ - copied from r305467, head/tests/sys/kqueue/libkqueue/ Replaced: stable/11/tests/sys/kqueue/Makefile - copied, changed from r305467, head/tests/sys/kqueue/Makefile Deleted: stable/11/tests/sys/kqueue/Makefile.depend stable/11/tests/sys/kqueue/common.h stable/11/tests/sys/kqueue/config.h stable/11/tests/sys/kqueue/kqueue_test.sh stable/11/tests/sys/kqueue/main.c stable/11/tests/sys/kqueue/proc.c stable/11/tests/sys/kqueue/read.c stable/11/tests/sys/kqueue/signal.c stable/11/tests/sys/kqueue/timer.c stable/11/tests/sys/kqueue/user.c stable/11/tests/sys/kqueue/vnode.c Modified: stable/11/ObsoleteFiles.inc stable/11/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c stable/11/contrib/netbsd-tests/kernel/kqueue/read/t_file.c stable/11/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c stable/11/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c stable/11/contrib/netbsd-tests/kernel/kqueue/t_proc1.c stable/11/contrib/netbsd-tests/kernel/kqueue/t_proc2.c stable/11/contrib/netbsd-tests/kernel/kqueue/t_proc3.c stable/11/contrib/netbsd-tests/kernel/kqueue/t_sig.c stable/11/contrib/netbsd-tests/kernel/kqueue/t_vnode.c stable/11/etc/mtree/BSD.tests.dist Directory Properties: stable/11/ (props changed) Modified: stable/11/ObsoleteFiles.inc ============================================================================== --- stable/11/ObsoleteFiles.inc Sat Dec 3 02:48:55 2016 (r309468) +++ stable/11/ObsoleteFiles.inc Sat Dec 3 02:55:19 2016 (r309469) @@ -51,6 +51,9 @@ OLD_FILES+=usr/share/man/man4/hv_vss.4.g OLD_FILES+=usr/share/man/man4/hv_ata_pci_disengage.4.gz # 20161015: remove link to removed m_getclr(9) macro OLD_FILES+=usr/share/man/man9/m_getclr.9.gz +# 20160906: libkqueue tests moved to /usr/tests/sys/kqueue/libkqueue +OLD_FILES+=usr/tests/sys/kqueue/kqtest +OLD_FILES+=usr/tests/sys/kqueue/kqueue_test # 20160703: POSIXify locales with variants OLD_FILES+=usr/share/locale/zh_Hant_TW.UTF-8/LC_COLLATE OLD_FILES+=usr/share/locale/zh_Hant_TW.UTF-8/LC_CTYPE Modified: stable/11/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c ============================================================================== --- stable/11/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c Sat Dec 3 02:48:55 2016 (r309468) +++ stable/11/contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c Sat Dec 3 02:55:19 2016 (r309469) @@ -78,7 +78,11 @@ ATF_TC_BODY(fifo, tc) RL(n = kevent(kq, NULL, 0, event, 1, NULL)); (void)printf("kevent num %d filt %d flags: %#x, fflags: %#x, " +#ifdef __FreeBSD__ + "data: %" PRIdPTR "\n", n, event[0].filter, event[0].flags, +#else "data: %" PRId64 "\n", n, event[0].filter, event[0].flags, +#endif event[0].fflags, event[0].data); ATF_REQUIRE_EQ(event[0].filter, EVFILT_READ); Modified: stable/11/contrib/netbsd-tests/kernel/kqueue/read/t_file.c ============================================================================== --- stable/11/contrib/netbsd-tests/kernel/kqueue/read/t_file.c Sat Dec 3 02:48:55 2016 (r309468) +++ stable/11/contrib/netbsd-tests/kernel/kqueue/read/t_file.c Sat Dec 3 02:55:19 2016 (r309469) @@ -111,7 +111,11 @@ ATF_TC_BODY(file, tc) num += n; (void)printf("kevent num %d flags: %#x, fflags: %#x, data: " +#ifdef __FreeBSD__ + "%" PRIdPTR "\n", n, event[0].flags, event[0].fflags, +#else "%" PRId64 "\n", n, event[0].flags, event[0].fflags, +#endif event[0].data); if (event[0].data < 0) Modified: stable/11/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c ============================================================================== --- stable/11/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c Sat Dec 3 02:48:55 2016 (r309468) +++ stable/11/contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c Sat Dec 3 02:55:19 2016 (r309469) @@ -67,7 +67,11 @@ ATF_TC_BODY(pipe, tc) RL(n = kevent(kq, NULL, 0, event, 1, NULL)); (void)printf("kevent num %d flags: %#x, fflags: %#x, data: " +#ifdef __FreeBSD__ + "%" PRIdPTR "\n", n, event[0].flags, event[0].fflags, event[0].data); +#else "%" PRId64 "\n", n, event[0].flags, event[0].fflags, event[0].data); +#endif RL(n = read(fds[0], buffer, event[0].data)); buffer[n] = '\0'; Modified: stable/11/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c ============================================================================== --- stable/11/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c Sat Dec 3 02:48:55 2016 (r309468) +++ stable/11/contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c Sat Dec 3 02:55:19 2016 (r309469) @@ -103,7 +103,11 @@ h_check(bool check_master) RL(n = kevent(kq, NULL, 0, event, 1, NULL)); (void)printf("kevent num %d filt %d flags: %#x, fflags: %#x, " +#ifdef __FreeBSD__ + "data: %" PRIdPTR "\n", n, event[0].filter, event[0].flags, +#else "data: %" PRId64 "\n", n, event[0].filter, event[0].flags, +#endif event[0].fflags, event[0].data); ATF_REQUIRE_EQ(event[0].filter, EVFILT_READ); Modified: stable/11/contrib/netbsd-tests/kernel/kqueue/t_proc1.c ============================================================================== --- stable/11/contrib/netbsd-tests/kernel/kqueue/t_proc1.c Sat Dec 3 02:48:55 2016 (r309468) +++ stable/11/contrib/netbsd-tests/kernel/kqueue/t_proc1.c Sat Dec 3 02:55:19 2016 (r309469) @@ -139,7 +139,11 @@ ATF_TC_BODY(proc1, tc) printf(" NOTE_FORK"); } if (event[0].fflags & NOTE_CHILD) +#ifdef __FreeBSD__ + printf(" NOTE_CHILD, parent = %" PRIdPTR, event[0].data); +#else printf(" NOTE_CHILD, parent = %" PRId64, event[0].data); +#endif printf("\n"); } Modified: stable/11/contrib/netbsd-tests/kernel/kqueue/t_proc2.c ============================================================================== --- stable/11/contrib/netbsd-tests/kernel/kqueue/t_proc2.c Sat Dec 3 02:48:55 2016 (r309468) +++ stable/11/contrib/netbsd-tests/kernel/kqueue/t_proc2.c Sat Dec 3 02:55:19 2016 (r309469) @@ -34,6 +34,9 @@ __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); __RCSID("$NetBSD: t_proc2.c,v 1.2 2015/01/14 22:22:32 christos Exp $"); +#ifdef __FreeBSD__ +#include +#endif #include #include #include Modified: stable/11/contrib/netbsd-tests/kernel/kqueue/t_proc3.c ============================================================================== --- stable/11/contrib/netbsd-tests/kernel/kqueue/t_proc3.c Sat Dec 3 02:48:55 2016 (r309468) +++ stable/11/contrib/netbsd-tests/kernel/kqueue/t_proc3.c Sat Dec 3 02:55:19 2016 (r309469) @@ -32,6 +32,9 @@ #include __RCSID("$NetBSD: t_proc3.c,v 1.2 2015/01/14 22:22:32 christos Exp $"); +#ifdef __FreeBSD__ +#include +#endif #include #include #include Modified: stable/11/contrib/netbsd-tests/kernel/kqueue/t_sig.c ============================================================================== --- stable/11/contrib/netbsd-tests/kernel/kqueue/t_sig.c Sat Dec 3 02:48:55 2016 (r309468) +++ stable/11/contrib/netbsd-tests/kernel/kqueue/t_sig.c Sat Dec 3 02:55:19 2016 (r309469) @@ -34,6 +34,9 @@ __COPYRIGHT("@(#) Copyright (c) 2008\ The NetBSD Foundation, inc. All rights reserved."); __RCSID("$NetBSD: t_sig.c,v 1.2 2010/11/03 16:10:20 christos Exp $"); +#ifdef __FreeBSD__ +#include +#endif #include #include #include @@ -60,9 +63,13 @@ ATF_TC_HEAD(sig, tc) ATF_TC_BODY(sig, tc) { struct timespec timeout; +#ifdef __NetBSD__ struct kfilter_mapping km; +#endif struct kevent event[1]; +#ifdef __NetBSD__ char namebuf[32]; +#endif pid_t pid, child; int kq, n, num, status; @@ -84,16 +91,22 @@ ATF_TC_BODY(sig, tc) RL(kq = kqueue()); +#ifdef __NetBSD__ (void)strlcpy(namebuf, "EVFILT_SIGNAL", sizeof(namebuf)); km.name = namebuf; RL(ioctl(kq, KFILTER_BYNAME, &km)); (void)printf("got %d as filter number for `%s'.\n", km.filter, km.name); +#endif /* ignore the signal to avoid taking it for real */ REQUIRE_LIBC(signal(SIGUSR1, SIG_IGN), SIG_ERR); event[0].ident = SIGUSR1; +#ifdef __NetBSD__ event[0].filter = km.filter; +#else + event[0].filter = EVFILT_SIGNAL; +#endif event[0].flags = EV_ADD | EV_ENABLE; RL(kevent(kq, event, 1, NULL, 0, NULL)); @@ -117,7 +130,11 @@ ATF_TC_BODY(sig, tc) if (n == 0) continue; +#ifdef __FreeBSD__ + (void)printf("sig: kevent flags: 0x%x, data: %" PRIdPTR " (# " +#else (void)printf("sig: kevent flags: 0x%x, data: %" PRId64 " (# " +#endif "times signal posted)\n", event[0].flags, event[0].data); } Modified: stable/11/contrib/netbsd-tests/kernel/kqueue/t_vnode.c ============================================================================== --- stable/11/contrib/netbsd-tests/kernel/kqueue/t_vnode.c Sat Dec 3 02:48:55 2016 (r309468) +++ stable/11/contrib/netbsd-tests/kernel/kqueue/t_vnode.c Sat Dec 3 02:55:19 2016 (r309469) @@ -1,3 +1,6 @@ +#ifdef __FreeBSD__ +#include +#endif #include #include #include Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Sat Dec 3 02:48:55 2016 (r309468) +++ stable/11/etc/mtree/BSD.tests.dist Sat Dec 3 02:55:19 2016 (r309469) @@ -419,6 +419,8 @@ .. .. kqueue + libkqueue + .. .. mac bsdextended Copied and modified: stable/11/tests/sys/kqueue/Makefile (from r305467, head/tests/sys/kqueue/Makefile) ============================================================================== --- head/tests/sys/kqueue/Makefile Tue Sep 6 08:45:29 2016 (r305467, copy source) +++ stable/11/tests/sys/kqueue/Makefile Sat Dec 3 02:55:19 2016 (r309469) @@ -1,8 +1,20 @@ # $FreeBSD$ +TESTSRC= ${SRCTOP}/contrib/netbsd-tests/kernel/kqueue + TESTSDIR= ${TESTSBASE}/sys/kqueue BINDIR= ${TESTSDIR} +NETBSD_ATF_TESTS_C= proc1_test +# XXX: fails `ke.fflags & NOTE_TRACKERR` invariant +#NETBSD_ATF_TESTS_C+= proc2_test +NETBSD_ATF_TESTS_C+= proc3_test +NETBSD_ATF_TESTS_C+= sig_test +NETBSD_ATF_TESTS_C+= vnode_test + +WARNS?= 3 + TESTS_SUBDIRS+= libkqueue +.include .include From owner-svn-src-stable-11@freebsd.org Sat Dec 3 03:04:22 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45AFDC60019; Sat, 3 Dec 2016 03:04:22 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F08F51A15; Sat, 3 Dec 2016 03:04:21 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB334Lqf068371; Sat, 3 Dec 2016 03:04:21 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB334Lhh068370; Sat, 3 Dec 2016 03:04:21 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612030304.uB334Lhh068370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 3 Dec 2016 03:04:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309470 - stable/11/contrib/netbsd-tests/lib/libc/rpc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 03:04:22 -0000 Author: ngie Date: Sat Dec 3 03:04:20 2016 New Revision: 309470 URL: https://svnweb.freebsd.org/changeset/base/309470 Log: MFC r305451: Fix lib/libc/rpc test assumptions added in r305358 - Require root in the tcp/udp subtests (it's needed on FreeBSD when registering services). - Skip the tests if service registration fails. Modified: stable/11/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c ============================================================================== --- stable/11/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c Sat Dec 3 02:55:19 2016 (r309469) +++ stable/11/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c Sat Dec 3 03:04:20 2016 (r309470) @@ -24,6 +24,13 @@ __RCSID("$NetBSD: t_rpc.c,v 1.9 2015/11/ return; \ } while(/*CONSTCOND*/0) +#ifdef __FreeBSD__ +#define SKIPXI(ev, msg, ...) do { \ + atf_tc_skip(msg, __VA_ARGS__); \ + return ev; \ +} while(/*CONSTCOND*/0) +#endif + #else #define ERRX(ev, msg, ...) errx(ev, msg, __VA_ARGS__) #define SKIPX(ev, msg, ...) errx(ev, msg, __VA_ARGS__) @@ -188,7 +195,13 @@ regtest(const char *hostname, const char svc_fdset_init(p ? SVC_FDSET_POLL : 0); #endif if (!svc_create(server, PROGNUM, VERSNUM, transp)) +#ifdef __NetBSD__ ERRX(EXIT_FAILURE, "Cannot create server %d", num); +#else + { + SKIPXI(EXIT_FAILURE, "Cannot create server %d", num); + } +#endif switch ((pid = fork())) { case 0: @@ -335,6 +348,9 @@ ATF_TC(tcp); ATF_TC_HEAD(tcp, tc) { atf_tc_set_md_var(tc, "descr", "Checks svc tcp (select)"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.user", "root"); +#endif } ATF_TC_BODY(tcp, tc) @@ -347,6 +363,9 @@ ATF_TC(udp); ATF_TC_HEAD(udp, tc) { atf_tc_set_md_var(tc, "descr", "Checks svc udp (select)"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.user", "root"); +#endif } ATF_TC_BODY(udp, tc) @@ -359,6 +378,9 @@ ATF_TC(tcp_poll); ATF_TC_HEAD(tcp_poll, tc) { atf_tc_set_md_var(tc, "descr", "Checks svc tcp (poll)"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.user", "root"); +#endif } ATF_TC_BODY(tcp_poll, tc) @@ -371,6 +393,9 @@ ATF_TC(udp_poll); ATF_TC_HEAD(udp_poll, tc) { atf_tc_set_md_var(tc, "descr", "Checks svc udp (poll)"); +#ifdef __FreeBSD__ + atf_tc_set_md_var(tc, "require.user", "root"); +#endif } ATF_TC_BODY(udp_poll, tc) From owner-svn-src-stable-11@freebsd.org Sat Dec 3 03:05:45 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB2AEC600CB; Sat, 3 Dec 2016 03:05:45 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA74C1C65; Sat, 3 Dec 2016 03:05:45 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB335ibl068481; Sat, 3 Dec 2016 03:05:44 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB335ijk068480; Sat, 3 Dec 2016 03:05:44 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612030305.uB335ijk068480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 3 Dec 2016 03:05:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309471 - stable/11/lib/libc/tests/db X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 03:05:46 -0000 Author: ngie Date: Sat Dec 3 03:05:44 2016 New Revision: 309471 URL: https://svnweb.freebsd.org/changeset/base/309471 Log: MFC r305449: Install h_db to unbreak some of the lib/libc/db testcases after r305358 Modified: stable/11/lib/libc/tests/db/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/tests/db/Makefile ============================================================================== --- stable/11/lib/libc/tests/db/Makefile Sat Dec 3 03:04:20 2016 (r309470) +++ stable/11/lib/libc/tests/db/Makefile Sat Dec 3 03:05:44 2016 (r309471) @@ -5,7 +5,7 @@ PACKAGE= tests BINDIR= ${TESTSDIR} PROGS= h_db -PROGS= h_lfsr +PROGS+= h_lfsr ${PACKAGE}FILES+= README From owner-svn-src-stable-11@freebsd.org Sat Dec 3 03:15:10 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6B5AC60700; Sat, 3 Dec 2016 03:15:10 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95CD0669; Sat, 3 Dec 2016 03:15:10 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB33F9Fb072429; Sat, 3 Dec 2016 03:15:09 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB33F99u072428; Sat, 3 Dec 2016 03:15:09 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612030315.uB33F99u072428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 3 Dec 2016 03:15:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309473 - stable/11/contrib/netbsd-tests/games X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 03:15:10 -0000 Author: ngie Date: Sat Dec 3 03:15:09 2016 New Revision: 309473 URL: https://svnweb.freebsd.org/changeset/base/309473 Log: MFC r309472: Restore pathing for factor(1), which unnecessarily diverged in r278616 factor lives in /usr/games/, not /usr/bin, in NetBSD. The correct way to handle this is do on-the-fly manipulation of the test script via ATF_TESTS_SH_SED_, not by modify the pathing directly in the test script. This is being done to resolve an unnecessary conflict made when pulling back ^/head@r309469 (contrib/netbsd-tests update) to ^/stable/10. No functional change Modified: stable/11/contrib/netbsd-tests/games/t_factor.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/games/t_factor.sh ============================================================================== --- stable/11/contrib/netbsd-tests/games/t_factor.sh Sat Dec 3 03:13:32 2016 (r309472) +++ stable/11/contrib/netbsd-tests/games/t_factor.sh Sat Dec 3 03:15:09 2016 (r309473) @@ -37,7 +37,7 @@ expect() { atf_test_case overflow1 overflow1_head() { atf_set "descr" "Tests for overflow conditions" - atf_set "require.progs" "/usr/bin/factor" + atf_set "require.progs" "/usr/games/factor" } overflow1_body() { expect '8675309' '8675309: 8675309' @@ -56,7 +56,7 @@ atf_test_case loop1 loop1_head() { atf_set "descr" "Tests some cases that once locked the program" \ "in an infinite loop" - atf_set "require.progs" "/usr/bin/factor" + atf_set "require.progs" "/usr/games/factor" } loop1_body() { expect '2147483647111311' '2147483647111311: 3 3 3 131 607148331103' From owner-svn-src-stable-11@freebsd.org Sat Dec 3 03:59:25 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D04A1C6392A; Sat, 3 Dec 2016 03:59:25 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9F6881C32; Sat, 3 Dec 2016 03:59:25 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB33xO4T088623; Sat, 3 Dec 2016 03:59:24 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB33xOK7088622; Sat, 3 Dec 2016 03:59:24 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201612030359.uB33xOK7088622@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Ngie Cooper Date: Sat, 3 Dec 2016 03:59:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309475 - stable/11/contrib/netbsd-tests/lib/libc/gen X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 03:59:25 -0000 Author: ngie Date: Sat Dec 3 03:59:24 2016 New Revision: 309475 URL: https://svnweb.freebsd.org/changeset/base/309475 Log: MFC r309474: Don't build :strvis_locale if VIS_NOLOCALE is undefined The copy of contrib/libc-vis on ^/stable/10 doesn't contain all of the features in the ^/stable/11 // ^/head version, including VIS_NOLOCALE. The risk is lower in conditionally running the test instead of backporting the newer version of libc-vis Modified: stable/11/contrib/netbsd-tests/lib/libc/gen/t_vis.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/gen/t_vis.c ============================================================================== --- stable/11/contrib/netbsd-tests/lib/libc/gen/t_vis.c Sat Dec 3 03:56:20 2016 (r309474) +++ stable/11/contrib/netbsd-tests/lib/libc/gen/t_vis.c Sat Dec 3 03:59:24 2016 (r309475) @@ -144,6 +144,9 @@ ATF_TC_BODY(strunvis_hex, tc) } } +/* Begin FreeBSD: ^/stable/10 doesn't have VIS_NOLOCALE */ +#ifdef VIS_NOLOCALE +/* End FreeBSD */ ATF_TC(strvis_locale); ATF_TC_HEAD(strvis_locale, tc) { @@ -172,6 +175,9 @@ ATF_TC_BODY(strvis_locale, tc) setlocale(LC_CTYPE, ol); free(ol); } +/* Begin FreeBSD: ^/stable/10 doesn't have VIS_NOLOCALE */ +#endif /* VIS_NOLOCALE */ +/* End FreeBSD */ ATF_TP_ADD_TCS(tp) { @@ -180,7 +186,13 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, strvis_null); ATF_TP_ADD_TC(tp, strvis_empty); ATF_TP_ADD_TC(tp, strunvis_hex); +/* Begin FreeBSD: ^/stable/10 doesn't have VIS_NOLOCALE */ +#ifdef VIS_NOLOCALE +/* End FreeBSD */ ATF_TP_ADD_TC(tp, strvis_locale); +/* Begin FreeBSD: ^/stable/10 doesn't have VIS_NOLOCALE */ +#endif /* VIS_NOLOCALE */ +/* End FreeBSD */ return atf_no_error(); } From owner-svn-src-stable-11@freebsd.org Sat Dec 3 17:10:05 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D74F2C658E2; Sat, 3 Dec 2016 17:10:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4F42168A; Sat, 3 Dec 2016 17:10:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB3HA4fG007144; Sat, 3 Dec 2016 17:10:04 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB3HA47A007143; Sat, 3 Dec 2016 17:10:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201612031710.uB3HA47A007143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 3 Dec 2016 17:10:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309483 - stable/11/sys/x86/x86 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 17:10:06 -0000 Author: kib Date: Sat Dec 3 17:10:04 2016 New Revision: 309483 URL: https://svnweb.freebsd.org/changeset/base/309483 Log: MFC r309189: Fix automatic eventtimer hardware selection when ARAT is not implemented, and do not ignore TSCDLT. Modified: stable/11/sys/x86/x86/local_apic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/x86/x86/local_apic.c ============================================================================== --- stable/11/sys/x86/x86/local_apic.c Sat Dec 3 16:52:40 2016 (r309482) +++ stable/11/sys/x86/x86/local_apic.c Sat Dec 3 17:10:04 2016 (r309483) @@ -478,8 +478,9 @@ native_lapic_init(vm_paddr_t addr) lapic_et.et_quality = 600; if (!arat) { lapic_et.et_flags |= ET_FLAGS_C3STOP; - lapic_et.et_quality -= 200; - } else if ((cpu_feature & CPUID_TSC) != 0 && + lapic_et.et_quality = 100; + } + if ((cpu_feature & CPUID_TSC) != 0 && (cpu_feature2 & CPUID2_TSCDLT) != 0 && tsc_is_invariant && tsc_freq != 0) { lapic_timer_tsc_deadline = 1; From owner-svn-src-stable-11@freebsd.org Sat Dec 3 17:40:27 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D377BC65266; Sat, 3 Dec 2016 17:40:27 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 946D9D5E; Sat, 3 Dec 2016 17:40:27 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB3HeQVa020085; Sat, 3 Dec 2016 17:40:26 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB3HeQGX020083; Sat, 3 Dec 2016 17:40:26 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201612031740.uB3HeQGX020083@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 3 Dec 2016 17:40:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309488 - in stable/11/sys: dev/kbdmux modules/kbdmux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 17:40:27 -0000 Author: gonzo Date: Sat Dec 3 17:40:26 2016 New Revision: 309488 URL: https://svnweb.freebsd.org/changeset/base/309488 Log: MFC r308668: [evdev] Add evdev support to kbdmux(4) driver To enable event sourcing from kbdmux(4) kern.evdev.rcpt_mask value should have bit 1 set (this is default) Submitted by: Vladimir Kondratiev Differential Revision: https://reviews.freebsd.org/D8437 Modified: stable/11/sys/dev/kbdmux/kbdmux.c stable/11/sys/modules/kbdmux/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/kbdmux/kbdmux.c ============================================================================== --- stable/11/sys/dev/kbdmux/kbdmux.c Sat Dec 3 17:27:28 2016 (r309487) +++ stable/11/sys/dev/kbdmux/kbdmux.c Sat Dec 3 17:40:26 2016 (r309488) @@ -32,6 +32,7 @@ */ #include "opt_compat.h" +#include "opt_evdev.h" #include "opt_kbd.h" #include "opt_kbdmux.h" @@ -64,6 +65,11 @@ #include +#ifdef EVDEV_SUPPORT +#include +#include +#endif + #define KEYBOARD_NAME "kbdmux" MALLOC_DECLARE(M_KBDMUX); @@ -159,6 +165,11 @@ struct kbdmux_state u_int ks_composed_char; /* composed char code */ u_char ks_prefix; /* AT scan code prefix */ +#ifdef EVDEV_SUPPORT + struct evdev_dev * ks_evdev; + int ks_evdev_state; +#endif + SLIST_HEAD(, kbdmux_kbd) ks_kbds; /* keyboards */ KBDMUX_LOCK_DECL_GLOBAL; @@ -371,6 +382,12 @@ static keyboard_switch_t kbdmuxsw = { .diag = genkbd_diag, }; +#ifdef EVDEV_SUPPORT +static const struct evdev_methods kbdmux_evdev_methods = { + .ev_event = evdev_ev_kbd_event, +}; +#endif + /* * Return the number of found keyboards */ @@ -404,6 +421,10 @@ kbdmux_init(int unit, keyboard_t **kbdp, accentmap_t *accmap = NULL; fkeytab_t *fkeymap = NULL; int error, needfree, fkeymap_size, delay[2]; +#ifdef EVDEV_SUPPORT + struct evdev_dev *evdev; + char phys_loc[NAMELEN]; +#endif if (*kbdp == NULL) { *kbdp = kbd = malloc(sizeof(*kbd), M_KBDMUX, M_NOWAIT | M_ZERO); @@ -464,6 +485,30 @@ kbdmux_init(int unit, keyboard_t **kbdp, delay[1] = kbd->kb_delay2; kbdmux_ioctl(kbd, KDSETREPEAT, (caddr_t)delay); +#ifdef EVDEV_SUPPORT + /* register as evdev provider */ + evdev = evdev_alloc(); + evdev_set_name(evdev, "System keyboard multiplexer"); + snprintf(phys_loc, NAMELEN, KEYBOARD_NAME"%d", unit); + evdev_set_phys(evdev, phys_loc); + evdev_set_id(evdev, BUS_VIRTUAL, 0, 0, 0); + evdev_set_methods(evdev, kbd, &kbdmux_evdev_methods); + evdev_support_event(evdev, EV_SYN); + evdev_support_event(evdev, EV_KEY); + evdev_support_event(evdev, EV_LED); + evdev_support_event(evdev, EV_REP); + evdev_support_all_known_keys(evdev); + evdev_support_led(evdev, LED_NUML); + evdev_support_led(evdev, LED_CAPSL); + evdev_support_led(evdev, LED_SCROLLL); + + if (evdev_register(evdev)) + evdev_free(evdev); + else + state->ks_evdev = evdev; + state->ks_evdev_state = 0; +#endif + KBD_INIT_DONE(kbd); } @@ -532,6 +577,10 @@ kbdmux_term(keyboard_t *kbd) kbd_unregister(kbd); +#ifdef EVDEV_SUPPORT + evdev_free(state->ks_evdev); +#endif + KBDMUX_LOCK_DESTROY(state); bzero(state, sizeof(*state)); free(state, M_KBDMUX); @@ -694,6 +743,20 @@ next_code: kbd->kb_count ++; +#ifdef EVDEV_SUPPORT + /* push evdev event */ + if (evdev_rcpt_mask & EVDEV_RCPT_KBDMUX && state->ks_evdev != NULL) { + uint16_t key = evdev_scancode2key(&state->ks_evdev_state, + scancode); + + if (key != KEY_RESERVED) { + evdev_push_event(state->ks_evdev, EV_KEY, + key, scancode & 0x80 ? 0 : 1); + evdev_sync(state->ks_evdev); + } + } +#endif + /* return the byte as is for the K_RAW mode */ if (state->ks_mode == K_RAW) { KBDMUX_UNLOCK(state); @@ -1120,7 +1183,11 @@ kbdmux_ioctl(keyboard_t *kbd, u_long cmd } KBD_LED_VAL(kbd) = *(int *)arg; - +#ifdef EVDEV_SUPPORT + if (state->ks_evdev != NULL && + evdev_rcpt_mask & EVDEV_RCPT_KBDMUX) + evdev_push_leds(state->ks_evdev, *(int *)arg); +#endif /* KDSETLED on all slave keyboards */ SLIST_FOREACH(k, &state->ks_kbds, next) (void)kbdd_ioctl(k->kbd, KDSETLED, arg); @@ -1197,7 +1264,11 @@ kbdmux_ioctl(keyboard_t *kbd, u_long cmd kbd->kb_delay1 = delays[(mode >> 5) & 3]; kbd->kb_delay2 = rates[mode & 0x1f]; - +#ifdef EVDEV_SUPPORT + if (state->ks_evdev != NULL && + evdev_rcpt_mask & EVDEV_RCPT_KBDMUX) + evdev_push_repeats(state->ks_evdev, kbd); +#endif /* perform command on all slave keyboards */ SLIST_FOREACH(k, &state->ks_kbds, next) (void)kbdd_ioctl(k->kbd, cmd, arg); @@ -1395,4 +1466,6 @@ kbdmux_modevent(module_t mod, int type, } DEV_MODULE(kbdmux, kbdmux_modevent, NULL); - +#ifdef EVDEV_SUPPORT +MODULE_DEPEND(kbdmux, evdev, 1, 1, 1); +#endif Modified: stable/11/sys/modules/kbdmux/Makefile ============================================================================== --- stable/11/sys/modules/kbdmux/Makefile Sat Dec 3 17:27:28 2016 (r309487) +++ stable/11/sys/modules/kbdmux/Makefile Sat Dec 3 17:40:26 2016 (r309488) @@ -4,7 +4,8 @@ .PATH: ${.CURDIR}/../../dev/kbdmux KMOD= kbdmux -SRCS= kbdmux.c opt_compat.h opt_kbd.h opt_kbdmux.h bus_if.h device_if.h +SRCS= kbdmux.c opt_compat.h opt_evdev.h opt_kbd.h opt_kbdmux.h bus_if.h \ + device_if.h .if !defined(KERNBUILDDIR) opt_compat.h: From owner-svn-src-stable-11@freebsd.org Sat Dec 3 19:53:16 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C9F53C65A87; Sat, 3 Dec 2016 19:53:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 94F71BFA; Sat, 3 Dec 2016 19:53:16 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB3JrF2O089669; Sat, 3 Dec 2016 19:53:15 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB3JrFRp089668; Sat, 3 Dec 2016 19:53:15 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612031953.uB3JrFRp089668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 3 Dec 2016 19:53:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309508 - stable/11/usr.sbin/autofs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 19:53:16 -0000 Author: trasz Date: Sat Dec 3 19:53:15 2016 New Revision: 309508 URL: https://svnweb.freebsd.org/changeset/base/309508 Log: MFC r308206: Make autounmountd(8) not die when traced with "truss -p". Modified: stable/11/usr.sbin/autofs/autounmountd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/autofs/autounmountd.c ============================================================================== --- stable/11/usr.sbin/autofs/autounmountd.c Sat Dec 3 19:52:33 2016 (r309507) +++ stable/11/usr.sbin/autofs/autounmountd.c Sat Dec 3 19:53:15 2016 (r309508) @@ -244,8 +244,11 @@ do_wait(int kq, double sleep_time) log_debugx("waiting for filesystem event"); nevents = kevent(kq, NULL, 0, &unused, 1, NULL); } - if (nevents < 0) + if (nevents < 0) { + if (errno == EINTR) + return; log_err(1, "kevent"); + } if (nevents == 0) { log_debugx("timeout reached"); From owner-svn-src-stable-11@freebsd.org Sat Dec 3 20:30:08 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E57FC655D7; Sat, 3 Dec 2016 20:30:08 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0479A1FD0; Sat, 3 Dec 2016 20:30:07 +0000 (UTC) (envelope-from peter@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB3KU7RE002282; Sat, 3 Dec 2016 20:30:07 GMT (envelope-from peter@FreeBSD.org) Received: (from peter@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB3KU5PH002266; Sat, 3 Dec 2016 20:30:05 GMT (envelope-from peter@FreeBSD.org) Message-Id: <201612032030.uB3KU5PH002266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: peter set sender to peter@FreeBSD.org using -f From: Peter Wemm Date: Sat, 3 Dec 2016 20:30:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309511 - in stable/11/contrib/subversion: . subversion/include subversion/include/private subversion/libsvn_client subversion/libsvn_fs_fs subversion/libsvn_fs_x subversion/libsvn_ra_s... X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 20:30:08 -0000 Author: peter Date: Sat Dec 3 20:30:05 2016 New Revision: 309511 URL: https://svnweb.freebsd.org/changeset/base/309511 Log: MFC r309356: svn 1.9.4 -> 1.9.5 Modified: stable/11/contrib/subversion/CHANGES stable/11/contrib/subversion/README stable/11/contrib/subversion/build-outputs.mk stable/11/contrib/subversion/configure stable/11/contrib/subversion/configure.ac stable/11/contrib/subversion/get-deps.sh stable/11/contrib/subversion/subversion/include/private/svn_sqlite.h stable/11/contrib/subversion/subversion/include/svn_version.h stable/11/contrib/subversion/subversion/libsvn_client/merge.c stable/11/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c stable/11/contrib/subversion/subversion/libsvn_fs_fs/caching.c stable/11/contrib/subversion/subversion/libsvn_fs_fs/fs.c stable/11/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.c stable/11/contrib/subversion/subversion/libsvn_fs_fs/low_level.c stable/11/contrib/subversion/subversion/libsvn_fs_fs/pack.c stable/11/contrib/subversion/subversion/libsvn_fs_fs/pack.h stable/11/contrib/subversion/subversion/libsvn_fs_fs/rep-cache-db.h stable/11/contrib/subversion/subversion/libsvn_fs_fs/rep-cache.c stable/11/contrib/subversion/subversion/libsvn_fs_fs/rep-cache.h stable/11/contrib/subversion/subversion/libsvn_fs_fs/transaction.c stable/11/contrib/subversion/subversion/libsvn_fs_fs/tree.c stable/11/contrib/subversion/subversion/libsvn_fs_x/rep-cache-db.h stable/11/contrib/subversion/subversion/libsvn_ra_serf/xml.c stable/11/contrib/subversion/subversion/libsvn_repos/reporter.c stable/11/contrib/subversion/subversion/libsvn_repos/repos.c stable/11/contrib/subversion/subversion/libsvn_subr/config_file.c stable/11/contrib/subversion/subversion/libsvn_subr/deprecated.c stable/11/contrib/subversion/subversion/libsvn_subr/gpg_agent.c stable/11/contrib/subversion/subversion/libsvn_subr/internal_statements.h stable/11/contrib/subversion/subversion/libsvn_subr/sqlite.c stable/11/contrib/subversion/subversion/libsvn_subr/sysinfo.c stable/11/contrib/subversion/subversion/libsvn_subr/win32_crashrpt.c stable/11/contrib/subversion/subversion/libsvn_subr/xml.c stable/11/contrib/subversion/subversion/libsvn_wc/conflicts.c stable/11/contrib/subversion/subversion/libsvn_wc/update_editor.c stable/11/contrib/subversion/subversion/libsvn_wc/wc-checks.h stable/11/contrib/subversion/subversion/libsvn_wc/wc-metadata.h stable/11/contrib/subversion/subversion/libsvn_wc/wc-queries.h stable/11/contrib/subversion/subversion/svn/info-cmd.c stable/11/contrib/subversion/subversion/svn/merge-cmd.c stable/11/contrib/subversion/subversion/svnserve/serve.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/subversion/CHANGES ============================================================================== --- stable/11/contrib/subversion/CHANGES Sat Dec 3 20:01:12 2016 (r309510) +++ stable/11/contrib/subversion/CHANGES Sat Dec 3 20:30:05 2016 (r309511) @@ -1,3 +1,54 @@ +Version 1.9.5 +(29 Nov 2016, from /branches/1.9.x) +http://svn.apache.org/repos/asf/subversion/tags/1.9.5 + + User-visible changes: + - Client-side bugfixes: + * fix accessing non-existent paths during reintegrate merge (r1766699 et al) + * fix handling of newly secured subdirectories in working copy (r1724448) + * info: remove trailing whitespace in --show-item=revision (issue #4660) + * fix recording wrong revisions for tree conflicts (r1734106) + * gpg-agent: improve discovery of gpg-agent sockets (r1766327) + * gpg-agent: fix file descriptor leak (r1766323) + * resolve: fix --accept=mine-full for binary files (issue #4647) + * merge: fix possible crash (issue #4652) + * resolve: fix possible crash (r1748514) + * fix potential crash in Win32 crash reporter (r1663253 et al) + + - Server-side bugfixes: + * fsfs: fix "offset too large" error during pack (issue #4657) + * svnserve: enable hook script environments (r1769152) + * fsfs: fix possible data reconstruction error (issue #4658) + * fix source of spurious 'incoming edit' tree conflicts (r1770108) + * fsfs: improve caching for large directories (r1721285) + * fsfs: fix crash when encountering all-zero checksums (r1759686) + * fsfs: fix potential source of repository corruptions (r1756266) + * mod_dav_svn: fix excessive memory usage with mod_headers/mod_deflate + (issue #3084) + * mod_dav_svn: reduce memory usage during GET requests (r1757529 et al) + * fsfs: fix unexpected "database is locked" errors (r1741096 et al) + * fsfs: fix opening old repositories without db/format files (r1720015) + + - Client-side and server-side bugfixes: + * fix possible crash when reading invalid configuration files (r1715777) + + - Bindings bugfixes: + * swig-pl: do not corrupt "{DATE}" revision variable (r1767768) + * javahl: fix temporary accepting SSL server certificates (r1764851) + * swig-pl: fix possible stack corruption (r1683266, r1683267) + + Developer-visible changes: + - General: + * add zlib discovery through pkg-config (issue #4655) + * fix potential build issue with invalid SVN_LOCALE_DIR (issue #4653) + * ruby: fix test failures with ruby >= 2.2 (r1766621) + * fix link error with --disable-keychain on OS X (r1765385) + * swig: enable building with SWIG >= 3.0.6 (r1721488 et al) + * swig: fix building with -Wdate-time in $CPPFLAGS (r1722164) + * update serf download URI in build scripts (r1700130 et al) + * raise minimal httpd version from 2.0 to 2.2 (r1754193) + + Version 1.9.4 (28 Apr 2016, from /branches/1.9.x) http://svn.apache.org/repos/asf/subversion/tags/1.9.4 @@ -14,6 +65,8 @@ http://svn.apache.org/repos/asf/subversi * ra_serf: fix deleting directories with many files (issue #4557) - Server-side bugfixes: + * mod_authz_svn: fix crash in COPY/MOVE authorization check (CVE-2016-2168) + * svnserve/sasl: fix authenticating users with wrong realm (CVE-2016-2167) * improve documentation for AuthzSVNGroupsFile and groups-db (r1730856) * fsfs: reduce peak memory usage when listing large directories (r1725180) * fsfs: fix a rare source of incomplete dump files and reports (r1717876) @@ -31,8 +84,7 @@ http://svn.apache.org/repos/asf/subversi * fix ruby test suite to work with test-unit gem (r1714790) * allow building against KDE4 without conflict with KDE5 (r1734926) * fix update_tests.py#76 with SVNPathAuthz short_circuit (r1736432) - * build system tweaks: - * tweak how symbolic error names in maintainer mode (r1735179) + * tweak getting symbolic error names in maintainer mode (r1735179) * fix inconsistent behavior of inherited property API (r1717874 et al) - API changes: @@ -882,12 +934,44 @@ http://svn.apache.org/repos/asf/subversi * javahl: allow compiling with a C++11 compiler (r1684412) +Version 1.8.17 +(29 Nov 2016, from /branches/1.8.x) +http://svn.apache.org/repos/asf/subversion/tags/1.8.17 + + User-visible changes: + - Client-side bugfixes: + * fix handling of newly secured subdirectories in working copy (r1724448) + * ra_serf: fix deleting directories with many files (issue #4557) + * svnlook: properly remove tempfiles on diff errors (r1711346) + * gpg-agent: properly handle passwords with percent characters (issue #4611) + * merge: fix crash when merging to a local add (r1702299 et al) + + - Server-side bugfixes: + * fsfs: fix possible data reconstruction error (issue #4658) + + - Client-side and server-side bugfixes: + * fix potential memory access bugs (r1722860 et al) + + - Bindings bugfixes: + * javahl: fix temporary accepting SSL server certificates (r1764851) + * swig-pl: do not corrupt "{DATE}" revision variable (r1767768) + * swig-pl: fix possible stack corruption (r1683266) + + Developer-visible changes: + - General: + * fix inconsistent behavior of inherited property API (r1717875, r1717878) + * fix patch filter invocation in svn_client_patch() (r1706783) + * fix potential build issue with invalid SVN_LOCALE_DIR (issue #4653) + + Version 1.8.16 (28 Apr 2016, from /branches/1.8.x) http://svn.apache.org/repos/asf/subversion/tags/1.8.16 User-visible changes: - Server-side bugfixes: + * mod_authz_svn: fix crash in COPY/MOVE authorization check (CVE-2016-2168) + * svnserve/sasl: fix authenticating users with wrong realm (CVE-2016-2167) * mod_authz_svn: fix authz with mod_auth_kerb/mod_auth_ntlm (issue #4602) * dump: don't write broken dump files in some ambiguously encoded fsfs repositories (issue #4554) @@ -1641,7 +1725,7 @@ http://svn.apache.org/repos/asf/subversi * fix bug in mergeinfo recording during foreign-repos merge (r1430310) * fix spurious merge conflicts for binary files with keywords (issue #4221) * fix patching symlinks with 'svn patch' (issue #4273) - * make 'svn switch' refresh lock information (issue #3376) + * make 'svn switch' refresh lock information (issue #3378) * fix 'svn diff' output doesn't apply as patch without fuzz (issue #3362) * fix mergeinfo recording for multiple-revision-range merge (issue #4306) * fix diffs shown by 'show-diff' conflict prompt option (r1438879) Modified: stable/11/contrib/subversion/README ============================================================================== --- stable/11/contrib/subversion/README Sat Dec 3 20:01:12 2016 (r309510) +++ stable/11/contrib/subversion/README Sat Dec 3 20:30:05 2016 (r309511) @@ -2,7 +2,7 @@ Subversion, a version control system. ===================================== -$LastChangedDate: 2012-02-10 14:58:53 +0000 (Fri, 10 Feb 2012) $ +$LastChangedDate: 2016-05-31 16:08:20 +0000 (Tue, 31 May 2016) $ Contents: @@ -36,10 +36,10 @@ II. DOCUMENTATION It is written in DocBook XML, and the sources can be found at: - http://svnbook.googlecode.com/svn/trunk/ + http://svn.code.sf.net/p/svnbook/source/trunk/ If you wish to build the documentation from source, read the - src/en/README file within the book source. + en/README file within the book source. Modified: stable/11/contrib/subversion/build-outputs.mk ============================================================================== --- stable/11/contrib/subversion/build-outputs.mk Sat Dec 3 20:01:12 2016 (r309510) +++ stable/11/contrib/subversion/build-outputs.mk Sat Dec 3 20:30:05 2016 (r309511) @@ -3351,7 +3351,7 @@ subversion/tests/libsvn_diff/diff-diff3- subversion/tests/libsvn_diff/parse-diff-test.lo: subversion/tests/libsvn_diff/parse-diff-test.c subversion/include/private/svn_debug.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_diff.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/include/svn_utf.h subversion/tests/svn_test.h -subversion/tests/libsvn_fs/fs-test.lo: subversion/tests/libsvn_fs/fs-test.c subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_fs_private.h subversion/include/private/svn_fs_util.h subversion/include/private/svn_fspath.h subversion/include/private/svn_mutex.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_props.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_time.h subversion/include/svn_types.h subversion/include/svn_version.h subversion/libsvn_delta/delta.h subversion/libsvn_fs/fs-loader.h subversion/s vn_private_config.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h +subversion/tests/libsvn_fs/fs-test.lo: subversion/tests/libsvn_fs/fs-test.c subversion/include/private/svn_debug.h subversion/include/private/svn_editor.h subversion/include/private/svn_fs_private.h subversion/include/private/svn_fs_util.h subversion/include/private/svn_fspath.h subversion/include/private/svn_mutex.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_token.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_props.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_time.h subversion/include/svn_types.h subversion/include/svn_version. h subversion/libsvn_delta/delta.h subversion/libsvn_fs/fs-loader.h subversion/svn_private_config.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h subversion/tests/libsvn_fs/locks-test.lo: subversion/tests/libsvn_fs/locks-test.c subversion/include/private/svn_debug.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h @@ -3363,7 +3363,7 @@ subversion/tests/libsvn_fs_base/strings- subversion/tests/libsvn_fs_fs/fs-fs-fuzzy-test.lo: subversion/tests/libsvn_fs_fs/fs-fs-fuzzy-test.c subversion/include/private/svn_atomic.h subversion/include/private/svn_cache.h subversion/include/private/svn_debug.h subversion/include/private/svn_dep_compat.h subversion/include/private/svn_editor.h subversion/include/private/svn_fs_fs_private.h subversion/include/private/svn_fs_private.h subversion/include/private/svn_mutex.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_string_private.h subversion/include/private/svn_token.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_iter.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_poo ls.h subversion/include/svn_props.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/libsvn_fs_fs/fs.h subversion/libsvn_fs_fs/fs_fs.h subversion/libsvn_fs_fs/id.h subversion/libsvn_fs_fs/rev_file.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h -subversion/tests/libsvn_fs_fs/fs-fs-pack-test.lo: subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c subversion/include/private/svn_atomic.h subversion/include/private/svn_cache.h subversion/include/private/svn_debug.h subversion/include/private/svn_dep_compat.h subversion/include/private/svn_editor.h subversion/include/private/svn_fs_fs_private.h subversion/include/private/svn_fs_private.h subversion/include/private/svn_mutex.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_string_private.h subversion/include/private/svn_token.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_iter.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools .h subversion/include/svn_props.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/libsvn_fs/fs-loader.h subversion/libsvn_fs_fs/fs.h subversion/libsvn_fs_fs/fs_fs.h subversion/libsvn_fs_fs/id.h subversion/libsvn_fs_fs/low_level.h subversion/libsvn_fs_fs/util.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h +subversion/tests/libsvn_fs_fs/fs-fs-pack-test.lo: subversion/tests/libsvn_fs_fs/fs-fs-pack-test.c subversion/include/private/svn_atomic.h subversion/include/private/svn_cache.h subversion/include/private/svn_debug.h subversion/include/private/svn_dep_compat.h subversion/include/private/svn_editor.h subversion/include/private/svn_fs_fs_private.h subversion/include/private/svn_fs_private.h subversion/include/private/svn_mutex.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_string_private.h subversion/include/private/svn_token.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_iter.h subversion/include/svn_mergeinfo.h subversion/include/svn_path.h subversion/include/svn_pools .h subversion/include/svn_props.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/libsvn_fs/fs-loader.h subversion/libsvn_fs_fs/fs.h subversion/libsvn_fs_fs/fs_fs.h subversion/libsvn_fs_fs/id.h subversion/libsvn_fs_fs/low_level.h subversion/libsvn_fs_fs/pack.h subversion/libsvn_fs_fs/util.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h subversion/tests/libsvn_fs_fs/fs-fs-private-test.lo: subversion/tests/libsvn_fs_fs/fs-fs-private-test.c subversion/include/private/svn_atomic.h subversion/include/private/svn_cache.h subversion/include/private/svn_debug.h subversion/include/private/svn_dep_compat.h subversion/include/private/svn_editor.h subversion/include/private/svn_fs_fs_private.h subversion/include/private/svn_fs_private.h subversion/include/private/svn_mutex.h subversion/include/private/svn_sqlite.h subversion/include/private/svn_string_private.h subversion/include/private/svn_subr_private.h subversion/include/private/svn_token.h subversion/include/svn_auth.h subversion/include/svn_checksum.h subversion/include/svn_config.h subversion/include/svn_delta.h subversion/include/svn_dirent_uri.h subversion/include/svn_error.h subversion/include/svn_error_codes.h subversion/include/svn_fs.h subversion/include/svn_hash.h subversion/include/svn_io.h subversion/include/svn_iter.h subversion/include/svn_mergeinfo.h subver sion/include/svn_path.h subversion/include/svn_pools.h subversion/include/svn_props.h subversion/include/svn_repos.h subversion/include/svn_string.h subversion/include/svn_types.h subversion/libsvn_fs_fs/fs.h subversion/libsvn_fs_fs/id.h subversion/libsvn_fs_fs/index.h subversion/libsvn_fs_fs/rev_file.h subversion/tests/svn_test.h subversion/tests/svn_test_fs.h Modified: stable/11/contrib/subversion/configure ============================================================================== --- stable/11/contrib/subversion/configure Sat Dec 3 20:01:12 2016 (r309510) +++ stable/11/contrib/subversion/configure Sat Dec 3 20:30:05 2016 (r309511) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for subversion 1.9.4. +# Generated by GNU Autoconf 2.69 for subversion 1.9.5. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='subversion' PACKAGE_TARNAME='subversion' -PACKAGE_VERSION='1.9.4' -PACKAGE_STRING='subversion 1.9.4' +PACKAGE_VERSION='1.9.5' +PACKAGE_STRING='subversion 1.9.5' PACKAGE_BUGREPORT='http://subversion.apache.org/' PACKAGE_URL='' @@ -1471,7 +1471,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures subversion 1.9.4 to adapt to many kinds of systems. +\`configure' configures subversion 1.9.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1537,7 +1537,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of subversion 1.9.4:";; + short | recursive ) echo "Configuration of subversion 1.9.5:";; esac cat <<\_ACEOF @@ -1751,7 +1751,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -subversion configure 1.9.4 +subversion configure 1.9.5 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2295,7 +2295,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by subversion $as_me 1.9.4, which was +It was created by subversion $as_me 1.9.5, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2675,8 +2675,8 @@ ac_configure="$SHELL $ac_aux_dir/configu -{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring Subversion 1.9.4" >&5 -$as_echo "$as_me: Configuring Subversion 1.9.4" >&6;} +{ $as_echo "$as_me:${as_lineno-$LINENO}: Configuring Subversion 1.9.5" >&5 +$as_echo "$as_me: Configuring Subversion 1.9.5" >&6;} abs_srcdir="`cd $srcdir && pwd`" @@ -7422,7 +7422,10 @@ _ACEOF localedir='${datadir}/locale' -if test "${datadir}" = '${prefix}/share' && test "${prefix}" = "NONE"; then +if test "${prefix}" = "NONE" \ + && ( test "${datadir}" = '${prefix}/share' \ + || ( test "${datadir}" = '${datarootdir}' \ + && test "${datarootdir}" = '${prefix}/share' ) ); then exp_localedir='${ac_default_prefix}/share/locale' else exp_localedir=$localedir @@ -22550,68 +22553,34 @@ fi zlib_found=no + zlib_skip=no # Check whether --with-zlib was given. if test "${with_zlib+set}" = set; then : withval=$with_zlib; - if test "$withval" = "yes" ; then - ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" -if test "x$ac_cv_header_zlib_h" = xyes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflate in -lz" >&5 -$as_echo_n "checking for inflate in -lz... " >&6; } -if ${ac_cv_lib_z_inflate+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lz $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + if test "$withval" = "yes"; then + zlib_skip=no + elif test "$withval" = "no"; then + zlib_skip=yes + else + zlib_skip=no + zlib_prefix="$withval" + fi -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char inflate (); -int -main () -{ -return inflate (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_z_inflate=yes -else - ac_cv_lib_z_inflate=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflate" >&5 -$as_echo "$ac_cv_lib_z_inflate" >&6; } -if test "x$ac_cv_lib_z_inflate" = xyes; then : - zlib_found="builtin" fi -fi - + if test "$zlib_skip" = "yes"; then + as_fn_error $? "subversion requires zlib" "$LINENO" 5 + fi - elif test "$withval" = "no" ; then - as_fn_error $? "cannot compile without zlib." "$LINENO" 5 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: zlib library configuration" >&5 -$as_echo "$as_me: zlib library configuration" >&6;} - zlib_prefix=$withval - save_cppflags="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I$zlib_prefix/include" - for ac_header in zlib.h + if test -n "$zlib_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: zlib library configuration via prefix" >&5 +$as_echo "$as_me: zlib library configuration via prefix" >&6;} + save_cppflags="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I$zlib_prefix/include" + for ac_header in zlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" if test "x$ac_cv_header_zlib_h" = xyes; then : @@ -22619,9 +22588,9 @@ if test "x$ac_cv_header_zlib_h" = xyes; #define HAVE_ZLIB_H 1 _ACEOF - save_ldflags="$LDFLAGS" - LDFLAGS="$LDFLAGS -L$zlib_prefix/lib" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflate in -lz" >&5 + save_ldflags="$LDFLAGS" + LDFLAGS="$LDFLAGS -L$zlib_prefix/lib" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflate in -lz" >&5 $as_echo_n "checking for inflate in -lz... " >&6; } if ${ac_cv_lib_z_inflate+:} false; then : $as_echo_n "(cached) " >&6 @@ -22658,24 +22627,86 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflate" >&5 $as_echo "$ac_cv_lib_z_inflate" >&6; } if test "x$ac_cv_lib_z_inflate" = xyes; then : - zlib_found="yes" + + zlib_found="yes" + SVN_ZLIB_INCLUDES="-I$zlib_prefix/include" + SVN_ZLIB_LIBS="` + input_flags="-L$zlib_prefix/lib" + output_flags="" + filtered_dirs="/lib /lib64 /usr/lib /usr/lib64" + for flag in $input_flags; do + filter="no" + for dir in $filtered_dirs; do + if test "$flag" = "-L$dir" || test "$flag" = "-L$dir/"; then + filter="yes" + break + fi + done + if test "$filter" = "no"; then + output_flags="$output_flags $flag" + fi + done + if test -n "$output_flags"; then + printf "%s" "${output_flags# }" + fi +` -lz" + fi - LDFLAGS="$save_ldflags" + LDFLAGS="$save_ldflags" fi done - CPPFLAGS="$save_cppflags" + CPPFLAGS="$save_cppflags" + else + + { $as_echo "$as_me:${as_lineno-$LINENO}: zlib library configuration via pkg-config" >&5 +$as_echo "$as_me: zlib library configuration via pkg-config" >&6;} + if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlib library" >&5 +$as_echo_n "checking for zlib library... " >&6; } + if $PKG_CONFIG zlib --exists; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + zlib_found=yes + SVN_ZLIB_INCLUDES=`$PKG_CONFIG zlib --cflags` + SVN_ZLIB_LIBS=`$PKG_CONFIG zlib --libs` + SVN_ZLIB_LIBS="` + input_flags="$SVN_ZLIB_LIBS" + output_flags="" + filtered_dirs="/lib /lib64 /usr/lib /usr/lib64" + for flag in $input_flags; do + filter="no" + for dir in $filtered_dirs; do + if test "$flag" = "-L$dir" || test "$flag" = "-L$dir/"; then + filter="yes" + break + fi + done + if test "$filter" = "no"; then + output_flags="$output_flags $flag" + fi + done + if test -n "$output_flags"; then + printf "%s" "${output_flags# }" + fi +`" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi + fi -else - ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" + if test "$zlib_found" = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: zlib library configuration" >&5 +$as_echo "$as_me: zlib library configuration" >&6;} + ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" if test "x$ac_cv_header_zlib_h" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflate in -lz" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inflate in -lz" >&5 $as_echo_n "checking for inflate in -lz... " >&6; } if ${ac_cv_lib_z_inflate+:} false; then : $as_echo_n "(cached) " >&6 @@ -22712,46 +22743,22 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_inflate" >&5 $as_echo "$ac_cv_lib_z_inflate" >&6; } if test "x$ac_cv_lib_z_inflate" = xyes; then : - zlib_found="builtin" -fi + zlib_found="builtin" + SVN_ZLIB_LIBS="-lz" fi - fi - if test "$zlib_found" = "no"; then - as_fn_error $? "subversion requires zlib" "$LINENO" 5 - fi - - if test "$zlib_found" = "yes"; then - SVN_ZLIB_INCLUDES="-I$zlib_prefix/include" - LDFLAGS="$LDFLAGS ` - input_flags="-L$zlib_prefix/lib" - output_flags="" - filtered_dirs="/lib /lib64 /usr/lib /usr/lib64" - for flag in $input_flags; do - filter="no" - for dir in $filtered_dirs; do - if test "$flag" = "-L$dir" || test "$flag" = "-L$dir/"; then - filter="yes" - break - fi - done - if test "$filter" = "no"; then - output_flags="$output_flags $flag" fi - done - if test -n "$output_flags"; then - printf "%s" "${output_flags# }" - fi -`" fi - SVN_ZLIB_LIBS="-lz" + if test "$zlib_found" = "no"; then + as_fn_error $? "subversion requires zlib" "$LINENO" 5 + fi @@ -23785,15 +23792,14 @@ $as_echo "$SWIG_VERSION_RAW" >&6; } # packages/rpm/redhat-7.x/subversion.spec # packages/rpm/rhel-3/subversion.spec # packages/rpm/rhel-4/subversion.spec - if test -n "$SWIG_VERSION" && test "$SWIG_VERSION" -ge "103024" && \ - test "$SWIG_VERSION" -lt "300000"; then + if test -n "$SWIG_VERSION" && test "$SWIG_VERSION" -ge "103024"; then SWIG_SUITABLE=yes else SWIG_SUITABLE=no { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Detected SWIG version $SWIG_VERSION_RAW" >&5 $as_echo "$as_me: WARNING: Detected SWIG version $SWIG_VERSION_RAW" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Subversion requires SWIG >= 1.3.24 and < 3.0.0 " >&5 -$as_echo "$as_me: WARNING: Subversion requires SWIG >= 1.3.24 and < 3.0.0 " >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Subversion requires SWIG >= 1.3.24" >&5 +$as_echo "$as_me: WARNING: Subversion requires SWIG >= 1.3.24" >&2;} fi fi @@ -24274,15 +24280,14 @@ $as_echo "$SWIG_VERSION_RAW" >&6; } # packages/rpm/redhat-7.x/subversion.spec # packages/rpm/rhel-3/subversion.spec # packages/rpm/rhel-4/subversion.spec - if test -n "$SWIG_VERSION" && test "$SWIG_VERSION" -ge "103024" && \ - test "$SWIG_VERSION" -lt "300000"; then + if test -n "$SWIG_VERSION" && test "$SWIG_VERSION" -ge "103024"; then SWIG_SUITABLE=yes else SWIG_SUITABLE=no { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Detected SWIG version $SWIG_VERSION_RAW" >&5 $as_echo "$as_me: WARNING: Detected SWIG version $SWIG_VERSION_RAW" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Subversion requires SWIG >= 1.3.24 and < 3.0.0 " >&5 -$as_echo "$as_me: WARNING: Subversion requires SWIG >= 1.3.24 and < 3.0.0 " >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Subversion requires SWIG >= 1.3.24" >&5 +$as_echo "$as_me: WARNING: Subversion requires SWIG >= 1.3.24" >&2;} fi fi @@ -24763,15 +24768,14 @@ $as_echo "$SWIG_VERSION_RAW" >&6; } # packages/rpm/redhat-7.x/subversion.spec # packages/rpm/rhel-3/subversion.spec # packages/rpm/rhel-4/subversion.spec - if test -n "$SWIG_VERSION" && test "$SWIG_VERSION" -ge "103024" && \ - test "$SWIG_VERSION" -lt "300000"; then + if test -n "$SWIG_VERSION" && test "$SWIG_VERSION" -ge "103024"; then SWIG_SUITABLE=yes else SWIG_SUITABLE=no { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Detected SWIG version $SWIG_VERSION_RAW" >&5 $as_echo "$as_me: WARNING: Detected SWIG version $SWIG_VERSION_RAW" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Subversion requires SWIG >= 1.3.24 and < 3.0.0 " >&5 -$as_echo "$as_me: WARNING: Subversion requires SWIG >= 1.3.24 and < 3.0.0 " >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Subversion requires SWIG >= 1.3.24" >&5 +$as_echo "$as_me: WARNING: Subversion requires SWIG >= 1.3.24" >&2;} fi fi @@ -25255,15 +25259,14 @@ $as_echo "$SWIG_VERSION_RAW" >&6; } # packages/rpm/redhat-7.x/subversion.spec # packages/rpm/rhel-3/subversion.spec # packages/rpm/rhel-4/subversion.spec - if test -n "$SWIG_VERSION" && test "$SWIG_VERSION" -ge "103024" && \ - test "$SWIG_VERSION" -lt "300000"; then + if test -n "$SWIG_VERSION" && test "$SWIG_VERSION" -ge "103024"; then SWIG_SUITABLE=yes else SWIG_SUITABLE=no { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Detected SWIG version $SWIG_VERSION_RAW" >&5 $as_echo "$as_me: WARNING: Detected SWIG version $SWIG_VERSION_RAW" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Subversion requires SWIG >= 1.3.24 and < 3.0.0 " >&5 -$as_echo "$as_me: WARNING: Subversion requires SWIG >= 1.3.24 and < 3.0.0 " >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Subversion requires SWIG >= 1.3.24" >&5 +$as_echo "$as_me: WARNING: Subversion requires SWIG >= 1.3.24" >&2;} fi fi @@ -26152,6 +26155,9 @@ SWIG_CPPFLAGS="$CPPFLAGS" SWIG_CPPFLAGS=`echo "$SWIG_CPPFLAGS" | $SED -e 's/-no-cpp-precomp //'` + SWIG_CPPFLAGS=`echo "$SWIG_CPPFLAGS" | $SED -e 's/-Wdate-time //'` + + cat >>confdefs.h <<_ACEOF @@ -26750,7 +26756,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by subversion $as_me 1.9.4, which was +This file was extended by subversion $as_me 1.9.5, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -26816,7 +26822,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -subversion config.status 1.9.4 +subversion config.status 1.9.5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: stable/11/contrib/subversion/configure.ac ============================================================================== --- stable/11/contrib/subversion/configure.ac Sat Dec 3 20:01:12 2016 (r309510) +++ stable/11/contrib/subversion/configure.ac Sat Dec 3 20:30:05 2016 (r309511) @@ -199,7 +199,10 @@ localedir='${datadir}/locale' AC_SUBST(localedir) dnl For SVN_LOCALE_DIR, we have to expand it to something. See SVN_BINDIR. -if test "${datadir}" = '${prefix}/share' && test "${prefix}" = "NONE"; then +if test "${prefix}" = "NONE" \ + && ( test "${datadir}" = '${prefix}/share' \ + || ( test "${datadir}" = '${datarootdir}' \ + && test "${datarootdir}" = '${prefix}/share' ) ); then exp_localedir='${ac_default_prefix}/share/locale' else exp_localedir=$localedir @@ -1504,6 +1507,7 @@ fi # Need to strip '-no-cpp-precomp' from CPPFLAGS for SWIG as well. SWIG_CPPFLAGS="$CPPFLAGS" SVN_STRIP_FLAG(SWIG_CPPFLAGS, [-no-cpp-precomp ]) +SVN_STRIP_FLAG(SWIG_CPPFLAGS, [-Wdate-time ]) AC_SUBST([SWIG_CPPFLAGS]) dnl Since this is used only on Unix-y systems, define the path separator as '/' Modified: stable/11/contrib/subversion/get-deps.sh ============================================================================== --- stable/11/contrib/subversion/get-deps.sh Sat Dec 3 20:01:12 2016 (r309510) +++ stable/11/contrib/subversion/get-deps.sh Sat Dec 3 20:30:05 2016 (r309511) @@ -89,7 +89,7 @@ get_serf() { test -d $BASEDIR/serf && return cd $TEMPDIR - $HTTP_FETCH http://serf.googlecode.com/svn/src_releases/$SERF.tar.bz2 + $HTTP_FETCH https://archive.apache.org/dist/serf/$SERF.tar.bz2 cd $BASEDIR bzip2 -dc $TEMPDIR/$SERF.tar.bz2 | tar -xf - Modified: stable/11/contrib/subversion/subversion/include/private/svn_sqlite.h ============================================================================== --- stable/11/contrib/subversion/subversion/include/private/svn_sqlite.h Sat Dec 3 20:01:12 2016 (r309510) +++ stable/11/contrib/subversion/subversion/include/private/svn_sqlite.h Sat Dec 3 20:30:05 2016 (r309511) @@ -555,6 +555,9 @@ svn_sqlite__hotcopy(const char *src_path const char *dst_path, apr_pool_t *scratch_pool); +/* Backported version of SVN_ERR_SQLITE_ROLLBACK_FAILED. */ +#define SVN_SQLITE__ERR_ROLLBACK_FAILED (SVN_ERR_MISC_CATEGORY_START + 44) + #ifdef __cplusplus } #endif /* __cplusplus */ Modified: stable/11/contrib/subversion/subversion/include/svn_version.h ============================================================================== --- stable/11/contrib/subversion/subversion/include/svn_version.h Sat Dec 3 20:01:12 2016 (r309510) +++ stable/11/contrib/subversion/subversion/include/svn_version.h Sat Dec 3 20:30:05 2016 (r309511) @@ -70,7 +70,7 @@ extern "C" { * * @since New in 1.1. */ -#define SVN_VER_PATCH 4 +#define SVN_VER_PATCH 5 /** @deprecated Provided for backward compatibility with the 1.0 API. */ @@ -93,7 +93,7 @@ extern "C" { * * Always change this at the same time as SVN_VER_NUMTAG. */ -#define SVN_VER_TAG " (r1740329)" +#define SVN_VER_TAG " (r1770682)" /** Number tag: a string describing the version. @@ -117,7 +117,7 @@ extern "C" { * file version. Its value remains 0 in the repository except in release * tags where it is the revision from which the tag was created. */ -#define SVN_VER_REVISION 1740329 +#define SVN_VER_REVISION 1770682 /* Version strings composed from the above definitions. */ Modified: stable/11/contrib/subversion/subversion/libsvn_client/merge.c ============================================================================== --- stable/11/contrib/subversion/subversion/libsvn_client/merge.c Sat Dec 3 20:01:12 2016 (r309510) +++ stable/11/contrib/subversion/subversion/libsvn_client/merge.c Sat Dec 3 20:30:05 2016 (r309511) @@ -1295,6 +1295,15 @@ record_skip(merge_cmd_baton_t *merge_b, return SVN_NO_ERROR; } +/* Forward declaration */ +static svn_client__merge_path_t * +find_nearest_ancestor_with_intersecting_ranges( + svn_revnum_t *start, + svn_revnum_t *end, + const apr_array_header_t *children_with_mergeinfo, + svn_boolean_t path_is_own_ancestor, + const char *local_abspath); + /* Record a tree conflict in the WC, unless this is a dry run or a record- * only merge, or if a tree conflict is already flagged for the VICTIM_PATH. * (The latter can happen if a merge-tracking-aware merge is doing multiple @@ -1366,11 +1375,45 @@ record_tree_conflict(merge_cmd_baton_t * reason = svn_wc_conflict_reason_moved_here; } - SVN_ERR(make_conflict_versions(&left, &right, local_abspath, - merge_left_node_kind, - merge_right_node_kind, - &merge_b->merge_source, merge_b->target, - result_pool, scratch_pool)); + if (HONOR_MERGEINFO(merge_b) && merge_b->merge_source.ancestral) + { + struct merge_source_t *source; + svn_client__pathrev_t *loc1; + svn_client__pathrev_t *loc2; + svn_merge_range_t range = + {SVN_INVALID_REVNUM, SVN_INVALID_REVNUM, TRUE}; + + /* We are honoring mergeinfo so do not blindly record + * a conflict describing the merge of + * SOURCE->LOC1->URL@SOURCE->LOC1->REV through + * SOURCE->LOC2->URL@SOURCE->LOC2->REV + * but figure out the actual revision range merged. */ + (void)find_nearest_ancestor_with_intersecting_ranges( + &(range.start), &(range.end), + merge_b->notify_begin.nodes_with_mergeinfo, + action != svn_wc_conflict_action_delete, + local_abspath); + loc1 = svn_client__pathrev_dup(merge_b->merge_source.loc1, + scratch_pool); + loc2 = svn_client__pathrev_dup(merge_b->merge_source.loc2, + scratch_pool); + loc1->rev = range.start; + loc2->rev = range.end; + source = merge_source_create(loc1, loc2, + merge_b->merge_source.ancestral, + scratch_pool); + SVN_ERR(make_conflict_versions(&left, &right, local_abspath, + merge_left_node_kind, + merge_right_node_kind, + source, merge_b->target, + result_pool, scratch_pool)); + } + else + SVN_ERR(make_conflict_versions(&left, &right, local_abspath, + merge_left_node_kind, + merge_right_node_kind, + &merge_b->merge_source, merge_b->target, + result_pool, scratch_pool)); /* Fix up delete of file, add of dir replacement (or other way around) */ if (existing_conflict != NULL && existing_conflict->src_left_version) @@ -10956,7 +10999,7 @@ find_unsynced_ranges(const svn_client__p potentially_unmerged_ranges->nelts - 1, svn_merge_range_t *))->end; log_find_operative_baton_t log_baton; - const char *old_session_url; + const char *old_session_url = NULL; svn_error_t *err; log_baton.merged_catalog = merged_catalog; @@ -10967,14 +11010,22 @@ find_unsynced_ranges(const svn_client__p = svn_client__pathrev_fspath(target_loc, scratch_pool); log_baton.result_pool = result_pool; - SVN_ERR(svn_client__ensure_ra_session_url( - &old_session_url, ra_session, target_loc->url, scratch_pool)); + /* Reparent the session to TARGET_LOC if this target location + * exists within the unmerged revision range. */ + if (target_loc->rev <= youngest_rev && target_loc->rev >= oldest_rev) + SVN_ERR(svn_client__ensure_ra_session_url( + &old_session_url, ra_session, target_loc->url, scratch_pool)); + err = get_log(ra_session, "", youngest_rev, oldest_rev, TRUE, /* discover_changed_paths */ log_find_operative_revs, &log_baton, scratch_pool); - SVN_ERR(svn_error_compose_create( - err, svn_ra_reparent(ra_session, old_session_url, scratch_pool))); + if (old_session_url) + err = svn_error_compose_create(err, + svn_ra_reparent(ra_session, + old_session_url, + scratch_pool)); + SVN_ERR(err); } return SVN_NO_ERROR; Modified: stable/11/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c ============================================================================== --- stable/11/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c Sat Dec 3 20:01:12 2016 (r309510) +++ stable/11/contrib/subversion/subversion/libsvn_fs_fs/cached_data.c Sat Dec 3 20:30:05 2016 (r309511) @@ -1571,6 +1571,17 @@ read_plain_window(svn_stringbuf_t **nwin return SVN_NO_ERROR; } +/* Skip SIZE bytes from the PLAIN representation RS. */ +static svn_error_t * +skip_plain_window(rep_state_t *rs, + apr_size_t size) +{ + /* Update RS. */ + rs->current += (apr_off_t)size; + + return SVN_NO_ERROR; +} + /* Get the undeltified window that is a result of combining all deltas from the current desired representation identified in *RB with its base representation. Store the window in *RESULT. */ @@ -1628,9 +1639,18 @@ get_combined_window(svn_stringbuf_t **re Also note that we may have short-cut reading the delta chain -- in which case SRC_OPS is 0 and it might not be a PLAIN rep. */ source = buf; - if (source == NULL && rb->src_state != NULL && window->src_ops) - SVN_ERR(read_plain_window(&source, rb->src_state, window->sview_len, - pool, iterpool)); + if (source == NULL && rb->src_state != NULL) + { + /* Even if we don't need the source rep now, we still must keep + * its read offset in sync with what we might need for the next + * window. */ + if (window->src_ops) + SVN_ERR(read_plain_window(&source, rb->src_state, + window->sview_len, + pool, iterpool)); + else + SVN_ERR(skip_plain_window(rb->src_state, window->sview_len)); + } /* Combine this window with the current one. */ new_pool = svn_pool_create(rb->pool); Modified: stable/11/contrib/subversion/subversion/libsvn_fs_fs/caching.c ============================================================================== --- stable/11/contrib/subversion/subversion/libsvn_fs_fs/caching.c Sat Dec 3 20:01:12 2016 (r309510) +++ stable/11/contrib/subversion/subversion/libsvn_fs_fs/caching.c Sat Dec 3 20:30:05 2016 (r309511) @@ -430,7 +430,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f svn_fs_fs__deserialize_dir_entries, sizeof(pair_cache_key_t), apr_pstrcat(pool, prefix, "DIR", SVN_VA_NULL), - SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY, + SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, fs->pool, pool)); @@ -806,7 +806,7 @@ svn_fs_fs__initialize_txn_caches(svn_fs_ APR_HASH_KEY_STRING, apr_pstrcat(pool, prefix, "TXNDIR", SVN_VA_NULL), - 0, + SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, TRUE, pool, pool)); Modified: stable/11/contrib/subversion/subversion/libsvn_fs_fs/fs.c ============================================================================== --- stable/11/contrib/subversion/subversion/libsvn_fs_fs/fs.c Sat Dec 3 20:01:12 2016 (r309510) +++ stable/11/contrib/subversion/subversion/libsvn_fs_fs/fs.c Sat Dec 3 20:30:05 2016 (r309511) @@ -452,7 +452,7 @@ fs_pack(svn_fs_t *fs, apr_pool_t *common_pool) { SVN_ERR(fs_open(fs, path, common_pool_lock, pool, common_pool)); - return svn_fs_fs__pack(fs, notify_func, notify_baton, + return svn_fs_fs__pack(fs, 0, notify_func, notify_baton, cancel_func, cancel_baton, pool); } Modified: stable/11/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.c ============================================================================== --- stable/11/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.c Sat Dec 3 20:01:12 2016 (r309510) +++ stable/11/contrib/subversion/subversion/libsvn_fs_fs/fs_fs.c Sat Dec 3 20:30:05 2016 (r309511) @@ -492,6 +492,7 @@ read_format(int *pformat, svn_error_clear(err); *pformat = 1; *max_files_per_dir = 0; + *use_log_addressing = FALSE; return SVN_NO_ERROR; } Modified: stable/11/contrib/subversion/subversion/libsvn_fs_fs/low_level.c ============================================================================== --- stable/11/contrib/subversion/subversion/libsvn_fs_fs/low_level.c Sat Dec 3 20:01:12 2016 (r309510) +++ stable/11/contrib/subversion/subversion/libsvn_fs_fs/low_level.c Sat Dec 3 20:30:05 2016 (r309511) @@ -764,7 +764,11 @@ svn_fs_fs__parse_representation(represen SVN_ERR(svn_checksum_parse_hex(&checksum, svn_checksum_md5, str, scratch_pool)); - memcpy(rep->md5_digest, checksum->digest, sizeof(rep->md5_digest)); + + /* If STR is a all-zero checksum, CHECKSUM will be NULL and REP already + contains the correct value. */ + if (checksum) + memcpy(rep->md5_digest, checksum->digest, sizeof(rep->md5_digest)); /* The remaining fields are only used for formats >= 4, so check that. */ str = svn_cstring_tokenize(" ", &string); @@ -778,8 +782,16 @@ svn_fs_fs__parse_representation(represen SVN_ERR(svn_checksum_parse_hex(&checksum, svn_checksum_sha1, str, scratch_pool)); + + /* We do have a valid SHA1 but it might be all 0. + We cannot be sure where that came from (Alas! legacy), so let's not + claim we know the SHA1 in that case. */ rep->has_sha1 = checksum != NULL; - memcpy(rep->sha1_digest, checksum->digest, sizeof(rep->sha1_digest)); + + /* If STR is a all-zero checksum, CHECKSUM will be NULL and REP already + contains the correct value. */ + if (checksum) + memcpy(rep->sha1_digest, checksum->digest, sizeof(rep->sha1_digest)); /* Read the uniquifier. */ str = svn_cstring_tokenize("/", &string); Modified: stable/11/contrib/subversion/subversion/libsvn_fs_fs/pack.c ============================================================================== --- stable/11/contrib/subversion/subversion/libsvn_fs_fs/pack.c Sat Dec 3 20:01:12 2016 (r309510) +++ stable/11/contrib/subversion/subversion/libsvn_fs_fs/pack.c Sat Dec 3 20:30:05 2016 (r309511) @@ -335,21 +335,40 @@ static svn_error_t * reset_pack_context(pack_context_t *context, apr_pool_t *pool) { + const char *temp_dir; + apr_array_clear(context->changes); - SVN_ERR(svn_io_file_trunc(context->changes_file, 0, pool)); + SVN_ERR(svn_io_file_close(context->changes_file, pool)); apr_array_clear(context->file_props); - SVN_ERR(svn_io_file_trunc(context->file_props_file, 0, pool)); + SVN_ERR(svn_io_file_close(context->file_props_file, pool)); apr_array_clear(context->dir_props); - SVN_ERR(svn_io_file_trunc(context->dir_props_file, 0, pool)); + SVN_ERR(svn_io_file_close(context->dir_props_file, pool)); apr_array_clear(context->rev_offsets); apr_array_clear(context->path_order); apr_array_clear(context->references); apr_array_clear(context->reps); - SVN_ERR(svn_io_file_trunc(context->reps_file, 0, pool)); + SVN_ERR(svn_io_file_close(context->reps_file, pool)); svn_pool_clear(context->info_pool); + /* The new temporary files must live at least as long as any other info + * object in CONTEXT. */ + SVN_ERR(svn_io_temp_dir(&temp_dir, pool)); + SVN_ERR(svn_io_open_unique_file3(&context->changes_file, NULL, temp_dir, + svn_io_file_del_on_close, + context->info_pool, pool)); + SVN_ERR(svn_io_open_unique_file3(&context->file_props_file, NULL, temp_dir, + svn_io_file_del_on_close, + context->info_pool, pool)); + SVN_ERR(svn_io_open_unique_file3(&context->dir_props_file, NULL, temp_dir, + svn_io_file_del_on_close, + context->info_pool, pool)); + SVN_ERR(svn_io_open_unique_file3(&context->reps_file, NULL, temp_dir, + svn_io_file_del_on_close, + context->info_pool, pool)); + context->paths = svn_prefix_tree__create(context->info_pool); + return SVN_NO_ERROR; } @@ -1410,21 +1429,20 @@ append_revision(pack_context_t *context, apr_off_t offset = 0; apr_pool_t *iterpool = svn_pool_create(pool); svn_fs_fs__revision_file_t *rev_file; - apr_finfo_t finfo; - - /* Get the size of the file. */ - const char *path = svn_dirent_join(context->shard_dir, - apr_psprintf(iterpool, "%ld", - context->start_rev), - pool); - SVN_ERR(svn_io_stat(&finfo, path, APR_FINFO_SIZE, pool)); + svn_filesize_t revdata_size; - /* Copy all the bits from the rev file to the end of the pack file. */ + /* Copy all non-index contents the rev file to the end of the pack file. */ SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&rev_file, context->fs, context->start_rev, pool, iterpool)); + + SVN_ERR(svn_fs_fs__auto_read_footer(rev_file)); + revdata_size = rev_file->l2p_offset; + + SVN_ERR(svn_io_file_aligned_seek(rev_file->file, ffd->block_size, NULL, 0, + iterpool)); SVN_ERR(copy_file_data(context, context->pack_file, rev_file->file, - finfo.size, iterpool)); + revdata_size, iterpool)); /* mark the start of a new revision */ SVN_ERR(svn_fs_fs__l2p_proto_index_add_revision(context->proto_l2p_index, @@ -1432,7 +1450,7 @@ append_revision(pack_context_t *context, /* read the phys-to-log index file until we covered the whole rev file. * That index contains enough info to build both target indexes from it. */ - while (offset < finfo.size) + while (offset < revdata_size) { /* read one cluster */ int i; @@ -1456,7 +1474,7 @@ append_revision(pack_context_t *context, /* process entry while inside the rev file */ offset = entry->offset; - if (offset < finfo.size) + if (offset < revdata_size) { entry->offset += context->pack_offset; offset += entry->size; @@ -1470,7 +1488,7 @@ append_revision(pack_context_t *context, } svn_pool_destroy(iterpool); - context->pack_offset += finfo.size; + context->pack_offset += revdata_size; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-11@freebsd.org Sat Dec 3 21:19:46 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1CA5C65B9B; Sat, 3 Dec 2016 21:19:46 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80634B8C; Sat, 3 Dec 2016 21:19:46 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB3LJjMu022478; Sat, 3 Dec 2016 21:19:45 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB3LJjkn022477; Sat, 3 Dec 2016 21:19:45 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612032119.uB3LJjkn022477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 3 Dec 2016 21:19:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309514 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 21:19:46 -0000 Author: trasz Date: Sat Dec 3 21:19:45 2016 New Revision: 309514 URL: https://svnweb.freebsd.org/changeset/base/309514 Log: MFC r308088: Fix getfsstat(2) handling of flags. The 'flags' argument is an enum, not a bitfield. For the intended usage - being passed either MNT_WAIT, or MNT_NOWAIT - this shouldn't introduce any changes in behaviour. Modified: stable/11/sys/kern/vfs_syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_syscalls.c ============================================================================== --- stable/11/sys/kern/vfs_syscalls.c Sat Dec 3 20:35:39 2016 (r309513) +++ stable/11/sys/kern/vfs_syscalls.c Sat Dec 3 21:19:45 2016 (r309514) @@ -495,16 +495,16 @@ kern_getfsstat(struct thread *td, struct sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK; /* * If MNT_NOWAIT or MNT_LAZY is specified, do not - * refresh the fsstat cache. MNT_NOWAIT or MNT_LAZY - * overrides MNT_WAIT. + * refresh the fsstat cache. */ - if (((flags & (MNT_LAZY|MNT_NOWAIT)) == 0 || - (flags & MNT_WAIT)) && - (error = VFS_STATFS(mp, sp))) { - mtx_lock(&mountlist_mtx); - nmp = TAILQ_NEXT(mp, mnt_list); - vfs_unbusy(mp); - continue; + if (flags != MNT_LAZY && flags != MNT_NOWAIT) { + error = VFS_STATFS(mp, sp); + if (error != 0) { + mtx_lock(&mountlist_mtx); + nmp = TAILQ_NEXT(mp, mnt_list); + vfs_unbusy(mp); + continue; + } } if (priv_check(td, PRIV_VFS_GENERATION)) { bcopy(sp, &sb, sizeof(sb)); From owner-svn-src-stable-11@freebsd.org Sat Dec 3 21:23:45 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E804C65D6C; Sat, 3 Dec 2016 21:23:45 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8B00F76; Sat, 3 Dec 2016 21:23:44 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB3LNi2r026146; Sat, 3 Dec 2016 21:23:44 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB3LNiCI026145; Sat, 3 Dec 2016 21:23:44 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612032123.uB3LNiCI026145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 3 Dec 2016 21:23:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309515 - stable/11/sys/kern X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 21:23:45 -0000 Author: trasz Date: Sat Dec 3 21:23:43 2016 New Revision: 309515 URL: https://svnweb.freebsd.org/changeset/base/309515 Log: MFC r308209: Fix getfsstat(2) with MNT_WAIT to not skip filesystems that are in the process of being unmounted. Previously it would skip them, even if the unmount eventually failed eg due to the filesystem being busy. This behaviour broke autounmountd(8) - if you tried to manually unmount a mounted filesystem, using 'automount -u', and the autounmountd attempted to refresh the filesystem list in that very moment, it would conclude that the filesystem got unmounted and not try to unmount it afterwards. Modified: stable/11/sys/kern/vfs_syscalls.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/vfs_syscalls.c ============================================================================== --- stable/11/sys/kern/vfs_syscalls.c Sat Dec 3 21:19:45 2016 (r309514) +++ stable/11/sys/kern/vfs_syscalls.c Sat Dec 3 21:23:43 2016 (r309515) @@ -446,16 +446,19 @@ kern_getfsstat(struct thread *td, struct size_t *countp, enum uio_seg bufseg, int flags) { struct mount *mp, *nmp; - struct statfs *sfsp, *sp, sb; + struct statfs *sfsp, *sp, sb, *tofree; size_t count, maxcount; int error; +restart: maxcount = bufsize / sizeof(struct statfs); - if (bufsize == 0) + if (bufsize == 0) { sfsp = NULL; - else if (bufseg == UIO_USERSPACE) + tofree = NULL; + } else if (bufseg == UIO_USERSPACE) { sfsp = *buf; - else /* if (bufseg == UIO_SYSSPACE) */ { + tofree = NULL; + } else /* if (bufseg == UIO_SYSSPACE) */ { count = 0; mtx_lock(&mountlist_mtx); TAILQ_FOREACH(mp, &mountlist, mnt_list) { @@ -464,8 +467,8 @@ kern_getfsstat(struct thread *td, struct mtx_unlock(&mountlist_mtx); if (maxcount > count) maxcount = count; - sfsp = *buf = malloc(maxcount * sizeof(struct statfs), M_TEMP, - M_WAITOK); + tofree = sfsp = *buf = malloc(maxcount * sizeof(struct statfs), + M_TEMP, M_WAITOK); } count = 0; mtx_lock(&mountlist_mtx); @@ -480,9 +483,24 @@ kern_getfsstat(struct thread *td, struct continue; } #endif - if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK)) { - nmp = TAILQ_NEXT(mp, mnt_list); - continue; + if (flags == MNT_WAIT) { + if (vfs_busy(mp, MBF_MNTLSTLOCK) != 0) { + /* + * If vfs_busy() failed, and MBF_NOWAIT + * wasn't passed, then the mp is gone. + * Furthermore, because of MBF_MNTLSTLOCK, + * the mountlist_mtx was dropped. We have + * no other choice than to start over. + */ + mtx_unlock(&mountlist_mtx); + free(tofree, M_TEMP); + goto restart; + } + } else { + if (vfs_busy(mp, MBF_NOWAIT | MBF_MNTLSTLOCK) != 0) { + nmp = TAILQ_NEXT(mp, mnt_list); + continue; + } } if (sfsp && count < maxcount) { sp = &mp->mnt_stat; From owner-svn-src-stable-11@freebsd.org Sat Dec 3 21:27:20 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78682C65F06; Sat, 3 Dec 2016 21:27:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F0B6131E; Sat, 3 Dec 2016 21:27:20 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB3LRJRs026330; Sat, 3 Dec 2016 21:27:19 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB3LRJPi026328; Sat, 3 Dec 2016 21:27:19 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201612032127.uB3LRJPi026328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 3 Dec 2016 21:27:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309516 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 21:27:20 -0000 Author: trasz Date: Sat Dec 3 21:27:19 2016 New Revision: 309516 URL: https://svnweb.freebsd.org/changeset/base/309516 Log: MFC r308250: Check for lengths being <= 0. Note that this interface can only be accessed by root. It uses unsigned ints instead of size_t to preserve the ABI. PR: 207627 Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl_ioctl.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Sat Dec 3 21:23:43 2016 (r309515) +++ stable/11/sys/cam/ctl/ctl.c Sat Dec 3 21:27:19 2016 (r309516) @@ -2370,7 +2370,7 @@ ctl_ioctl_fill_ooa(struct ctl_lun *lun, } static void * -ctl_copyin_alloc(void *user_addr, int len, char *error_str, +ctl_copyin_alloc(void *user_addr, unsigned int len, char *error_str, size_t error_str_len) { void *kptr; @@ -2425,6 +2425,12 @@ ctl_copyin_args(int num_args, struct ctl for (i = 0; i < num_args; i++) { uint8_t *tmpptr; + if (args[i].namelen == 0) { + snprintf(error_str, error_str_len, "Argument %d " + "name length is zero", i); + goto bailout; + } + args[i].kname = ctl_copyin_alloc(args[i].name, args[i].namelen, error_str, error_str_len); if (args[i].kname == NULL) @@ -2437,10 +2443,17 @@ ctl_copyin_args(int num_args, struct ctl } if (args[i].flags & CTL_BEARG_RD) { + if (args[i].vallen == 0) { + snprintf(error_str, error_str_len, "Argument %d " + "value length is zero", i); + goto bailout; + } + tmpptr = ctl_copyin_alloc(args[i].value, args[i].vallen, error_str, error_str_len); if (tmpptr == NULL) goto bailout; + if ((args[i].flags & CTL_BEARG_ASCII) && (tmpptr[args[i].vallen - 1] != '\0')) { snprintf(error_str, error_str_len, "Argument " Modified: stable/11/sys/cam/ctl/ctl_ioctl.h ============================================================================== --- stable/11/sys/cam/ctl/ctl_ioctl.h Sat Dec 3 21:23:43 2016 (r309515) +++ stable/11/sys/cam/ctl/ctl_ioctl.h Sat Dec 3 21:27:19 2016 (r309516) @@ -317,20 +317,20 @@ typedef enum { * * flags: Flags for the parameter, see above for values. * - * vallen: Length of the value in bytes. + * vallen: Length of the value in bytes, including the terminating NUL. * - * value: Value to be set/fetched. + * value: Value to be set/fetched. This must be NUL-terminated. * * kname: For kernel use only. * * kvalue: For kernel use only. */ struct ctl_be_arg { - int namelen; - char *name; - int flags; - int vallen; - void *value; + unsigned int namelen; + char *name; + int flags; + unsigned int vallen; + void *value; char *kname; void *kvalue; From owner-svn-src-stable-11@freebsd.org Sat Dec 3 21:49:27 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72868C6582D; Sat, 3 Dec 2016 21:49:27 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2923A84; Sat, 3 Dec 2016 21:49:27 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB3LnQDB034689; Sat, 3 Dec 2016 21:49:26 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB3LnQTE034688; Sat, 3 Dec 2016 21:49:26 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201612032149.uB3LnQTE034688@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 3 Dec 2016 21:49:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r309517 - stable/11/sbin/umount X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 21:49:27 -0000 Author: rmacklem Date: Sat Dec 3 21:49:26 2016 New Revision: 309517 URL: https://svnweb.freebsd.org/changeset/base/309517 Log: MFC: r308871 Modify umount so that it does not do an Unmount RPC for NFSv4 mounts and uses TCP for the Unmount RPC if the mount is over TCP. Without this patch, umount does an Unmount RPC over UDP for all NFS mounts. Modified: stable/11/sbin/umount/umount.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/umount/umount.c ============================================================================== --- stable/11/sbin/umount/umount.c Sat Dec 3 21:27:19 2016 (r309516) +++ stable/11/sbin/umount/umount.c Sat Dec 3 21:49:26 2016 (r309517) @@ -49,6 +49,7 @@ static const char rcsid[] = #include #include #include +#include #include #include @@ -323,6 +324,9 @@ umountfs(struct statfs *sfs) CLIENT *clp; char *nfsdirname, *orignfsdirname; char *hostp, *delimp; + char buf[1024]; + struct nfscl_dumpmntopts dumpmntopts; + const char *proto_ptr = NULL; ai = NULL; do_rpc = 0; @@ -361,8 +365,24 @@ umountfs(struct statfs *sfs) * mount from mntfromname that is still mounted. */ if (getmntentry(sfs->f_mntfromname, NULL, NULL, - CHECKUNIQUE) != NULL) + CHECKUNIQUE) != NULL) { do_rpc = 1; + proto_ptr = "udp"; + /* + * Try and find out whether this NFS mount is NFSv4 and + * what protocol is being used. If this fails, the + * default is NFSv2,3 and use UDP for the Unmount RPC. + */ + dumpmntopts.ndmnt_fname = sfs->f_mntonname; + dumpmntopts.ndmnt_buf = buf; + dumpmntopts.ndmnt_blen = sizeof(buf); + if (nfssvc(NFSSVC_DUMPMNTOPTS, &dumpmntopts) >= 0) { + if (strstr(buf, "nfsv4,") != NULL) + do_rpc = 0; + else if (strstr(buf, ",tcp,") != NULL) + proto_ptr = "tcp"; + } + } } if (!namematch(ai)) { @@ -400,7 +420,7 @@ umountfs(struct statfs *sfs) * has been unmounted. */ if (ai != NULL && !(fflag & MNT_FORCE) && do_rpc) { - clp = clnt_create(hostp, MOUNTPROG, MOUNTVERS3, "udp"); + clp = clnt_create(hostp, MOUNTPROG, MOUNTVERS3, proto_ptr); if (clp == NULL) { warnx("%s: %s", hostp, clnt_spcreateerror("MOUNTPROG"));